@esri/solution-deployer 4.1.0 → 4.1.2-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.
@@ -0,0 +1,48 @@
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
+ export declare function deploySolutionFromTemplate(templateSolutionId: string, solutionTemplateBase: any, solutionTemplateData: any, authentication: common.UserSession, options: common.IDeploySolutionOptions): Promise<string>;
18
+ /**
19
+ * Add source-id to items/groups typeKeywords
20
+ *
21
+ * @param template the array of solution data templates
22
+ * @private
23
+ */
24
+ export declare function _addSourceId(templates: common.IItemTemplate[]): common.IItemTemplate[];
25
+ /**
26
+ * Update the deployOptions with the group properties
27
+ *
28
+ * @param deployOptions
29
+ * @param sourceInfo
30
+ * @param authentication
31
+ * @param isGroup Boolean to indicate if the files are associated with a group or item
32
+ * @private
33
+ */
34
+ export declare function _applySourceToDeployOptions(deployOptions: common.IDeploySolutionOptions, solutionTemplateBase: any, templateDictionary: any, authentication: common.UserSession): common.IDeploySolutionOptions;
35
+ export declare function _replaceParamVariables(solutionTemplateData: any, templateDictionary: any): void;
36
+ export declare function _updateProp(template: common.IItemTemplate, path: string, lookup: string, templateDictionary: any): common.IItemTemplate;
37
+ export declare function _checkedReplaceAll(template: string, oldValue: string, newValue: string): string;
38
+ export declare function _getPortalBaseUrl(portalResponse: common.IPortal, authentication: common.UserSession): string;
39
+ export declare function _updateGroupReferences(itemTemplates: any[], templateDictionary: any): any[];
40
+ export declare function _purgeTemplateProperties(itemTemplate: any): any;
41
+ /**
42
+ * Returns a match of a supplied id with the suffix ".itemId" in the template dictionary.
43
+ *
44
+ * @param id Id to look for
45
+ * @param templateDictionary Hash mapping property names to replacement values
46
+ * @returns Match in template dictionary or original id
47
+ */
48
+ export declare function _getNewItemId(id: string, templateDictionary: any): string;
@@ -0,0 +1,332 @@
1
+ "use strict";
2
+ /** @license
3
+ * Copyright 2018 Esri
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports._getNewItemId = exports._purgeTemplateProperties = exports._updateGroupReferences = exports._getPortalBaseUrl = exports._checkedReplaceAll = exports._updateProp = exports._replaceParamVariables = exports._applySourceToDeployOptions = exports._addSourceId = exports.deploySolutionFromTemplate = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const common = tslib_1.__importStar(require("@esri/solution-common"));
21
+ const deployItems = tslib_1.__importStar(require("./deploySolutionItems"));
22
+ const hub_common_1 = require("@esri/hub-common");
23
+ const portal = tslib_1.__importStar(require("@esri/arcgis-rest-portal"));
24
+ const post_process_1 = require("./helpers/post-process");
25
+ const sortTemplates_1 = require("./helpers/sortTemplates");
26
+ const solution_common_1 = require("@esri/solution-common");
27
+ // NOTE: Moved to separate file to allow stubbing in main deploySolution tests
28
+ function deploySolutionFromTemplate(templateSolutionId, solutionTemplateBase, solutionTemplateData, authentication, options) {
29
+ options.storageVersion = common.extractSolutionVersion(solutionTemplateData);
30
+ return new Promise((resolve, reject) => {
31
+ // It is possible to provide a separate authentication for the source
32
+ const storageAuthentication = options.storageAuthentication
33
+ ? options.storageAuthentication
34
+ : authentication;
35
+ // Replacement dictionary and high-level deployment ids for cleanup
36
+ // TODO: Extract all templateDictionary prep into a separate function
37
+ const templateDictionary = options.templateDictionary ?? {};
38
+ let deployedFolderId;
39
+ let deployedSolutionId;
40
+ _applySourceToDeployOptions(options, solutionTemplateBase, templateDictionary, authentication);
41
+ if (options.additionalTypeKeywords) {
42
+ solutionTemplateBase.typeKeywords = [].concat(solutionTemplateBase.typeKeywords, options.additionalTypeKeywords);
43
+ }
44
+ // Get the thumbnail file
45
+ let thumbFilename = "thumbnail";
46
+ let thumbDef = Promise.resolve(null);
47
+ if (!options.thumbnail && options.thumbnailurl) {
48
+ // Figure out the thumbnail's filename
49
+ thumbFilename =
50
+ common.getFilenameFromUrl(options.thumbnailurl) || thumbFilename;
51
+ const thumbnailurl = common.appendQueryParam(options.thumbnailurl, "w=400");
52
+ delete options.thumbnailurl;
53
+ // Fetch the thumbnail
54
+ thumbDef = common.getBlobAsFile(thumbnailurl, thumbFilename, storageAuthentication, [400]);
55
+ }
56
+ _replaceParamVariables(solutionTemplateData, templateDictionary);
57
+ // Get information about deployment environment
58
+ Promise.all([
59
+ common.getPortal("", authentication),
60
+ common.getUser(authentication),
61
+ common.getFoldersAndGroups(authentication),
62
+ thumbDef
63
+ ])
64
+ .then(responses => {
65
+ const [portalResponse, userResponse, foldersAndGroupsResponse, thumbnailFile] = responses;
66
+ if (!options.thumbnail && thumbnailFile) {
67
+ options.thumbnail = thumbnailFile;
68
+ }
69
+ // update template items with source-itemId type keyword
70
+ solutionTemplateData.templates = _addSourceId(solutionTemplateData.templates);
71
+ templateDictionary.isPortal = portalResponse.isPortal;
72
+ templateDictionary.organization = Object.assign(templateDictionary.organization || {}, portalResponse);
73
+ // TODO: Add more computed properties here
74
+ // portal: portalResponse
75
+ // orgextent as bbox for assignment onto items
76
+ // more info in #266 https://github.com/Esri/solution.js/issues/266
77
+ templateDictionary.portalBaseUrl = _getPortalBaseUrl(portalResponse, authentication);
78
+ templateDictionary.user = userResponse;
79
+ templateDictionary.user.folders = foldersAndGroupsResponse.folders;
80
+ templateDictionary.user.groups = foldersAndGroupsResponse.groups.filter((group) => group.owner === templateDictionary.user.username);
81
+ // if we have tracking views and the user is not admin or the org doesn't support tracking an error is thrown
82
+ common.setLocationTrackingEnabled(portalResponse, userResponse, templateDictionary, solutionTemplateData.templates);
83
+ const trackingOwnerPromise = common.getTackingServiceOwner(templateDictionary, authentication);
84
+ // Create a folder to hold the deployed solution. We use the solution name, appending a sequential
85
+ // suffix if the folder exists, e.g.,
86
+ // * Manage Right of Way Activities
87
+ // * Manage Right of Way Activities 1
88
+ // * Manage Right of Way Activities 2
89
+ const folderPromise = common.createUniqueFolder(solutionTemplateBase.title, templateDictionary, authentication);
90
+ // Apply the portal extents to the solution
91
+ const portalExtent = portalResponse.defaultExtent;
92
+ const extentsPromise = common.convertExtentWithFallback(portalExtent, undefined, { wkid: 4326 }, portalResponse.helperServices.geometry.url, authentication);
93
+ // Await completion of async actions: folder creation & extents conversion
94
+ return Promise.all([folderPromise, extentsPromise, trackingOwnerPromise]);
95
+ })
96
+ .then(responses => {
97
+ const [folderResponse, wgs84Extent, trackingOwnerResponse] = responses;
98
+ deployedFolderId = folderResponse.folder.id;
99
+ templateDictionary.folderId = deployedFolderId;
100
+ templateDictionary.solutionItemExtent =
101
+ wgs84Extent.xmin +
102
+ "," +
103
+ wgs84Extent.ymin +
104
+ "," +
105
+ wgs84Extent.xmax +
106
+ "," +
107
+ wgs84Extent.ymax;
108
+ // Hub Solutions depend on organization defaultExtentBBox as a nested array not a string
109
+ templateDictionary.organization.defaultExtentBBox = [
110
+ [wgs84Extent.xmin, wgs84Extent.ymin],
111
+ [wgs84Extent.xmax, wgs84Extent.ymax]
112
+ ];
113
+ // update templateDictionary to indicate if the user owns the tracking service
114
+ // this will affect how we handle group sharing
115
+ /* istanbul ignore else */
116
+ if (templateDictionary.locationTrackingEnabled) {
117
+ (0, solution_common_1.setCreateProp)(templateDictionary, "locationTracking.userIsOwner", trackingOwnerResponse);
118
+ }
119
+ // Create a deployed Solution item
120
+ const createSolutionItemBase = {
121
+ ...common.sanitizeJSONAndReportChanges(solutionTemplateBase),
122
+ type: "Solution",
123
+ typeKeywords: ["Solution"]
124
+ };
125
+ if (options.additionalTypeKeywords) {
126
+ createSolutionItemBase.typeKeywords = ["Solution"].concat(options.additionalTypeKeywords);
127
+ }
128
+ // Create deployed solution item
129
+ createSolutionItemBase.thumbnail = options.thumbnail;
130
+ return common.createItemWithData(createSolutionItemBase, {}, authentication, deployedFolderId);
131
+ })
132
+ .then(createSolutionResponse => {
133
+ deployedSolutionId = createSolutionResponse.id;
134
+ // Protect the solution item
135
+ const protectOptions = {
136
+ id: deployedSolutionId,
137
+ authentication
138
+ };
139
+ return portal.protectItem(protectOptions);
140
+ })
141
+ .then(() => {
142
+ // TODO: Attach the whole solution model so we can
143
+ // have stuff like `{{solution.item.title}}
144
+ templateDictionary.solutionItemId = deployedSolutionId;
145
+ solutionTemplateBase.id = deployedSolutionId;
146
+ solutionTemplateBase.tryitUrl = _checkedReplaceAll(solutionTemplateBase.tryitUrl, templateSolutionId, deployedSolutionId);
147
+ solutionTemplateBase.url = _checkedReplaceAll(solutionTemplateBase.url, templateSolutionId, deployedSolutionId);
148
+ // Handle the contained item templates
149
+ return deployItems.deploySolutionItems(storageAuthentication.portal, templateSolutionId, solutionTemplateData.templates, storageAuthentication, templateDictionary, deployedSolutionId, authentication, options);
150
+ })
151
+ .then((clonedSolutionsResponse) => {
152
+ solutionTemplateData.templates = solutionTemplateData.templates.map((itemTemplate) => {
153
+ // Update ids present in template dictionary
154
+ itemTemplate.itemId = common.getProp(templateDictionary, `${itemTemplate.itemId}.itemId`);
155
+ // Update the dependencies hash to point to the new item ids
156
+ itemTemplate.dependencies = itemTemplate.dependencies.map((id) => (0, hub_common_1.getWithDefault)(templateDictionary, `${id}.itemId`, id));
157
+ return itemTemplate;
158
+ });
159
+ // Sort the templates into build order, which is provided by clonedSolutionsResponse
160
+ (0, sortTemplates_1.sortTemplates)(solutionTemplateData.templates, clonedSolutionsResponse.map(response => response.id));
161
+ // Wrap up with post-processing, in which we deal with groups and cycle remnants
162
+ return (0, post_process_1.postProcess)(deployedSolutionId, solutionTemplateData.templates, clonedSolutionsResponse, authentication, templateDictionary);
163
+ })
164
+ .then(() => {
165
+ // Update solution item using internal representation & and the updated data JSON
166
+ solutionTemplateBase.typeKeywords = [].concat(solutionTemplateBase.typeKeywords, ["Deployed"]);
167
+ const iTemplateKeyword = solutionTemplateBase.typeKeywords.indexOf("Template");
168
+ /* istanbul ignore else */
169
+ if (iTemplateKeyword >= 0) {
170
+ solutionTemplateBase.typeKeywords.splice(iTemplateKeyword, 1);
171
+ }
172
+ solutionTemplateData.templates = solutionTemplateData.templates.map((itemTemplate) => _purgeTemplateProperties(itemTemplate));
173
+ solutionTemplateData.templates = _updateGroupReferences(solutionTemplateData.templates, templateDictionary);
174
+ // Update solution items data using template dictionary, and then update the
175
+ // itemId & dependencies in each item template
176
+ solutionTemplateBase.data = common.replaceInTemplate(solutionTemplateData, templateDictionary);
177
+ // Write any user defined params to the solution
178
+ /* istanbul ignore else */
179
+ if (templateDictionary.params) {
180
+ solutionTemplateBase.data.params = templateDictionary.params;
181
+ }
182
+ return common.updateItem(solutionTemplateBase, authentication, deployedFolderId);
183
+ })
184
+ .then(() => resolve(solutionTemplateBase.id), reject);
185
+ });
186
+ }
187
+ exports.deploySolutionFromTemplate = deploySolutionFromTemplate;
188
+ /**
189
+ * Add source-id to items/groups typeKeywords
190
+ *
191
+ * @param template the array of solution data templates
192
+ * @private
193
+ */
194
+ function _addSourceId(templates) {
195
+ return templates.map((template) => {
196
+ /* istanbul ignore else */
197
+ if (template.item) {
198
+ const typeKeywords = template.item.typeKeywords || [];
199
+ typeKeywords.push("source-" + template.itemId);
200
+ template.item.typeKeywords = typeKeywords;
201
+ }
202
+ return template;
203
+ });
204
+ }
205
+ exports._addSourceId = _addSourceId;
206
+ /**
207
+ * Update the deployOptions with the group properties
208
+ *
209
+ * @param deployOptions
210
+ * @param sourceInfo
211
+ * @param authentication
212
+ * @param isGroup Boolean to indicate if the files are associated with a group or item
213
+ * @private
214
+ */
215
+ function _applySourceToDeployOptions(deployOptions, solutionTemplateBase, templateDictionary, authentication) {
216
+ // Deploy a solution from the template's contents,
217
+ // using the template's information as defaults for the deployed solution item
218
+ ["title", "snippet", "description", "tags"].forEach(prop => {
219
+ deployOptions[prop] = deployOptions[prop] ?? solutionTemplateBase[prop];
220
+ if (deployOptions[prop]) {
221
+ solutionTemplateBase[prop] = deployOptions[prop];
222
+ // carry these options forward on the templateDict
223
+ templateDictionary[prop] = deployOptions[prop];
224
+ }
225
+ });
226
+ if (!deployOptions.thumbnailurl && solutionTemplateBase.thumbnail) {
227
+ // Get the full path to the thumbnail
228
+ deployOptions.thumbnailurl = common.generateSourceThumbnailUrl(authentication.portal, solutionTemplateBase.id, solutionTemplateBase.thumbnail);
229
+ delete solutionTemplateBase.thumbnail;
230
+ }
231
+ return deployOptions;
232
+ }
233
+ exports._applySourceToDeployOptions = _applySourceToDeployOptions;
234
+ //???
235
+ function _replaceParamVariables(solutionTemplateData, templateDictionary) {
236
+ // a custom params object can be passed in with the options to deploy a solution
237
+ // in most cases we can defer to the item type handlers to use these values
238
+ // for variable replacement
239
+ // for spatial reference specifically we need to replace up front so the default extent
240
+ // logic can execute as expected
241
+ solutionTemplateData.templates = solutionTemplateData.templates.map((template) => {
242
+ // 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
243
+ // return common.replaceInTemplate(template, templateDictionary);
244
+ /* istanbul ignore else */
245
+ if (template.type === "Feature Service") {
246
+ const paramsLookup = "params.";
247
+ const wkidItemPath = "item.spatialReference.wkid";
248
+ template = _updateProp(template, wkidItemPath, paramsLookup, templateDictionary);
249
+ const wkidServicePath = "properties.service.spatialReference.wkid";
250
+ template = _updateProp(template, wkidServicePath, paramsLookup, templateDictionary);
251
+ }
252
+ return template;
253
+ });
254
+ }
255
+ exports._replaceParamVariables = _replaceParamVariables;
256
+ //???
257
+ function _updateProp(template, path, lookup, templateDictionary) {
258
+ const wkid = common.getProp(template, path);
259
+ /* istanbul ignore else */
260
+ if (wkid && typeof wkid === "string" && wkid.indexOf(lookup) > -1) {
261
+ common.setProp(template, path, common.replaceInTemplate(wkid, templateDictionary));
262
+ }
263
+ return template;
264
+ }
265
+ exports._updateProp = _updateProp;
266
+ //???
267
+ function _checkedReplaceAll(template, oldValue, newValue) {
268
+ let newTemplate;
269
+ if (template && template.indexOf(oldValue) > -1) {
270
+ const re = new RegExp(oldValue, "g");
271
+ newTemplate = template.replace(re, newValue);
272
+ }
273
+ else {
274
+ newTemplate = template;
275
+ }
276
+ return newTemplate;
277
+ }
278
+ exports._checkedReplaceAll = _checkedReplaceAll;
279
+ //???
280
+ function _getPortalBaseUrl(portalResponse, authentication) {
281
+ // As of Spring 2020, only HTTPS (see
282
+ // https://www.esri.com/arcgis-blog/products/product/administration/2019-arcgis-transport-security-improvements/)
283
+ const scheme = "https"; // portalResponse.allSSL ? "https" : "http";
284
+ const urlKey = common.getProp(portalResponse, "urlKey");
285
+ const customBaseUrl = common.getProp(portalResponse, "customBaseUrl");
286
+ const enterpriseBaseUrl = common.getProp(portalResponse, "portalHostname");
287
+ return urlKey && customBaseUrl
288
+ ? `${scheme}://${urlKey}.${customBaseUrl}`
289
+ : enterpriseBaseUrl
290
+ ? `${scheme}://${enterpriseBaseUrl}`
291
+ : authentication.portal.replace("/sharing/rest", "");
292
+ }
293
+ exports._getPortalBaseUrl = _getPortalBaseUrl;
294
+ //???
295
+ function _updateGroupReferences(itemTemplates, templateDictionary) {
296
+ const groupIds = itemTemplates.reduce((result, t) => {
297
+ if (t.type === "Group") {
298
+ result.push(t.itemId);
299
+ }
300
+ return result;
301
+ }, []);
302
+ Object.keys(templateDictionary).forEach(k => {
303
+ const newId = templateDictionary[k].itemId;
304
+ if (groupIds.indexOf(newId) > -1) {
305
+ itemTemplates.forEach(t => {
306
+ t.groups = t.groups.map((id) => (id === k ? newId : id));
307
+ });
308
+ }
309
+ });
310
+ return itemTemplates;
311
+ }
312
+ exports._updateGroupReferences = _updateGroupReferences;
313
+ //???
314
+ function _purgeTemplateProperties(itemTemplate) {
315
+ const retainProps = ["itemId", "type", "dependencies", "groups"];
316
+ const deleteProps = Object.keys(itemTemplate).filter(k => retainProps.indexOf(k) < 0);
317
+ common.deleteProps(itemTemplate, deleteProps);
318
+ return itemTemplate;
319
+ }
320
+ exports._purgeTemplateProperties = _purgeTemplateProperties;
321
+ /**
322
+ * Returns a match of a supplied id with the suffix ".itemId" in the template dictionary.
323
+ *
324
+ * @param id Id to look for
325
+ * @param templateDictionary Hash mapping property names to replacement values
326
+ * @returns Match in template dictionary or original id
327
+ */
328
+ function _getNewItemId(id, templateDictionary) {
329
+ return common.getProp(templateDictionary, id + ".itemId") ?? id;
330
+ }
331
+ exports._getNewItemId = _getNewItemId;
332
+ //# sourceMappingURL=deploySolutionFromTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploySolutionFromTemplate.js","sourceRoot":"","sources":["../../src/deploySolutionFromTemplate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,sEAAgD;AAChD,2EAAqD;AACrD,iDAAkD;AAClD,yEAAmD;AACnD,yDAAqD;AACrD,2DAAwD;AACxD,2DAAsD;AAEtD,8EAA8E;AAE9E,SAAgB,0BAA0B,CACxC,kBAA0B,EAC1B,oBAAyB,EACzB,oBAAyB,EACzB,cAAkC,EAClC,OAAsC;IAEtC,OAAO,CAAC,cAAc,GAAG,MAAM,CAAC,sBAAsB,CAAC,oBAAoB,CAAC,CAAC;IAE7E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,qEAAqE;QACrE,MAAM,qBAAqB,GAAuB,OAAO,CAAC,qBAAqB;YAC7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EAAE;YAChC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBACxB,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAU,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;IACH,OAAO,aAAa,CAAC;AACvB,CAAC;AAvBD,wDAuBC;AAED,KAAK;AACL,SAAgB,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,CAC5D,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAChC,CAAC;IACF,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAC9C,OAAO,YAAY,CAAC;AACtB,CAAC;AAPD,4DAOC;AAED;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,EAAU,EAAE,kBAAuB;IAC/D,OAAO,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;AAClE,CAAC;AAFD,sCAEC"}
@@ -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>>;