@esri/solution-simple-types 1.1.3 → 1.3.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.
Files changed (72) hide show
  1. package/dist/esm/dashboard.d.ts +0 -1
  2. package/dist/esm/dashboard.js +0 -1
  3. package/dist/esm/dashboard.js.map +1 -1
  4. package/dist/esm/helpers/convert-item-to-template.d.ts +3 -2
  5. package/dist/esm/helpers/convert-item-to-template.js +12 -11
  6. package/dist/esm/helpers/convert-item-to-template.js.map +1 -1
  7. package/dist/esm/notebook.d.ts +12 -2
  8. package/dist/esm/notebook.js +23 -3
  9. package/dist/esm/notebook.js.map +1 -1
  10. package/dist/esm/oic.d.ts +3 -2
  11. package/dist/esm/oic.js +6 -3
  12. package/dist/esm/oic.js.map +1 -1
  13. package/dist/esm/quickcapture.d.ts +3 -2
  14. package/dist/esm/quickcapture.js +4 -3
  15. package/dist/esm/quickcapture.js.map +1 -1
  16. package/dist/esm/simple-types.d.ts +3 -2
  17. package/dist/esm/simple-types.js +4 -3
  18. package/dist/esm/simple-types.js.map +1 -1
  19. package/dist/esm/webmap.d.ts +3 -2
  20. package/dist/esm/webmap.js +6 -5
  21. package/dist/esm/webmap.js.map +1 -1
  22. package/dist/esm/webmappingapplication.d.ts +3 -2
  23. package/dist/esm/webmappingapplication.js +7 -6
  24. package/dist/esm/webmappingapplication.js.map +1 -1
  25. package/dist/esm/workforce.d.ts +3 -2
  26. package/dist/esm/workforce.js +4 -3
  27. package/dist/esm/workforce.js.map +1 -1
  28. package/dist/node/dashboard.d.ts +0 -1
  29. package/dist/node/dashboard.js +2 -2
  30. package/dist/node/dashboard.js.map +1 -1
  31. package/dist/node/helpers/convert-item-to-template.d.ts +3 -2
  32. package/dist/node/helpers/convert-item-to-template.js +21 -19
  33. package/dist/node/helpers/convert-item-to-template.js.map +1 -1
  34. package/dist/node/helpers/create-item-from-template.js +5 -4
  35. package/dist/node/helpers/create-item-from-template.js.map +1 -1
  36. package/dist/node/index.js +7 -6
  37. package/dist/node/index.js.map +1 -1
  38. package/dist/node/notebook.d.ts +12 -2
  39. package/dist/node/notebook.js +28 -6
  40. package/dist/node/notebook.js.map +1 -1
  41. package/dist/node/oic.d.ts +3 -2
  42. package/dist/node/oic.js +8 -4
  43. package/dist/node/oic.js.map +1 -1
  44. package/dist/node/quickcapture.d.ts +3 -2
  45. package/dist/node/quickcapture.js +7 -5
  46. package/dist/node/quickcapture.js.map +1 -1
  47. package/dist/node/simple-types.d.ts +3 -2
  48. package/dist/node/simple-types.js +9 -7
  49. package/dist/node/simple-types.js.map +1 -1
  50. package/dist/node/webmap.d.ts +3 -2
  51. package/dist/node/webmap.js +8 -6
  52. package/dist/node/webmap.js.map +1 -1
  53. package/dist/node/webmappingapplication.d.ts +3 -2
  54. package/dist/node/webmappingapplication.js +9 -7
  55. package/dist/node/webmappingapplication.js.map +1 -1
  56. package/dist/node/workforce.d.ts +3 -2
  57. package/dist/node/workforce.js +6 -4
  58. package/dist/node/workforce.js.map +1 -1
  59. package/dist/umd/dashboard.d.ts +0 -1
  60. package/dist/umd/helpers/convert-item-to-template.d.ts +3 -2
  61. package/dist/umd/notebook.d.ts +12 -2
  62. package/dist/umd/oic.d.ts +3 -2
  63. package/dist/umd/quickcapture.d.ts +3 -2
  64. package/dist/umd/simple-types.d.ts +3 -2
  65. package/dist/umd/simple-types.umd.js +304 -246
  66. package/dist/umd/simple-types.umd.js.map +1 -1
  67. package/dist/umd/simple-types.umd.min.js +4 -4
  68. package/dist/umd/simple-types.umd.min.js.map +1 -1
  69. package/dist/umd/webmap.d.ts +3 -2
  70. package/dist/umd/webmappingapplication.d.ts +3 -2
  71. package/dist/umd/workforce.d.ts +3 -2
  72. package/package.json +22 -23
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-simple-types - v1.1.3 - Apache-2.0
3
- * Copyright (c) 2018-2021 Esri, Inc.
4
- * Mon Oct 18 2021 09:03:22 GMT-0700 (Pacific Daylight Time)
2
+ * @esri/solution-simple-types - v1.3.0 - Apache-2.0
3
+ * Copyright (c) 2018-2022 Esri, Inc.
4
+ * Thu Feb 17 2022 09:44:31 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
@@ -40,11 +60,10 @@
40
60
  * Converts a dashboard item to a template.
41
61
  *
42
62
  * @param itemTemplate Template for the dashboard item
43
- * @param authentication Credentials for any requests
44
63
  * @return templatized itemTemplate
45
64
  */
