@esri/solution-deployer 6.1.0-alpha.0 → 6.2.0-alpha.0
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/cjs/deploySolutionFromTemplate.d.ts +55 -0
- package/dist/cjs/deploySolutionFromTemplate.js +334 -0
- package/dist/cjs/deploySolutionFromTemplate.js.map +1 -0
- package/dist/cjs/deploySolutionItems.d.ts +224 -0
- package/dist/cjs/deploySolutionItems.js +876 -0
- package/dist/cjs/deploySolutionItems.js.map +1 -0
- package/dist/cjs/deployer.d.ts +34 -0
- package/dist/cjs/deployer.js +99 -0
- package/dist/cjs/deployer.js.map +1 -0
- package/dist/cjs/deployerUtils.d.ts +47 -0
- package/dist/cjs/deployerUtils.js +120 -0
- package/dist/cjs/deployerUtils.js.map +1 -0
- package/dist/cjs/helpers/post-process.d.ts +29 -0
- package/dist/cjs/helpers/post-process.js +63 -0
- package/dist/cjs/helpers/post-process.js.map +1 -0
- package/dist/cjs/helpers/share-templates-to-groups.d.ts +24 -0
- package/dist/cjs/helpers/share-templates-to-groups.js +65 -0
- package/dist/cjs/helpers/share-templates-to-groups.js.map +1 -0
- package/dist/cjs/helpers/sortTemplates.d.ts +23 -0
- package/dist/cjs/helpers/sortTemplates.js +14 -0
- package/dist/cjs/helpers/sortTemplates.js.map +1 -0
- package/dist/cjs/index.d.ts +24 -0
- package/dist/cjs/index.js +28 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/module-map.d.ts +23 -0
- package/dist/cjs/module-map.js +234 -0
- package/dist/cjs/module-map.js.map +1 -0
- package/dist/esm/deploySolutionFromTemplate.d.ts +55 -0
- package/dist/esm/deploySolutionFromTemplate.js +319 -0
- package/dist/esm/deploySolutionFromTemplate.js.map +1 -0
- package/dist/esm/deploySolutionItems.d.ts +224 -0
- package/dist/esm/deploySolutionItems.js +853 -0
- package/dist/esm/deploySolutionItems.js.map +1 -0
- package/dist/esm/deployer.d.ts +34 -0
- package/dist/esm/deployer.js +94 -0
- package/dist/esm/deployer.js.map +1 -0
- package/dist/esm/deployerUtils.d.ts +47 -0
- package/dist/esm/deployerUtils.js +112 -0
- package/dist/esm/deployerUtils.js.map +1 -0
- package/dist/esm/helpers/post-process.d.ts +29 -0
- package/dist/esm/helpers/post-process.js +59 -0
- package/dist/esm/helpers/post-process.js.map +1 -0
- package/dist/esm/helpers/share-templates-to-groups.d.ts +24 -0
- package/dist/esm/helpers/share-templates-to-groups.js +61 -0
- package/dist/esm/helpers/share-templates-to-groups.js.map +1 -0
- package/dist/esm/helpers/sortTemplates.d.ts +23 -0
- package/dist/esm/helpers/sortTemplates.js +10 -0
- package/dist/esm/helpers/sortTemplates.js.map +1 -0
- package/dist/esm/index.d.ts +24 -0
- package/dist/esm/index.js +25 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/module-map.d.ts +23 -0
- package/dist/esm/module-map.js +230 -0
- package/dist/esm/module-map.js.map +1 -0
- package/package.json +14 -14
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/** @license
|
|
2
|
+
* Copyright 2018 Esri
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import * as common from "@esri/solution-common";
|
|
17
|
+
import * as deployItems from "./deploySolutionItems";
|
|
18
|
+
import { getWithDefault } from "@esri/hub-common";
|
|
19
|
+
import { postProcess } from "./helpers/post-process";
|
|
20
|
+
import { sortTemplates } from "./helpers/sortTemplates";
|
|
21
|
+
// NOTE: Moved to separate file to allow stubbing in main deploySolution tests
|
|
22
|
+
export async function deploySolutionFromTemplate(templateSolutionId, solutionTemplateBase, solutionTemplateData, authentication, options) {
|
|
23
|
+
options.storageVersion = common.extractSolutionVersion(solutionTemplateData);
|
|
24
|
+
// It is possible to provide a separate authentication for the source
|
|
25
|
+
const storageAuthentication = options.storageAuthentication
|
|
26
|
+
? options.storageAuthentication
|
|
27
|
+
: authentication;
|
|
28
|
+
// Replacement dictionary and high-level deployment ids for cleanup
|
|
29
|
+
// TODO: Extract all templateDictionary prep into a separate function
|
|
30
|
+
const templateDictionary = options.templateDictionary ?? {};
|
|
31
|
+
const preProcessResponse = common.preprocessWorkflowTemplates(solutionTemplateData.templates, templateDictionary);
|
|
32
|
+
solutionTemplateData.templates = preProcessResponse.deployTemplates;
|
|
33
|
+
_applySourceToDeployOptions(options, solutionTemplateBase, templateDictionary, authentication);
|
|
34
|
+
if (options.additionalTypeKeywords) {
|
|
35
|
+
solutionTemplateBase.typeKeywords = [].concat(solutionTemplateBase.typeKeywords, options.additionalTypeKeywords);
|
|
36
|
+
}
|
|
37
|
+
// Get the thumbnail file
|
|
38
|
+
let thumbFilename = "thumbnail";
|
|
39
|
+
let thumbDef = Promise.resolve(null);
|
|
40
|
+
if (!options.thumbnail && options.thumbnailurl) {
|
|
41
|
+
// Figure out the thumbnail's filename
|
|
42
|
+
thumbFilename = common.getFilenameFromUrl(options.thumbnailurl) || thumbFilename;
|
|
43
|
+
const thumbnailurl = common.appendQueryParam(options.thumbnailurl, "w=400");
|
|
44
|
+
delete options.thumbnailurl;
|
|
45
|
+
// Fetch the thumbnail
|
|
46
|
+
thumbDef = common.getBlobAsFile(thumbnailurl, thumbFilename, storageAuthentication, [400]);
|
|
47
|
+
}
|
|
48
|
+
_replaceParamVariables(solutionTemplateData, templateDictionary);
|
|
49
|
+
// Get information about deployment environment
|
|
50
|
+
const environResponses = await Promise.all([
|
|
51
|
+
common.getPortal("", authentication),
|
|
52
|
+
common.getPortalUrls(authentication),
|
|
53
|
+
common.getUser(authentication),
|
|
54
|
+
common.getFoldersAndGroups(authentication),
|
|
55
|
+
thumbDef,
|
|
56
|
+
]);
|
|
57
|
+
const [portalResponse, portalUrlsResponse, userResponse, foldersAndGroupsResponse, thumbnailFile] = environResponses;
|
|
58
|
+
if (!options.thumbnail && thumbnailFile) {
|
|
59
|
+
options.thumbnail = thumbnailFile;
|
|
60
|
+
}
|
|
61
|
+
// update template items with source-itemId type keyword
|
|
62
|
+
solutionTemplateData.templates = _addSourceId(solutionTemplateData.templates);
|
|
63
|
+
templateDictionary.isPortal = portalResponse.isPortal;
|
|
64
|
+
templateDictionary.organization = Object.assign(templateDictionary.organization || {}, portalResponse);
|
|
65
|
+
// TODO: Add more computed properties here
|
|
66
|
+
// portal: portalResponse
|
|
67
|
+
// orgextent as bbox for assignment onto items
|
|
68
|
+
// more info in #266 https://github.com/Esri/solution.js/issues/266
|
|
69
|
+
templateDictionary.portalUrls = portalUrlsResponse.urls;
|
|
70
|
+
templateDictionary.portalBaseUrl = _getPortalBaseUrl(portalResponse, authentication);
|
|
71
|
+
templateDictionary.user = userResponse;
|
|
72
|
+
templateDictionary.user.folders = foldersAndGroupsResponse.folders;
|
|
73
|
+
templateDictionary.user.groups = foldersAndGroupsResponse.groups.filter((group) => group.owner === templateDictionary.user.username);
|
|
74
|
+
// Add information needed for workflow manager
|
|
75
|
+
const user = await common.getUser(authentication);
|
|
76
|
+
templateDictionary.workflowBaseUrl = await common.getWorkflowBaseURL(authentication, portalResponse, user.orgId);
|
|
77
|
+
// if we have tracking views and the user is not admin or the org doesn't support tracking an error is thrown
|
|
78
|
+
common.setLocationTrackingEnabled(portalResponse, userResponse, templateDictionary, solutionTemplateData.templates);
|
|
79
|
+
const trackingOwnerPromise = common.getTackingServiceOwner(templateDictionary, authentication);
|
|
80
|
+
// Create a folder to hold the deployed solution. We use the solution name, appending a sequential
|
|
81
|
+
// suffix if the folder exists, e.g.,
|
|
82
|
+
// * Manage Right of Way Activities
|
|
83
|
+
// * Manage Right of Way Activities 1
|
|
84
|
+
// * Manage Right of Way Activities 2
|
|
85
|
+
const folderPromise = common.createUniqueFolder(solutionTemplateBase.title, templateDictionary, authentication);
|
|
86
|
+
// Apply the portal extents to the solution
|
|
87
|
+
const portalExtent = portalResponse.defaultExtent;
|
|
88
|
+
const extentsPromise = common.convertExtentWithFallback(portalExtent, undefined, { wkid: 4326 }, portalResponse.helperServices.geometry.url, authentication);
|
|
89
|
+
// Await completion of async actions: folder creation & extents conversion
|
|
90
|
+
const folderExtentsResponses = await Promise.all([folderPromise, extentsPromise, trackingOwnerPromise]);
|
|
91
|
+
const [folderResponse, wgs84Extent, trackingOwnerResponse] = folderExtentsResponses;
|
|
92
|
+
const deployedFolderId = folderResponse.folder.id;
|
|
93
|
+
templateDictionary.folderId = deployedFolderId;
|
|
94
|
+
templateDictionary.solutionItemExtent =
|
|
95
|
+
wgs84Extent.xmin + "," + wgs84Extent.ymin + "," + wgs84Extent.xmax + "," + wgs84Extent.ymax;
|
|
96
|
+
// Hub Solutions depend on organization defaultExtentBBox as a nested array not a string
|
|
97
|
+
templateDictionary.organization.defaultExtentBBox = [
|
|
98
|
+
[wgs84Extent.xmin, wgs84Extent.ymin],
|
|
99
|
+
[wgs84Extent.xmax, wgs84Extent.ymax],
|
|
100
|
+
];
|
|
101
|
+
// update templateDictionary to indicate if the user owns the tracking service
|
|
102
|
+
// this will affect how we handle group sharing
|
|
103
|
+
/* istanbul ignore else */
|
|
104
|
+
if (templateDictionary.locationTrackingEnabled) {
|
|
105
|
+
common.setCreateProp(templateDictionary, "locationTracking.userIsOwner", trackingOwnerResponse);
|
|
106
|
+
}
|
|
107
|
+
let deployedSolutionId;
|
|
108
|
+
if (!options.dontCreateSolutionItem) {
|
|
109
|
+
// Create a deployed Solution item
|
|
110
|
+
solutionTemplateBase.categories = []; // we don't want to carry over categories from the template
|
|
111
|
+
const createSolutionItemBase = {
|
|
112
|
+
...common.sanitizeJSON(solutionTemplateBase),
|
|
113
|
+
type: "Solution",
|
|
114
|
+
typeKeywords: ["Solution"],
|
|
115
|
+
};
|
|
116
|
+
if (options.additionalTypeKeywords) {
|
|
117
|
+
createSolutionItemBase.typeKeywords = ["Solution"].concat(options.additionalTypeKeywords);
|
|
118
|
+
}
|
|
119
|
+
// Create deployed solution item
|
|
120
|
+
createSolutionItemBase.thumbnail = options.thumbnail;
|
|
121
|
+
const createSolutionResponse = await common.createItemWithData(createSolutionItemBase, {}, authentication, deployedFolderId);
|
|
122
|
+
deployedSolutionId = createSolutionResponse.id;
|
|
123
|
+
// Protect the solution item
|
|
124
|
+
const protectOptions = {
|
|
125
|
+
id: deployedSolutionId,
|
|
126
|
+
authentication,
|
|
127
|
+
};
|
|
128
|
+
await common.protectItem(protectOptions);
|
|
129
|
+
// TODO: Attach the whole solution model so we can
|
|
130
|
+
// have stuff like `{{solution.item.title}}
|
|
131
|
+
templateDictionary.solutionItemId = deployedSolutionId;
|
|
132
|
+
solutionTemplateBase.id = deployedSolutionId;
|
|
133
|
+
solutionTemplateBase.tryitUrl = _checkedReplaceAll(solutionTemplateBase.tryitUrl, templateSolutionId, deployedSolutionId);
|
|
134
|
+
solutionTemplateBase.url = _checkedReplaceAll(solutionTemplateBase.url, templateSolutionId, deployedSolutionId);
|
|
135
|
+
}
|
|
136
|
+
// Handle the contained item templates
|
|
137
|
+
const clonedSolutionsResponse = await deployItems.deploySolutionItems(storageAuthentication.portal, templateSolutionId, solutionTemplateData.templates, storageAuthentication, templateDictionary, deployedSolutionId, authentication, options);
|
|
138
|
+
solutionTemplateData.templates = solutionTemplateData.templates.map((itemTemplate) => {
|
|
139
|
+
// Update ids present in template dictionary
|
|
140
|
+
itemTemplate.itemId = common.getProp(templateDictionary, `${itemTemplate.itemId}.itemId`);
|
|
141
|
+
// Update the dependencies hash to point to the new item ids
|
|
142
|
+
itemTemplate.dependencies = itemTemplate.dependencies.map((id) => getWithDefault(templateDictionary, `${id}.itemId`, id));
|
|
143
|
+
return itemTemplate;
|
|
144
|
+
});
|
|
145
|
+
// Sort the templates into build order, which is provided by clonedSolutionsResponse
|
|
146
|
+
sortTemplates(solutionTemplateData.templates, clonedSolutionsResponse.map((response) => response.id));
|
|
147
|
+
// Wrap up with post-processing, in which we deal with groups and cycle remnants
|
|
148
|
+
await postProcess(deployedSolutionId, solutionTemplateData.templates, clonedSolutionsResponse, authentication, templateDictionary);
|
|
149
|
+
if (!options.dontCreateSolutionItem) {
|
|
150
|
+
// Update solution item using internal representation & and the updated data JSON
|
|
151
|
+
solutionTemplateBase.typeKeywords = [].concat(solutionTemplateBase.typeKeywords, ["Deployed"]);
|
|
152
|
+
const iTemplateKeyword = solutionTemplateBase.typeKeywords.indexOf("Template");
|
|
153
|
+
/* istanbul ignore else */
|
|
154
|
+
if (iTemplateKeyword >= 0) {
|
|
155
|
+
solutionTemplateBase.typeKeywords.splice(iTemplateKeyword, 1);
|
|
156
|
+
}
|
|
157
|
+
solutionTemplateData.templates = solutionTemplateData.templates.map((itemTemplate) => _purgeTemplateProperties(itemTemplate));
|
|
158
|
+
_handleWorkflowManagedTemplates(preProcessResponse, solutionTemplateData);
|
|
159
|
+
solutionTemplateData.templates = _updateGroupReferences(solutionTemplateData.templates, templateDictionary);
|
|
160
|
+
solutionTemplateData.templates = common.updateWorkflowTemplateIds(solutionTemplateData.templates, templateDictionary);
|
|
161
|
+
// Update solution items data using template dictionary, and then update the
|
|
162
|
+
// itemId & dependencies in each item template
|
|
163
|
+
solutionTemplateBase.data = common.replaceInTemplate(solutionTemplateData, templateDictionary);
|
|
164
|
+
// Write any user defined params to the solution
|
|
165
|
+
/* istanbul ignore else */
|
|
166
|
+
if (templateDictionary.params) {
|
|
167
|
+
solutionTemplateBase.data.params = templateDictionary.params;
|
|
168
|
+
}
|
|
169
|
+
await common.updateItem(solutionTemplateBase, authentication, deployedFolderId);
|
|
170
|
+
}
|
|
171
|
+
return solutionTemplateBase.id;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Add templates for the items that were automatically created by workflow
|
|
175
|
+
*
|
|
176
|
+
* @param preProcessResponse response from pre processing of workflow items
|
|
177
|
+
* @param solutionTemplateData the current solution template data that will be used to show item details
|
|
178
|
+
*/
|
|
179
|
+
export function _handleWorkflowManagedTemplates(preProcessResponse, solutionTemplateData) {
|
|
180
|
+
preProcessResponse.workflowManagedTemplates.forEach((itemTemplate) => {
|
|
181
|
+
solutionTemplateData.templates.push(_purgeTemplateProperties(itemTemplate));
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Add source-id to items/groups typeKeywords
|
|
186
|
+
*
|
|
187
|
+
* @param template the array of solution data templates
|
|
188
|
+
* @private
|
|
189
|
+
*/
|
|
190
|
+
export function _addSourceId(templates) {
|
|
191
|
+
return templates.map((template) => {
|
|
192
|
+
/* istanbul ignore else */
|
|
193
|
+
if (template.item) {
|
|
194
|
+
const typeKeywords = template.item.typeKeywords || [];
|
|
195
|
+
typeKeywords.push("source-" + template.itemId);
|
|
196
|
+
template.item.typeKeywords = typeKeywords;
|
|
197
|
+
}
|
|
198
|
+
return template;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Update the deployOptions with the group properties
|
|
203
|
+
*
|
|
204
|
+
* @param deployOptions
|
|
205
|
+
* @param sourceInfo
|
|
206
|
+
* @param authentication
|
|
207
|
+
* @param isGroup Boolean to indicate if the files are associated with a group or item
|
|
208
|
+
* @private
|
|
209
|
+
*/
|
|
210
|
+
export function _applySourceToDeployOptions(deployOptions, solutionTemplateBase, templateDictionary, authentication) {
|
|
211
|
+
// Deploy a solution from the template's contents,
|
|
212
|
+
// using the template's information as defaults for the deployed solution item
|
|
213
|
+
["title", "snippet", "description", "tags"].forEach((prop) => {
|
|
214
|
+
deployOptions[prop] = deployOptions[prop] ?? solutionTemplateBase[prop];
|
|
215
|
+
if (deployOptions[prop]) {
|
|
216
|
+
solutionTemplateBase[prop] = deployOptions[prop];
|
|
217
|
+
// carry these options forward on the templateDict
|
|
218
|
+
templateDictionary[prop] = deployOptions[prop];
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
if (!deployOptions.thumbnailurl && solutionTemplateBase.thumbnail) {
|
|
222
|
+
// Get the full path to the thumbnail
|
|
223
|
+
deployOptions.thumbnailurl = common.generateSourceThumbnailUrl(authentication.portal, solutionTemplateBase.id, solutionTemplateBase.thumbnail);
|
|
224
|
+
delete solutionTemplateBase.thumbnail;
|
|
225
|
+
}
|
|
226
|
+
return deployOptions;
|
|
227
|
+
}
|
|
228
|
+
//TODO: function doc
|
|
229
|
+
export function _replaceParamVariables(solutionTemplateData, templateDictionary) {
|
|
230
|
+
// a custom params object can be passed in with the options to deploy a solution
|
|
231
|
+
// in most cases we can defer to the item type handlers to use these values
|
|
232
|
+
// for variable replacement
|
|
233
|
+
// for spatial reference specifically we need to replace up front so the default extent
|
|
234
|
+
// logic can execute as expected
|
|
235
|
+
solutionTemplateData.templates = solutionTemplateData.templates.map((template) => {
|
|
236
|
+
// can't do this as it causes other values that don't exist in the dict yet to revert to defaults they may have defined
|
|
237
|
+
// return common.replaceInTemplate(template, templateDictionary);
|
|
238
|
+
/* istanbul ignore else */
|
|
239
|
+
if (template.type === "Feature Service") {
|
|
240
|
+
const paramsLookup = "params.";
|
|
241
|
+
const wkidItemPath = "item.spatialReference.wkid";
|
|
242
|
+
template = _updateProp(template, wkidItemPath, paramsLookup, templateDictionary);
|
|
243
|
+
const wkidServicePath = "properties.service.spatialReference.wkid";
|
|
244
|
+
template = _updateProp(template, wkidServicePath, paramsLookup, templateDictionary);
|
|
245
|
+
}
|
|
246
|
+
return template;
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
//TODO: function doc
|
|
250
|
+
export function _updateProp(template, path, lookup, templateDictionary) {
|
|
251
|
+
const wkid = common.getProp(template, path);
|
|
252
|
+
/* istanbul ignore else */
|
|
253
|
+
if (wkid && typeof wkid === "string" && wkid.indexOf(lookup) > -1) {
|
|
254
|
+
common.setProp(template, path, common.replaceInTemplate(wkid, templateDictionary));
|
|
255
|
+
}
|
|
256
|
+
return template;
|
|
257
|
+
}
|
|
258
|
+
//TODO: function doc
|
|
259
|
+
export function _checkedReplaceAll(template, oldValue, newValue) {
|
|
260
|
+
let newTemplate;
|
|
261
|
+
if (template && template.indexOf(oldValue) > -1) {
|
|
262
|
+
const re = new RegExp(oldValue, "g");
|
|
263
|
+
newTemplate = template.replace(re, newValue);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
newTemplate = template;
|
|
267
|
+
}
|
|
268
|
+
return newTemplate;
|
|
269
|
+
}
|
|
270
|
+
//TODO: function doc
|
|
271
|
+
export function _getPortalBaseUrl(portalResponse, authentication) {
|
|
272
|
+
// As of Spring 2020, only HTTPS (see
|
|
273
|
+
// https://www.esri.com/arcgis-blog/products/product/administration/2019-arcgis-transport-security-improvements/)
|
|
274
|
+
const scheme = "https"; // portalResponse.allSSL ? "https" : "http";
|
|
275
|
+
const urlKey = common.getProp(portalResponse, "urlKey");
|
|
276
|
+
const customBaseUrl = common.getProp(portalResponse, "customBaseUrl");
|
|
277
|
+
const enterpriseBaseUrl = common.getProp(portalResponse, "portalHostname");
|
|
278
|
+
return urlKey && customBaseUrl
|
|
279
|
+
? `${scheme}://${urlKey}.${customBaseUrl}`
|
|
280
|
+
: enterpriseBaseUrl
|
|
281
|
+
? `${scheme}://${enterpriseBaseUrl}`
|
|
282
|
+
: authentication.portal.replace("/sharing/rest", "");
|
|
283
|
+
}
|
|
284
|
+
//TODO: function doc
|
|
285
|
+
export function _updateGroupReferences(itemTemplates, templateDictionary) {
|
|
286
|
+
const groupIds = itemTemplates.reduce((result, t) => {
|
|
287
|
+
if (t.type === "Group") {
|
|
288
|
+
result.push(t.itemId);
|
|
289
|
+
}
|
|
290
|
+
return result;
|
|
291
|
+
}, []);
|
|
292
|
+
Object.keys(templateDictionary).forEach((k) => {
|
|
293
|
+
const newId = templateDictionary[k].itemId;
|
|
294
|
+
if (groupIds.indexOf(newId) > -1) {
|
|
295
|
+
itemTemplates.forEach((t) => {
|
|
296
|
+
t.groups = t.groups.map((id) => (id === k ? newId : id));
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
return itemTemplates;
|
|
301
|
+
}
|
|
302
|
+
//TODO: function doc
|
|
303
|
+
export function _purgeTemplateProperties(itemTemplate) {
|
|
304
|
+
const retainProps = ["itemId", "type", "dependencies", "groups"];
|
|
305
|
+
const deleteProps = Object.keys(itemTemplate).filter((k) => retainProps.indexOf(k) < 0);
|
|
306
|
+
common.deleteProps(itemTemplate, deleteProps);
|
|
307
|
+
return itemTemplate;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Returns a match of a supplied id with the suffix ".itemId" in the template dictionary.
|
|
311
|
+
*
|
|
312
|
+
* @param id Id to look for
|
|
313
|
+
* @param templateDictionary Hash mapping property names to replacement values
|
|
314
|
+
* @returns Match in template dictionary or original id
|
|
315
|
+
*/
|
|
316
|
+
export function _getNewItemId(id, templateDictionary) {
|
|
317
|
+
return common.getProp(templateDictionary, id + ".itemId") ?? id;
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=deploySolutionFromTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploySolutionFromTemplate.js","sourceRoot":"","sources":["../../src/deploySolutionFromTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,8EAA8E;AAE9E,MAAM,CAAC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;IACH,CAAC,CAAC,CAAC;IACH,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,oBAAoB;AACpB,MAAM,UAAU,wBAAwB,CAAC,YAAiB;IACxD,MAAM,WAAW,GAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,CAAC,CAAC;IAC3E,MAAM,WAAW,GAAa,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAClG,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAC9C,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,EAAU,EAAE,kBAAuB;IAC/D,OAAO,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/** @license
|
|
2
|
+
* Copyright 2018 Esri
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Manages deployment of items via the REST API.
|
|
18
|
+
*
|
|
19
|
+
* @module deployItems
|
|
20
|
+
*/
|
|
21
|
+
import * as common from "@esri/solution-common";
|
|
22
|
+
/**
|
|
23
|
+
* Deploys a set of items defined by templates.
|
|
24
|
+
*
|
|
25
|
+
* @param portalSharingUrl Server/sharing
|
|
26
|
+
* @param storageItemId Id of storage item
|
|
27
|
+
* @param templates A collection of AGO item templates
|
|
28
|
+
* @param storageAuthentication Credentials for the organization with the source items
|
|
29
|
+
* @param templateDictionary Hash of facts: org URL, adlib replacements
|
|
30
|
+
* @param deployedSolutionId Id of deployed Solution item
|
|
31
|
+
* @param destinationAuthentication Credentials for the destination organization
|
|
32
|
+
* @param options Options to tune deployment
|
|
33
|
+
* @returns A promise that will resolve with the list of information about the created items
|
|
34
|
+
*/
|
|
35
|
+
export declare function deploySolutionItems(portalSharingUrl: string, storageItemId: string, templates: common.IItemTemplate[], storageAuthentication: common.UserSession, templateDictionary: any, deployedSolutionId: string, destinationAuthentication: common.UserSession, options: common.IDeploySolutionOptions): Promise<common.ICreateItemFromTemplateResponse[]>;
|
|
36
|
+
/**
|
|
37
|
+
* For each item to be patched, convert it to its cloned id and mark the item as needing post processing.
|
|
38
|
+
*
|
|
39
|
+
* @param itemsToBePatched List of items that need to have their dependencies patched
|
|
40
|
+
* @param templateDictionary Hash of facts: org URL, adlib replacements
|
|
41
|
+
* @param templates A collection of AGO item templates
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
export declare function _flagPatchItemsForPostProcessing(itemsToBePatched: common.IKeyedListsOfStrings, templateDictionary: any, templates: common.ICreateItemFromTemplateResponse[]): void;
|
|
45
|
+
/**
|
|
46
|
+
* Portal does not allow views of a single source to be created at the same time.
|
|
47
|
+
*
|
|
48
|
+
* Update view templates with an array of other view template ids that it should wait on.
|
|
49
|
+
*
|
|
50
|
+
* @param templates a collection of AGO item templates
|
|
51
|
+
*
|
|
52
|
+
* @returns An updated array of item templates
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
export declare function _evaluateSharedViewSources(templates: common.IItemTemplate[]): common.IItemTemplate[];
|
|
56
|
+
/**
|
|
57
|
+
* Add a syncViews array to each template that will hold all other view ids that
|
|
58
|
+
* have the same FS dependency.
|
|
59
|
+
* These arrays will be processed later to only contain ids that each view will need to wait on.
|
|
60
|
+
*
|
|
61
|
+
* @param templates a collection of AGO item templates
|
|
62
|
+
* @param views an array of view template details
|
|
63
|
+
*
|
|
64
|
+
* @returns An updated array of item templates
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
export declare function _updateViewTemplates(templates: common.IItemTemplate[], views: any[]): common.IItemTemplate[];
|
|
68
|
+
/**
|
|
69
|
+
* Get all view templates from the source templates collection
|
|
70
|
+
*
|
|
71
|
+
* @param views A collection of view ID and dependencies
|
|
72
|
+
*
|
|
73
|
+
* @returns an array of objects with the source FS id as the key and a list of views that are
|
|
74
|
+
* dependant upon it
|
|
75
|
+
*
|
|
76
|
+
* @private
|
|
77
|
+
*/
|
|
78
|
+
export declare function _getViewHash(views: any[]): any;
|
|
79
|
+
/**
|
|
80
|
+
* Get all view templates from the source templates collection
|
|
81
|
+
*
|
|
82
|
+
* @param templates A collection of AGO item templates
|
|
83
|
+
*
|
|
84
|
+
* @returns an array with the view id and its dependencies
|
|
85
|
+
*
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
export declare function _getViews(templates: common.IItemTemplate[]): any[];
|
|
89
|
+
/**
|
|
90
|
+
* Search for existing items and update the templateDictionary with key details
|
|
91
|
+
*
|
|
92
|
+
* @param templates A collection of AGO item templates
|
|
93
|
+
* @param reuseItems Option to search for existing items
|
|
94
|
+
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
95
|
+
* @param authentication Credentials for the requests
|
|
96
|
+
*
|
|
97
|
+
* @returns A Promise that will resolve once existing items have been evaluated
|
|
98
|
+
*
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
export declare function _reuseDeployedItems(templates: common.IItemTemplate[], reuseItems: boolean, templateDictionary: any, authentication: common.UserSession): Promise<any>;
|
|
102
|
+
/**
|
|
103
|
+
* Search for existing items and update the templateDictionary with key details
|
|
104
|
+
*
|
|
105
|
+
* Subtle difference between _reuseDeployedItems and _useExistingItems
|
|
106
|
+
* _reuseDeployedItems: will search all existing items based on specific type keywords
|
|
107
|
+
* that would have been added by a previous deployment
|
|
108
|
+
* _useExistingItems: will search for an existing item that the user provided
|
|
109
|
+
* the item id for while configuring in the deployment app.
|
|
110
|
+
* This type of item would not necessarily have been laid down by a previous deployment and
|
|
111
|
+
* can thus not expect that it will have the type keywords
|
|
112
|
+
*
|
|
113
|
+
* @param templates A collection of AGO item templates
|
|
114
|
+
* @param useExisting Option to search for existing items
|
|
115
|
+
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
116
|
+
* @param authentication Credentials for the requests
|
|
117
|
+
*
|
|
118
|
+
* @returns A Promise that will resolve once existing items have been evaluated
|
|
119
|
+
*
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
export declare function _useExistingItems(templates: common.IItemTemplate[], useExisting: boolean, templateDictionary: any, authentication: common.UserSession): Promise<any>;
|
|
123
|
+
/**
|
|
124
|
+
* Verify if the existing item has the source-<itemId> typeKeyword and set it if not
|
|
125
|
+
* This allows items that did not come from deployment to be found for reuse after they
|
|
126
|
+
* have been used once via a custom itemId param
|
|
127
|
+
*
|
|
128
|
+
* @param itemDefs
|
|
129
|
+
* @param sourceIdHash key value pairs..actual itemId is the key and the source itemId is the value
|
|
130
|
+
* @param authentication credentials for the requests
|
|
131
|
+
*
|
|
132
|
+
* @returns a promise to indicate when the requests are complete
|
|
133
|
+
* @private
|
|
134
|
+
*/
|
|
135
|
+
export declare function _setTypekeywordForExisting(itemDefs: Array<Promise<any>>, sourceIdHash: any, authentication: common.UserSession): Promise<any>;
|
|
136
|
+
/**
|
|
137
|
+
* Update the templateDictionary with key details by item type
|
|
138
|
+
*
|
|
139
|
+
* @param templates A collection of AGO item templates
|
|
140
|
+
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
141
|
+
*
|
|
142
|
+
* @private
|
|
143
|
+
*/
|
|
144
|
+
export declare function _updateTemplateDictionary(templates: common.IItemTemplate[], templateDictionary: any, authentication: common.UserSession): Promise<any>;
|
|
145
|
+
/**
|
|
146
|
+
* Add the fields from the source layer to the template dictionary for any required replacements
|
|
147
|
+
*
|
|
148
|
+
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
149
|
+
* @param itemId the id for the item
|
|
150
|
+
* @param layerId the id for the layer
|
|
151
|
+
* @param fields the fields to transfer
|
|
152
|
+
*
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
export declare function _setFields(templateDictionary: any, itemId: string, layerId: string, fields: any[]): void;
|
|
156
|
+
/**
|
|
157
|
+
* In some cases an item id search will return a stale item reference
|
|
158
|
+
* it will subsequently fail when we try to fetch the underlying service.
|
|
159
|
+
*
|
|
160
|
+
* We need to remove the item info that has been added to the template dictionary
|
|
161
|
+
* and treat the item as we do other items that don't already exist on deployment.
|
|
162
|
+
*
|
|
163
|
+
* @param result the service request result
|
|
164
|
+
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
165
|
+
*
|
|
166
|
+
* @private
|
|
167
|
+
*/
|
|
168
|
+
export declare function _updateTemplateDictionaryForError(templateDictionary: any, itemId: string): any;
|
|
169
|
+
/**
|
|
170
|
+
* Optionally search by tags and then update the templateDictionary based on the search results
|
|
171
|
+
*
|
|
172
|
+
* @param existingItemsResponse response object from search by typeKeyword and type
|
|
173
|
+
* @param existingItemIds list of the template ids we have queried
|
|
174
|
+
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
175
|
+
* @param authentication Credentials for the request
|
|
176
|
+
* @param addTagQuery Boolean to indicate if a search by tag should happen
|
|
177
|
+
* @returns IFindExistingItemsResponse object with promise that will resolve with an array of results
|
|
178
|
+
* and an array of item ids
|
|
179
|
+
* @private
|
|
180
|
+
*/
|
|
181
|
+
export declare function _handleExistingItems(existingItemsResponse: any[], existingItemInfos: common.IFindExistingItemInfos[], templateDictionary: any, authentication: common.UserSession, addTagQuery: boolean): common.IFindExistingItemsResponse;
|
|
182
|
+
export declare function _updateTemplateDictionaryById(templateDictionary: any, sourceId: string, itemId: string, v: any): void;
|
|
183
|
+
/**
|
|
184
|
+
* Search items based on user query
|
|
185
|
+
*
|
|
186
|
+
* @param templates Templates to examine
|
|
187
|
+
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
188
|
+
* @param authentication Credentials for the request
|
|
189
|
+
* @returns IFindExistingItemsResponse object with promise that will resolve with an array of results
|
|
190
|
+
* and an array of item ids
|
|
191
|
+
* @private
|
|
192
|
+
*/
|
|
193
|
+
export declare function _findExistingItemByKeyword(templates: common.IItemTemplate[], templateDictionary: any, authentication: common.UserSession): common.IFindExistingItemsResponse;
|
|
194
|
+
/**
|
|
195
|
+
* Search items based on user query
|
|
196
|
+
*
|
|
197
|
+
* @param query Query string to use
|
|
198
|
+
* @param authentication Credentials for the request
|
|
199
|
+
* @returns A promise that will resolve with an array of results
|
|
200
|
+
* @private
|
|
201
|
+
*/
|
|
202
|
+
export declare function _findExistingItem(query: string, authentication: common.UserSession): Promise<any>;
|
|
203
|
+
/**
|
|
204
|
+
* Creates an item from a template once the item's dependencies have been created.
|
|
205
|
+
*
|
|
206
|
+
* @param template Template of item to deploy
|
|
207
|
+
* @param resourceFilePaths URL, folder, and filename for each item resource/metadata/thumbnail
|
|
208
|
+
* @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies
|
|
209
|
+
* @param userSession Options for the request
|
|
210
|
+
* @param itemProgressCallback Function for reporting progress updates from type-specific template handlers
|
|
211
|
+
* @returns A promise that will resolve with the id of the deployed item (which is simply returned if it's
|
|
212
|
+
* already in the templates list
|
|
213
|
+
* @private
|
|
214
|
+
*/
|
|
215
|
+
export declare function _createItemFromTemplateWhenReady(template: common.IItemTemplate, resourceFilePaths: common.IDeployFileCopyPath[], storageAuthentication: common.UserSession, templateDictionary: any, destinationAuthentication: common.UserSession, itemProgressCallback: common.IItemProgressCallback): Promise<common.ICreateItemFromTemplateResponse>;
|
|
216
|
+
/**
|
|
217
|
+
* Accumulates the estimated deployment cost of a set of templates.
|
|
218
|
+
*
|
|
219
|
+
* @param templates Templates to examine
|
|
220
|
+
* @returns Sum of estimated deployment costs
|
|
221
|
+
* @private
|
|
222
|
+
*/
|
|
223
|
+
export declare function _estimateDeploymentCost(templates: common.IItemTemplate[]): number;
|
|
224
|
+
export declare function _getGroupUpdates(template: common.IItemTemplate, authentication: common.UserSession, templateDictionary: any): Array<Promise<any>>;
|