@esri/solution-deployer 1.1.5 → 1.2.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/umd/deployer.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-deployer - v1.
|
|
2
|
+
* @esri/solution-deployer - v1.2.0 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2018-2021 Esri, Inc.
|
|
4
|
-
*
|
|
4
|
+
* Thu Dec 09 2021 16:06:07 GMT-0800 (Pacific Standard 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.
|
|
@@ -18,8 +18,33 @@
|
|
|
18
18
|
(function (global, factory) {
|
|
19
19
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common'), require('@esri/solution-feature-layer'), require('@esri/solution-file'), require('@esri/solution-form'), require('@esri/solution-group'), require('@esri/solution-simple-types'), require('@esri/solution-storymap'), require('@esri/solution-velocity'), require('@esri/solution-web-experience'), require('@esri/solution-hub-types'), require('@esri/hub-common'), require('@esri/arcgis-rest-portal')) :
|
|
20
20
|
typeof define === 'function' && define.amd ? define(['exports', '@esri/solution-common', '@esri/solution-feature-layer', '@esri/solution-file', '@esri/solution-form', '@esri/solution-group', '@esri/solution-simple-types', '@esri/solution-storymap', '@esri/solution-velocity', '@esri/solution-web-experience', '@esri/solution-hub-types', '@esri/hub-common', '@esri/arcgis-rest-portal'], factory) :
|
|
21
|
-
(global = global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisHub, global.arcgisRest));
|
|
22
|
-
}(this, (function (exports, common, featureLayer, fileProcessor, formProcessor, group, solutionSimpleTypes, solutionStorymap, solutionVelocity, solutionWebExperience, solutionHubTypes, hubCommon, portal) { 'use strict';
|
|
21
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisSolution, global.arcgisHub, global.arcgisRest));
|
|
22
|
+
})(this, (function (exports, common, featureLayer, fileProcessor, formProcessor, group, solutionSimpleTypes, solutionStorymap, solutionVelocity, solutionWebExperience, solutionHubTypes, hubCommon, portal) { 'use strict';
|
|
23
|
+
|
|
24
|
+
function _interopNamespace(e) {
|
|
25
|
+
if (e && e.__esModule) return e;
|
|
26
|
+
var n = Object.create(null);
|
|
27
|
+
if (e) {
|
|
28
|
+
Object.keys(e).forEach(function (k) {
|
|
29
|
+
if (k !== 'default') {
|
|
30
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
31
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return e[k]; }
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
n["default"] = e;
|
|
39
|
+
return Object.freeze(n);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var common__namespace = /*#__PURE__*/_interopNamespace(common);
|
|
43
|
+
var featureLayer__namespace = /*#__PURE__*/_interopNamespace(featureLayer);
|
|
44
|
+
var fileProcessor__namespace = /*#__PURE__*/_interopNamespace(fileProcessor);
|
|
45
|
+
var formProcessor__namespace = /*#__PURE__*/_interopNamespace(formProcessor);
|
|
46
|
+
var group__namespace = /*#__PURE__*/_interopNamespace(group);
|
|
47
|
+
var portal__namespace = /*#__PURE__*/_interopNamespace(portal);
|
|
23
48
|
|
|
24
49
|
/** @license
|
|
25
50
|
* Copyright 2020 Esri
|
|
@@ -36,7 +61,7 @@
|
|
|
36
61
|
* See the License for the specific language governing permissions and
|
|
37
62
|
* limitations under the License.
|
|
38
63
|
*/
|
|
39
|
-
const UNSUPPORTED = null;
|
|
64
|
+
const UNSUPPORTED$1 = null;
|
|
40
65
|
/**
|
|
41
66
|
* Mapping from item type to module with type-specific template-handling code.
|
|
42
67
|
* AGO types come from a blend of arcgis-portal-app\src\js\arcgisonline\pages\item\_Info.js and
|
|
@@ -45,12 +70,12 @@
|
|
|
45
70
|
const moduleMap = {
|
|
46
71
|
////////////////////////////////////////////////////////
|
|
47
72
|
// Group type
|
|
48
|
-
Group:
|
|
73
|
+
Group: group__namespace,
|
|
49
74
|
////////////////////////////////////////////////////////
|
|
50
75
|
// Layer types
|
|
51
76
|
"Big Data Analytic": solutionVelocity.VelocityProcessor,
|
|
52
77
|
"Feature Collection": solutionSimpleTypes.simpleTypes,
|
|
53
|
-
"Feature Service":
|
|
78
|
+
"Feature Service": featureLayer__namespace,
|
|
54
79
|
Feed: solutionVelocity.VelocityProcessor,
|
|
55
80
|
"Geocoding Service": undefined,
|
|
56
81
|
"Geodata Service": undefined,
|
|
@@ -59,7 +84,7 @@
|
|
|
59
84
|
"Globe Service": undefined,
|
|
60
85
|
"Image Service": undefined,
|
|
61
86
|
KML: undefined,
|
|
62
|
-
"Map Service":
|
|
87
|
+
"Map Service": featureLayer__namespace,
|
|
63
88
|
"Network Analysis Service": undefined,
|
|
64
89
|
"Real Time Analytic": solutionVelocity.VelocityProcessor,
|
|
65
90
|
"Relational Database Connection": undefined,
|
|
@@ -83,8 +108,8 @@
|
|
|
83
108
|
"Data Store": undefined,
|
|
84
109
|
"Desktop Application": undefined,
|
|
85
110
|
"Excalibur Imagery Project": undefined,
|
|
86
|
-
Form:
|
|
87
|
-
"Hub Initiative": UNSUPPORTED,
|
|
111
|
+
Form: formProcessor__namespace,
|
|
112
|
+
"Hub Initiative": UNSUPPORTED$1,
|
|
88
113
|
"Hub Page": solutionHubTypes.HubPageProcessor,
|
|
89
114
|
"Hub Site Application": solutionHubTypes.HubSiteProcessor,
|
|
90
115
|
"Insights Model": solutionSimpleTypes.simpleTypes,
|
|
@@ -99,7 +124,7 @@
|
|
|
99
124
|
"QuickCapture Project": solutionSimpleTypes.quickcaptureProcessor,
|
|
100
125
|
"Site Application": solutionHubTypes.HubSiteProcessor,
|
|
101
126
|
"Site Page": solutionHubTypes.HubPageProcessor,
|
|
102
|
-
Solution: UNSUPPORTED,
|
|
127
|
+
Solution: UNSUPPORTED$1,
|
|
103
128
|
StoryMap: solutionStorymap.StoryMapProcessor,
|
|
104
129
|
"Urban Model": undefined,
|
|
105
130
|
"Web Experience Template": undefined,
|
|
@@ -108,99 +133,99 @@
|
|
|
108
133
|
"Workforce Project": solutionSimpleTypes.simpleTypes,
|
|
109
134
|
////////////////////////////////////////////////////////
|
|
110
135
|
// File types
|
|
111
|
-
"360 VR Experience":
|
|
112
|
-
"AppBuilder Extension":
|
|
113
|
-
"AppBuilder Widget Package":
|
|
114
|
-
"Application Configuration":
|
|
115
|
-
"ArcGIS Pro Add In":
|
|
116
|
-
"ArcGIS Pro Configuration":
|
|
117
|
-
"ArcPad Package":
|
|
118
|
-
"Basemap Package":
|
|
119
|
-
"CAD Drawing":
|
|
120
|
-
"CityEngine Web Scene":
|
|
121
|
-
"Code Attachment": UNSUPPORTED,
|
|
122
|
-
"Code Sample":
|
|
123
|
-
"Color Set":
|
|
124
|
-
"Compact Tile Package":
|
|
125
|
-
"CSV Collection":
|
|
126
|
-
CSV:
|
|
127
|
-
"Deep Learning Package":
|
|
128
|
-
"Desktop Add In":
|
|
129
|
-
"Desktop Application Template":
|
|
130
|
-
"Desktop Style":
|
|
131
|
-
"Document Link":
|
|
132
|
-
"Explorer Add In":
|
|
133
|
-
"Explorer Layer":
|
|
134
|
-
"Explorer Map":
|
|
135
|
-
"Feature Collection Template":
|
|
136
|
-
"File Geodatabase":
|
|
137
|
-
GeoJson:
|
|
138
|
-
GeoPackage:
|
|
139
|
-
"Geoprocessing Package":
|
|
140
|
-
"Geoprocessing Sample":
|
|
141
|
-
"Globe Document":
|
|
142
|
-
"Image Collection":
|
|
143
|
-
Image:
|
|
144
|
-
"iWork Keynote":
|
|
145
|
-
"iWork Numbers":
|
|
146
|
-
"iWork Pages":
|
|
147
|
-
"KML Collection":
|
|
148
|
-
"Layer Package":
|
|
149
|
-
"Layer Template":
|
|
150
|
-
Layer:
|
|
151
|
-
Layout:
|
|
152
|
-
"Locator Package":
|
|
153
|
-
"Map Document":
|
|
154
|
-
"Map Package":
|
|
155
|
-
"Map Template":
|
|
156
|
-
"Microsoft Excel":
|
|
157
|
-
"Microsoft Powerpoint":
|
|
158
|
-
"Microsoft Word":
|
|
159
|
-
"Mobile Basemap Package":
|
|
160
|
-
"Mobile Map Package":
|
|
161
|
-
"Mobile Scene Package":
|
|
162
|
-
"Native Application":
|
|
163
|
-
"Native Application Installer":
|
|
164
|
-
"Native Application Template":
|
|
165
|
-
netCDF:
|
|
166
|
-
"Operation View":
|
|
167
|
-
"Operations Dashboard Add In":
|
|
168
|
-
"Operations Dashboard Extension":
|
|
169
|
-
PDF:
|
|
170
|
-
"Pro Layer Package":
|
|
171
|
-
"Pro Layer":
|
|
172
|
-
"Pro Map Package":
|
|
173
|
-
"Pro Map":
|
|
174
|
-
"Pro Report":
|
|
175
|
-
"Project Package":
|
|
176
|
-
"Project Template":
|
|
177
|
-
"Published Map":
|
|
178
|
-
"Raster function template":
|
|
179
|
-
"Report Template":
|
|
180
|
-
"Rule Package":
|
|
181
|
-
"Scene Document":
|
|
182
|
-
"Scene Package":
|
|
183
|
-
"Service Definition":
|
|
184
|
-
Shapefile:
|
|
185
|
-
"Statistical Data Collection":
|
|
186
|
-
Style:
|
|
187
|
-
"Survey123 Add In":
|
|
188
|
-
"Symbol Set":
|
|
189
|
-
"Task File":
|
|
190
|
-
"Tile Package":
|
|
191
|
-
"Toolbox Package":
|
|
192
|
-
"Vector Tile Package":
|
|
193
|
-
"Viewer Configuration":
|
|
194
|
-
"Visio Document":
|
|
195
|
-
"Window Mobile Package":
|
|
196
|
-
"Windows Mobile Package":
|
|
197
|
-
"Windows Viewer Add In":
|
|
198
|
-
"Windows Viewer Configuration":
|
|
199
|
-
"Workflow Manager Package":
|
|
136
|
+
"360 VR Experience": fileProcessor__namespace,
|
|
137
|
+
"AppBuilder Extension": fileProcessor__namespace,
|
|
138
|
+
"AppBuilder Widget Package": fileProcessor__namespace,
|
|
139
|
+
"Application Configuration": fileProcessor__namespace,
|
|
140
|
+
"ArcGIS Pro Add In": fileProcessor__namespace,
|
|
141
|
+
"ArcGIS Pro Configuration": fileProcessor__namespace,
|
|
142
|
+
"ArcPad Package": fileProcessor__namespace,
|
|
143
|
+
"Basemap Package": fileProcessor__namespace,
|
|
144
|
+
"CAD Drawing": fileProcessor__namespace,
|
|
145
|
+
"CityEngine Web Scene": fileProcessor__namespace,
|
|
146
|
+
"Code Attachment": UNSUPPORTED$1,
|
|
147
|
+
"Code Sample": fileProcessor__namespace,
|
|
148
|
+
"Color Set": fileProcessor__namespace,
|
|
149
|
+
"Compact Tile Package": fileProcessor__namespace,
|
|
150
|
+
"CSV Collection": fileProcessor__namespace,
|
|
151
|
+
CSV: fileProcessor__namespace,
|
|
152
|
+
"Deep Learning Package": fileProcessor__namespace,
|
|
153
|
+
"Desktop Add In": fileProcessor__namespace,
|
|
154
|
+
"Desktop Application Template": fileProcessor__namespace,
|
|
155
|
+
"Desktop Style": fileProcessor__namespace,
|
|
156
|
+
"Document Link": fileProcessor__namespace,
|
|
157
|
+
"Explorer Add In": fileProcessor__namespace,
|
|
158
|
+
"Explorer Layer": fileProcessor__namespace,
|
|
159
|
+
"Explorer Map": fileProcessor__namespace,
|
|
160
|
+
"Feature Collection Template": fileProcessor__namespace,
|
|
161
|
+
"File Geodatabase": fileProcessor__namespace,
|
|
162
|
+
GeoJson: fileProcessor__namespace,
|
|
163
|
+
GeoPackage: fileProcessor__namespace,
|
|
164
|
+
"Geoprocessing Package": fileProcessor__namespace,
|
|
165
|
+
"Geoprocessing Sample": fileProcessor__namespace,
|
|
166
|
+
"Globe Document": fileProcessor__namespace,
|
|
167
|
+
"Image Collection": fileProcessor__namespace,
|
|
168
|
+
Image: fileProcessor__namespace,
|
|
169
|
+
"iWork Keynote": fileProcessor__namespace,
|
|
170
|
+
"iWork Numbers": fileProcessor__namespace,
|
|
171
|
+
"iWork Pages": fileProcessor__namespace,
|
|
172
|
+
"KML Collection": fileProcessor__namespace,
|
|
173
|
+
"Layer Package": fileProcessor__namespace,
|
|
174
|
+
"Layer Template": fileProcessor__namespace,
|
|
175
|
+
Layer: fileProcessor__namespace,
|
|
176
|
+
Layout: fileProcessor__namespace,
|
|
177
|
+
"Locator Package": fileProcessor__namespace,
|
|
178
|
+
"Map Document": fileProcessor__namespace,
|
|
179
|
+
"Map Package": fileProcessor__namespace,
|
|
180
|
+
"Map Template": fileProcessor__namespace,
|
|
181
|
+
"Microsoft Excel": fileProcessor__namespace,
|
|
182
|
+
"Microsoft Powerpoint": fileProcessor__namespace,
|
|
183
|
+
"Microsoft Word": fileProcessor__namespace,
|
|
184
|
+
"Mobile Basemap Package": fileProcessor__namespace,
|
|
185
|
+
"Mobile Map Package": fileProcessor__namespace,
|
|
186
|
+
"Mobile Scene Package": fileProcessor__namespace,
|
|
187
|
+
"Native Application": fileProcessor__namespace,
|
|
188
|
+
"Native Application Installer": fileProcessor__namespace,
|
|
189
|
+
"Native Application Template": fileProcessor__namespace,
|
|
190
|
+
netCDF: fileProcessor__namespace,
|
|
191
|
+
"Operation View": fileProcessor__namespace,
|
|
192
|
+
"Operations Dashboard Add In": fileProcessor__namespace,
|
|
193
|
+
"Operations Dashboard Extension": fileProcessor__namespace,
|
|
194
|
+
PDF: fileProcessor__namespace,
|
|
195
|
+
"Pro Layer Package": fileProcessor__namespace,
|
|
196
|
+
"Pro Layer": fileProcessor__namespace,
|
|
197
|
+
"Pro Map Package": fileProcessor__namespace,
|
|
198
|
+
"Pro Map": fileProcessor__namespace,
|
|
199
|
+
"Pro Report": fileProcessor__namespace,
|
|
200
|
+
"Project Package": fileProcessor__namespace,
|
|
201
|
+
"Project Template": fileProcessor__namespace,
|
|
202
|
+
"Published Map": fileProcessor__namespace,
|
|
203
|
+
"Raster function template": fileProcessor__namespace,
|
|
204
|
+
"Report Template": fileProcessor__namespace,
|
|
205
|
+
"Rule Package": fileProcessor__namespace,
|
|
206
|
+
"Scene Document": fileProcessor__namespace,
|
|
207
|
+
"Scene Package": fileProcessor__namespace,
|
|
208
|
+
"Service Definition": fileProcessor__namespace,
|
|
209
|
+
Shapefile: fileProcessor__namespace,
|
|
210
|
+
"Statistical Data Collection": fileProcessor__namespace,
|
|
211
|
+
Style: fileProcessor__namespace,
|
|
212
|
+
"Survey123 Add In": fileProcessor__namespace,
|
|
213
|
+
"Symbol Set": fileProcessor__namespace,
|
|
214
|
+
"Task File": fileProcessor__namespace,
|
|
215
|
+
"Tile Package": fileProcessor__namespace,
|
|
216
|
+
"Toolbox Package": fileProcessor__namespace,
|
|
217
|
+
"Vector Tile Package": fileProcessor__namespace,
|
|
218
|
+
"Viewer Configuration": fileProcessor__namespace,
|
|
219
|
+
"Visio Document": fileProcessor__namespace,
|
|
220
|
+
"Window Mobile Package": fileProcessor__namespace,
|
|
221
|
+
"Windows Mobile Package": fileProcessor__namespace,
|
|
222
|
+
"Windows Viewer Add In": fileProcessor__namespace,
|
|
223
|
+
"Windows Viewer Configuration": fileProcessor__namespace,
|
|
224
|
+
"Workflow Manager Package": fileProcessor__namespace,
|
|
200
225
|
////////////////////////////////////////////////////////
|
|
201
226
|
// Testing "types"
|
|
202
227
|
Undefined: undefined,
|
|
203
|
-
Unsupported: UNSUPPORTED
|
|
228
|
+
Unsupported: UNSUPPORTED$1
|
|
204
229
|
};
|
|
205
230
|
|
|
206
231
|
/** @license
|
|
@@ -218,7 +243,7 @@
|
|
|
218
243
|
* See the License for the specific language governing permissions and
|
|
219
244
|
* limitations under the License.
|
|
220
245
|
*/
|
|
221
|
-
const UNSUPPORTED
|
|
246
|
+
const UNSUPPORTED = null;
|
|
222
247
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
223
248
|
/**
|
|
224
249
|
* Deploys a set of items defined by templates.
|
|
@@ -248,9 +273,9 @@
|
|
|
248
273
|
percentDone += progressPercentStep * costUsed;
|
|
249
274
|
/* istanbul ignore else */
|
|
250
275
|
if (options.progressCallback) {
|
|
251
|
-
if (status ===
|
|
276
|
+
if (status === common__namespace.EItemProgressStatus.Finished) {
|
|
252
277
|
const event = {
|
|
253
|
-
event:
|
|
278
|
+
event: common__namespace.SItemProgressStatus[status],
|
|
254
279
|
data: itemId
|
|
255
280
|
};
|
|
256
281
|
options.progressCallback(Math.round(percentDone), options.jobId, event);
|
|
@@ -261,12 +286,12 @@
|
|
|
261
286
|
}
|
|
262
287
|
/* istanbul ignore if */
|
|
263
288
|
if (options.consoleProgress) {
|
|
264
|
-
console.log(Date.now(), itemId, options.jobId ?? "",
|
|
289
|
+
console.log(Date.now(), itemId, options.jobId ?? "", common__namespace.SItemProgressStatus[status], percentDone.toFixed(0) + "%", costUsed, createdItemId ? "==> " + createdItemId : "");
|
|
265
290
|
}
|
|
266
|
-
if (status ===
|
|
291
|
+
if (status === common__namespace.EItemProgressStatus.Created) {
|
|
267
292
|
deployedItemIds.push(createdItemId);
|
|
268
293
|
}
|
|
269
|
-
else if (status ===
|
|
294
|
+
else if (status === common__namespace.EItemProgressStatus.Failed) {
|
|
270
295
|
failedTemplateItemIds.push(itemId);
|
|
271
296
|
console.error("Item " + itemId + " has failed");
|
|
272
297
|
statusOK = false;
|
|
@@ -275,13 +300,13 @@
|
|
|
275
300
|
// ---------------------------------------------------------------------------------------------------------------
|
|
276
301
|
};
|
|
277
302
|
// portal does not allow views of a single source to be created at the same time
|
|
278
|
-
if (
|
|
303
|
+
if (common__namespace.getProp(templateDictionary, "organization.isPortal")) {
|
|
279
304
|
templates = _evaluateSharedViewSources(templates);
|
|
280
305
|
}
|
|
281
306
|
// Create an ordered graph of the templates so that dependencies are created before the items that need them.
|
|
282
307
|
// Because cycles are permitted, we also keep track of items that need to be patched later because their
|
|
283
308
|
// dependencies are necessarily created after they are created.
|
|
284
|
-
const { buildOrder, itemsToBePatched } =
|
|
309
|
+
const { buildOrder, itemsToBePatched } = common__namespace.topologicallySortItems(templates);
|
|
285
310
|
// For each item in order from no dependencies to dependent on other items,
|
|
286
311
|
// * replace template symbols using template dictionary
|
|
287
312
|
// * create item in destination group
|
|
@@ -290,14 +315,14 @@
|
|
|
290
315
|
const reuseItemsDef = _reuseDeployedItems(templates, options.enableItemReuse ?? false, templateDictionary, destinationAuthentication);
|
|
291
316
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
292
317
|
reuseItemsDef.then(() => {
|
|
293
|
-
const useExistingItemsDef = _useExistingItems(templates,
|
|
318
|
+
const useExistingItemsDef = _useExistingItems(templates, common__namespace.getProp(templateDictionary, "params.useExisting"), templateDictionary, destinationAuthentication);
|
|
294
319
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
295
320
|
useExistingItemsDef.then(() => {
|
|
296
|
-
templates =
|
|
321
|
+
templates = common__namespace.setNamesAndTitles(templates, templateDictionary.solutionItemId);
|
|
297
322
|
buildOrder.forEach((id) => {
|
|
298
323
|
// Get the item's template out of the list of templates
|
|
299
|
-
const template =
|
|
300
|
-
awaitAllItems.push(_createItemFromTemplateWhenReady(template,
|
|
324
|
+
const template = common__namespace.findTemplateInList(templates, id);
|
|
325
|
+
awaitAllItems.push(_createItemFromTemplateWhenReady(template, common__namespace.generateStorageFilePaths(portalSharingUrl, storageItemId, template.resources, options.storageVersion), storageAuthentication, templateDictionary, destinationAuthentication, itemProgressCallback));
|
|
301
326
|
});
|
|
302
327
|
// Wait until all items have been created
|
|
303
328
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
@@ -315,14 +340,15 @@
|
|
|
315
340
|
consoleProgress: true
|
|
316
341
|
};
|
|
317
342
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
318
|
-
|
|
319
|
-
.
|
|
343
|
+
common__namespace
|
|
344
|
+
.deleteSolutionByComponents(deployedSolutionId, deployedItemIds, templates, templateDictionary, destinationAuthentication, progressOptions)
|
|
345
|
+
.then(() => reject(common__namespace.failWithIds(failedTemplateItemIds)));
|
|
320
346
|
}
|
|
321
347
|
});
|
|
322
348
|
});
|
|
323
349
|
}, e => {
|
|
324
350
|
console.error(e);
|
|
325
|
-
reject(
|
|
351
|
+
reject(common__namespace.fail(e));
|
|
326
352
|
});
|
|
327
353
|
});
|
|
328
354
|
}
|
|
@@ -369,8 +395,8 @@
|
|
|
369
395
|
Object.keys(viewHash).forEach(k => {
|
|
370
396
|
const _views = viewHash[k];
|
|
371
397
|
_views.forEach(cv => {
|
|
372
|
-
const template =
|
|
373
|
-
const syncViews =
|
|
398
|
+
const template = common__namespace.findTemplateInList(templates, cv);
|
|
399
|
+
const syncViews = common__namespace.getProp(template, "properties.syncViews");
|
|
374
400
|
/* istanbul ignore else */
|
|
375
401
|
if (visited.indexOf(template.itemId) > -1) {
|
|
376
402
|
processed = processed.concat(syncViews);
|
|
@@ -378,7 +404,7 @@
|
|
|
378
404
|
/* istanbul ignore else */
|
|
379
405
|
if (syncViews && syncViews.length > 0) {
|
|
380
406
|
// when a view has multiple dependencies we need to retain the syncViews if they have been set already...
|
|
381
|
-
|
|
407
|
+
common__namespace.setProp(template, "properties.syncViews", common__namespace.cloneObject(processed));
|
|
382
408
|
}
|
|
383
409
|
/* istanbul ignore else */
|
|
384
410
|
if (processed.indexOf(cv) < 0) {
|
|
@@ -409,7 +435,7 @@
|
|
|
409
435
|
v.dependencies.forEach((id) => {
|
|
410
436
|
templates = templates.map(t => {
|
|
411
437
|
/* istanbul ignore else */
|
|
412
|
-
if (
|
|
438
|
+
if (common__namespace.getProp(t, "properties.service.isView") &&
|
|
413
439
|
t.dependencies.indexOf(id) > -1 &&
|
|
414
440
|
t.itemId !== v.id) {
|
|
415
441
|
/* istanbul ignore else */
|
|
@@ -464,7 +490,7 @@
|
|
|
464
490
|
function _getViews(templates) {
|
|
465
491
|
return templates.reduce((acc, v) => {
|
|
466
492
|
/* istanbul ignore else */
|
|
467
|
-
if (
|
|
493
|
+
if (common__namespace.getProp(v, "properties.service.isView")) {
|
|
468
494
|
acc.push({
|
|
469
495
|
id: v.itemId,
|
|
470
496
|
dependencies: v.dependencies
|
|
@@ -495,8 +521,8 @@
|
|
|
495
521
|
_handleExistingItems(existingItemsByTagResponse, templateDictionary, authentication, false);
|
|
496
522
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
497
523
|
_updateTemplateDictionary(templates, templateDictionary, authentication).then(resolve);
|
|
498
|
-
}, e => reject(
|
|
499
|
-
}, e => reject(
|
|
524
|
+
}, e => reject(common__namespace.fail(e)));
|
|
525
|
+
}, e => reject(common__namespace.fail(e)));
|
|
500
526
|
}
|
|
501
527
|
else {
|
|
502
528
|
resolve(null);
|
|
@@ -536,7 +562,7 @@
|
|
|
536
562
|
_updateTemplateDictionaryById(templateDictionary, k, v.itemId, v);
|
|
537
563
|
// need to check and set the typeKeyword if it doesn't exist on this service yet
|
|
538
564
|
// when the user has passed in an itemId that does not come from a previous deployment
|
|
539
|
-
itemDefs.push(
|
|
565
|
+
itemDefs.push(common__namespace.getItemBase(v.itemId, authentication));
|
|
540
566
|
sourceIdHash[v.itemId] = k;
|
|
541
567
|
/* istanbul ignore else */
|
|
542
568
|
if (itemIds.indexOf(k) < 0) {
|
|
@@ -547,7 +573,7 @@
|
|
|
547
573
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
548
574
|
_setTypekeywordForExisting(itemDefs, sourceIdHash, authentication).then(() => {
|
|
549
575
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
550
|
-
_updateTemplateDictionary(itemIds.map(id =>
|
|
576
|
+
_updateTemplateDictionary(itemIds.map(id => common__namespace.getTemplateById(templates, id)), templateDictionary, authentication).then(resolve);
|
|
551
577
|
});
|
|
552
578
|
}
|
|
553
579
|
else {
|
|
@@ -581,7 +607,7 @@
|
|
|
581
607
|
if (typeKeywords.indexOf(sourceKeyword) < 0) {
|
|
582
608
|
typeKeywords.push(sourceKeyword);
|
|
583
609
|
const itemUpdate = { id: result.id, typeKeywords };
|
|
584
|
-
itemUpdateDefs.push(
|
|
610
|
+
itemUpdateDefs.push(common__namespace.updateItem(itemUpdate, authentication));
|
|
585
611
|
}
|
|
586
612
|
}
|
|
587
613
|
});
|
|
@@ -619,13 +645,13 @@
|
|
|
619
645
|
if (templateInfo && templateInfo.url && templateInfo.itemId) {
|
|
620
646
|
/* istanbul ignore else */
|
|
621
647
|
if (t.item.type === "Feature Service") {
|
|
622
|
-
const enterpriseIDMapping =
|
|
623
|
-
Object.assign(templateDictionary[t.itemId],
|
|
648
|
+
const enterpriseIDMapping = common__namespace.getProp(templateDictionary, `params.${t.itemId}.enterpriseIDMapping`);
|
|
649
|
+
Object.assign(templateDictionary[t.itemId], common__namespace.getLayerSettings(common__namespace.getLayersAndTables(t), templateInfo.url, templateInfo.itemId, enterpriseIDMapping));
|
|
624
650
|
// if the service has veiws keep track of the fields so we can use them to
|
|
625
651
|
// compare with the view fields
|
|
626
652
|
/* istanbul ignore else */
|
|
627
|
-
if (
|
|
628
|
-
|
|
653
|
+
if (common__namespace.getProp(t, "properties.service.hasViews")) {
|
|
654
|
+
common__namespace._updateTemplateDictionaryFields(t, templateDictionary, false);
|
|
629
655
|
}
|
|
630
656
|
}
|
|
631
657
|
// for fs query with its url...for non fs query the item
|
|
@@ -635,8 +661,8 @@
|
|
|
635
661
|
/* istanbul ignore else */
|
|
636
662
|
if (urls.indexOf(templateInfo.url) < 0) {
|
|
637
663
|
defs.push(t.item.type === "Feature Service"
|
|
638
|
-
?
|
|
639
|
-
:
|
|
664
|
+
? common__namespace.rest_request(templateInfo.url, { authentication })
|
|
665
|
+
: common__namespace.getItemBase(templateInfo.itemId, authentication));
|
|
640
666
|
urls.push(templateInfo.url);
|
|
641
667
|
types.push(t.item.type);
|
|
642
668
|
ids.push(templateInfo.itemId);
|
|
@@ -656,19 +682,19 @@
|
|
|
656
682
|
const v = templateDictionary[k];
|
|
657
683
|
/* istanbul ignore else */
|
|
658
684
|
if (v.itemId && v.itemId === r.serviceItemId) {
|
|
659
|
-
|
|
685
|
+
common__namespace.setDefaultSpatialReference(templateDictionary, k, r.spatialReference);
|
|
660
686
|
// keep the extent values from these responses as well
|
|
661
|
-
|
|
687
|
+
common__namespace.setCreateProp(templateDictionary, `${k}.defaultExtent`, r.fullExtent || r.initialExtent);
|
|
662
688
|
const layerIds = (r.layers || []).map((l) => l.id);
|
|
663
689
|
const tablesIds = (r.tables || []).map((t) => t.id);
|
|
664
|
-
fieldDefs.push(
|
|
690
|
+
fieldDefs.push(common__namespace.getExistingLayersAndTables(urls[i], layerIds.concat(tablesIds), authentication));
|
|
665
691
|
}
|
|
666
692
|
});
|
|
667
693
|
}
|
|
668
694
|
else {
|
|
669
695
|
/* istanbul ignore else */
|
|
670
696
|
if (types[i] === "Feature Service" ||
|
|
671
|
-
|
|
697
|
+
common__namespace.getProp(r, "response.error")) {
|
|
672
698
|
// if an error is returned we need to clean up the templateDictionary
|
|
673
699
|
templateDictionary = _updateTemplateDictionaryForError(templateDictionary, ids[i]);
|
|
674
700
|
}
|
|
@@ -690,7 +716,7 @@
|
|
|
690
716
|
return true;
|
|
691
717
|
}
|
|
692
718
|
});
|
|
693
|
-
const enterpriseIDMapping =
|
|
719
|
+
const enterpriseIDMapping = common__namespace.getProp(templateDictionary, `params.${sourceId}.enterpriseIDMapping`);
|
|
694
720
|
if (enterpriseIDMapping) {
|
|
695
721
|
Object.keys(enterpriseIDMapping).forEach(id => {
|
|
696
722
|
if (enterpriseIDMapping[id].toString() ===
|
|
@@ -734,7 +760,7 @@
|
|
|
734
760
|
* @protected
|
|
735
761
|
*/
|
|
736
762
|
function _setFields(templateDictionary, itemId, layerId, fields) {
|
|
737
|
-
const layerInfo =
|
|
763
|
+
const layerInfo = common__namespace.getProp(templateDictionary, `${itemId}.layer${layerId}`);
|
|
738
764
|
/* istanbul ignore else */
|
|
739
765
|
if (layerInfo && fields) {
|
|
740
766
|
layerInfo.fields = fields;
|
|
@@ -818,7 +844,7 @@
|
|
|
818
844
|
}
|
|
819
845
|
function _updateTemplateDictionaryById(templateDictionary, sourceId, itemId, v) {
|
|
820
846
|
templateDictionary[sourceId] = Object.assign(templateDictionary[sourceId] || {}, {
|
|
821
|
-
def: Promise.resolve(
|
|
847
|
+
def: Promise.resolve(common__namespace.generateEmptyCreationResponse(v.type, itemId)),
|
|
822
848
|
itemId,
|
|
823
849
|
name: v.name,
|
|
824
850
|
title: v.title,
|
|
@@ -871,7 +897,7 @@
|
|
|
871
897
|
authentication: authentication,
|
|
872
898
|
pagingParam: { start: 1, num: 100 }
|
|
873
899
|
};
|
|
874
|
-
return
|
|
900
|
+
return common__namespace.searchItems(searchOptions);
|
|
875
901
|
}
|
|
876
902
|
/**
|
|
877
903
|
* Creates an item from a template once the item's dependencies have been created.
|
|
@@ -891,9 +917,9 @@
|
|
|
891
917
|
// if there is no entry in the templateDictionary
|
|
892
918
|
// or if we have a basic entry without the deferred request for its creation, add it
|
|
893
919
|
if (!templateDictionary.hasOwnProperty(template.itemId) ||
|
|
894
|
-
!
|
|
920
|
+
!common__namespace.getProp(templateDictionary[template.itemId], "def")) {
|
|
895
921
|
let createResponse;
|
|
896
|
-
let statusCode =
|
|
922
|
+
let statusCode = common__namespace.EItemProgressStatus.Unknown;
|
|
897
923
|
let itemHandler;
|
|
898
924
|
templateDictionary[template.itemId] =
|
|
899
925
|
templateDictionary[template.itemId] || {};
|
|
@@ -901,7 +927,7 @@
|
|
|
901
927
|
templateDictionary[template.itemId].def = new Promise(resolve => {
|
|
902
928
|
// Wait until all of the item's dependencies are deployed
|
|
903
929
|
const _awaitDependencies = template.dependencies.reduce((acc, id) => {
|
|
904
|
-
const def =
|
|
930
|
+
const def = common__namespace.getProp(templateDictionary, `${id}.def`);
|
|
905
931
|
// can't use maybePush as that clones the object, which does not work for Promises
|
|
906
932
|
/* istanbul ignore else */
|
|
907
933
|
if (def) {
|
|
@@ -909,10 +935,10 @@
|
|
|
909
935
|
}
|
|
910
936
|
return acc;
|
|
911
937
|
}, []);
|
|
912
|
-
const syncViews =
|
|
938
|
+
const syncViews = common__namespace.getProp(template, "properties.syncViews");
|
|
913
939
|
const awaitDependencies = syncViews && syncViews.length > 0
|
|
914
940
|
? syncViews.reduce((acc, v) => {
|
|
915
|
-
const def =
|
|
941
|
+
const def = common__namespace.getProp(templateDictionary, `${v}.def`);
|
|
916
942
|
/* istanbul ignore else */
|
|
917
943
|
if (def) {
|
|
918
944
|
acc.push(def);
|
|
@@ -925,18 +951,18 @@
|
|
|
925
951
|
// Find the conversion handler for this item type
|
|
926
952
|
const templateType = template.type;
|
|
927
953
|
itemHandler = moduleMap[templateType];
|
|
928
|
-
if (!itemHandler || itemHandler === UNSUPPORTED
|
|
929
|
-
if (itemHandler === UNSUPPORTED
|
|
930
|
-
statusCode =
|
|
954
|
+
if (!itemHandler || itemHandler === UNSUPPORTED) {
|
|
955
|
+
if (itemHandler === UNSUPPORTED) {
|
|
956
|
+
statusCode = common__namespace.EItemProgressStatus.Ignored;
|
|
931
957
|
throw new Error();
|
|
932
958
|
}
|
|
933
959
|
else {
|
|
934
|
-
statusCode =
|
|
960
|
+
statusCode = common__namespace.EItemProgressStatus.Failed;
|
|
935
961
|
throw new Error();
|
|
936
962
|
}
|
|
937
963
|
}
|
|
938
964
|
// Get the item's thumbnail
|
|
939
|
-
return
|
|
965
|
+
return common__namespace.getThumbnailFromStorageItem(storageAuthentication, resourceFilePaths);
|
|
940
966
|
})
|
|
941
967
|
.then(thumbnail => {
|
|
942
968
|
template.item.thumbnail = thumbnail;
|
|
@@ -946,17 +972,17 @@
|
|
|
946
972
|
})
|
|
947
973
|
.then((response) => {
|
|
948
974
|
if (response.id === "") {
|
|
949
|
-
statusCode =
|
|
975
|
+
statusCode = common__namespace.EItemProgressStatus.Failed;
|
|
950
976
|
throw new Error("handled"); // fails to create item
|
|
951
977
|
}
|
|
952
978
|
/* istanbul ignore else */
|
|
953
979
|
createResponse = response;
|
|
954
980
|
if (createResponse.item.item.url) {
|
|
955
|
-
|
|
981
|
+
common__namespace.setCreateProp(templateDictionary, template.itemId + ".url", createResponse.item.item.url);
|
|
956
982
|
}
|
|
957
983
|
if (resourceFilePaths.length > 0) {
|
|
958
984
|
// Copy resources, metadata, form
|
|
959
|
-
return
|
|
985
|
+
return common__namespace.copyFilesFromStorageItem(storageAuthentication, resourceFilePaths, templateDictionary.folderId, createResponse.id, destinationAuthentication, createResponse.item);
|
|
960
986
|
}
|
|
961
987
|
else {
|
|
962
988
|
return Promise.resolve(null);
|
|
@@ -967,12 +993,12 @@
|
|
|
967
993
|
})
|
|
968
994
|
.catch(error => {
|
|
969
995
|
if (!error || error.message !== "handled") {
|
|
970
|
-
itemProgressCallback(template.itemId, statusCode ===
|
|
971
|
-
?
|
|
996
|
+
itemProgressCallback(template.itemId, statusCode === common__namespace.EItemProgressStatus.Unknown
|
|
997
|
+
? common__namespace.EItemProgressStatus.Failed
|
|
972
998
|
: statusCode, 0);
|
|
973
999
|
}
|
|
974
1000
|
// Item type not supported or fails to get item dependencies
|
|
975
|
-
resolve(
|
|
1001
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type));
|
|
976
1002
|
});
|
|
977
1003
|
});
|
|
978
1004
|
}
|
|
@@ -994,7 +1020,7 @@
|
|
|
994
1020
|
function _getGroupUpdates(template, authentication, templateDictionary) {
|
|
995
1021
|
const groups = template.groups || [];
|
|
996
1022
|
return groups.map((sourceGroupId) => {
|
|
997
|
-
return
|
|
1023
|
+
return common__namespace.shareItem(templateDictionary[sourceGroupId].itemId, template.itemId, authentication, common__namespace.isTrackingViewTemplate(template) ? templateDictionary.locationTracking.owner : undefined);
|
|
998
1024
|
});
|
|
999
1025
|
}
|
|
1000
1026
|
|
|
@@ -1139,7 +1165,7 @@
|
|
|
1139
1165
|
*/
|
|
1140
1166
|
// NOTE: Moved to separate file to allow stubbing in main deploySolution tests
|
|
1141
1167
|
function deploySolutionFromTemplate(templateSolutionId, solutionTemplateBase, solutionTemplateData, authentication, options) {
|
|
1142
|
-
options.storageVersion =
|
|
1168
|
+
options.storageVersion = common__namespace.extractSolutionVersion(solutionTemplateData);
|
|
1143
1169
|
return new Promise((resolve, reject) => {
|
|
1144
1170
|
// It is possible to provide a separate authentication for the source
|
|
1145
1171
|
const storageAuthentication = options.storageAuthentication
|
|
@@ -1160,18 +1186,18 @@
|
|
|
1160
1186
|
if (!options.thumbnail && options.thumbnailurl) {
|
|
1161
1187
|
// Figure out the thumbnail's filename
|
|
1162
1188
|
thumbFilename =
|
|
1163
|
-
|
|
1164
|
-
const thumbnailurl =
|
|
1189
|
+
common__namespace.getFilenameFromUrl(options.thumbnailurl) || thumbFilename;
|
|
1190
|
+
const thumbnailurl = common__namespace.appendQueryParam(options.thumbnailurl, "w=400");
|
|
1165
1191
|
delete options.thumbnailurl;
|
|
1166
1192
|
// Fetch the thumbnail
|
|
1167
|
-
thumbDef =
|
|
1193
|
+
thumbDef = common__namespace.getBlobAsFile(thumbnailurl, thumbFilename, storageAuthentication, [400]);
|
|
1168
1194
|
}
|
|
1169
1195
|
_replaceParamVariables(solutionTemplateData, templateDictionary);
|
|
1170
1196
|
// Get information about deployment environment
|
|
1171
1197
|
Promise.all([
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1198
|
+
common__namespace.getPortal("", authentication),
|
|
1199
|
+
common__namespace.getUser(authentication),
|
|
1200
|
+
common__namespace.getFoldersAndGroups(authentication),
|
|
1175
1201
|
thumbDef
|
|
1176
1202
|
])
|
|
1177
1203
|
.then(responses => {
|
|
@@ -1190,7 +1216,7 @@
|
|
|
1190
1216
|
}
|
|
1191
1217
|
/* istanbul ignore else */
|
|
1192
1218
|
if (template.item.tags &&
|
|
1193
|
-
|
|
1219
|
+
common__namespace.getProp(template, "item.type") === "Group") {
|
|
1194
1220
|
template.item.tags.push(sourceId);
|
|
1195
1221
|
}
|
|
1196
1222
|
}
|
|
@@ -1207,17 +1233,17 @@
|
|
|
1207
1233
|
templateDictionary.user.folders = foldersAndGroupsResponse.folders;
|
|
1208
1234
|
templateDictionary.user.groups = foldersAndGroupsResponse.groups.filter((group) => group.owner === templateDictionary.user.username);
|
|
1209
1235
|
// if we have tracking views and the user is not admin or the org doesn't support tracking an error is thrown
|
|
1210
|
-
|
|
1211
|
-
const trackingOwnerPromise =
|
|
1236
|
+
common__namespace.setLocationTrackingEnabled(portalResponse, userResponse, templateDictionary, solutionTemplateData.templates);
|
|
1237
|
+
const trackingOwnerPromise = common__namespace.getTackingServiceOwner(templateDictionary, authentication);
|
|
1212
1238
|
// Create a folder to hold the deployed solution. We use the solution name, appending a sequential
|
|
1213
1239
|
// suffix if the folder exists, e.g.,
|
|
1214
1240
|
// * Manage Right of Way Activities
|
|
1215
1241
|
// * Manage Right of Way Activities 1
|
|
1216
1242
|
// * Manage Right of Way Activities 2
|
|
1217
|
-
const folderPromise =
|
|
1243
|
+
const folderPromise = common__namespace.createUniqueFolder(solutionTemplateBase.title, templateDictionary, authentication);
|
|
1218
1244
|
// Apply the portal extents to the solution
|
|
1219
1245
|
const portalExtent = portalResponse.defaultExtent;
|
|
1220
|
-
const extentsPromise =
|
|
1246
|
+
const extentsPromise = common__namespace.convertExtentWithFallback(portalExtent, undefined, { wkid: 4326 }, portalResponse.helperServices.geometry.url, authentication);
|
|
1221
1247
|
// Await completion of async actions: folder creation & extents conversion
|
|
1222
1248
|
return Promise.all([folderPromise, extentsPromise, trackingOwnerPromise]);
|
|
1223
1249
|
})
|
|
@@ -1246,7 +1272,7 @@
|
|
|
1246
1272
|
}
|
|
1247
1273
|
// Create a deployed Solution item
|
|
1248
1274
|
const createSolutionItemBase = {
|
|
1249
|
-
...
|
|
1275
|
+
...common__namespace.sanitizeJSONAndReportChanges(solutionTemplateBase),
|
|
1250
1276
|
type: "Solution",
|
|
1251
1277
|
typeKeywords: ["Solution"]
|
|
1252
1278
|
};
|
|
@@ -1255,7 +1281,7 @@
|
|
|
1255
1281
|
}
|
|
1256
1282
|
// Create deployed solution item
|
|
1257
1283
|
createSolutionItemBase.thumbnail = options.thumbnail;
|
|
1258
|
-
return
|
|
1284
|
+
return common__namespace.createItemWithData(createSolutionItemBase, {}, authentication, deployedFolderId);
|
|
1259
1285
|
})
|
|
1260
1286
|
.then(createSolutionResponse => {
|
|
1261
1287
|
deployedSolutionId = createSolutionResponse.id;
|
|
@@ -1264,7 +1290,7 @@
|
|
|
1264
1290
|
id: deployedSolutionId,
|
|
1265
1291
|
authentication
|
|
1266
1292
|
};
|
|
1267
|
-
return
|
|
1293
|
+
return portal__namespace.protectItem(protectOptions);
|
|
1268
1294
|
})
|
|
1269
1295
|
.then(() => {
|
|
1270
1296
|
// TODO: Attach the whole solution model so we can
|
|
@@ -1279,7 +1305,7 @@
|
|
|
1279
1305
|
.then((clonedSolutionsResponse) => {
|
|
1280
1306
|
solutionTemplateData.templates = solutionTemplateData.templates.map((itemTemplate) => {
|
|
1281
1307
|
// Update ids present in template dictionary
|
|
1282
|
-
itemTemplate.itemId =
|
|
1308
|
+
itemTemplate.itemId = common__namespace.getProp(templateDictionary, `${itemTemplate.itemId}.itemId`);
|
|
1283
1309
|
// Update the dependencies hash to point to the new item ids
|
|
1284
1310
|
itemTemplate.dependencies = itemTemplate.dependencies.map((id) => hubCommon.getWithDefault(templateDictionary, `${id}.itemId`, id));
|
|
1285
1311
|
return itemTemplate;
|
|
@@ -1301,13 +1327,13 @@
|
|
|
1301
1327
|
solutionTemplateData.templates = _updateGroupReferences(solutionTemplateData.templates, templateDictionary);
|
|
1302
1328
|
// Update solution items data using template dictionary, and then update the
|
|
1303
1329
|
// itemId & dependencies in each item template
|
|
1304
|
-
solutionTemplateBase.data =
|
|
1330
|
+
solutionTemplateBase.data = common__namespace.replaceInTemplate(solutionTemplateData, templateDictionary);
|
|
1305
1331
|
// Write any user defined params to the solution
|
|
1306
1332
|
/* istanbul ignore else */
|
|
1307
1333
|
if (templateDictionary.params) {
|
|
1308
1334
|
solutionTemplateBase.data.params = templateDictionary.params;
|
|
1309
1335
|
}
|
|
1310
|
-
return
|
|
1336
|
+
return common__namespace.updateItem(solutionTemplateBase, authentication, deployedFolderId);
|
|
1311
1337
|
})
|
|
1312
1338
|
.then(() => resolve(solutionTemplateBase.id), reject);
|
|
1313
1339
|
});
|
|
@@ -1334,7 +1360,7 @@
|
|
|
1334
1360
|
});
|
|
1335
1361
|
if (!deployOptions.thumbnailurl && solutionTemplateBase.thumbnail) {
|
|
1336
1362
|
// Get the full path to the thumbnail
|
|
1337
|
-
deployOptions.thumbnailurl =
|
|
1363
|
+
deployOptions.thumbnailurl = common__namespace.generateSourceThumbnailUrl(authentication.portal, solutionTemplateBase.id, solutionTemplateBase.thumbnail);
|
|
1338
1364
|
delete solutionTemplateBase.thumbnail;
|
|
1339
1365
|
}
|
|
1340
1366
|
return deployOptions;
|
|
@@ -1360,10 +1386,10 @@
|
|
|
1360
1386
|
});
|
|
1361
1387
|
}
|
|
1362
1388
|
function _updateProp(template, path, lookup, templateDictionary) {
|
|
1363
|
-
const wkid =
|
|
1389
|
+
const wkid = common__namespace.getProp(template, path);
|
|
1364
1390
|
/* istanbul ignore else */
|
|
1365
1391
|
if (wkid && typeof wkid === "string" && wkid.indexOf(lookup) > -1) {
|
|
1366
|
-
|
|
1392
|
+
common__namespace.setProp(template, path, common__namespace.replaceInTemplate(wkid, templateDictionary));
|
|
1367
1393
|
}
|
|
1368
1394
|
return template;
|
|
1369
1395
|
}
|
|
@@ -1382,9 +1408,9 @@
|
|
|
1382
1408
|
// As of Spring 2020, only HTTPS (see
|
|
1383
1409
|
// https://www.esri.com/arcgis-blog/products/product/administration/2019-arcgis-transport-security-improvements/)
|
|
1384
1410
|
const scheme = "https"; // portalResponse.allSSL ? "https" : "http";
|
|
1385
|
-
const urlKey =
|
|
1386
|
-
const customBaseUrl =
|
|
1387
|
-
const enterpriseBaseUrl =
|
|
1411
|
+
const urlKey = common__namespace.getProp(portalResponse, "urlKey");
|
|
1412
|
+
const customBaseUrl = common__namespace.getProp(portalResponse, "customBaseUrl");
|
|
1413
|
+
const enterpriseBaseUrl = common__namespace.getProp(portalResponse, "portalHostname");
|
|
1388
1414
|
return urlKey && customBaseUrl
|
|
1389
1415
|
? `${scheme}://${urlKey}.${customBaseUrl}`
|
|
1390
1416
|
: enterpriseBaseUrl
|
|
@@ -1411,7 +1437,7 @@
|
|
|
1411
1437
|
function _purgeTemplateProperties(itemTemplate) {
|
|
1412
1438
|
const retainProps = ["itemId", "type", "dependencies", "groups"];
|
|
1413
1439
|
const deleteProps = Object.keys(itemTemplate).filter(k => retainProps.indexOf(k) < 0);
|
|
1414
|
-
|
|
1440
|
+
common__namespace.deleteProps(itemTemplate, deleteProps);
|
|
1415
1441
|
return itemTemplate;
|
|
1416
1442
|
}
|
|
1417
1443
|
|
|
@@ -1441,11 +1467,11 @@
|
|
|
1441
1467
|
if (typeof idOrObject === "string") {
|
|
1442
1468
|
// get the item + data
|
|
1443
1469
|
return Promise.all([
|
|
1444
|
-
|
|
1445
|
-
|
|
1470
|
+
common__namespace.getItemBase(idOrObject, authentication),
|
|
1471
|
+
common__namespace.getItemDataAsJson(idOrObject, authentication)
|
|
1446
1472
|
]).then(([item, data]) => {
|
|
1447
1473
|
// format into a model and migrate the schema
|
|
1448
|
-
return
|
|
1474
|
+
return common__namespace.migrateSchema({
|
|
1449
1475
|
item,
|
|
1450
1476
|
data
|
|
1451
1477
|
});
|
|
@@ -1455,10 +1481,10 @@
|
|
|
1455
1481
|
// check if it is a "Model"
|
|
1456
1482
|
if (_isModel(idOrObject)) {
|
|
1457
1483
|
// run migrations
|
|
1458
|
-
return
|
|
1484
|
+
return common__namespace.migrateSchema(idOrObject);
|
|
1459
1485
|
}
|
|
1460
1486
|
else {
|
|
1461
|
-
return Promise.reject(
|
|
1487
|
+
return Promise.reject(common__namespace.fail(`getSolutionTemplateItem must be passed an item id or a model object`));
|
|
1462
1488
|
}
|
|
1463
1489
|
}
|
|
1464
1490
|
}
|
|
@@ -1478,7 +1504,7 @@
|
|
|
1478
1504
|
deployOptions.tags = deployOptions.tags ?? item.tags;
|
|
1479
1505
|
// add the thumbnail url
|
|
1480
1506
|
deployOptions.thumbnailurl = item.thumbnail
|
|
1481
|
-
?
|
|
1507
|
+
? common__namespace.getItemThumbnailUrl(item.id, item.thumbnail, false, authentication)
|
|
1482
1508
|
: null;
|
|
1483
1509
|
return deployOptions;
|
|
1484
1510
|
}
|
|
@@ -1558,7 +1584,7 @@
|
|
|
1558
1584
|
function deploySolution(maybeModel, authentication, options) {
|
|
1559
1585
|
// if we are not passed the maybeModel, reject
|
|
1560
1586
|
if (!maybeModel) {
|
|
1561
|
-
return Promise.reject(
|
|
1587
|
+
return Promise.reject(common__namespace.fail("The Solution Template id is missing"));
|
|
1562
1588
|
}
|
|
1563
1589
|
let deployOptions = options || {};
|
|
1564
1590
|
/* istanbul ignore else */
|
|
@@ -1573,7 +1599,7 @@
|
|
|
1573
1599
|
return getSolutionTemplateItem(maybeModel, storageAuthentication)
|
|
1574
1600
|
.then(model => {
|
|
1575
1601
|
if (!isSolutionTemplateItem(model.item)) {
|
|
1576
|
-
return Promise.reject(
|
|
1602
|
+
return Promise.reject(common__namespace.fail(`${model.item.id} is not a Solution Template`));
|
|
1577
1603
|
}
|
|
1578
1604
|
else {
|
|
1579
1605
|
// fetch the metadata if the model's id is a GUID and pass the item & data forward
|
|
@@ -1587,8 +1613,8 @@
|
|
|
1587
1613
|
// extract responses
|
|
1588
1614
|
const [itemBase, itemData] = responses;
|
|
1589
1615
|
// sanitize all the things
|
|
1590
|
-
const sanitizer = new
|
|
1591
|
-
const item =
|
|
1616
|
+
const sanitizer = new common__namespace.Sanitizer();
|
|
1617
|
+
const item = common__namespace.sanitizeJSONAndReportChanges(itemBase, sanitizer);
|
|
1592
1618
|
// TODO: we should delegate data sanization to the type-specific modules
|
|
1593
1619
|
const data = itemData;
|
|
1594
1620
|
// get the item id before it is deleted
|
|
@@ -1596,7 +1622,7 @@
|
|
|
1596
1622
|
// apply item props to deployOptions
|
|
1597
1623
|
deployOptions = updateDeployOptions(deployOptions, item, storageAuthentication);
|
|
1598
1624
|
// Clone before mutating? This was messing me up in some testing...
|
|
1599
|
-
|
|
1625
|
+
common__namespace.deleteItemProps(item);
|
|
1600
1626
|
return deploySolutionFromTemplate(itemId, item, data, authentication, deployOptions);
|
|
1601
1627
|
})
|
|
1602
1628
|
.then(createdSolutionId => {
|
|
@@ -1618,7 +1644,7 @@
|
|
|
1618
1644
|
});
|
|
1619
1645
|
}
|
|
1620
1646
|
|
|
1621
|
-
exports.UNSUPPORTED = UNSUPPORTED;
|
|
1647
|
+
exports.UNSUPPORTED = UNSUPPORTED$1;
|
|
1622
1648
|
exports._createItemFromTemplateWhenReady = _createItemFromTemplateWhenReady;
|
|
1623
1649
|
exports._estimateDeploymentCost = _estimateDeploymentCost;
|
|
1624
1650
|
exports._evaluateSharedViewSources = _evaluateSharedViewSources;
|
|
@@ -1647,5 +1673,5 @@
|
|
|
1647
1673
|
|
|
1648
1674
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1649
1675
|
|
|
1650
|
-
}))
|
|
1676
|
+
}));
|
|
1651
1677
|
//# sourceMappingURL=deployer.umd.js.map
|