46
- function convertItemToTemplate(itemTemplate) {
47
- return _extractDependencies(itemTemplate);
65
+ function convertItemToTemplate$8(itemTemplate) {
66
+ return _extractDependencies$3(itemTemplate);
48
67
  }
49
68
  /**
50
69
  * Templatizes all itemIds and updates the dependency array
@@ -53,7 +72,7 @@
53
72
  * @return The updated itemTemplate
54
73
  * @protected
55
74
  */
56
- function _extractDependencies(itemTemplate) {
75
+ function _extractDependencies$3(itemTemplate) {
57
76
  // get dependencies from any
58
77
  const updatePaths = [
59
78
  "data.widgets",
@@ -62,7 +81,7 @@
62
81
  "data.urlParameters"
63
82
  ];
64
83
  updatePaths.forEach(path => {
65
- const objs = common.getProp(itemTemplate, path);
84
+ const objs = common__namespace.getProp(itemTemplate, path);
66
85
  if (Array.isArray(objs)) {
67
86
  objs.forEach(obj => {
68
87
  /* istanbul ignore else */
@@ -71,7 +90,7 @@
71
90
  if (itemTemplate.dependencies.indexOf(obj.itemId) < 0) {
72
91
  itemTemplate.dependencies.push(obj.itemId);
73
92
  }
74
- obj.itemId = common.templatizeTerm(obj.itemId, obj.itemId, ".itemId");
93
+ obj.itemId = common__namespace.templatizeTerm(obj.itemId, obj.itemId, ".itemId");
75
94
  }
76
95
  /* istanbul ignore else */
77
96
  if (Array.isArray(obj.datasets)) {
@@ -91,16 +110,16 @@
91
110
  function _getDatasourceDependencies(obj, itemTemplate) {
92
111
  obj.datasets.forEach((dataset) => {
93
112
  // when the datasource has an itemId is an external datasource
94
- const itemId = common.getProp(dataset, "dataSource.itemId");
113
+ const itemId = common__namespace.getProp(dataset, "dataSource.itemId");
95
114
  if (itemId) {
96
115
  if (itemTemplate.dependencies.indexOf(itemId) < 0) {
97
116
  itemTemplate.dependencies.push(itemId);
98
117
  }
99
- const layerId = common.getProp(dataset, "dataSource.layerId");
100
- dataset.dataSource.itemId = common.templatizeTerm(itemId, itemId, layerId !== undefined ? ".layer" + layerId + ".itemId" : ".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");
101
120
  /* istanbul ignore else */
102
121
  if (layerId !== undefined) {
103
- dataset.dataSource.layerId = common.templatizeTerm(itemId, itemId, ".layer" + layerId + ".layerId");
122
+ dataset.dataSource.layerId = common__namespace.templatizeTerm(itemId, itemId, ".layer" + layerId + ".layerId");
104
123
  }
105
124
  }
106
125
  });
@@ -112,7 +131,7 @@
112
131
  * @param datasourceInfos A list of datasource info objects that contain key values to templatize field references
113
132
  * @returns The solutionTemplate with templatized field references
114
133
  */
115
- function postProcessFieldReferences(solutionTemplate, datasourceInfos) {
134
+ function postProcessFieldReferences$3(solutionTemplate, datasourceInfos) {
116
135
  const updatePaths = [
117
136
  "data.widgets",
118
137
  "data.headerPanel.selectors",
@@ -122,12 +141,12 @@
122
141
  // dashboards reference datasets from other widgets
123
142
  // add reference IDs to the appropriate datasourceInfos
124
143
  updatePaths.forEach(path => {
125
- const objs = common.getProp(solutionTemplate, path);
144
+ const objs = common__namespace.getProp(solutionTemplate, path);
126
145
  _updateDatasourceReferences(objs, datasourceInfos);
127
146
  });
128
147
  // after we know the potential references go ahead and templatize
129
148
  updatePaths.forEach(path => {
130
- _templatize(solutionTemplate, path, datasourceInfos);
149
+ _templatize$1(solutionTemplate, path, datasourceInfos);
131
150
  });
132
151
  return solutionTemplate;
133
152
  }
@@ -146,9 +165,9 @@
146
165
  if (Array.isArray(obj.datasets)) {
147
166
  obj.datasets.forEach((dataset) => {
148
167
  // when the datasource has an itemId it's an external datasource
149
- const itemId = common.cleanLayerBasedItemId(common.getProp(dataset, "dataSource.itemId"));
168
+ const itemId = common__namespace.cleanLayerBasedItemId(common__namespace.getProp(dataset, "dataSource.itemId"));
150
169
  if (itemId) {
151
- const layerId = common.cleanLayerId(common.getProp(dataset, "dataSource.layerId"));
170
+ const layerId = common__namespace.cleanLayerId(common__namespace.getProp(dataset, "dataSource.layerId"));
152
171
  datasourceInfos.some(ds => {
153
172
  if (ds.itemId === itemId && ds.layerId === layerId) {
154
173
  _updateReferences(ds, obj.id);
@@ -162,7 +181,7 @@
162
181
  else {
163
182
  // add placeholder for map layer datasource info so we can know the items that reference them
164
183
  // needed when item field reference are derived from another widgets datasource eg. <dashboardWidgetId>#datasetname
165
- const id = common.getProp(dataset, "dataSource.id");
184
+ const id = common__namespace.getProp(dataset, "dataSource.id");
166
185
  if (id) {
167
186
  const dashboardLayerId = id.split("#")[1];
168
187
  datasourceInfos.some(ds => {
@@ -189,11 +208,11 @@
189
208
  * @param datasourceInfos A list of objects that contain key details about the datasources from the application
190
209
  * @protected
191
210
  */
192
- function _templatize(itemTemplate, path, datasourceInfos) {
193
- const obj = common.getProp(itemTemplate, path);
211
+ function _templatize$1(itemTemplate, path, datasourceInfos) {
212
+ const obj = common__namespace.getProp(itemTemplate, path);
194
213
  /* istanbul ignore else */
195
214
  if (obj) {
196
- common.setProp(itemTemplate, path, _templatizeByDatasource(obj, datasourceInfos));
215
+ common__namespace.setProp(itemTemplate, path, _templatizeByDatasource(obj, datasourceInfos));
197
216
  }
198
217
  }
199
218
  /**
@@ -221,16 +240,16 @@
221
240
  if (_action.fieldMap &&
222
241
  _action.targetId &&
223
242
  _action.targetId.indexOf("#") > -1) {
224
- const datasourceInfo = _getDatasourceInfo(_action, datasourceInfos);
243
+ const datasourceInfo = _getDatasourceInfo$1(_action, datasourceInfos);
225
244
  /* istanbul ignore else */
226
245
  if (datasourceInfo) {
227
- const fields = common.getProp(datasourceInfo, "fields");
228
- const basePath = common.getProp(datasourceInfo, "basePath");
246
+ const fields = common__namespace.getProp(datasourceInfo, "fields");
247
+ const basePath = common__namespace.getProp(datasourceInfo, "basePath");
229
248
  /* istanbul ignore else */
230
249
  if (Array.isArray(fields) && basePath) {
231
250
  _action.fieldMap = _action.fieldMap.map((m) => {
232
251
  const _m = m;
233
- _m.targetName = common.templatizeFieldReferences(_m.targetName, fields, basePath);
252
+ _m.targetName = common__namespace.templatizeFieldReferences(_m.targetName, fields, basePath);
234
253
  return _m;
235
254
  });
236
255
  }
@@ -246,15 +265,15 @@
246
265
  _obj.datasets = _obj.datasets.map((dataset) => {
247
266
  let _dataset = dataset;
248
267
  if (_dataset.type === "serviceDataset") {
249
- const datasourceInfo = _getDatasourceInfo(dataset, datasourceInfos);
268
+ const datasourceInfo = _getDatasourceInfo$1(dataset, datasourceInfos);
250
269
  /* istanbul ignore else */
251
270
  if (datasourceInfo) {
252
- const fields = common.getProp(datasourceInfo, "fields");
253
- const basePath = common.getProp(datasourceInfo, "basePath");
271
+ const fields = common__namespace.getProp(datasourceInfo, "fields");
272
+ const basePath = common__namespace.getProp(datasourceInfo, "basePath");
254
273
  /* istanbul ignore else */
255
274
  if (Array.isArray(fields) && basePath) {
256
- _obj = common.templatizeFieldReferences(_obj, fields, basePath);
257
- _dataset = common.templatizeFieldReferences(_dataset, fields, basePath);
275
+ _obj = common__namespace.templatizeFieldReferences(_obj, fields, basePath);
276
+ _dataset = common__namespace.templatizeFieldReferences(_dataset, fields, basePath);
258
277
  }
259
278
  }
260
279
  }
@@ -278,11 +297,11 @@
278
297
  * @return The supporting datasource info for the given object
279
298
  * @protected
280
299
  */
281
- function _getDatasourceInfo(obj, datasourceInfos) {
300
+ function _getDatasourceInfo$1(obj, datasourceInfos) {
282
301
  let info;
283
302
  // the datasource will have an id property when it's referencing a map layer
284
303
  // the fields collection will already be defined
285
- const id = common.getProp(obj, "dataSource.id") || common.getProp(obj, "targetId");
304
+ const id = common__namespace.getProp(obj, "dataSource.id") || common__namespace.getProp(obj, "targetId");
286
305
  if (id) {
287
306
  const dashboardLayerId = id.split("#")[1];
288
307
  if (!datasourceInfos.some(di => {
@@ -302,8 +321,8 @@
302
321
  }
303
322
  else {
304
323
  // otherwise match the itemId and the layerId to get the correct fields and path
305
- const itemId = common.cleanLayerBasedItemId(common.getProp(obj, "dataSource.itemId"));
306
- const layerId = common.cleanLayerId(common.getProp(obj, "dataSource.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"));
307
326
  /* istanbul ignore else */
308
327
  if (itemId) {
309
328
  datasourceInfos.some(di => {
@@ -349,10 +368,11 @@
349
368
  * Converts a web mapping application item into a template.
350
369
  *
351
370
  * @param itemInfo Info about the item
352
- * @param authentication Credentials for working with AGO
371
+ * @param destAuthentication Credentials for requests to the destination organization
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$1(itemTemplate, authentication) {
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
- common.placeholder(common.SERVER_NAME) + // add placeholder server name
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$1(itemTemplate);
393
+ itemTemplate.dependencies = _extractDependencies$2(itemTemplate);
374
394
  // Set the folder
375
- common.setProp(itemTemplate, "data.folderId", "{{folderId}}");
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
- ], common.placeholder(common.SERVER_NAME));
392
- common.setProp(itemTemplate, "data.geometryService", common.placeholder(common.GEOMETRY_SERVER_NAME));
393
- templatizeDatasources(itemTemplate, authentication, portalUrl).then(() => {
394
- templatizeWidgets(itemTemplate, authentication, portalUrl, "data.widgetPool.widgets").then(_itemTemplate => {
395
- templatizeWidgets(_itemTemplate, authentication, portalUrl, "data.widgetOnScreen.widgets", true).then(updatedItemTemplate => {
396
- templatizeValues(updatedItemTemplate, authentication, portalUrl, "data.values").then(_updatedItemTemplate => {
411
+ ], common__namespace.placeholder(common__namespace.SERVER_NAME));
412
+ common__namespace.setProp(itemTemplate, "data.geometryService", common__namespace.placeholder(common__namespace.GEOMETRY_SERVER_NAME));
413
+ templatizeDatasources(itemTemplate, srcAuthentication, portalUrl).then(() => {
414
+ templatizeWidgets(itemTemplate, srcAuthentication, portalUrl, "data.widgetPool.widgets").then(_itemTemplate => {
415
+ templatizeWidgets(_itemTemplate, srcAuthentication, portalUrl, "data.widgetOnScreen.widgets", true).then(updatedItemTemplate => {
416
+ templatizeValues(updatedItemTemplate, srcAuthentication, portalUrl, "data.values").then(_updatedItemTemplate => {
397
417
  resolve(_updatedItemTemplate);
398
- }, e => reject(common.fail(e)));
399
- }, e => reject(common.fail(e)));
400
- }, e => reject(common.fail(e)));
401
- }, e => reject(common.fail(e)));
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 = common.getProp(itemTemplate, "data.dataSource.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
- common.setProp(ds, "portalUrl", common.placeholder(common.SERVER_NAME));
412
- const itemId = common.getProp(ds, "itemId");
413
- if (common.getProp(ds, "url")) {
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 = common.templatizeTerm(itemId, itemId, ".layer" + layerId + ".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(common.fail(e)));
443
+ }, e => rejectReq(common__namespace.fail(e)));
424
444
  }));
425
445
  }
426
446
  else {
427
447
  if (itemId) {
428
- ds.itemId = common.templatizeTerm(itemId, itemId, ".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(common.fail(e)));
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 = common.getProp(itemTemplate, widgetPath) || [];
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 && common.getProp(widget, "icon")) {
448
- setValues(widget, ["icon"], common.placeholder(common.SERVER_NAME));
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
- common.setProp(itemTemplate, widgetPath, JSON.parse(response));
482
+ common__namespace.setProp(itemTemplate, widgetPath, JSON.parse(response));
463
483
  resolve(itemTemplate);
464
- }, e => reject(common.fail(e)));
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 = common.getProp(itemTemplate, widgetPath);
494
+ let values = common__namespace.getProp(itemTemplate, widgetPath);
475
495
  let serviceRequests = [];
476
496
  let requestUrls = [];
477
497
  if (values) {
478
- if (common.getProp(values, "icon")) {
479
- setValues(values, ["icon"], common.placeholder(common.SERVER_NAME));
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
- common.setProp(itemTemplate, widgetPath, JSON.parse(response));
510
+ common__namespace.setProp(itemTemplate, widgetPath, JSON.parse(response));
491
511
  resolve(itemTemplate);
492
- }, e => reject(common.fail(e)));
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 (common.getProp(serviceResponse, "serviceItemId")) {
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(common.fail(e)));
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, common.placeholder(common.NA_SERVER_NAME));
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, common.placeholder(common.GEOCODE_SERVER_NAME));
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, common.placeholder(common.SERVER_NAME));
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(common.rest_request(url, options));
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 = common.getProp(itemTemplate, path);
594
+ const url = common__namespace.getProp(itemTemplate, path);
575
595
  if (url) {
576
596
  const subString = url.substring(url.indexOf("/", url.indexOf("//") + 2));
577
- common.setProp(itemTemplate, path, subString !== url ? base + subString : base);
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 (common.hasAnyKeyword(originalTemplate, [
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 = common.updateItem(updateOptions, destinationAuthentication);
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: common.checkUrlPathTermination(common.replaceInTemplate(common.placeholder(common.SERVER_NAME), templateDictionary)) +
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 = common.createItemWithData(itemInfo, {}, destinationAuthentication, templateDictionary.folderId);
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$1(model) {
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 (common.hasAnyKeyword(model, ["WAB2D", "WAB3D", "Web AppBuilder"])) {
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 common.getProps(model, props);
662
+ return common__namespace.getProps(model, props);
643
663
  }
644
664
  function _getWABDependencies(model) {
645
665
  const deps = [];
646
- const v = common.getProp(model, "data.map.itemId");
666
+ const v = common__namespace.getProp(model, "data.map.itemId");
647
667
  if (v) {
648
668
  deps.push(v);
649
669
  }
650
- const dataSources = common.getProp(model, "data.dataSource.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 = common.getProp(itemTemplate, path);
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
- common.setProp(itemTemplate, path, common.templatizeTerm(id, id, ".itemId"));
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$1(solutionTemplate, datasourceInfos) {
712
+ function postProcessFieldReferences$2(solutionTemplate, datasourceInfos) {
693
713
  // handle datasources common for WAB apps
694
- const dataSources = common.getProp(solutionTemplate, "data.dataSource.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
- common.setProp(solutionTemplate, "data.dataSource.dataSources", dataSources);
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 = common.getProp(solutionTemplate, path);
728
+ const widgets = common__namespace.getProp(solutionTemplate, path);
709
729
  if (widgets) {
710
- common.setProp(solutionTemplate, path, _templatizeObjectArray(widgets, datasourceInfos));
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 = common.getProp(solutionTemplate, "data.values");
734
+ const values = common__namespace.getProp(solutionTemplate, "data.values");
715
735
  if (values) {
716
- common.setProp(solutionTemplate, "data.values", _templatizeObject(values, datasourceInfos));
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 = common.templatizeFieldReferences(obj, ds.fields, ds.basePath, templatizeKeys);
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 = common.templatizeFieldReferences(obj, ds.fields, ds.basePath, templatizeKeys);
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] = common.templatizeFieldReferences(obj[i], ds.fields, ds.basePath, templatizeKeys);
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 = common.templatizeFieldReferences(obj, ds.fields, ds.basePath, templatizeKeys);
962
+ obj = common__namespace.templatizeFieldReferences(obj, ds.fields, ds.basePath, templatizeKeys);
943
963
  }
944
964
  clone[i] = obj[i];
945
965
  }
@@ -974,11 +994,12 @@
974
994
  * Converts an workforce item to a template.
975
995
  *
976
996
  * @param itemTemplate template for the workforce project item
977
- * @param authentication credentials for any requests
997
+ * @param destAuthentication Credentials for requests to the destination organization
998
+ * @param srcAuthentication Credentials for requests to source items
978
999
  * @return templatized itemTemplate
979
1000
  */
980
- function convertItemToTemplate$2(itemTemplate, authentication) {
981
- return common.convertWorkforceItemToTemplate(itemTemplate, authentication);
1001
+ function convertItemToTemplate$6(itemTemplate, destAuthentication, srcAuthentication) {
1002
+ return common__namespace.convertWorkforceItemToTemplate(itemTemplate, srcAuthentication);
982
1003
  }
983
1004
  /**
984
1005
  * Gets the current user and updates the dispatchers service
@@ -988,7 +1009,7 @@
988
1009
  * @return A promise that will resolve with { "success" === true || false }
989
1010
  */
990
1011
  function fineTuneCreatedItem$1(newlyCreatedItem, destinationAuthentication, templateDictionary) {
991
- return common.fineTuneCreatedWorkforceItem(newlyCreatedItem, destinationAuthentication, "", templateDictionary);
1012
+ return common__namespace.fineTuneCreatedWorkforceItem(newlyCreatedItem, destinationAuthentication, "", templateDictionary);
992
1013
  }
993
1014
 
994
1015
  /** @license
@@ -1006,35 +1027,37 @@
1006
1027
  * See the License for the specific language governing permissions and
1007
1028
  * limitations under the License.
1008
1029
  */
1009
- function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
1030
+ function createItemFromTemplate$3(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
1010
1031
  return new Promise(resolve => {
1011
1032
  // Interrupt process if progress callback returns `false`
1012
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Started, 0)) {
1013
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Ignored, 0);
1014
- resolve(common.generateEmptyCreationResponse(template.type));
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));
1015
1036
  }
1016
1037
  else {
1017
1038
  // Replace the templatized symbols in a copy of the template
1018
- let newItemTemplate = common.cloneObject(template);
1019
- newItemTemplate = common.replaceInTemplate(newItemTemplate, templateDictionary);
1039
+ let newItemTemplate = common__namespace.cloneObject(template);
1040
+ newItemTemplate = common__namespace.replaceInTemplate(newItemTemplate, templateDictionary);
1020
1041
  // Create the item, then update its URL with its new id
1021
1042
  // some fieldnames are used as keys for objects
1022
1043
  // when we templatize field references for web applications we first stringify the components of the
1023
1044
  // web application that could contain field references and then serach for them with a regular expression.
1024
1045
  // We also need to stringify the web application when de-templatizing so it will find all of these occurrences as well.
1025
1046
  if (template.type === "Web Mapping Application" && template.data) {
1026
- newItemTemplate = JSON.parse(common.replaceInTemplate(JSON.stringify(newItemTemplate), templateDictionary));
1047
+ newItemTemplate = JSON.parse(common__namespace.replaceInTemplate(JSON.stringify(newItemTemplate), templateDictionary));
1027
1048
  }
1028
1049
  if (template.item.thumbnail) {
1029
1050
  newItemTemplate.item.thumbnail = template.item.thumbnail; // make sure that our File is still there
1030
1051
  }
1031
- common.createItemWithData(newItemTemplate.item, newItemTemplate.data, destinationAuthentication, templateDictionary.folderId)
1052
+ common__namespace
1053
+ .createItemWithData(newItemTemplate.item, newItemTemplate.data, destinationAuthentication, templateDictionary.folderId)
1032
1054
  .then(createResponse => {
1033
1055
  // Interrupt process if progress callback returns `false`
1034
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.id)) {
1035
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Cancelled, 0);
1036
- common.removeItem(createResponse.id, destinationAuthentication)
1037
- .then(() => resolve(common.generateEmptyCreationResponse(template.type)), () => resolve(common.generateEmptyCreationResponse(template.type)));
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)));
1038
1061
  }
1039
1062
  else {
1040
1063
  // Add the new item to the settings
@@ -1046,42 +1069,43 @@
1046
1069
  // in legacy deployments
1047
1070
  if (newItemTemplate.type === "Web Mapping Application" &&
1048
1071
  template.data) {
1049
- common.setProp(newItemTemplate, "data.appItemId", createResponse.id);
1072
+ common__namespace.setProp(newItemTemplate, "data.appItemId", createResponse.id);
1050
1073
  }
1051
- const postProcess = common.hasUnresolvedVariables(newItemTemplate.data);
1074
+ const postProcess = common__namespace.hasUnresolvedVariables(newItemTemplate.data);
1052
1075
  // Update the template again now that we have the new item id
1053
1076
  const originalURL = newItemTemplate.item.url;
1054
- newItemTemplate = common.replaceInTemplate(newItemTemplate, templateDictionary);
1077
+ newItemTemplate = common__namespace.replaceInTemplate(newItemTemplate, templateDictionary);
1055
1078
  // Update relationships
1056
1079
  let relationshipsDef = Promise.resolve([]);
1057
1080
  if (newItemTemplate.relatedItems) {
1058
1081
  // Templatize references in relationships obj
1059
- const updatedRelatedItems = common.replaceInTemplate(common.templatizeIds(newItemTemplate.relatedItems), templateDictionary);
1082
+ const updatedRelatedItems = common__namespace.replaceInTemplate(common__namespace.templatizeIds(newItemTemplate.relatedItems), templateDictionary);
1060
1083
  // Add the relationships
1061
- relationshipsDef = common.addForwardItemRelationships(newItemTemplate.itemId, updatedRelatedItems, destinationAuthentication);
1084
+ relationshipsDef = common__namespace.addForwardItemRelationships(newItemTemplate.itemId, updatedRelatedItems, destinationAuthentication);
1062
1085
  }
1063
1086
  // Check for extra processing for web mapping application et al.
1064
1087
  let customProcDef;
1065
1088
  if (template.type === "Web Mapping Application" &&
1066
1089
  template.data &&
1067
- common.hasAnyKeyword(template, [
1090
+ common__namespace.hasAnyKeyword(template, [
1068
1091
  "WAB2D",
1069
1092
  "WAB3D",
1070
1093
  "Web AppBuilder"
1071
1094
  ])) {
1072
1095
  // If this is a Web AppBuilder application, we will create a Code Attachment for downloading
1073
- customProcDef = fineTuneCreatedItem(template, newItemTemplate, templateDictionary, destinationAuthentication);
1096
+ customProcDef = fineTuneCreatedItem$2(template, newItemTemplate, templateDictionary, destinationAuthentication);
1074
1097
  }
1075
1098
  else if (template.type === "Workforce Project") {
1076
1099
  customProcDef = fineTuneCreatedItem$1(newItemTemplate, destinationAuthentication, templateDictionary);
1077
1100
  }
1078
1101
  else if (template.type === "Notebook") {
1079
- customProcDef = fineTuneCreatedItem$2(template, newItemTemplate, templateDictionary, destinationAuthentication);
1102
+ customProcDef = fineTuneCreatedItem(template, newItemTemplate, templateDictionary, destinationAuthentication);
1080
1103
  }
1081
1104
  else if (originalURL !== newItemTemplate.item.url) {
1082
1105
  // For web mapping applications that are not Web AppBuilder apps
1083
1106
  customProcDef = new Promise((resolve2, reject2) => {
1084
- common.updateItemURL(createResponse.id, newItemTemplate.item.url, destinationAuthentication)
1107
+ common__namespace
1108
+ .updateItemURL(createResponse.id, newItemTemplate.item.url, destinationAuthentication)
1085
1109
  .then(() => resolve2(), reject2);
1086
1110
  });
1087
1111
  }
@@ -1090,10 +1114,11 @@
1090
1114
  }
1091
1115
  Promise.all([relationshipsDef, customProcDef]).then(() => {
1092
1116
  // Interrupt process if progress callback returns `false`
1093
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor / 2, createResponse.id)) {
1094
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Cancelled, 0);
1095
- common.removeItem(createResponse.id, destinationAuthentication)
1096
- .then(() => resolve(common.generateEmptyCreationResponse(template.type)), () => resolve(common.generateEmptyCreationResponse(template.type)));
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)));
1097
1122
  }
1098
1123
  else {
1099
1124
  resolve({
@@ -1104,13 +1129,13 @@
1104
1129
  });
1105
1130
  }
1106
1131
  }, () => {
1107
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
1108
- resolve(common.generateEmptyCreationResponse(template.type)); // fails to deploy all resources to the item
1132
+ itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
1133
+ resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to deploy all resources to the item
1109
1134
  });
1110
1135
  }
1111
1136
  }, () => {
1112
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
1113
- resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item
1137
+ itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
1138
+ resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
1114
1139
  });
1115
1140
  }
1116
1141
  });
@@ -1157,8 +1182,8 @@
1157
1182
 
1158
1183
  var notebookHelpers = /*#__PURE__*/Object.freeze({
1159
1184
  __proto__: null,
1160
- createItemFromTemplate: createItemFromTemplate,
1161
- convertItemToTemplate: convertItemToTemplate$7,
1185
+ createItemFromTemplate: createItemFromTemplate$3,
1186
+ convertItemToTemplate: convertItemToTemplate$1,
1162
1187
  updateNotebookData: updateNotebookData
1163
1188
  });
1164
1189
 
@@ -1182,20 +1207,21 @@
1182
1207
  *
1183
1208
  * @param solutionItemId The solution to contain the template
1184
1209
  * @param itemInfo Info about the item
1185
- * @param authentication Credentials for working with AGO
1210
+ * @param destAuthentication Credentials for requests to the destination organization
1211
+ * @param srcAuthentication Credentials for requests to source items
1186
1212
  * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
1187
1213
  * @return A promise that will resolve when the template has been created
1188
1214
  */
1189
- function convertItemToTemplate$3(solutionItemId, itemInfo, authentication, templateDictionary) {
1215
+ function convertItemToTemplate$5(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
1190
1216
  // Delegate back to simple-types, which will in-turn delegate
1191
1217
  // to convertNotebookToTemplate at the correct point in the process
1192
1218
  // This is a temporary refactor step
1193
- return convertItemToTemplate$7(solutionItemId, itemInfo, authentication, templateDictionary);
1219
+ return convertItemToTemplate$1(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary);
1194
1220
  }
1195
1221
  // Delegate back to simple-types
1196
1222
  // This is a temporary refactor step
1197
- function createItemFromTemplate$1(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
1198
- return createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback);
1223
+ function createItemFromTemplate$2(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
1224
+ return createItemFromTemplate$3(template, templateDictionary, destinationAuthentication, itemProgressCallback);
1199
1225
  }
1200
1226
  /**
1201
1227
  * Converts a Python Notebook item to a template.
@@ -1206,6 +1232,7 @@
1206
1232
  function convertNotebookToTemplate(itemTemplate) {
1207
1233
  // The templates data to process
1208
1234
  const data = itemTemplate.data;
1235
+ deleteProps(data);
1209
1236
  let dataString = JSON.stringify(data);
1210
1237
  const idTest = /[0-9A-F]{32}/gim;
1211
1238
  if (data && idTest.test(dataString)) {
@@ -1227,6 +1254,24 @@
1227
1254
  }
1228
1255
  return itemTemplate;
1229
1256
  }
1257
+ /**
1258
+ * Remove interpreter and papermill props
1259
+ *
1260
+ * This function will update the data passed in by removing key props
1261
+ *
1262
+ * @param data The notebooks data object
1263
+ *
1264
+ */
1265
+ function deleteProps(data) {
1266
+ /* istanbul ignore else */
1267
+ if (data) {
1268
+ const props = ["metadata.interpreter", "metadata.papermill"];
1269
+ common__namespace.deleteProps(data, props);
1270
+ (data.cells || []).forEach((cell) => {
1271
+ common__namespace.deleteProps(cell, props);
1272
+ });
1273
+ }
1274
+ }
1230
1275
  /**
1231
1276
  * Update the notebooks data
1232
1277
  *
@@ -1237,14 +1282,15 @@
1237
1282
  *
1238
1283
  * @return A promise that will resolve once any updates have been made
1239
1284
  */
1240
- function fineTuneCreatedItem$2(originalTemplate, newlyCreatedItem, templateDictionary, authentication) {
1285
+ function fineTuneCreatedItem(originalTemplate, newlyCreatedItem, templateDictionary, authentication) {
1241
1286
  return new Promise((resolve, reject) => {
1242
1287
  const updateOptions = {
1243
1288
  id: newlyCreatedItem.itemId,
1244
1289
  url: newlyCreatedItem.item.url,
1245
- data: common.jsonToFile(newlyCreatedItem.data, newlyCreatedItem.itemId + ".ipynb")
1290
+ data: common__namespace.jsonToFile(newlyCreatedItem.data, newlyCreatedItem.itemId + ".ipynb")
1246
1291
  };
1247
- common.updateItem(updateOptions, authentication)
1292
+ common__namespace
1293
+ .updateItem(updateOptions, authentication)
1248
1294
  .then(() => resolve(null), reject);
1249
1295
  });
1250
1296
  }
@@ -1258,17 +1304,18 @@
1258
1304
  * @param {UserSession} authentication The destination session info
1259
1305
  * @returns {Promise<any>}
1260
1306
  */
1261
- function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
1262
- return common.updateItemTemplateFromDictionary(itemId, templateDictionary, authentication);
1307
+ function postProcess$2(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
1308
+ return common__namespace.updateItemTemplateFromDictionary(itemId, templateDictionary, authentication);
1263
1309
  }
1264
1310
 
1265
1311
  var notebook = /*#__PURE__*/Object.freeze({
1266
1312
  __proto__: null,
1267
- convertItemToTemplate: convertItemToTemplate$3,
1268
- createItemFromTemplate: createItemFromTemplate$1,
1313
+ convertItemToTemplate: convertItemToTemplate$5,
1314
+ createItemFromTemplate: createItemFromTemplate$2,
1269
1315
  convertNotebookToTemplate: convertNotebookToTemplate,
1270
- fineTuneCreatedItem: fineTuneCreatedItem$2,
1271
- postProcess: postProcess
1316
+ deleteProps: deleteProps,
1317
+ fineTuneCreatedItem: fineTuneCreatedItem,
1318
+ postProcess: postProcess$2
1272
1319
  });
1273
1320
 
1274
1321
  /** @license
@@ -1291,13 +1338,14 @@
1291
1338
  * Converts an AGOL OIC (Oriented Imagery Catalog) item to a template.
1292
1339
  *
1293
1340
  * @param itemTemplate Template for the OIC (Oriented Imagery Catalog) item
1294
- * @param authentication credentials for the request
1341
+ * @param destAuthentication Credentials for requests to the destination organization
1342
+ * @param srcAuthentication Credentials for requests to source items
1295
1343
  * @return Template for the solution item that contains key details for item reconstruction
1296
1344
  */
1297
- function convertItemToTemplate$4(itemTemplate, authentication) {
1345
+ function convertItemToTemplate$4(itemTemplate, destAuthentication, srcAuthentication) {
1298
1346
  return new Promise((resolve, reject) => {
1299
1347
  // Extract dependencies
1300
- _extractDependencies$2(itemTemplate, authentication).then((results) => {
1348
+ _extractDependencies$1(itemTemplate, srcAuthentication).then((results) => {
1301
1349
  itemTemplate.dependencies = results.dependencies;
1302
1350
  // Templatize the map layer ids after we've extracted them as dependencies
1303
1351
  /* istanbul ignore else */
@@ -1306,7 +1354,7 @@
1306
1354
  itemTemplate.data.properties.OverviewURL = _templatizeOicLayerUrl(itemTemplate.data.properties.OverviewURL, results.urlHash);
1307
1355
  }
1308
1356
  resolve(itemTemplate);
1309
- }, e => reject(common.fail(e)));
1357
+ }, e => reject(common__namespace.fail(e)));
1310
1358
  });
1311
1359
  }
1312
1360
  /**
@@ -1317,7 +1365,7 @@
1317
1365
  * @return List of dependencies ids and url/itemId hash
1318
1366
  * @protected
1319
1367
  */
1320
- function _extractDependencies$2(itemTemplate, authentication) {
1368
+ function _extractDependencies$1(itemTemplate, authentication) {
1321
1369
  return new Promise((resolve, reject) => {
1322
1370
  const dependencies = [];
1323
1371
  if (itemTemplate.data?.properties) {
@@ -1332,9 +1380,9 @@
1332
1380
  itemTemplate.data.properties.ServiceURL) {
1333
1381
  layerURLs.push(itemTemplate.data.properties.OverviewURL);
1334
1382
  }
1335
- _getLayerIds(layerURLs, dependencies, authentication).then(results => {
1383
+ _getLayerIds$1(layerURLs, dependencies, authentication).then(results => {
1336
1384
  resolve(results);
1337
- }, e => reject(common.fail(e)));
1385
+ }, e => reject(common__namespace.fail(e)));
1338
1386
  }
1339
1387
  else {
1340
1388
  resolve({
@@ -1353,7 +1401,7 @@
1353
1401
  * @return List of dependencies ids and url/itemId hash
1354
1402
  * @protected
1355
1403
  */
1356
- function _getLayerIds(layerURLs, dependencies, authentication) {
1404
+ function _getLayerIds$1(layerURLs, dependencies, authentication) {
1357
1405
  return new Promise((resolve, reject) => {
1358
1406
  const urlHash = {};
1359
1407
  const options = {
@@ -1370,7 +1418,7 @@
1370
1418
  // avoid redundant checks when we have a layer with subLayers
1371
1419
  /* istanbul ignore else */
1372
1420
  if (Object.keys(layerChecks).indexOf(baseUrl) < 0) {
1373
- layerChecks[baseUrl] = common.rest_request(layerURL, options);
1421
+ layerChecks[baseUrl] = common__namespace.rest_request(layerURL, options);
1374
1422
  }
1375
1423
  layerPromises.push(layerChecks[baseUrl]);
1376
1424
  return true;
@@ -1387,7 +1435,7 @@
1387
1435
  Promise.all(layerPromises).then(serviceResponses => {
1388
1436
  serviceResponses.forEach((serviceResponse, i) => {
1389
1437
  /* istanbul ignore else */
1390
- if (common.getProp(serviceResponse, "serviceItemId")) {
1438
+ if (common__namespace.getProp(serviceResponse, "serviceItemId")) {
1391
1439
  const id = serviceResponse.serviceItemId;
1392
1440
  /* istanbul ignore else */
1393
1441
  if (dependencies.indexOf(id) < 0) {
@@ -1400,7 +1448,7 @@
1400
1448
  dependencies: dependencies,
1401
1449
  urlHash: urlHash
1402
1450
  });
1403
- }, e => reject(common.fail(e)));
1451
+ }, e => reject(common__namespace.fail(e)));
1404
1452
  }
1405
1453
  else {
1406
1454
  resolve({
@@ -1424,8 +1472,10 @@
1424
1472
  const id = urlHash[layerURL];
1425
1473
  if (id) {
1426
1474
  const layerId = layerURL.substr(layerURL.lastIndexOf("/") + 1);
1427
- templatizedURL = common.templatizeTerm(id, id, ".layer" + layerId + ".url");
1475
+ templatizedURL = common__namespace.templatizeTerm(id, id, ".layer" + layerId + ".url");
1428
1476
  }
1477
+ // replace everything up until /home with portalBaseUrl var and templatize the itemId
1478
+ templatizedURL = common__namespace.templatizeIds(templatizedURL.replace(/.+?(?=\/home)/, "{{portalBaseUrl}}"));
1429
1479
  }
1430
1480
  return templatizedURL;
1431
1481
  }
@@ -1448,8 +1498,8 @@
1448
1498
 
1449
1499
  var quickcaptureHelpers = /*#__PURE__*/Object.freeze({
1450
1500
  __proto__: null,
1451
- createItemFromTemplate: createItemFromTemplate,
1452
- convertItemToTemplate: convertItemToTemplate$7
1501
+ createItemFromTemplate: createItemFromTemplate$3,
1502
+ convertItemToTemplate: convertItemToTemplate$1
1453
1503
  });
1454
1504
 
1455
1505
  /** @license
@@ -1473,15 +1523,16 @@
1473
1523
  *
1474
1524
  * @param solutionItemId The solution to contain the template
1475
1525
  * @param itemInfo Info about the item
1476
- * @param authentication Credentials for working with AGO
1526
+ * @param destAuthentication Credentials for requests to the destination organization
1527
+ * @param srcAuthentication Credentials for requests to source items
1477
1528
  * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
1478
1529
  * @return A promise that will resolve when the template has been created
1479
1530
  */
1480
- function convertItemToTemplate$5(solutionItemId, itemInfo, authentication, templateDictionary) {
1531
+ function convertItemToTemplate$3(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
1481
1532
  // Delegate back to simple-types, which will in-turn delegate
1482
1533
  // to convertNotebookToTemplate at the correct point in the process
1483
1534
  // This is a temporary refactor step
1484
- return convertItemToTemplate$7(solutionItemId, itemInfo, authentication, templateDictionary);
1535
+ return convertItemToTemplate$1(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary);
1485
1536
  }
1486
1537
  /**
1487
1538
  * Converts an quick capture item to a template.
@@ -1499,7 +1550,7 @@
1499
1550
  data.some((item) => {
1500
1551
  if (item.type === "application/json") {
1501
1552
  applicationName = item.name;
1502
- applicationRequest = common.getBlobText(item);
1553
+ applicationRequest = common__namespace.getBlobText(item);
1503
1554
  return true;
1504
1555
  }
1505
1556
  });
@@ -1551,8 +1602,8 @@
1551
1602
  * @param data the quick capture application
1552
1603
  */
1553
1604
  function _templatizeAdminEmail(data) {
1554
- if (common.getProp(data, "preferences.adminEmail")) {
1555
- common.setProp(data, "preferences.adminEmail", "{{user.email}}");
1605
+ if (common__namespace.getProp(data, "preferences.adminEmail")) {
1606
+ common__namespace.setProp(data, "preferences.adminEmail", "{{user.email}}");
1556
1607
  }
1557
1608
  }
1558
1609
  /**
@@ -1575,11 +1626,11 @@
1575
1626
  * @param urlPath the path to the url property
1576
1627
  */
1577
1628
  function _templatizeUrl(obj, idPath, urlPath) {
1578
- const id = common.getProp(obj, idPath);
1579
- const url = common.getProp(obj, urlPath);
1629
+ const id = common__namespace.getProp(obj, idPath);
1630
+ const url = common__namespace.getProp(obj, urlPath);
1580
1631
  if (url) {
1581
1632
  const layerId = url.substr(url.lastIndexOf("/") + 1);
1582
- common.setProp(obj, urlPath, common.templatizeTerm(id, id, ".layer" + layerId + ".url"));
1633
+ common__namespace.setProp(obj, urlPath, common__namespace.templatizeTerm(id, id, ".layer" + layerId + ".url"));
1583
1634
  }
1584
1635
  }
1585
1636
  /**
@@ -1589,17 +1640,17 @@
1589
1640
  * @param path the path to the id property
1590
1641
  */
1591
1642
  function _templatizeId(obj, path) {
1592
- const id = common.getProp(obj, path);
1643
+ const id = common__namespace.getProp(obj, path);
1593
1644
  if (id) {
1594
- common.setProp(obj, path, common.templatizeTerm(id, id, ".itemId"));
1645
+ common__namespace.setProp(obj, path, common__namespace.templatizeTerm(id, id, ".itemId"));
1595
1646
  }
1596
1647
  }
1597
1648
  //#endregion
1598
1649
  //#region Deploy Process ---------------------------------------------------------------------------------------//
1599
1650
  // Delegate back to simple-types
1600
1651
  // This is a temporary refactor step
1601
- function createItemFromTemplate$2(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
1602
- return createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback);
1652
+ function createItemFromTemplate$1(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
1653
+ return createItemFromTemplate$3(template, templateDictionary, destinationAuthentication, itemProgressCallback);
1603
1654
  }
1604
1655
  /**
1605
1656
  * QuickCapture post-processing actions
@@ -1613,10 +1664,12 @@
1613
1664
  */
1614
1665
  function postProcess$1(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
1615
1666
  return new Promise((resolve, reject) => {
1616
- template.data = common.replaceInTemplate(template.data, templateDictionary);
1617
- common.updateItemTemplateFromDictionary(itemId, templateDictionary, authentication)
1667
+ template.data = common__namespace.replaceInTemplate(template.data, templateDictionary);
1668
+ common__namespace
1669
+ .updateItemTemplateFromDictionary(itemId, templateDictionary, authentication)
1618
1670
  .then(() => {
1619
- common.updateItemResourceText(itemId, template.data.name, JSON.stringify(template.data.application), authentication)
1671
+ common__namespace
1672
+ .updateItemResourceText(itemId, template.data.name, JSON.stringify(template.data.application), authentication)
1620
1673
  .then(resolve, reject);
1621
1674
  }, reject);
1622
1675
  });
@@ -1625,14 +1678,14 @@
1625
1678
 
1626
1679
  var quickcapture = /*#__PURE__*/Object.freeze({
1627
1680
  __proto__: null,
1628
- convertItemToTemplate: convertItemToTemplate$5,
1681
+ convertItemToTemplate: convertItemToTemplate$3,
1629
1682
  convertQuickCaptureToTemplate: convertQuickCaptureToTemplate,
1630
1683
  _templatizeApplication: _templatizeApplication,
1631
1684
  _templatizeAdminEmail: _templatizeAdminEmail,
1632
1685
  _updateDependencies: _updateDependencies,
1633
1686
  _templatizeUrl: _templatizeUrl,
1634
1687
  _templatizeId: _templatizeId,
1635
- createItemFromTemplate: createItemFromTemplate$2,
1688
+ createItemFromTemplate: createItemFromTemplate$1,
1636
1689
  postProcess: postProcess$1
1637
1690
  });
1638
1691
 
@@ -1662,18 +1715,19 @@
1662
1715
  * Converts an AGOL webmap item to a template.
1663
1716
  *
1664
1717
  * @param itemTemplate Template for the webmap item
1665
- * @param authentication credentials for the request
1718
+ * @param destAuthentication Credentials for requests to the destination organization
1719
+ * @param srcAuthentication Credentials for requests to source items
1666
1720
  * @return Template for the solution item that contains key details for item reconstruction
1667
1721
  */
1668
- function convertItemToTemplate$6(itemTemplate, authentication) {
1722
+ function convertItemToTemplate$2(itemTemplate, destAuthentication, srcAuthentication) {
1669
1723
  return new Promise((resolve, reject) => {
1670
1724
  // Templatize the app URL
1671
- itemTemplate.item.url =
1672
- common.checkUrlPathTermination(common.placeholder(common.SERVER_NAME)) +
1725
+ itemTemplate.item.url = itemTemplate.item.url ?
1726
+ common__namespace.checkUrlPathTermination(common__namespace.placeholder(common__namespace.SERVER_NAME)) +
1673
1727
  WEBMAP_APP_URL_PART +
1674
- itemTemplate.item.id; // templatized id
1728
+ itemTemplate.item.id : itemTemplate.item.url; // templatized id
1675
1729
  // Extract dependencies
1676
- _extractDependencies$3(itemTemplate, authentication).then((results) => {
1730
+ _extractDependencies(itemTemplate, srcAuthentication).then((results) => {
1677
1731
  itemTemplate.dependencies = results.dependencies;
1678
1732
  // Templatize the map layer ids after we've extracted them as dependencies
1679
1733
  if (itemTemplate.data) {
@@ -1683,7 +1737,7 @@
1683
1737
  _excludeInitialState(itemTemplate.data);
1684
1738
  }
1685
1739
  resolve(itemTemplate);
1686
- }, e => reject(common.fail(e)));
1740
+ }, e => reject(common__namespace.fail(e)));
1687
1741
  });
1688
1742
  }
1689
1743
  /**
@@ -1694,16 +1748,16 @@
1694
1748
  * @return List of dependencies ids and url/itemId hash
1695
1749
  * @protected
1696
1750
  */
1697
- function _extractDependencies$3(itemTemplate, authentication) {
1751
+ function _extractDependencies(itemTemplate, authentication) {
1698
1752
  return new Promise((resolve, reject) => {
1699
1753
  const dependencies = [];
1700
1754
  if (itemTemplate.data) {
1701
1755
  const layers = itemTemplate.data.operationalLayers || [];
1702
1756
  const tables = itemTemplate.data.tables || [];
1703
1757
  const layersAndTables = layers.concat(tables);
1704
- _getLayerIds$1(layersAndTables, dependencies, authentication).then(results => {
1758
+ _getLayerIds(layersAndTables, dependencies, authentication).then(results => {
1705
1759
  resolve(results);
1706
- }, e => reject(common.fail(e)));
1760
+ }, e => reject(common__namespace.fail(e)));
1707
1761
  }
1708
1762
  else {
1709
1763
  resolve({
@@ -1724,7 +1778,7 @@
1724
1778
  * @protected
1725
1779
  */
1726
1780
  function _excludeInitialState(data) {
1727
- common.deleteProp(data, "initialState");
1781
+ common__namespace.deleteProp(data, "initialState");
1728
1782
  }
1729
1783
  /**
1730
1784
  * Extracts the AGOL itemId for each layer or table object in a list using the url.
@@ -1735,7 +1789,7 @@
1735
1789
  * @return List of dependencies ids and url/itemId hash
1736
1790
  * @protected
1737
1791
  */
1738
- function _getLayerIds$1(layerList, dependencies, authentication) {
1792
+ function _getLayerIds(layerList, dependencies, authentication) {
1739
1793
  return new Promise((resolve, reject) => {
1740
1794
  const urlHash = {};
1741
1795
  const options = {
@@ -1751,7 +1805,7 @@
1751
1805
  if (baseUrl) {
1752
1806
  // avoid redundant checks when we have a layer with subLayers
1753
1807
  if (Object.keys(layerChecks).indexOf(baseUrl) < 0) {
1754
- layerChecks[baseUrl] = common.rest_request(layer.url, options);
1808
+ layerChecks[baseUrl] = common__namespace.rest_request(layer.url, options);
1755
1809
  }
1756
1810
  layerPromises.push(layerChecks[baseUrl]);
1757
1811
  return true;
@@ -1767,7 +1821,7 @@
1767
1821
  if (layerPromises.length > 0) {
1768
1822
  Promise.all(layerPromises).then(serviceResponses => {
1769
1823
  serviceResponses.forEach((serviceResponse, i) => {
1770
- if (common.getProp(serviceResponse, "serviceItemId")) {
1824
+ if (common__namespace.getProp(serviceResponse, "serviceItemId")) {
1771
1825
  const id = serviceResponse.serviceItemId;
1772
1826
  if (dependencies.indexOf(id) < 0) {
1773
1827
  dependencies.push(id);
@@ -1779,7 +1833,7 @@
1779
1833
  dependencies: dependencies,
1780
1834
  urlHash: urlHash
1781
1835
  });
1782
- }, e => reject(common.fail(e)));
1836
+ }, e => reject(common__namespace.fail(e)));
1783
1837
  }
1784
1838
  else {
1785
1839
  resolve({
@@ -1805,8 +1859,8 @@
1805
1859
  ? urlHash[layer.url]
1806
1860
  : undefined;
1807
1861
  if (id) {
1808
- layer.url = common.templatizeTerm(id, id, ".layer" + layerId + ".url");
1809
- layer.itemId = common.templatizeTerm(id, id, ".layer" + layerId + ".itemId");
1862
+ layer.url = common__namespace.templatizeTerm(id, id, ".layer" + layerId + ".url");
1863
+ layer.itemId = common__namespace.templatizeTerm(id, id, ".layer" + layerId + ".itemId");
1810
1864
  }
1811
1865
  }
1812
1866
  });
@@ -1818,7 +1872,7 @@
1818
1872
  * @param datasourceInfos A list of datasource info objects that contain key values to templatize field references
1819
1873
  * @returns The solutionTemplate with templatized field references
1820
1874
  */
1821
- function postProcessFieldReferences$2(solutionTemplate, datasourceInfos) {
1875
+ function postProcessFieldReferences$1(solutionTemplate, datasourceInfos) {
1822
1876
  const paths = [
1823
1877
  "data.operationalLayers",
1824
1878
  "data.tables",
@@ -1835,9 +1889,9 @@
1835
1889
  * @param path A string path to the object property to templatize
1836
1890
  */
1837
1891
  function _templatizeProperty(solutionTemplate, datasourceInfos, path) {
1838
- const objs = common.getProp(solutionTemplate, path);
1892
+ const objs = common__namespace.getProp(solutionTemplate, path);
1839
1893
  if (objs) {
1840
- common.setProp(solutionTemplate, path, _templatize$1(objs, datasourceInfos));
1894
+ common__namespace.setProp(solutionTemplate, path, _templatize(objs, datasourceInfos));
1841
1895
  }
1842
1896
  }
1843
1897
  /**
@@ -1847,21 +1901,21 @@
1847
1901
  * @param datasourceInfos A list of datasource info objects that contain key values to templatize field references
1848
1902
  * @returns updated instances of the objects
1849
1903
  */
1850
- function _templatize$1(objs, datasourceInfos) {
1904
+ function _templatize(objs, datasourceInfos) {
1851
1905
  objs.forEach(obj => {
1852
- const ds = _getDatasourceInfo$1(obj, datasourceInfos);
1906
+ const ds = _getDatasourceInfo(obj, datasourceInfos);
1853
1907
  if (ds) {
1854
1908
  const fieldNames = ds.fields.map(f => f.name);
1855
- common._templatizePopupInfo(obj, ds, ds.basePath, ds.itemId, fieldNames);
1856
- common._templatizeDefinitionEditor(obj, ds.basePath, fieldNames);
1909
+ common__namespace._templatizePopupInfo(obj, ds, ds.basePath, ds.itemId, fieldNames);
1910
+ common__namespace._templatizeDefinitionEditor(obj, ds.basePath, fieldNames);
1857
1911
  if (obj.layerDefinition) {
1858
- common._templatizeDrawingInfo(obj.layerDefinition, ds.basePath, fieldNames);
1859
- common._templatizeDefinitionExpression(obj.layerDefinition, ds.basePath, fieldNames);
1912
+ common__namespace._templatizeDrawingInfo(obj.layerDefinition, ds.basePath, fieldNames);
1913
+ common__namespace._templatizeDefinitionExpression(obj.layerDefinition, ds.basePath, fieldNames);
1860
1914
  }
1861
1915
  // used for applicationProperties search layers
1862
- const fieldName = common.getProp(obj, "field.name");
1916
+ const fieldName = common__namespace.getProp(obj, "field.name");
1863
1917
  if (fieldName) {
1864
- common.setProp(obj, "field.name", common._templatizeFieldName(fieldName, obj, ds.itemId, ds.basePath));
1918
+ common__namespace.setProp(obj, "field.name", common__namespace._templatizeFieldName(fieldName, obj, ds.itemId, ds.basePath));
1865
1919
  }
1866
1920
  }
1867
1921
  });
@@ -1874,7 +1928,7 @@
1874
1928
  * @param datasourceInfos A list of datasource info objects that contain key values to templatize field references
1875
1929
  * @returns datasourceInfo for the given object id
1876
1930
  */
1877
- function _getDatasourceInfo$1(obj, datasourceInfos) {
1931
+ function _getDatasourceInfo(obj, datasourceInfos) {
1878
1932
  let datasourceInfo;
1879
1933
  datasourceInfos.some(ds => {
1880
1934
  if (ds.ids.indexOf(obj.id) > -1) {
@@ -1908,19 +1962,20 @@
1908
1962
  *
1909
1963
  * @param solutionItemId The solution to contain the template
1910
1964
  * @param itemInfo Info about the item
1911
- * @param authentication Credentials for working with AGO
1965
+ * @param destAuthentication Credentials for requests to the destination organization
1966
+ * @param srcAuthentication Credentials for requests to source items
1912
1967
  * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
1913
1968
  *
1914
1969
  * @return A promise that will resolve when the template has been created
1915
1970
  */
1916
- function convertItemToTemplate$7(solutionItemId, itemInfo, authentication, templateDictionary) {
1971
+ function convertItemToTemplate$1(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
1917
1972
  return new Promise((resolve, reject) => {
1918
1973
  // Init template
1919
- const itemTemplate = common.createInitializedItemTemplate(itemInfo);
1974
+ const itemTemplate = common__namespace.createInitializedItemTemplate(itemInfo);
1920
1975
  // Templatize item info property values
1921
- itemTemplate.item.id = common.templatizeTerm(itemTemplate.item.id, itemTemplate.item.id, ".itemId");
1976
+ itemTemplate.item.id = common__namespace.templatizeTerm(itemTemplate.item.id, itemTemplate.item.id, ".itemId");
1922
1977
  // Request related items
1923
- const relatedPromise = common.getItemRelatedItemsInSameDirection(itemTemplate.itemId, "forward", authentication);
1978
+ const relatedPromise = common__namespace.getItemRelatedItemsInSameDirection(itemTemplate.itemId, "forward", srcAuthentication);
1924
1979
  // Perform type-specific handling
1925
1980
  let dataPromise = Promise.resolve({});
1926
1981
  switch (itemInfo.type) {
@@ -1940,15 +1995,16 @@
1940
1995
  case "Notebook":
1941
1996
  dataPromise = new Promise(resolveJSON => {
1942
1997
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
1943
- common.getItemDataAsJson(itemTemplate.itemId, authentication)
1998
+ common__namespace
1999
+ .getItemDataAsJson(itemTemplate.itemId, srcAuthentication)
1944
2000
  .then(json => resolveJSON(json));
1945
2001
  });
1946
2002
  break;
1947
2003
  case "Form":
1948
- dataPromise = common.getItemDataAsFile(itemTemplate.itemId, itemTemplate.item.name, authentication);
2004
+ dataPromise = common__namespace.getItemDataAsFile(itemTemplate.itemId, itemTemplate.item.name, srcAuthentication);
1949
2005
  break;
1950
2006
  case "QuickCapture Project":
1951
- dataPromise = common.getItemResourcesFiles(itemTemplate.itemId, authentication);
2007
+ dataPromise = common__namespace.getItemResourcesFiles(itemTemplate.itemId, srcAuthentication);
1952
2008
  break;
1953
2009
  }
1954
2010
  // Errors are handled as resolved empty values; this means that there's no `reject` clause to handle, hence:
@@ -1956,7 +2012,7 @@
1956
2012
  Promise.all([dataPromise, relatedPromise]).then(responses => {
1957
2013
  const [itemDataResponse, relatedItemsResponse] = responses;
1958
2014
  // need to pre-process for velocity urls before they could be templatized by other processors
1959
- itemTemplate.data = common.updateVelocityReferences(itemDataResponse, itemInfo.type, templateDictionary);
2015
+ itemTemplate.data = common__namespace.updateVelocityReferences(itemDataResponse, itemInfo.type, templateDictionary);
1960
2016
  const relationships = relatedItemsResponse;
1961
2017
  // Save the mappings to related items & add those items to the dependencies, but not WMA Code Attachments
1962
2018
  itemTemplate.dependencies = [];
@@ -1976,7 +2032,7 @@
1976
2032
  let templateModifyingPromise = Promise.resolve(itemTemplate);
1977
2033
  switch (itemInfo.type) {
1978
2034
  case "Dashboard":
1979
- convertItemToTemplate(itemTemplate);
2035
+ convertItemToTemplate$8(itemTemplate);
1980
2036
  break;
1981
2037
  case "Form":
1982
2038
  // Store the form's data in the solution resources, not in template
@@ -1988,9 +2044,10 @@
1988
2044
  ? originalFilename
1989
2045
  : `${itemTemplate.itemId}.zip`;
1990
2046
  itemTemplate.item.name = filename;
1991
- const storageName = common.convertItemResourceToStorageResource(itemTemplate.itemId + "_info_data", filename, common.SolutionTemplateFormatVersion);
2047
+ const storageName = common__namespace.convertItemResourceToStorageResource(itemTemplate.itemId + "_info_data", filename, common__namespace.SolutionTemplateFormatVersion);
1992
2048
  wrapupPromise = new Promise((resolveDataStorage, rejectDataStorage) => {
1993
- common.addResourceFromBlob(itemDataResponse, solutionItemId, storageName.folder, filename, authentication)
2049
+ common__namespace
2050
+ .addResourceFromBlob(itemDataResponse, solutionItemId, storageName.folder, filename, destAuthentication)
1994
2051
  .then(() => {
1995
2052
  // Update the template's resources
1996
2053
  itemTemplate.resources.push(storageName.folder + "/" + storageName.filename);
@@ -2003,27 +2060,27 @@
2003
2060
  convertNotebookToTemplate(itemTemplate);
2004
2061
  break;
2005
2062
  case "Oriented Imagery Catalog":
2006
- templateModifyingPromise = convertItemToTemplate$4(itemTemplate, authentication);
2063
+ templateModifyingPromise = convertItemToTemplate$4(itemTemplate, destAuthentication, srcAuthentication);
2007
2064
  break;
2008
2065
  case "Web Map":
2009
2066
  case "Web Scene":
2010
- templateModifyingPromise = convertItemToTemplate$6(itemTemplate, authentication);
2067
+ templateModifyingPromise = convertItemToTemplate$2(itemTemplate, destAuthentication, srcAuthentication);
2011
2068
  break;
2012
2069
  case "Web Mapping Application":
2013
2070
  if (itemDataResponse) {
2014
- templateModifyingPromise = convertItemToTemplate$1(itemTemplate, authentication);
2071
+ templateModifyingPromise = convertItemToTemplate$7(itemTemplate, destAuthentication, srcAuthentication);
2015
2072
  }
2016
2073
  break;
2017
2074
  case "Workforce Project":
2018
- templateModifyingPromise = convertItemToTemplate$2(itemTemplate, authentication);
2075
+ templateModifyingPromise = convertItemToTemplate$6(itemTemplate, destAuthentication, srcAuthentication);
2019
2076
  break;
2020
2077
  case "QuickCapture Project":
2021
2078
  templateModifyingPromise = convertQuickCaptureToTemplate(itemTemplate);
2022
2079
  break;
2023
2080
  }
2024
2081
  wrapupPromise.then(() => {
2025
- templateModifyingPromise.then(resolve, err => reject(common.fail(err)));
2026
- }, err => reject(common.fail(err)));
2082
+ templateModifyingPromise.then(resolve, err => reject(common__namespace.fail(err)));
2083
+ }, err => reject(common__namespace.fail(err)));
2027
2084
  });
2028
2085
  });
2029
2086
  }
@@ -2046,8 +2103,8 @@
2046
2103
 
2047
2104
  var simpleTypeHelpers = /*#__PURE__*/Object.freeze({
2048
2105
  __proto__: null,
2049
- createItemFromTemplate: createItemFromTemplate,
2050
- convertItemToTemplate: convertItemToTemplate$7
2106
+ createItemFromTemplate: createItemFromTemplate$3,
2107
+ convertItemToTemplate: convertItemToTemplate$1
2051
2108
  });
2052
2109
 
2053
2110
  /** @license
@@ -2070,12 +2127,13 @@
2070
2127
  *
2071
2128
  * @param solutionItemId The solution to contain the template
2072
2129
  * @param itemInfo Info about the item
2073
- * @param authentication Credentials for working with AGO
2130
+ * @param destAuthentication Credentials for requests to the destination organization
2131
+ * @param srcAuthentication Credentials for requests to source items
2074
2132
  * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
2075
2133
  * @return A promise that will resolve when the template has been created
2076
2134
  */
2077
- function convertItemToTemplate$8(solutionItemId, itemInfo, authentication, templateDictionary) {
2078
- return convertItemToTemplate$7(solutionItemId, itemInfo, authentication, templateDictionary);
2135
+ function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
2136
+ return convertItemToTemplate$1(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary);
2079
2137
  }
2080
2138
  /**
2081
2139
  * Delegate to simpleType creator
@@ -2085,8 +2143,8 @@
2085
2143
  * @param destinationAuthentication
2086
2144
  * @param itemProgressCallback
2087
2145
  */
2088
- function createItemFromTemplate$3(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
2089
- return createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback);
2146
+ function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
2147
+ return createItemFromTemplate$3(template, templateDictionary, destinationAuthentication, itemProgressCallback);
2090
2148
  }
2091
2149
  /**
2092
2150
  * Templatizes field references within specific template types.
@@ -2097,16 +2155,16 @@
2097
2155
  * @param type The item type
2098
2156
  * @return The updated solution template
2099
2157
  */
2100
- function postProcessFieldReferences$3(solutionTemplate, datasourceInfos, type) {
2158
+ function postProcessFieldReferences(solutionTemplate, datasourceInfos, type) {
2101
2159
  switch (type) {
2102
2160
  case "Web Mapping Application":
2103
- postProcessFieldReferences$1(solutionTemplate, datasourceInfos);
2161
+ postProcessFieldReferences$2(solutionTemplate, datasourceInfos);
2104
2162
  break;
2105
2163
  case "Dashboard":
2106
- postProcessFieldReferences(solutionTemplate, datasourceInfos);
2164
+ postProcessFieldReferences$3(solutionTemplate, datasourceInfos);
2107
2165
  break;
2108
2166
  case "Web Map":
2109
- postProcessFieldReferences$2(solutionTemplate, datasourceInfos);
2167
+ postProcessFieldReferences$1(solutionTemplate, datasourceInfos);
2110
2168
  break;
2111
2169
  }
2112
2170
  return solutionTemplate;
@@ -2121,16 +2179,16 @@
2121
2179
  * @param {UserSession} authentication The destination session info
2122
2180
  * @returns Promise resolving to successfulness of update
2123
2181
  */
2124
- function postProcess$2(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
2182
+ function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
2125
2183
  return common.updateItemTemplateFromDictionary(itemId, templateDictionary, authentication);
2126
2184
  }
2127
2185
 
2128
2186
  var simpleTypes = /*#__PURE__*/Object.freeze({
2129
2187
  __proto__: null,
2130
- convertItemToTemplate: convertItemToTemplate$8,
2131
- createItemFromTemplate: createItemFromTemplate$3,
2132
- postProcessFieldReferences: postProcessFieldReferences$3,
2133
- postProcess: postProcess$2
2188
+ convertItemToTemplate: convertItemToTemplate,
2189
+ createItemFromTemplate: createItemFromTemplate,
2190
+ postProcessFieldReferences: postProcessFieldReferences,
2191
+ postProcess: postProcess
2134
2192
  });
2135
2193
 
2136
2194
  exports.notebookHelpers = notebookHelpers;
@@ -2142,5 +2200,5 @@
2142
2200
 
2143
2201
  Object.defineProperty(exports, '__esModule', { value: true });
2144
2202
 
2145
- })));
2203
+ }));
2146
2204
  //# sourceMappingURL=simple-types.umd.js.map