@esri/solution-simple-types 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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-simple-types - v1.
|
|
2
|
+
* @esri/solution-simple-types - v1.2.0 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2018-2021 Esri, Inc.
|
|
4
|
-
*
|
|
4
|
+
* Thu Dec 09 2021 16:04:06 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,28 @@
|
|
|
18
18
|
(function (global, factory) {
|
|
19
19
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common')) :
|
|
20
20
|
typeof define === 'function' && define.amd ? define(['exports', '@esri/solution-common'], factory) :
|
|
21
|
-
(global = global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution));
|
|
22
|
-
}(this, (function (exports, common) { 'use strict';
|
|
21
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution));
|
|
22
|
+
})(this, (function (exports, common) { '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);
|
|
23
43
|
|
|
24
44
|
/** @license
|
|
25
45
|
* Copyright 2018 Esri
|
|
@@ -42,8 +62,8 @@
|
|
|
42
62
|
* @param itemTemplate Template for the dashboard item
|
|
43
63
|
* @return templatized itemTemplate
|
|
44
64
|
*/
|
|
45
|
-
function convertItemToTemplate(itemTemplate) {
|
|
46
|
-
return _extractDependencies(itemTemplate);
|
|
65
|
+
function convertItemToTemplate$8(itemTemplate) {
|
|
66
|
+
return _extractDependencies$3(itemTemplate);
|
|
47
67
|
}
|
|
48
68
|
/**
|
|
49
69
|
* Templatizes all itemIds and updates the dependency array
|
|
@@ -52,7 +72,7 @@
|
|
|
52
72
|
* @return The updated itemTemplate
|
|
53
73
|
* @protected
|
|
54
74
|
*/
|
|
55
|
-
function _extractDependencies(itemTemplate) {
|
|
75
|
+
function _extractDependencies$3(itemTemplate) {
|
|
56
76
|
// get dependencies from any
|
|
57
77
|
const updatePaths = [
|
|
58
78
|
"data.widgets",
|
|
@@ -61,7 +81,7 @@
|
|
|
61
81
|
"data.urlParameters"
|
|
62
82
|
];
|
|
63
83
|
updatePaths.forEach(path => {
|
|
64
|
-
const objs =
|
|
84
|
+
const objs = common__namespace.getProp(itemTemplate, path);
|
|
65
85
|
if (Array.isArray(objs)) {
|
|
66
86
|
objs.forEach(obj => {
|
|
67
87
|
/* istanbul ignore else */
|
|
@@ -70,7 +90,7 @@
|
|
|
70
90
|
if (itemTemplate.dependencies.indexOf(obj.itemId) < 0) {
|
|
71
91
|
itemTemplate.dependencies.push(obj.itemId);
|
|
72
92
|
}
|
|
73
|
-
obj.itemId =
|
|
93
|
+
obj.itemId = common__namespace.templatizeTerm(obj.itemId, obj.itemId, ".itemId");
|
|
74
94
|
}
|
|
75
95
|
/* istanbul ignore else */
|
|
76
96
|
if (Array.isArray(obj.datasets)) {
|
|
@@ -90,16 +110,16 @@
|
|
|
90
110
|
function _getDatasourceDependencies(obj, itemTemplate) {
|
|
91
111
|
obj.datasets.forEach((dataset) => {
|
|
92
112
|
// when the datasource has an itemId is an external datasource
|
|
93
|
-
const itemId =
|
|
113
|
+
const itemId = common__namespace.getProp(dataset, "dataSource.itemId");
|
|
94
114
|
if (itemId) {
|
|
95
115
|
if (itemTemplate.dependencies.indexOf(itemId) < 0) {
|
|
96
116
|
itemTemplate.dependencies.push(itemId);
|
|
97
117
|
}
|
|
98
|
-
const layerId =
|
|
99
|
-
dataset.dataSource.itemId =
|
|
118
|
+
const layerId = common__namespace.getProp(dataset, "dataSource.layerId");
|
|
119
|
+
dataset.dataSource.itemId = common__namespace.templatizeTerm(itemId, itemId, layerId !== undefined ? ".layer" + layerId + ".itemId" : ".itemId");
|
|
100
120
|
/* istanbul ignore else */
|
|
101
121
|
if (layerId !== undefined) {
|
|
102
|
-
dataset.dataSource.layerId =
|
|
122
|
+
dataset.dataSource.layerId = common__namespace.templatizeTerm(itemId, itemId, ".layer" + layerId + ".layerId");
|
|
103
123
|
}
|
|
104
124
|
}
|
|
105
125
|
});
|
|
@@ -111,7 +131,7 @@
|
|
|
111
131
|
* @param datasourceInfos A list of datasource info objects that contain key values to templatize field references
|
|
112
132
|
* @returns The solutionTemplate with templatized field references
|
|
113
133
|
*/
|
|
114
|
-
function postProcessFieldReferences(solutionTemplate, datasourceInfos) {
|
|
134
|
+
function postProcessFieldReferences$3(solutionTemplate, datasourceInfos) {
|
|
115
135
|
const updatePaths = [
|
|
116
136
|
"data.widgets",
|
|
117
137
|
"data.headerPanel.selectors",
|
|
@@ -121,12 +141,12 @@
|
|
|
121
141
|
// dashboards reference datasets from other widgets
|
|
122
142
|
// add reference IDs to the appropriate datasourceInfos
|
|
123
143
|
updatePaths.forEach(path => {
|
|
124
|
-
const objs =
|
|
144
|
+
const objs = common__namespace.getProp(solutionTemplate, path);
|
|
125
145
|
_updateDatasourceReferences(objs, datasourceInfos);
|
|
126
146
|
});
|
|
127
147
|
// after we know the potential references go ahead and templatize
|
|
128
148
|
updatePaths.forEach(path => {
|
|
129
|
-
_templatize(solutionTemplate, path, datasourceInfos);
|
|
149
|
+
_templatize$1(solutionTemplate, path, datasourceInfos);
|
|
130
150
|
});
|
|
131
151
|
return solutionTemplate;
|
|
132
152
|
}
|
|
@@ -145,9 +165,9 @@
|
|
|
145
165
|
if (Array.isArray(obj.datasets)) {
|
|
146
166
|
obj.datasets.forEach((dataset) => {
|
|
147
167
|
// when the datasource has an itemId it's an external datasource
|
|
148
|
-
const itemId =
|
|
168
|
+
const itemId = common__namespace.cleanLayerBasedItemId(common__namespace.getProp(dataset, "dataSource.itemId"));
|
|
149
169
|
if (itemId) {
|
|
150
|
-
const layerId =
|
|
170
|
+
const layerId = common__namespace.cleanLayerId(common__namespace.getProp(dataset, "dataSource.layerId"));
|
|
151
171
|
datasourceInfos.some(ds => {
|
|
152
172
|
if (ds.itemId === itemId && ds.layerId === layerId) {
|
|
153
173
|
_updateReferences(ds, obj.id);
|
|
@@ -161,7 +181,7 @@
|
|
|
161
181
|
else {
|
|
162
182
|
// add placeholder for map layer datasource info so we can know the items that reference them
|
|
163
183
|
// needed when item field reference are derived from another widgets datasource eg. <dashboardWidgetId>#datasetname
|
|
164
|
-
const id =
|
|
184
|
+
const id = common__namespace.getProp(dataset, "dataSource.id");
|
|
165
185
|
if (id) {
|
|
166
186
|
const dashboardLayerId = id.split("#")[1];
|
|
167
187
|
datasourceInfos.some(ds => {
|
|
@@ -188,11 +208,11 @@
|
|
|
188
208
|
* @param datasourceInfos A list of objects that contain key details about the datasources from the application
|
|
189
209
|
* @protected
|
|
190
210
|
*/
|
|
191
|
-
function _templatize(itemTemplate, path, datasourceInfos) {
|
|
192
|
-
const obj =
|
|
211
|
+
function _templatize$1(itemTemplate, path, datasourceInfos) {
|
|
212
|
+
const obj = common__namespace.getProp(itemTemplate, path);
|
|
193
213
|
/* istanbul ignore else */
|
|
194
214
|
if (obj) {
|
|
195
|
-
|
|
215
|
+
common__namespace.setProp(itemTemplate, path, _templatizeByDatasource(obj, datasourceInfos));
|
|
196
216
|
}
|
|
197
217
|
}
|
|
198
218
|
/**
|
|
@@ -220,16 +240,16 @@
|
|
|
220
240
|
if (_action.fieldMap &&
|
|
221
241
|
_action.targetId &&
|
|
222
242
|
_action.targetId.indexOf("#") > -1) {
|
|
223
|
-
const datasourceInfo = _getDatasourceInfo(_action, datasourceInfos);
|
|
243
|
+
const datasourceInfo = _getDatasourceInfo$1(_action, datasourceInfos);
|
|
224
244
|
/* istanbul ignore else */
|
|
225
245
|
if (datasourceInfo) {
|
|
226
|
-
const fields =
|
|
227
|
-
const basePath =
|
|
246
|
+
const fields = common__namespace.getProp(datasourceInfo, "fields");
|
|
247
|
+
const basePath = common__namespace.getProp(datasourceInfo, "basePath");
|
|
228
248
|
/* istanbul ignore else */
|
|
229
249
|
if (Array.isArray(fields) && basePath) {
|
|
230
250
|
_action.fieldMap = _action.fieldMap.map((m) => {
|
|
231
251
|
const _m = m;
|
|
232
|
-
_m.targetName =
|
|
252
|
+
_m.targetName = common__namespace.templatizeFieldReferences(_m.targetName, fields, basePath);
|
|
233
253
|
return _m;
|
|
234
254
|
});
|
|
235
255
|
}
|
|
@@ -245,15 +265,15 @@
|
|
|
245
265
|
_obj.datasets = _obj.datasets.map((dataset) => {
|
|
246
266
|
let _dataset = dataset;
|
|
247
267
|
if (_dataset.type === "serviceDataset") {
|
|
248
|
-
const datasourceInfo = _getDatasourceInfo(dataset, datasourceInfos);
|
|
268
|
+
const datasourceInfo = _getDatasourceInfo$1(dataset, datasourceInfos);
|
|
249
269
|
/* istanbul ignore else */
|
|
250
270
|
if (datasourceInfo) {
|
|
251
|
-
const fields =
|
|
252
|
-
const basePath =
|
|
271
|
+
const fields = common__namespace.getProp(datasourceInfo, "fields");
|
|
272
|
+
const basePath = common__namespace.getProp(datasourceInfo, "basePath");
|
|
253
273
|
/* istanbul ignore else */
|
|
254
274
|
if (Array.isArray(fields) && basePath) {
|
|
255
|
-
_obj =
|
|
256
|
-
_dataset =
|
|
275
|
+
_obj = common__namespace.templatizeFieldReferences(_obj, fields, basePath);
|
|
276
|
+
_dataset = common__namespace.templatizeFieldReferences(_dataset, fields, basePath);
|
|
257
277
|
}
|
|
258
278
|
}
|
|
259
279
|
}
|
|
@@ -277,11 +297,11 @@
|
|
|
277
297
|
* @return The supporting datasource info for the given object
|
|
278
298
|
* @protected
|
|
279
299
|
*/
|
|
280
|
-
function _getDatasourceInfo(obj, datasourceInfos) {
|
|
300
|
+
function _getDatasourceInfo$1(obj, datasourceInfos) {
|
|
281
301
|
let info;
|
|
282
302
|
// the datasource will have an id property when it's referencing a map layer
|
|
283
303
|
// the fields collection will already be defined
|
|
284
|
-
const id =
|
|
304
|
+
const id = common__namespace.getProp(obj, "dataSource.id") || common__namespace.getProp(obj, "targetId");
|
|
285
305
|
if (id) {
|
|
286
306
|
const dashboardLayerId = id.split("#")[1];
|
|
287
307
|
if (!datasourceInfos.some(di => {
|
|
@@ -301,8 +321,8 @@
|
|
|
301
321
|
}
|
|
302
322
|
else {
|
|
303
323
|
// otherwise match the itemId and the layerId to get the correct fields and path
|
|
304
|
-
const itemId =
|
|
305
|
-
const layerId =
|
|
324
|
+
const itemId = common__namespace.cleanLayerBasedItemId(common__namespace.getProp(obj, "dataSource.itemId"));
|
|
325
|
+
const layerId = common__namespace.cleanLayerId(common__namespace.getProp(obj, "dataSource.layerId"));
|
|
306
326
|
/* istanbul ignore else */
|
|
307
327
|
if (itemId) {
|
|
308
328
|
datasourceInfos.some(di => {
|
|
@@ -352,7 +372,7 @@
|
|
|
352
372
|
* @param srcAuthentication Credentials for requests to source items
|
|
353
373
|
* @return A promise that will resolve when the template has been created
|
|
354
374
|
*/
|
|
355
|
-
function convertItemToTemplate$
|
|
375
|
+
function convertItemToTemplate$7(itemTemplate, destAuthentication, srcAuthentication) {
|
|
356
376
|
return new Promise((resolve, reject) => {
|
|
357
377
|
// Remove org base URL and app id, e.g.,
|
|
358
378
|
// http://anOrg.maps.arcgis.com/apps/CrowdsourcePolling/index.html?appid=6fc5992522d34a6b5ce80d17835eea21
|
|
@@ -364,15 +384,15 @@
|
|
|
364
384
|
const templatizedUrl = itemTemplate.item.url;
|
|
365
385
|
const iSep = templatizedUrl.indexOf("//");
|
|
366
386
|
itemTemplate.item.url =
|
|
367
|
-
|
|
387
|
+
common__namespace.placeholder(common__namespace.SERVER_NAME) + // add placeholder server name
|
|
368
388
|
templatizedUrl.substring(templatizedUrl.indexOf("/", iSep + 2), templatizedUrl.lastIndexOf("=") + 1) +
|
|
369
389
|
itemTemplate.item.id; // templatized id
|
|
370
390
|
portalUrl = templatizedUrl.replace(templatizedUrl.substring(templatizedUrl.indexOf("/", iSep + 2)), "");
|
|
371
391
|
}
|
|
372
392
|
// Extract dependencies
|
|
373
|
-
itemTemplate.dependencies = _extractDependencies$
|
|
393
|
+
itemTemplate.dependencies = _extractDependencies$2(itemTemplate);
|
|
374
394
|
// Set the folder
|
|
375
|
-
|
|
395
|
+
common__namespace.setProp(itemTemplate, "data.folderId", "{{folderId}}");
|
|
376
396
|
// Set the map or group after we've extracted them as dependencies
|
|
377
397
|
_templatizeIdPaths(itemTemplate, [
|
|
378
398
|
"data.map.itemId",
|
|
@@ -388,48 +408,48 @@
|
|
|
388
408
|
"data.map.portalUrl",
|
|
389
409
|
"data.portalUrl",
|
|
390
410
|
"data.httpProxy.url"
|
|
391
|
-
],
|
|
392
|
-
|
|
411
|
+
], common__namespace.placeholder(common__namespace.SERVER_NAME));
|
|
412
|
+
common__namespace.setProp(itemTemplate, "data.geometryService", common__namespace.placeholder(common__namespace.GEOMETRY_SERVER_NAME));
|
|
393
413
|
templatizeDatasources(itemTemplate, srcAuthentication, portalUrl).then(() => {
|
|
394
414
|
templatizeWidgets(itemTemplate, srcAuthentication, portalUrl, "data.widgetPool.widgets").then(_itemTemplate => {
|
|
395
415
|
templatizeWidgets(_itemTemplate, srcAuthentication, portalUrl, "data.widgetOnScreen.widgets", true).then(updatedItemTemplate => {
|
|
396
416
|
templatizeValues(updatedItemTemplate, srcAuthentication, portalUrl, "data.values").then(_updatedItemTemplate => {
|
|
397
417
|
resolve(_updatedItemTemplate);
|
|
398
|
-
}, e => reject(
|
|
399
|
-
}, e => reject(
|
|
400
|
-
}, e => reject(
|
|
401
|
-
}, e => reject(
|
|
418
|
+
}, e => reject(common__namespace.fail(e)));
|
|
419
|
+
}, e => reject(common__namespace.fail(e)));
|
|
420
|
+
}, e => reject(common__namespace.fail(e)));
|
|
421
|
+
}, e => reject(common__namespace.fail(e)));
|
|
402
422
|
});
|
|
403
423
|
}
|
|
404
424
|
function templatizeDatasources(itemTemplate, authentication, portalUrl) {
|
|
405
425
|
return new Promise((resolve, reject) => {
|
|
406
|
-
const dataSources =
|
|
426
|
+
const dataSources = common__namespace.getProp(itemTemplate, "data.dataSource.dataSources");
|
|
407
427
|
if (dataSources && Object.keys(dataSources).length > 0) {
|
|
408
428
|
const pendingRequests = new Array();
|
|
409
429
|
Object.keys(dataSources).forEach(k => {
|
|
410
430
|
const ds = dataSources[k];
|
|
411
|
-
|
|
412
|
-
const itemId =
|
|
413
|
-
if (
|
|
431
|
+
common__namespace.setProp(ds, "portalUrl", common__namespace.placeholder(common__namespace.SERVER_NAME));
|
|
432
|
+
const itemId = common__namespace.getProp(ds, "itemId");
|
|
433
|
+
if (common__namespace.getProp(ds, "url")) {
|
|
414
434
|
if (itemId) {
|
|
415
435
|
const layerId = ds.url.substr(ds.url.lastIndexOf("/") + 1);
|
|
416
|
-
ds.itemId =
|
|
436
|
+
ds.itemId = common__namespace.templatizeTerm(itemId, itemId, ".layer" + layerId + ".itemId");
|
|
417
437
|
}
|
|
418
438
|
const urlResults = findUrls(ds.url, portalUrl, [], [], authentication);
|
|
419
439
|
pendingRequests.push(new Promise((resolveReq, rejectReq) => {
|
|
420
440
|
handleServiceRequests(urlResults.serviceRequests, urlResults.requestUrls, urlResults.testString).then(response => {
|
|
421
441
|
ds.url = response;
|
|
422
442
|
resolveReq();
|
|
423
|
-
}, e => rejectReq(
|
|
443
|
+
}, e => rejectReq(common__namespace.fail(e)));
|
|
424
444
|
}));
|
|
425
445
|
}
|
|
426
446
|
else {
|
|
427
447
|
if (itemId) {
|
|
428
|
-
ds.itemId =
|
|
448
|
+
ds.itemId = common__namespace.templatizeTerm(itemId, itemId, ".itemId");
|
|
429
449
|
}
|
|
430
450
|
}
|
|
431
451
|
});
|
|
432
|
-
Promise.all(pendingRequests).then(() => resolve(itemTemplate), e => reject(
|
|
452
|
+
Promise.all(pendingRequests).then(() => resolve(itemTemplate), e => reject(common__namespace.fail(e)));
|
|
433
453
|
}
|
|
434
454
|
else {
|
|
435
455
|
resolve(itemTemplate);
|
|
@@ -439,13 +459,13 @@
|
|
|
439
459
|
function templatizeWidgets(itemTemplate, authentication, portalUrl, widgetPath, isOnScreen = false) {
|
|
440
460
|
return new Promise((resolve, reject) => {
|
|
441
461
|
// update widgets
|
|
442
|
-
const widgets =
|
|
462
|
+
const widgets = common__namespace.getProp(itemTemplate, widgetPath) || [];
|
|
443
463
|
let serviceRequests = [];
|
|
444
464
|
let requestUrls = [];
|
|
445
465
|
widgets.forEach(widget => {
|
|
446
466
|
/* istanbul ignore else */
|
|
447
|
-
if (!isOnScreen &&
|
|
448
|
-
setValues(widget, ["icon"],
|
|
467
|
+
if (!isOnScreen && common__namespace.getProp(widget, "icon")) {
|
|
468
|
+
setValues(widget, ["icon"], common__namespace.placeholder(common__namespace.SERVER_NAME));
|
|
449
469
|
}
|
|
450
470
|
const config = widget.config;
|
|
451
471
|
if (config) {
|
|
@@ -459,9 +479,9 @@
|
|
|
459
479
|
if (serviceRequests.length > 0) {
|
|
460
480
|
const sWidgets = JSON.stringify(widgets);
|
|
461
481
|
handleServiceRequests(serviceRequests, requestUrls, sWidgets).then(response => {
|
|
462
|
-
|
|
482
|
+
common__namespace.setProp(itemTemplate, widgetPath, JSON.parse(response));
|
|
463
483
|
resolve(itemTemplate);
|
|
464
|
-
}, e => reject(
|
|
484
|
+
}, e => reject(common__namespace.fail(e)));
|
|
465
485
|
}
|
|
466
486
|
else {
|
|
467
487
|
resolve(itemTemplate);
|
|
@@ -471,12 +491,12 @@
|
|
|
471
491
|
function templatizeValues(itemTemplate, authentication, portalUrl, widgetPath) {
|
|
472
492
|
return new Promise((resolve, reject) => {
|
|
473
493
|
// update properties of values collection for web app templates
|
|
474
|
-
let values =
|
|
494
|
+
let values = common__namespace.getProp(itemTemplate, widgetPath);
|
|
475
495
|
let serviceRequests = [];
|
|
476
496
|
let requestUrls = [];
|
|
477
497
|
if (values) {
|
|
478
|
-
if (
|
|
479
|
-
setValues(values, ["icon"],
|
|
498
|
+
if (common__namespace.getProp(values, "icon")) {
|
|
499
|
+
setValues(values, ["icon"], common__namespace.placeholder(common__namespace.SERVER_NAME));
|
|
480
500
|
}
|
|
481
501
|
const sConfig = JSON.stringify(values);
|
|
482
502
|
const urlResults = findUrls(sConfig, portalUrl, requestUrls, serviceRequests, authentication);
|
|
@@ -487,9 +507,9 @@
|
|
|
487
507
|
if (serviceRequests.length > 0) {
|
|
488
508
|
const sWidgets = JSON.stringify(values);
|
|
489
509
|
handleServiceRequests(serviceRequests, requestUrls, sWidgets).then(response => {
|
|
490
|
-
|
|
510
|
+
common__namespace.setProp(itemTemplate, widgetPath, JSON.parse(response));
|
|
491
511
|
resolve(itemTemplate);
|
|
492
|
-
}, e => reject(
|
|
512
|
+
}, e => reject(common__namespace.fail(e)));
|
|
493
513
|
}
|
|
494
514
|
else {
|
|
495
515
|
resolve(itemTemplate);
|
|
@@ -502,7 +522,7 @@
|
|
|
502
522
|
let i = 0;
|
|
503
523
|
Promise.all(serviceRequests).then(serviceResponses => {
|
|
504
524
|
serviceResponses.forEach(serviceResponse => {
|
|
505
|
-
if (
|
|
525
|
+
if (common__namespace.getProp(serviceResponse, "serviceItemId")) {
|
|
506
526
|
const serviceTemplate = "{{" +
|
|
507
527
|
serviceResponse.serviceItemId +
|
|
508
528
|
(serviceResponse.hasOwnProperty("id")
|
|
@@ -514,7 +534,7 @@
|
|
|
514
534
|
i++;
|
|
515
535
|
});
|
|
516
536
|
resolve(objString);
|
|
517
|
-
}, e => reject(
|
|
537
|
+
}, e => reject(common__namespace.fail(e)));
|
|
518
538
|
}
|
|
519
539
|
else {
|
|
520
540
|
resolve(objString);
|
|
@@ -531,18 +551,18 @@
|
|
|
531
551
|
if (results && results.length) {
|
|
532
552
|
results.forEach((url) => {
|
|
533
553
|
if (url.indexOf("NAServer") > -1) {
|
|
534
|
-
testString = replaceUrl(testString, url,
|
|
554
|
+
testString = replaceUrl(testString, url, common__namespace.placeholder(common__namespace.NA_SERVER_NAME));
|
|
535
555
|
}
|
|
536
556
|
else if (url.indexOf("GeocodeServer") > -1) {
|
|
537
|
-
testString = replaceUrl(testString, url,
|
|
557
|
+
testString = replaceUrl(testString, url, common__namespace.placeholder(common__namespace.GEOCODE_SERVER_NAME));
|
|
538
558
|
}
|
|
539
559
|
else if (portalUrl && url.indexOf(portalUrl) > -1) {
|
|
540
|
-
testString = replaceUrl(testString, portalUrl,
|
|
560
|
+
testString = replaceUrl(testString, portalUrl, common__namespace.placeholder(common__namespace.SERVER_NAME));
|
|
541
561
|
}
|
|
542
562
|
else if (url.indexOf("FeatureServer") > -1) {
|
|
543
563
|
if (requestUrls.indexOf(url) === -1) {
|
|
544
564
|
requestUrls.push(url);
|
|
545
|
-
serviceRequests.push(
|
|
565
|
+
serviceRequests.push(common__namespace.rest_request(url, options));
|
|
546
566
|
}
|
|
547
567
|
}
|
|
548
568
|
});
|
|
@@ -571,17 +591,17 @@
|
|
|
571
591
|
}
|
|
572
592
|
function setValues(itemTemplate, paths, base) {
|
|
573
593
|
paths.forEach(path => {
|
|
574
|
-
const url =
|
|
594
|
+
const url = common__namespace.getProp(itemTemplate, path);
|
|
575
595
|
if (url) {
|
|
576
596
|
const subString = url.substring(url.indexOf("/", url.indexOf("//") + 2));
|
|
577
|
-
|
|
597
|
+
common__namespace.setProp(itemTemplate, path, subString !== url ? base + subString : base);
|
|
578
598
|
}
|
|
579
599
|
});
|
|
580
600
|
}
|
|
581
|
-
function fineTuneCreatedItem(originalTemplate, newlyCreatedItem, templateDictionary, destinationAuthentication) {
|
|
601
|
+
function fineTuneCreatedItem$2(originalTemplate, newlyCreatedItem, templateDictionary, destinationAuthentication) {
|
|
582
602
|
return new Promise(resolve => {
|
|
583
603
|
// If this is a Web AppBuilder application, we will create a Code Attachment for downloading
|
|
584
|
-
if (
|
|
604
|
+
if (common__namespace.hasAnyKeyword(originalTemplate, [
|
|
585
605
|
"WAB2D",
|
|
586
606
|
"WAB3D",
|
|
587
607
|
"Web AppBuilder"
|
|
@@ -592,7 +612,7 @@
|
|
|
592
612
|
url: newlyCreatedItem.item.url,
|
|
593
613
|
data: newlyCreatedItem.data
|
|
594
614
|
};
|
|
595
|
-
const updateDef =
|
|
615
|
+
const updateDef = common__namespace.updateItem(updateOptions, destinationAuthentication);
|
|
596
616
|
const itemInfo = {
|
|
597
617
|
tags: originalTemplate.item.tags,
|
|
598
618
|
title: originalTemplate.item.title,
|
|
@@ -600,12 +620,12 @@
|
|
|
600
620
|
typeKeywords: ["Code", "Javascript", "Web Mapping Application"],
|
|
601
621
|
relationshipType: "WMA2Code",
|
|
602
622
|
originItemId: newlyCreatedItem.itemId,
|
|
603
|
-
url:
|
|
623
|
+
url: common__namespace.checkUrlPathTermination(common__namespace.replaceInTemplate(common__namespace.placeholder(common__namespace.SERVER_NAME), templateDictionary)) +
|
|
604
624
|
"sharing/rest/content/items/" +
|
|
605
625
|
newlyCreatedItem.itemId +
|
|
606
626
|
"/package"
|
|
607
627
|
};
|
|
608
|
-
const createItemWithDataDef =
|
|
628
|
+
const createItemWithDataDef = common__namespace.createItemWithData(itemInfo, {}, destinationAuthentication, templateDictionary.folderId);
|
|
609
629
|
Promise.all([updateDef, createItemWithDataDef]).then(() => resolve(null), () => resolve(null));
|
|
610
630
|
}
|
|
611
631
|
else {
|
|
@@ -622,14 +642,14 @@
|
|
|
622
642
|
* @return A promise that will resolve with list of dependent ids
|
|
623
643
|
* @protected
|
|
624
644
|
*/
|
|
625
|
-
function _extractDependencies$
|
|
645
|
+
function _extractDependencies$2(model) {
|
|
626
646
|
let processor = _getGenericWebAppDependencies;
|
|
627
647
|
/*
|
|
628
648
|
if (common.hasTypeKeyword(model, "Story Map")) {
|
|
629
649
|
processor = getStoryMapDependencies;
|
|
630
650
|
}
|
|
631
651
|
*/
|
|
632
|
-
if (
|
|
652
|
+
if (common__namespace.hasAnyKeyword(model, ["WAB2D", "WAB3D", "Web AppBuilder"])) {
|
|
633
653
|
processor = _getWABDependencies;
|
|
634
654
|
}
|
|
635
655
|
return processor(model);
|
|
@@ -639,15 +659,15 @@
|
|
|
639
659
|
*/
|
|
640
660
|
function _getGenericWebAppDependencies(model) {
|
|
641
661
|
const props = ["data.values.webmap", "data.values.group"];
|
|
642
|
-
return
|
|
662
|
+
return common__namespace.getProps(model, props);
|
|
643
663
|
}
|
|
644
664
|
function _getWABDependencies(model) {
|
|
645
665
|
const deps = [];
|
|
646
|
-
const v =
|
|
666
|
+
const v = common__namespace.getProp(model, "data.map.itemId");
|
|
647
667
|
if (v) {
|
|
648
668
|
deps.push(v);
|
|
649
669
|
}
|
|
650
|
-
const dataSources =
|
|
670
|
+
const dataSources = common__namespace.getProp(model, "data.dataSource.dataSources");
|
|
651
671
|
if (dataSources) {
|
|
652
672
|
Object.keys(dataSources).forEach(k => {
|
|
653
673
|
const ds = dataSources[k];
|
|
@@ -667,7 +687,7 @@
|
|
|
667
687
|
*/
|
|
668
688
|
function _templatizeIdPaths(itemTemplate, paths) {
|
|
669
689
|
paths.forEach(path => {
|
|
670
|
-
const id =
|
|
690
|
+
const id = common__namespace.getProp(itemTemplate, path);
|
|
671
691
|
_templatizeIdPath(itemTemplate, path, id);
|
|
672
692
|
});
|
|
673
693
|
}
|
|
@@ -680,7 +700,7 @@
|
|
|
680
700
|
* @protected
|
|
681
701
|
*/
|
|
682
702
|
function _templatizeIdPath(itemTemplate, path, id) {
|
|
683
|
-
|
|
703
|
+
common__namespace.setProp(itemTemplate, path, common__namespace.templatizeTerm(id, id, ".itemId"));
|
|
684
704
|
}
|
|
685
705
|
/**
|
|
686
706
|
* Templatize field references for datasources and widgets.
|
|
@@ -689,15 +709,15 @@
|
|
|
689
709
|
* @param datasourceInfos A list of datasource info objects that contain key values to templatize field references
|
|
690
710
|
* @returns The solutionTemplate with templatized field references
|
|
691
711
|
*/
|
|
692
|
-
function postProcessFieldReferences$
|
|
712
|
+
function postProcessFieldReferences$2(solutionTemplate, datasourceInfos) {
|
|
693
713
|
// handle datasources common for WAB apps
|
|
694
|
-
const dataSources =
|
|
714
|
+
const dataSources = common__namespace.getProp(solutionTemplate, "data.dataSource.dataSources");
|
|
695
715
|
if (dataSources && Object.keys(dataSources).length > 0) {
|
|
696
716
|
Object.keys(dataSources).forEach(k => {
|
|
697
717
|
const ds = dataSources[k];
|
|
698
718
|
dataSources[k] = _templatizeObject(ds, datasourceInfos);
|
|
699
719
|
});
|
|
700
|
-
|
|
720
|
+
common__namespace.setProp(solutionTemplate, "data.dataSource.dataSources", dataSources);
|
|
701
721
|
}
|
|
702
722
|
// handle widgets common for WAB apps
|
|
703
723
|
const paths = [
|
|
@@ -705,15 +725,15 @@
|
|
|
705
725
|
"data.widgetOnScreen.widgets"
|
|
706
726
|
];
|
|
707
727
|
paths.forEach(path => {
|
|
708
|
-
const widgets =
|
|
728
|
+
const widgets = common__namespace.getProp(solutionTemplate, path);
|
|
709
729
|
if (widgets) {
|
|
710
|
-
|
|
730
|
+
common__namespace.setProp(solutionTemplate, path, _templatizeObjectArray(widgets, datasourceInfos));
|
|
711
731
|
}
|
|
712
732
|
});
|
|
713
733
|
// handle values common for web app templates
|
|
714
|
-
const values =
|
|
734
|
+
const values = common__namespace.getProp(solutionTemplate, "data.values");
|
|
715
735
|
if (values) {
|
|
716
|
-
|
|
736
|
+
common__namespace.setProp(solutionTemplate, "data.values", _templatizeObject(values, datasourceInfos));
|
|
717
737
|
}
|
|
718
738
|
return solutionTemplate;
|
|
719
739
|
}
|
|
@@ -728,7 +748,7 @@
|
|
|
728
748
|
obj = _prioritizedTests(obj, datasourceInfos, templatizeKeys);
|
|
729
749
|
const replaceOrder = _getReplaceOrder(obj, datasourceInfos);
|
|
730
750
|
replaceOrder.forEach(ds => {
|
|
731
|
-
obj =
|
|
751
|
+
obj = common__namespace.templatizeFieldReferences(obj, ds.fields, ds.basePath, templatizeKeys);
|
|
732
752
|
});
|
|
733
753
|
return obj;
|
|
734
754
|
}
|
|
@@ -884,7 +904,7 @@
|
|
|
884
904
|
}
|
|
885
905
|
else {
|
|
886
906
|
if (urlTest && urlTest.test(obj[i])) {
|
|
887
|
-
obj =
|
|
907
|
+
obj = common__namespace.templatizeFieldReferences(obj, ds.fields, ds.basePath, templatizeKeys);
|
|
888
908
|
}
|
|
889
909
|
clone[i] = obj[i];
|
|
890
910
|
}
|
|
@@ -933,13 +953,13 @@
|
|
|
933
953
|
else if (typeof obj[i] === "object") {
|
|
934
954
|
// some widgets store the layerId as a key to a collection of details that contain field references
|
|
935
955
|
if (idTest.test(i) && templatizeKeys) {
|
|
936
|
-
obj[i] =
|
|
956
|
+
obj[i] = common__namespace.templatizeFieldReferences(obj[i], ds.fields, ds.basePath, templatizeKeys);
|
|
937
957
|
}
|
|
938
958
|
clone[i] = _templatizeParentByWebMapLayerId(obj[i], ds, id, templatizeKeys);
|
|
939
959
|
}
|
|
940
960
|
else {
|
|
941
961
|
if (idTest.test(obj[i])) {
|
|
942
|
-
obj =
|
|
962
|
+
obj = common__namespace.templatizeFieldReferences(obj, ds.fields, ds.basePath, templatizeKeys);
|
|
943
963
|
}
|
|
944
964
|
clone[i] = obj[i];
|
|
945
965
|
}
|
|
@@ -978,8 +998,8 @@
|
|
|
978
998
|
* @param srcAuthentication Credentials for requests to source items
|
|
979
999
|
* @return templatized itemTemplate
|
|
980
1000
|
*/
|
|
981
|
-
function convertItemToTemplate$
|
|
982
|
-
return
|
|
1001
|
+
function convertItemToTemplate$6(itemTemplate, destAuthentication, srcAuthentication) {
|
|
1002
|
+
return common__namespace.convertWorkforceItemToTemplate(itemTemplate, srcAuthentication);
|
|
983
1003
|
}
|
|
984
1004
|
/**
|
|
985
1005
|
* Gets the current user and updates the dispatchers service
|
|
@@ -989,7 +1009,7 @@
|
|
|
989
1009
|
* @return A promise that will resolve with { "success" === true || false }
|
|
990
1010
|
*/
|
|
991
1011
|
function fineTuneCreatedItem$1(newlyCreatedItem, destinationAuthentication, templateDictionary) {
|
|
992
|
-
return
|
|
1012
|
+
return common__namespace.fineTuneCreatedWorkforceItem(newlyCreatedItem, destinationAuthentication, "", templateDictionary);
|
|
993
1013
|
}
|
|
994
1014
|
|
|
995
1015
|
/** @license
|
|
@@ -1007,35 +1027,37 @@
|
|
|
1007
1027
|
* See the License for the specific language governing permissions and
|
|
1008
1028
|
* limitations under the License.
|
|
1009
1029
|
*/
|
|
1010
|
-
function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
1030
|
+
function createItemFromTemplate$3(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
1011
1031
|
return new Promise(resolve => {
|
|
1012
1032
|
// Interrupt process if progress callback returns `false`
|
|
1013
|
-
if (!itemProgressCallback(template.itemId,
|
|
1014
|
-
itemProgressCallback(template.itemId,
|
|
1015
|
-
resolve(
|
|
1033
|
+
if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Started, 0)) {
|
|
1034
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Ignored, 0);
|
|
1035
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type));
|
|
1016
1036
|
}
|
|
1017
1037
|
else {
|
|
1018
1038
|
// Replace the templatized symbols in a copy of the template
|
|
1019
|
-
let newItemTemplate =
|
|
1020
|
-
newItemTemplate =
|
|
1039
|
+
let newItemTemplate = common__namespace.cloneObject(template);
|
|
1040
|
+
newItemTemplate = common__namespace.replaceInTemplate(newItemTemplate, templateDictionary);
|
|
1021
1041
|
// Create the item, then update its URL with its new id
|
|
1022
1042
|
// some fieldnames are used as keys for objects
|
|
1023
1043
|
// when we templatize field references for web applications we first stringify the components of the
|
|
1024
1044
|
// web application that could contain field references and then serach for them with a regular expression.
|
|
1025
1045
|
// We also need to stringify the web application when de-templatizing so it will find all of these occurrences as well.
|
|
1026
1046
|
if (template.type === "Web Mapping Application" && template.data) {
|
|
1027
|
-
newItemTemplate = JSON.parse(
|
|
1047
|
+
newItemTemplate = JSON.parse(common__namespace.replaceInTemplate(JSON.stringify(newItemTemplate), templateDictionary));
|
|
1028
1048
|
}
|
|
1029
1049
|
if (template.item.thumbnail) {
|
|
1030
1050
|
newItemTemplate.item.thumbnail = template.item.thumbnail; // make sure that our File is still there
|
|
1031
1051
|
}
|
|
1032
|
-
|
|
1052
|
+
common__namespace
|
|
1053
|
+
.createItemWithData(newItemTemplate.item, newItemTemplate.data, destinationAuthentication, templateDictionary.folderId)
|
|
1033
1054
|
.then(createResponse => {
|
|
1034
1055
|
// Interrupt process if progress callback returns `false`
|
|
1035
|
-
if (!itemProgressCallback(template.itemId,
|
|
1036
|
-
itemProgressCallback(template.itemId,
|
|
1037
|
-
|
|
1038
|
-
.
|
|
1056
|
+
if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.id)) {
|
|
1057
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
|
|
1058
|
+
common__namespace
|
|
1059
|
+
.removeItem(createResponse.id, destinationAuthentication)
|
|
1060
|
+
.then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
|
|
1039
1061
|
}
|
|
1040
1062
|
else {
|
|
1041
1063
|
// Add the new item to the settings
|
|
@@ -1047,42 +1069,43 @@
|
|
|
1047
1069
|
// in legacy deployments
|
|
1048
1070
|
if (newItemTemplate.type === "Web Mapping Application" &&
|
|
1049
1071
|
template.data) {
|
|
1050
|
-
|
|
1072
|
+
common__namespace.setProp(newItemTemplate, "data.appItemId", createResponse.id);
|
|
1051
1073
|
}
|
|
1052
|
-
const postProcess =
|
|
1074
|
+
const postProcess = common__namespace.hasUnresolvedVariables(newItemTemplate.data);
|
|
1053
1075
|
// Update the template again now that we have the new item id
|
|
1054
1076
|
const originalURL = newItemTemplate.item.url;
|
|
1055
|
-
newItemTemplate =
|
|
1077
|
+
newItemTemplate = common__namespace.replaceInTemplate(newItemTemplate, templateDictionary);
|
|
1056
1078
|
// Update relationships
|
|
1057
1079
|
let relationshipsDef = Promise.resolve([]);
|
|
1058
1080
|
if (newItemTemplate.relatedItems) {
|
|
1059
1081
|
// Templatize references in relationships obj
|
|
1060
|
-
const updatedRelatedItems =
|
|
1082
|
+
const updatedRelatedItems = common__namespace.replaceInTemplate(common__namespace.templatizeIds(newItemTemplate.relatedItems), templateDictionary);
|
|
1061
1083
|
// Add the relationships
|
|
1062
|
-
relationshipsDef =
|
|
1084
|
+
relationshipsDef = common__namespace.addForwardItemRelationships(newItemTemplate.itemId, updatedRelatedItems, destinationAuthentication);
|
|
1063
1085
|
}
|
|
1064
1086
|
// Check for extra processing for web mapping application et al.
|
|
1065
1087
|
let customProcDef;
|
|
1066
1088
|
if (template.type === "Web Mapping Application" &&
|
|
1067
1089
|
template.data &&
|
|
1068
|
-
|
|
1090
|
+
common__namespace.hasAnyKeyword(template, [
|
|
1069
1091
|
"WAB2D",
|
|
1070
1092
|
"WAB3D",
|
|
1071
1093
|
"Web AppBuilder"
|
|
1072
1094
|
])) {
|
|
1073
1095
|
// If this is a Web AppBuilder application, we will create a Code Attachment for downloading
|
|
1074
|
-
customProcDef = fineTuneCreatedItem(template, newItemTemplate, templateDictionary, destinationAuthentication);
|
|
1096
|
+
customProcDef = fineTuneCreatedItem$2(template, newItemTemplate, templateDictionary, destinationAuthentication);
|
|
1075
1097
|
}
|
|
1076
1098
|
else if (template.type === "Workforce Project") {
|
|
1077
1099
|
customProcDef = fineTuneCreatedItem$1(newItemTemplate, destinationAuthentication, templateDictionary);
|
|
1078
1100
|
}
|
|
1079
1101
|
else if (template.type === "Notebook") {
|
|
1080
|
-
customProcDef = fineTuneCreatedItem
|
|
1102
|
+
customProcDef = fineTuneCreatedItem(template, newItemTemplate, templateDictionary, destinationAuthentication);
|
|
1081
1103
|
}
|
|
1082
1104
|
else if (originalURL !== newItemTemplate.item.url) {
|
|
1083
1105
|
// For web mapping applications that are not Web AppBuilder apps
|
|
1084
1106
|
customProcDef = new Promise((resolve2, reject2) => {
|
|
1085
|
-
|
|
1107
|
+
common__namespace
|
|
1108
|
+
.updateItemURL(createResponse.id, newItemTemplate.item.url, destinationAuthentication)
|
|
1086
1109
|
.then(() => resolve2(), reject2);
|
|
1087
1110
|
});
|
|
1088
1111
|
}
|
|
@@ -1091,10 +1114,11 @@
|
|
|
1091
1114
|
}
|
|
1092
1115
|
Promise.all([relationshipsDef, customProcDef]).then(() => {
|
|
1093
1116
|
// Interrupt process if progress callback returns `false`
|
|
1094
|
-
if (!itemProgressCallback(template.itemId,
|
|
1095
|
-
itemProgressCallback(template.itemId,
|
|
1096
|
-
|
|
1097
|
-
.
|
|
1117
|
+
if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor / 2, createResponse.id)) {
|
|
1118
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
|
|
1119
|
+
common__namespace
|
|
1120
|
+
.removeItem(createResponse.id, destinationAuthentication)
|
|
1121
|
+
.then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
|
|
1098
1122
|
}
|
|
1099
1123
|
else {
|
|
1100
1124
|
resolve({
|
|
@@ -1105,13 +1129,13 @@
|
|
|
1105
1129
|
});
|
|
1106
1130
|
}
|
|
1107
1131
|
}, () => {
|
|
1108
|
-
itemProgressCallback(template.itemId,
|
|
1109
|
-
resolve(
|
|
1132
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
1133
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to deploy all resources to the item
|
|
1110
1134
|
});
|
|
1111
1135
|
}
|
|
1112
1136
|
}, () => {
|
|
1113
|
-
itemProgressCallback(template.itemId,
|
|
1114
|
-
resolve(
|
|
1137
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
1138
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
|
|
1115
1139
|
});
|
|
1116
1140
|
}
|
|
1117
1141
|
});
|
|
@@ -1158,8 +1182,8 @@
|
|
|
1158
1182
|
|
|
1159
1183
|
var notebookHelpers = /*#__PURE__*/Object.freeze({
|
|
1160
1184
|
__proto__: null,
|
|
1161
|
-
createItemFromTemplate: createItemFromTemplate,
|
|
1162
|
-
convertItemToTemplate: convertItemToTemplate$
|
|
1185
|
+
createItemFromTemplate: createItemFromTemplate$3,
|
|
1186
|
+
convertItemToTemplate: convertItemToTemplate$1,
|
|
1163
1187
|
updateNotebookData: updateNotebookData
|
|
1164
1188
|
});
|
|
1165
1189
|
|
|
@@ -1188,16 +1212,16 @@
|
|
|
1188
1212
|
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
1189
1213
|
* @return A promise that will resolve when the template has been created
|
|
1190
1214
|
*/
|
|
1191
|
-
function convertItemToTemplate$
|
|
1215
|
+
function convertItemToTemplate$5(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
|
|
1192
1216
|
// Delegate back to simple-types, which will in-turn delegate
|
|
1193
1217
|
// to convertNotebookToTemplate at the correct point in the process
|
|
1194
1218
|
// This is a temporary refactor step
|
|
1195
|
-
return convertItemToTemplate$
|
|
1219
|
+
return convertItemToTemplate$1(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary);
|
|
1196
1220
|
}
|
|
1197
1221
|
// Delegate back to simple-types
|
|
1198
1222
|
// This is a temporary refactor step
|
|
1199
|
-
function createItemFromTemplate$
|
|
1200
|
-
return createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback);
|
|
1223
|
+
function createItemFromTemplate$2(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
1224
|
+
return createItemFromTemplate$3(template, templateDictionary, destinationAuthentication, itemProgressCallback);
|
|
1201
1225
|
}
|
|
1202
1226
|
/**
|
|
1203
1227
|
* Converts a Python Notebook item to a template.
|
|
@@ -1239,14 +1263,15 @@
|
|
|
1239
1263
|
*
|
|
1240
1264
|
* @return A promise that will resolve once any updates have been made
|
|
1241
1265
|
*/
|
|
1242
|
-
function fineTuneCreatedItem
|
|
1266
|
+
function fineTuneCreatedItem(originalTemplate, newlyCreatedItem, templateDictionary, authentication) {
|
|
1243
1267
|
return new Promise((resolve, reject) => {
|
|
1244
1268
|
const updateOptions = {
|
|
1245
1269
|
id: newlyCreatedItem.itemId,
|
|
1246
1270
|
url: newlyCreatedItem.item.url,
|
|
1247
|
-
data:
|
|
1271
|
+
data: common__namespace.jsonToFile(newlyCreatedItem.data, newlyCreatedItem.itemId + ".ipynb")
|
|
1248
1272
|
};
|
|
1249
|
-
|
|
1273
|
+
common__namespace
|
|
1274
|
+
.updateItem(updateOptions, authentication)
|
|
1250
1275
|
.then(() => resolve(null), reject);
|
|
1251
1276
|
});
|
|
1252
1277
|
}
|
|
@@ -1260,17 +1285,17 @@
|
|
|
1260
1285
|
* @param {UserSession} authentication The destination session info
|
|
1261
1286
|
* @returns {Promise<any>}
|
|
1262
1287
|
*/
|
|
1263
|
-
function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
1264
|
-
return
|
|
1288
|
+
function postProcess$2(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
1289
|
+
return common__namespace.updateItemTemplateFromDictionary(itemId, templateDictionary, authentication);
|
|
1265
1290
|
}
|
|
1266
1291
|
|
|
1267
1292
|
var notebook = /*#__PURE__*/Object.freeze({
|
|
1268
1293
|
__proto__: null,
|
|
1269
|
-
convertItemToTemplate: convertItemToTemplate$
|
|
1270
|
-
createItemFromTemplate: createItemFromTemplate$
|
|
1294
|
+
convertItemToTemplate: convertItemToTemplate$5,
|
|
1295
|
+
createItemFromTemplate: createItemFromTemplate$2,
|
|
1271
1296
|
convertNotebookToTemplate: convertNotebookToTemplate,
|
|
1272
|
-
fineTuneCreatedItem: fineTuneCreatedItem
|
|
1273
|
-
postProcess: postProcess
|
|
1297
|
+
fineTuneCreatedItem: fineTuneCreatedItem,
|
|
1298
|
+
postProcess: postProcess$2
|
|
1274
1299
|
});
|
|
1275
1300
|
|
|
1276
1301
|
/** @license
|
|
@@ -1300,7 +1325,7 @@
|
|
|
1300
1325
|
function convertItemToTemplate$4(itemTemplate, destAuthentication, srcAuthentication) {
|
|
1301
1326
|
return new Promise((resolve, reject) => {
|
|
1302
1327
|
// Extract dependencies
|
|
1303
|
-
_extractDependencies$
|
|
1328
|
+
_extractDependencies$1(itemTemplate, srcAuthentication).then((results) => {
|
|
1304
1329
|
itemTemplate.dependencies = results.dependencies;
|
|
1305
1330
|
// Templatize the map layer ids after we've extracted them as dependencies
|
|
1306
1331
|
/* istanbul ignore else */
|
|
@@ -1309,7 +1334,7 @@
|
|
|
1309
1334
|
itemTemplate.data.properties.OverviewURL = _templatizeOicLayerUrl(itemTemplate.data.properties.OverviewURL, results.urlHash);
|
|
1310
1335
|
}
|
|
1311
1336
|
resolve(itemTemplate);
|
|
1312
|
-
}, e => reject(
|
|
1337
|
+
}, e => reject(common__namespace.fail(e)));
|
|
1313
1338
|
});
|
|
1314
1339
|
}
|
|
1315
1340
|
/**
|
|
@@ -1320,7 +1345,7 @@
|
|
|
1320
1345
|
* @return List of dependencies ids and url/itemId hash
|
|
1321
1346
|
* @protected
|
|
1322
1347
|
*/
|
|
1323
|
-
function _extractDependencies$
|
|
1348
|
+
function _extractDependencies$1(itemTemplate, authentication) {
|
|
1324
1349
|
return new Promise((resolve, reject) => {
|
|
1325
1350
|
const dependencies = [];
|
|
1326
1351
|
if (itemTemplate.data?.properties) {
|
|
@@ -1335,9 +1360,9 @@
|
|
|
1335
1360
|
itemTemplate.data.properties.ServiceURL) {
|
|
1336
1361
|
layerURLs.push(itemTemplate.data.properties.OverviewURL);
|
|
1337
1362
|
}
|
|
1338
|
-
_getLayerIds(layerURLs, dependencies, authentication).then(results => {
|
|
1363
|
+
_getLayerIds$1(layerURLs, dependencies, authentication).then(results => {
|
|
1339
1364
|
resolve(results);
|
|
1340
|
-
}, e => reject(
|
|
1365
|
+
}, e => reject(common__namespace.fail(e)));
|
|
1341
1366
|
}
|
|
1342
1367
|
else {
|
|
1343
1368
|
resolve({
|
|
@@ -1356,7 +1381,7 @@
|
|
|
1356
1381
|
* @return List of dependencies ids and url/itemId hash
|
|
1357
1382
|
* @protected
|
|
1358
1383
|
*/
|
|
1359
|
-
function _getLayerIds(layerURLs, dependencies, authentication) {
|
|
1384
|
+
function _getLayerIds$1(layerURLs, dependencies, authentication) {
|
|
1360
1385
|
return new Promise((resolve, reject) => {
|
|
1361
1386
|
const urlHash = {};
|
|
1362
1387
|
const options = {
|
|
@@ -1373,7 +1398,7 @@
|
|
|
1373
1398
|
// avoid redundant checks when we have a layer with subLayers
|
|
1374
1399
|
/* istanbul ignore else */
|
|
1375
1400
|
if (Object.keys(layerChecks).indexOf(baseUrl) < 0) {
|
|
1376
|
-
layerChecks[baseUrl] =
|
|
1401
|
+
layerChecks[baseUrl] = common__namespace.rest_request(layerURL, options);
|
|
1377
1402
|
}
|
|
1378
1403
|
layerPromises.push(layerChecks[baseUrl]);
|
|
1379
1404
|
return true;
|
|
@@ -1390,7 +1415,7 @@
|
|
|
1390
1415
|
Promise.all(layerPromises).then(serviceResponses => {
|
|
1391
1416
|
serviceResponses.forEach((serviceResponse, i) => {
|
|
1392
1417
|
/* istanbul ignore else */
|
|
1393
|
-
if (
|
|
1418
|
+
if (common__namespace.getProp(serviceResponse, "serviceItemId")) {
|
|
1394
1419
|
const id = serviceResponse.serviceItemId;
|
|
1395
1420
|
/* istanbul ignore else */
|
|
1396
1421
|
if (dependencies.indexOf(id) < 0) {
|
|
@@ -1403,7 +1428,7 @@
|
|
|
1403
1428
|
dependencies: dependencies,
|
|
1404
1429
|
urlHash: urlHash
|
|
1405
1430
|
});
|
|
1406
|
-
}, e => reject(
|
|
1431
|
+
}, e => reject(common__namespace.fail(e)));
|
|
1407
1432
|
}
|
|
1408
1433
|
else {
|
|
1409
1434
|
resolve({
|
|
@@ -1427,10 +1452,10 @@
|
|
|
1427
1452
|
const id = urlHash[layerURL];
|
|
1428
1453
|
if (id) {
|
|
1429
1454
|
const layerId = layerURL.substr(layerURL.lastIndexOf("/") + 1);
|
|
1430
|
-
templatizedURL =
|
|
1455
|
+
templatizedURL = common__namespace.templatizeTerm(id, id, ".layer" + layerId + ".url");
|
|
1431
1456
|
}
|
|
1432
1457
|
// replace everything up until /home with portalBaseUrl var and templatize the itemId
|
|
1433
|
-
templatizedURL =
|
|
1458
|
+
templatizedURL = common__namespace.templatizeIds(templatizedURL.replace(/.+?(?=\/home)/, "{{portalBaseUrl}}"));
|
|
1434
1459
|
}
|
|
1435
1460
|
return templatizedURL;
|
|
1436
1461
|
}
|
|
@@ -1453,8 +1478,8 @@
|
|
|
1453
1478
|
|
|
1454
1479
|
var quickcaptureHelpers = /*#__PURE__*/Object.freeze({
|
|
1455
1480
|
__proto__: null,
|
|
1456
|
-
createItemFromTemplate: createItemFromTemplate,
|
|
1457
|
-
convertItemToTemplate: convertItemToTemplate$
|
|
1481
|
+
createItemFromTemplate: createItemFromTemplate$3,
|
|
1482
|
+
convertItemToTemplate: convertItemToTemplate$1
|
|
1458
1483
|
});
|
|
1459
1484
|
|
|
1460
1485
|
/** @license
|
|
@@ -1483,11 +1508,11 @@
|
|
|
1483
1508
|
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
1484
1509
|
* @return A promise that will resolve when the template has been created
|
|
1485
1510
|
*/
|
|
1486
|
-
function convertItemToTemplate$
|
|
1511
|
+
function convertItemToTemplate$3(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
|
|
1487
1512
|
// Delegate back to simple-types, which will in-turn delegate
|
|
1488
1513
|
// to convertNotebookToTemplate at the correct point in the process
|
|
1489
1514
|
// This is a temporary refactor step
|
|
1490
|
-
return convertItemToTemplate$
|
|
1515
|
+
return convertItemToTemplate$1(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary);
|
|
1491
1516
|
}
|
|
1492
1517
|
/**
|
|
1493
1518
|
* Converts an quick capture item to a template.
|
|
@@ -1505,7 +1530,7 @@
|
|
|
1505
1530
|
data.some((item) => {
|
|
1506
1531
|
if (item.type === "application/json") {
|
|
1507
1532
|
applicationName = item.name;
|
|
1508
|
-
applicationRequest =
|
|
1533
|
+
applicationRequest = common__namespace.getBlobText(item);
|
|
1509
1534
|
return true;
|
|
1510
1535
|
}
|
|
1511
1536
|
});
|
|
@@ -1557,8 +1582,8 @@
|
|
|
1557
1582
|
* @param data the quick capture application
|
|
1558
1583
|
*/
|
|
1559
1584
|
function _templatizeAdminEmail(data) {
|
|
1560
|
-
if (
|
|
1561
|
-
|
|
1585
|
+
if (common__namespace.getProp(data, "preferences.adminEmail")) {
|
|
1586
|
+
common__namespace.setProp(data, "preferences.adminEmail", "{{user.email}}");
|
|
1562
1587
|
}
|
|
1563
1588
|
}
|
|
1564
1589
|
/**
|
|
@@ -1581,11 +1606,11 @@
|
|
|
1581
1606
|
* @param urlPath the path to the url property
|
|
1582
1607
|
*/
|
|
1583
1608
|
function _templatizeUrl(obj, idPath, urlPath) {
|
|
1584
|
-
const id =
|
|
1585
|
-
const url =
|
|
1609
|
+
const id = common__namespace.getProp(obj, idPath);
|
|
1610
|
+
const url = common__namespace.getProp(obj, urlPath);
|
|
1586
1611
|
if (url) {
|
|
1587
1612
|
const layerId = url.substr(url.lastIndexOf("/") + 1);
|
|
1588
|
-
|
|
1613
|
+
common__namespace.setProp(obj, urlPath, common__namespace.templatizeTerm(id, id, ".layer" + layerId + ".url"));
|
|
1589
1614
|
}
|
|
1590
1615
|
}
|
|
1591
1616
|
/**
|
|
@@ -1595,17 +1620,17 @@
|
|
|
1595
1620
|
* @param path the path to the id property
|
|
1596
1621
|
*/
|
|
1597
1622
|
function _templatizeId(obj, path) {
|
|
1598
|
-
const id =
|
|
1623
|
+
const id = common__namespace.getProp(obj, path);
|
|
1599
1624
|
if (id) {
|
|
1600
|
-
|
|
1625
|
+
common__namespace.setProp(obj, path, common__namespace.templatizeTerm(id, id, ".itemId"));
|
|
1601
1626
|
}
|
|
1602
1627
|
}
|
|
1603
1628
|
//#endregion
|
|
1604
1629
|
//#region Deploy Process ---------------------------------------------------------------------------------------//
|
|
1605
1630
|
// Delegate back to simple-types
|
|
1606
1631
|
// This is a temporary refactor step
|
|
1607
|
-
function createItemFromTemplate$
|
|
1608
|
-
return createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback);
|
|
1632
|
+
function createItemFromTemplate$1(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
1633
|
+
return createItemFromTemplate$3(template, templateDictionary, destinationAuthentication, itemProgressCallback);
|
|
1609
1634
|
}
|
|
1610
1635
|
/**
|
|
1611
1636
|
* QuickCapture post-processing actions
|
|
@@ -1619,10 +1644,12 @@
|
|
|
1619
1644
|
*/
|
|
1620
1645
|
function postProcess$1(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
1621
1646
|
return new Promise((resolve, reject) => {
|
|
1622
|
-
template.data =
|
|
1623
|
-
|
|
1647
|
+
template.data = common__namespace.replaceInTemplate(template.data, templateDictionary);
|
|
1648
|
+
common__namespace
|
|
1649
|
+
.updateItemTemplateFromDictionary(itemId, templateDictionary, authentication)
|
|
1624
1650
|
.then(() => {
|
|
1625
|
-
|
|
1651
|
+
common__namespace
|
|
1652
|
+
.updateItemResourceText(itemId, template.data.name, JSON.stringify(template.data.application), authentication)
|
|
1626
1653
|
.then(resolve, reject);
|
|
1627
1654
|
}, reject);
|
|
1628
1655
|
});
|
|
@@ -1631,14 +1658,14 @@
|
|
|
1631
1658
|
|
|
1632
1659
|
var quickcapture = /*#__PURE__*/Object.freeze({
|
|
1633
1660
|
__proto__: null,
|
|
1634
|
-
convertItemToTemplate: convertItemToTemplate$
|
|
1661
|
+
convertItemToTemplate: convertItemToTemplate$3,
|
|
1635
1662
|
convertQuickCaptureToTemplate: convertQuickCaptureToTemplate,
|
|
1636
1663
|
_templatizeApplication: _templatizeApplication,
|
|
1637
1664
|
_templatizeAdminEmail: _templatizeAdminEmail,
|
|
1638
1665
|
_updateDependencies: _updateDependencies,
|
|
1639
1666
|
_templatizeUrl: _templatizeUrl,
|
|
1640
1667
|
_templatizeId: _templatizeId,
|
|
1641
|
-
createItemFromTemplate: createItemFromTemplate$
|
|
1668
|
+
createItemFromTemplate: createItemFromTemplate$1,
|
|
1642
1669
|
postProcess: postProcess$1
|
|
1643
1670
|
});
|
|
1644
1671
|
|
|
@@ -1672,15 +1699,15 @@
|
|
|
1672
1699
|
* @param srcAuthentication Credentials for requests to source items
|
|
1673
1700
|
* @return Template for the solution item that contains key details for item reconstruction
|
|
1674
1701
|
*/
|
|
1675
|
-
function convertItemToTemplate$
|
|
1702
|
+
function convertItemToTemplate$2(itemTemplate, destAuthentication, srcAuthentication) {
|
|
1676
1703
|
return new Promise((resolve, reject) => {
|
|
1677
1704
|
// Templatize the app URL
|
|
1678
1705
|
itemTemplate.item.url =
|
|
1679
|
-
|
|
1706
|
+
common__namespace.checkUrlPathTermination(common__namespace.placeholder(common__namespace.SERVER_NAME)) +
|
|
1680
1707
|
WEBMAP_APP_URL_PART +
|
|
1681
1708
|
itemTemplate.item.id; // templatized id
|
|
1682
1709
|
// Extract dependencies
|
|
1683
|
-
_extractDependencies
|
|
1710
|
+
_extractDependencies(itemTemplate, srcAuthentication).then((results) => {
|
|
1684
1711
|
itemTemplate.dependencies = results.dependencies;
|
|
1685
1712
|
// Templatize the map layer ids after we've extracted them as dependencies
|
|
1686
1713
|
if (itemTemplate.data) {
|
|
@@ -1690,7 +1717,7 @@
|
|
|
1690
1717
|
_excludeInitialState(itemTemplate.data);
|
|
1691
1718
|
}
|
|
1692
1719
|
resolve(itemTemplate);
|
|
1693
|
-
}, e => reject(
|
|
1720
|
+
}, e => reject(common__namespace.fail(e)));
|
|
1694
1721
|
});
|
|
1695
1722
|
}
|
|
1696
1723
|
/**
|
|
@@ -1701,16 +1728,16 @@
|
|
|
1701
1728
|
* @return List of dependencies ids and url/itemId hash
|
|
1702
1729
|
* @protected
|
|
1703
1730
|
*/
|
|
1704
|
-
function _extractDependencies
|
|
1731
|
+
function _extractDependencies(itemTemplate, authentication) {
|
|
1705
1732
|
return new Promise((resolve, reject) => {
|
|
1706
1733
|
const dependencies = [];
|
|
1707
1734
|
if (itemTemplate.data) {
|
|
1708
1735
|
const layers = itemTemplate.data.operationalLayers || [];
|
|
1709
1736
|
const tables = itemTemplate.data.tables || [];
|
|
1710
1737
|
const layersAndTables = layers.concat(tables);
|
|
1711
|
-
_getLayerIds
|
|
1738
|
+
_getLayerIds(layersAndTables, dependencies, authentication).then(results => {
|
|
1712
1739
|
resolve(results);
|
|
1713
|
-
}, e => reject(
|
|
1740
|
+
}, e => reject(common__namespace.fail(e)));
|
|
1714
1741
|
}
|
|
1715
1742
|
else {
|
|
1716
1743
|
resolve({
|
|
@@ -1731,7 +1758,7 @@
|
|
|
1731
1758
|
* @protected
|
|
1732
1759
|
*/
|
|
1733
1760
|
function _excludeInitialState(data) {
|
|
1734
|
-
|
|
1761
|
+
common__namespace.deleteProp(data, "initialState");
|
|
1735
1762
|
}
|
|
1736
1763
|
/**
|
|
1737
1764
|
* Extracts the AGOL itemId for each layer or table object in a list using the url.
|
|
@@ -1742,7 +1769,7 @@
|
|
|
1742
1769
|
* @return List of dependencies ids and url/itemId hash
|
|
1743
1770
|
* @protected
|
|
1744
1771
|
*/
|
|
1745
|
-
function _getLayerIds
|
|
1772
|
+
function _getLayerIds(layerList, dependencies, authentication) {
|
|
1746
1773
|
return new Promise((resolve, reject) => {
|
|
1747
1774
|
const urlHash = {};
|
|
1748
1775
|
const options = {
|
|
@@ -1758,7 +1785,7 @@
|
|
|
1758
1785
|
if (baseUrl) {
|
|
1759
1786
|
// avoid redundant checks when we have a layer with subLayers
|
|
1760
1787
|
if (Object.keys(layerChecks).indexOf(baseUrl) < 0) {
|
|
1761
|
-
layerChecks[baseUrl] =
|
|
1788
|
+
layerChecks[baseUrl] = common__namespace.rest_request(layer.url, options);
|
|
1762
1789
|
}
|
|
1763
1790
|
layerPromises.push(layerChecks[baseUrl]);
|
|
1764
1791
|
return true;
|
|
@@ -1774,7 +1801,7 @@
|
|
|
1774
1801
|
if (layerPromises.length > 0) {
|
|
1775
1802
|
Promise.all(layerPromises).then(serviceResponses => {
|
|
1776
1803
|
serviceResponses.forEach((serviceResponse, i) => {
|
|
1777
|
-
if (
|
|
1804
|
+
if (common__namespace.getProp(serviceResponse, "serviceItemId")) {
|
|
1778
1805
|
const id = serviceResponse.serviceItemId;
|
|
1779
1806
|
if (dependencies.indexOf(id) < 0) {
|
|
1780
1807
|
dependencies.push(id);
|
|
@@ -1786,7 +1813,7 @@
|
|
|
1786
1813
|
dependencies: dependencies,
|
|
1787
1814
|
urlHash: urlHash
|
|
1788
1815
|
});
|
|
1789
|
-
}, e => reject(
|
|
1816
|
+
}, e => reject(common__namespace.fail(e)));
|
|
1790
1817
|
}
|
|
1791
1818
|
else {
|
|
1792
1819
|
resolve({
|
|
@@ -1812,8 +1839,8 @@
|
|
|
1812
1839
|
? urlHash[layer.url]
|
|
1813
1840
|
: undefined;
|
|
1814
1841
|
if (id) {
|
|
1815
|
-
layer.url =
|
|
1816
|
-
layer.itemId =
|
|
1842
|
+
layer.url = common__namespace.templatizeTerm(id, id, ".layer" + layerId + ".url");
|
|
1843
|
+
layer.itemId = common__namespace.templatizeTerm(id, id, ".layer" + layerId + ".itemId");
|
|
1817
1844
|
}
|
|
1818
1845
|
}
|
|
1819
1846
|
});
|
|
@@ -1825,7 +1852,7 @@
|
|
|
1825
1852
|
* @param datasourceInfos A list of datasource info objects that contain key values to templatize field references
|
|
1826
1853
|
* @returns The solutionTemplate with templatized field references
|
|
1827
1854
|
*/
|
|
1828
|
-
function postProcessFieldReferences$
|
|
1855
|
+
function postProcessFieldReferences$1(solutionTemplate, datasourceInfos) {
|
|
1829
1856
|
const paths = [
|
|
1830
1857
|
"data.operationalLayers",
|
|
1831
1858
|
"data.tables",
|
|
@@ -1842,9 +1869,9 @@
|
|
|
1842
1869
|
* @param path A string path to the object property to templatize
|
|
1843
1870
|
*/
|
|
1844
1871
|
function _templatizeProperty(solutionTemplate, datasourceInfos, path) {
|
|
1845
|
-
const objs =
|
|
1872
|
+
const objs = common__namespace.getProp(solutionTemplate, path);
|
|
1846
1873
|
if (objs) {
|
|
1847
|
-
|
|
1874
|
+
common__namespace.setProp(solutionTemplate, path, _templatize(objs, datasourceInfos));
|
|
1848
1875
|
}
|
|
1849
1876
|
}
|
|
1850
1877
|
/**
|
|
@@ -1854,21 +1881,21 @@
|
|
|
1854
1881
|
* @param datasourceInfos A list of datasource info objects that contain key values to templatize field references
|
|
1855
1882
|
* @returns updated instances of the objects
|
|
1856
1883
|
*/
|
|
1857
|
-
function _templatize
|
|
1884
|
+
function _templatize(objs, datasourceInfos) {
|
|
1858
1885
|
objs.forEach(obj => {
|
|
1859
|
-
const ds = _getDatasourceInfo
|
|
1886
|
+
const ds = _getDatasourceInfo(obj, datasourceInfos);
|
|
1860
1887
|
if (ds) {
|
|
1861
1888
|
const fieldNames = ds.fields.map(f => f.name);
|
|
1862
|
-
|
|
1863
|
-
|
|
1889
|
+
common__namespace._templatizePopupInfo(obj, ds, ds.basePath, ds.itemId, fieldNames);
|
|
1890
|
+
common__namespace._templatizeDefinitionEditor(obj, ds.basePath, fieldNames);
|
|
1864
1891
|
if (obj.layerDefinition) {
|
|
1865
|
-
|
|
1866
|
-
|
|
1892
|
+
common__namespace._templatizeDrawingInfo(obj.layerDefinition, ds.basePath, fieldNames);
|
|
1893
|
+
common__namespace._templatizeDefinitionExpression(obj.layerDefinition, ds.basePath, fieldNames);
|
|
1867
1894
|
}
|
|
1868
1895
|
// used for applicationProperties search layers
|
|
1869
|
-
const fieldName =
|
|
1896
|
+
const fieldName = common__namespace.getProp(obj, "field.name");
|
|
1870
1897
|
if (fieldName) {
|
|
1871
|
-
|
|
1898
|
+
common__namespace.setProp(obj, "field.name", common__namespace._templatizeFieldName(fieldName, obj, ds.itemId, ds.basePath));
|
|
1872
1899
|
}
|
|
1873
1900
|
}
|
|
1874
1901
|
});
|
|
@@ -1881,7 +1908,7 @@
|
|
|
1881
1908
|
* @param datasourceInfos A list of datasource info objects that contain key values to templatize field references
|
|
1882
1909
|
* @returns datasourceInfo for the given object id
|
|
1883
1910
|
*/
|
|
1884
|
-
function _getDatasourceInfo
|
|
1911
|
+
function _getDatasourceInfo(obj, datasourceInfos) {
|
|
1885
1912
|
let datasourceInfo;
|
|
1886
1913
|
datasourceInfos.some(ds => {
|
|
1887
1914
|
if (ds.ids.indexOf(obj.id) > -1) {
|
|
@@ -1921,14 +1948,14 @@
|
|
|
1921
1948
|
*
|
|
1922
1949
|
* @return A promise that will resolve when the template has been created
|
|
1923
1950
|
*/
|
|
1924
|
-
function convertItemToTemplate$
|
|
1951
|
+
function convertItemToTemplate$1(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
|
|
1925
1952
|
return new Promise((resolve, reject) => {
|
|
1926
1953
|
// Init template
|
|
1927
|
-
const itemTemplate =
|
|
1954
|
+
const itemTemplate = common__namespace.createInitializedItemTemplate(itemInfo);
|
|
1928
1955
|
// Templatize item info property values
|
|
1929
|
-
itemTemplate.item.id =
|
|
1956
|
+
itemTemplate.item.id = common__namespace.templatizeTerm(itemTemplate.item.id, itemTemplate.item.id, ".itemId");
|
|
1930
1957
|
// Request related items
|
|
1931
|
-
const relatedPromise =
|
|
1958
|
+
const relatedPromise = common__namespace.getItemRelatedItemsInSameDirection(itemTemplate.itemId, "forward", srcAuthentication);
|
|
1932
1959
|
// Perform type-specific handling
|
|
1933
1960
|
let dataPromise = Promise.resolve({});
|
|
1934
1961
|
switch (itemInfo.type) {
|
|
@@ -1948,15 +1975,16 @@
|
|
|
1948
1975
|
case "Notebook":
|
|
1949
1976
|
dataPromise = new Promise(resolveJSON => {
|
|
1950
1977
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1951
|
-
|
|
1978
|
+
common__namespace
|
|
1979
|
+
.getItemDataAsJson(itemTemplate.itemId, srcAuthentication)
|
|
1952
1980
|
.then(json => resolveJSON(json));
|
|
1953
1981
|
});
|
|
1954
1982
|
break;
|
|
1955
1983
|
case "Form":
|
|
1956
|
-
dataPromise =
|
|
1984
|
+
dataPromise = common__namespace.getItemDataAsFile(itemTemplate.itemId, itemTemplate.item.name, srcAuthentication);
|
|
1957
1985
|
break;
|
|
1958
1986
|
case "QuickCapture Project":
|
|
1959
|
-
dataPromise =
|
|
1987
|
+
dataPromise = common__namespace.getItemResourcesFiles(itemTemplate.itemId, srcAuthentication);
|
|
1960
1988
|
break;
|
|
1961
1989
|
}
|
|
1962
1990
|
// Errors are handled as resolved empty values; this means that there's no `reject` clause to handle, hence:
|
|
@@ -1964,7 +1992,7 @@
|
|
|
1964
1992
|
Promise.all([dataPromise, relatedPromise]).then(responses => {
|
|
1965
1993
|
const [itemDataResponse, relatedItemsResponse] = responses;
|
|
1966
1994
|
// need to pre-process for velocity urls before they could be templatized by other processors
|
|
1967
|
-
itemTemplate.data =
|
|
1995
|
+
itemTemplate.data = common__namespace.updateVelocityReferences(itemDataResponse, itemInfo.type, templateDictionary);
|
|
1968
1996
|
const relationships = relatedItemsResponse;
|
|
1969
1997
|
// Save the mappings to related items & add those items to the dependencies, but not WMA Code Attachments
|
|
1970
1998
|
itemTemplate.dependencies = [];
|
|
@@ -1984,7 +2012,7 @@
|
|
|
1984
2012
|
let templateModifyingPromise = Promise.resolve(itemTemplate);
|
|
1985
2013
|
switch (itemInfo.type) {
|
|
1986
2014
|
case "Dashboard":
|
|
1987
|
-
convertItemToTemplate(itemTemplate);
|
|
2015
|
+
convertItemToTemplate$8(itemTemplate);
|
|
1988
2016
|
break;
|
|
1989
2017
|
case "Form":
|
|
1990
2018
|
// Store the form's data in the solution resources, not in template
|
|
@@ -1996,9 +2024,10 @@
|
|
|
1996
2024
|
? originalFilename
|
|
1997
2025
|
: `${itemTemplate.itemId}.zip`;
|
|
1998
2026
|
itemTemplate.item.name = filename;
|
|
1999
|
-
const storageName =
|
|
2027
|
+
const storageName = common__namespace.convertItemResourceToStorageResource(itemTemplate.itemId + "_info_data", filename, common__namespace.SolutionTemplateFormatVersion);
|
|
2000
2028
|
wrapupPromise = new Promise((resolveDataStorage, rejectDataStorage) => {
|
|
2001
|
-
|
|
2029
|
+
common__namespace
|
|
2030
|
+
.addResourceFromBlob(itemDataResponse, solutionItemId, storageName.folder, filename, destAuthentication)
|
|
2002
2031
|
.then(() => {
|
|
2003
2032
|
// Update the template's resources
|
|
2004
2033
|
itemTemplate.resources.push(storageName.folder + "/" + storageName.filename);
|
|
@@ -2015,23 +2044,23 @@
|
|
|
2015
2044
|
break;
|
|
2016
2045
|
case "Web Map":
|
|
2017
2046
|
case "Web Scene":
|
|
2018
|
-
templateModifyingPromise = convertItemToTemplate$
|
|
2047
|
+
templateModifyingPromise = convertItemToTemplate$2(itemTemplate, destAuthentication, srcAuthentication);
|
|
2019
2048
|
break;
|
|
2020
2049
|
case "Web Mapping Application":
|
|
2021
2050
|
if (itemDataResponse) {
|
|
2022
|
-
templateModifyingPromise = convertItemToTemplate$
|
|
2051
|
+
templateModifyingPromise = convertItemToTemplate$7(itemTemplate, destAuthentication, srcAuthentication);
|
|
2023
2052
|
}
|
|
2024
2053
|
break;
|
|
2025
2054
|
case "Workforce Project":
|
|
2026
|
-
templateModifyingPromise = convertItemToTemplate$
|
|
2055
|
+
templateModifyingPromise = convertItemToTemplate$6(itemTemplate, destAuthentication, srcAuthentication);
|
|
2027
2056
|
break;
|
|
2028
2057
|
case "QuickCapture Project":
|
|
2029
2058
|
templateModifyingPromise = convertQuickCaptureToTemplate(itemTemplate);
|
|
2030
2059
|
break;
|
|
2031
2060
|
}
|
|
2032
2061
|
wrapupPromise.then(() => {
|
|
2033
|
-
templateModifyingPromise.then(resolve, err => reject(
|
|
2034
|
-
}, err => reject(
|
|
2062
|
+
templateModifyingPromise.then(resolve, err => reject(common__namespace.fail(err)));
|
|
2063
|
+
}, err => reject(common__namespace.fail(err)));
|
|
2035
2064
|
});
|
|
2036
2065
|
});
|
|
2037
2066
|
}
|
|
@@ -2054,8 +2083,8 @@
|
|
|
2054
2083
|
|
|
2055
2084
|
var simpleTypeHelpers = /*#__PURE__*/Object.freeze({
|
|
2056
2085
|
__proto__: null,
|
|
2057
|
-
createItemFromTemplate: createItemFromTemplate,
|
|
2058
|
-
convertItemToTemplate: convertItemToTemplate$
|
|
2086
|
+
createItemFromTemplate: createItemFromTemplate$3,
|
|
2087
|
+
convertItemToTemplate: convertItemToTemplate$1
|
|
2059
2088
|
});
|
|
2060
2089
|
|
|
2061
2090
|
/** @license
|
|
@@ -2083,8 +2112,8 @@
|
|
|
2083
2112
|
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
2084
2113
|
* @return A promise that will resolve when the template has been created
|
|
2085
2114
|
*/
|
|
2086
|
-
function convertItemToTemplate
|
|
2087
|
-
return convertItemToTemplate$
|
|
2115
|
+
function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
|
|
2116
|
+
return convertItemToTemplate$1(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary);
|
|
2088
2117
|
}
|
|
2089
2118
|
/**
|
|
2090
2119
|
* Delegate to simpleType creator
|
|
@@ -2094,8 +2123,8 @@
|
|
|
2094
2123
|
* @param destinationAuthentication
|
|
2095
2124
|
* @param itemProgressCallback
|
|
2096
2125
|
*/
|
|
2097
|
-
function createItemFromTemplate
|
|
2098
|
-
return createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback);
|
|
2126
|
+
function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
2127
|
+
return createItemFromTemplate$3(template, templateDictionary, destinationAuthentication, itemProgressCallback);
|
|
2099
2128
|
}
|
|
2100
2129
|
/**
|
|
2101
2130
|
* Templatizes field references within specific template types.
|
|
@@ -2106,16 +2135,16 @@
|
|
|
2106
2135
|
* @param type The item type
|
|
2107
2136
|
* @return The updated solution template
|
|
2108
2137
|
*/
|
|
2109
|
-
function postProcessFieldReferences
|
|
2138
|
+
function postProcessFieldReferences(solutionTemplate, datasourceInfos, type) {
|
|
2110
2139
|
switch (type) {
|
|
2111
2140
|
case "Web Mapping Application":
|
|
2112
|
-
postProcessFieldReferences$
|
|
2141
|
+
postProcessFieldReferences$2(solutionTemplate, datasourceInfos);
|
|
2113
2142
|
break;
|
|
2114
2143
|
case "Dashboard":
|
|
2115
|
-
postProcessFieldReferences(solutionTemplate, datasourceInfos);
|
|
2144
|
+
postProcessFieldReferences$3(solutionTemplate, datasourceInfos);
|
|
2116
2145
|
break;
|
|
2117
2146
|
case "Web Map":
|
|
2118
|
-
postProcessFieldReferences$
|
|
2147
|
+
postProcessFieldReferences$1(solutionTemplate, datasourceInfos);
|
|
2119
2148
|
break;
|
|
2120
2149
|
}
|
|
2121
2150
|
return solutionTemplate;
|
|
@@ -2130,16 +2159,16 @@
|
|
|
2130
2159
|
* @param {UserSession} authentication The destination session info
|
|
2131
2160
|
* @returns Promise resolving to successfulness of update
|
|
2132
2161
|
*/
|
|
2133
|
-
function postProcess
|
|
2162
|
+
function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
2134
2163
|
return common.updateItemTemplateFromDictionary(itemId, templateDictionary, authentication);
|
|
2135
2164
|
}
|
|
2136
2165
|
|
|
2137
2166
|
var simpleTypes = /*#__PURE__*/Object.freeze({
|
|
2138
2167
|
__proto__: null,
|
|
2139
|
-
convertItemToTemplate: convertItemToTemplate
|
|
2140
|
-
createItemFromTemplate: createItemFromTemplate
|
|
2141
|
-
postProcessFieldReferences: postProcessFieldReferences
|
|
2142
|
-
postProcess: postProcess
|
|
2168
|
+
convertItemToTemplate: convertItemToTemplate,
|
|
2169
|
+
createItemFromTemplate: createItemFromTemplate,
|
|
2170
|
+
postProcessFieldReferences: postProcessFieldReferences,
|
|
2171
|
+
postProcess: postProcess
|
|
2143
2172
|
});
|
|
2144
2173
|
|
|
2145
2174
|
exports.notebookHelpers = notebookHelpers;
|
|
@@ -2151,5 +2180,5 @@
|
|
|
2151
2180
|
|
|
2152
2181
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2153
2182
|
|
|
2154
|
-
}))
|
|
2183
|
+
}));
|
|
2155
2184
|
//# sourceMappingURL=simple-types.umd.js.map
|