@esri/solution-feature-layer 1.1.2 → 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-feature-layer - v1.1.2 - Apache-2.0
2
+ * @esri/solution-feature-layer - v1.2.0 - Apache-2.0
3
3
  * Copyright (c) 2018-2021 Esri, Inc.
4
- * Mon Aug 30 2021 23:57:20 GMT-0700 (Pacific Daylight Time)
4
+ * Thu Dec 09 2021 16:03:00 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.
@@ -16,249 +16,238 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  (function (global, factory) {
19
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common')) :
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';
19
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common')) :
20
+ typeof define === 'function' && define.amd ? define(['exports', '@esri/solution-common'], factory) :
21
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution));
22
+ })(this, (function (exports, common) { 'use strict';
23
23
 
24
- /*! *****************************************************************************
25
- Copyright (c) Microsoft Corporation. All rights reserved.
26
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
27
- this file except in compliance with the License. You may obtain a copy of the
28
- License at http://www.apache.org/licenses/LICENSE-2.0
29
-
30
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
31
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
32
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
33
- MERCHANTABLITY OR NON-INFRINGEMENT.
34
-
35
- See the Apache Version 2.0 License for specific language governing permissions
36
- and limitations under the License.
37
- ***************************************************************************** */
38
-
39
- var __assign = function() {
40
- __assign = Object.assign || function __assign(t) {
41
- for (var s, i = 1, n = arguments.length; i < n; i++) {
42
- s = arguments[i];
43
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
44
- }
45
- return t;
46
- };
47
- return __assign.apply(this, arguments);
48
- };
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
+ }
49
41
 
50
- /** @license
51
- * Copyright 2018 Esri
52
- *
53
- * Licensed under the Apache License, Version 2.0 (the "License");
54
- * you may not use this file except in compliance with the License.
55
- * You may obtain a copy of the License at
56
- *
57
- * http://www.apache.org/licenses/LICENSE-2.0
58
- *
59
- * Unless required by applicable law or agreed to in writing, software
60
- * distributed under the License is distributed on an "AS IS" BASIS,
61
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
62
- * See the License for the specific language governing permissions and
63
- * limitations under the License.
64
- */
65
- //#endregion
66
- //#region Publish Process --------------------------------------------------------------------------------------//
67
- /**
68
- * Fills in missing data, including full layer and table definitions, in a feature services' definition.
69
- *
70
- * @param solutionItemId
71
- * @param itemInfo Feature service item
72
- * @param userSession The session used to interact with the service the template is based on
73
- * @param templateDictionary Hash mapping property names to replacement values
74
- * @return A promise that will resolve when fullItem has been updated
75
- */
76
- function convertItemToTemplate(solutionItemId, itemInfo, authentication, templateDictionary) {
77
- return new Promise(function (resolve, reject) {
78
- // Init template
79
- var template = common.createInitializedItemTemplate(itemInfo);
80
- var hasInvalidDesignations = common.hasInvalidGroupDesignations(itemInfo.groupDesignations);
81
- if (hasInvalidDesignations) {
82
- common.updateTemplateForInvalidDesignations(template, authentication)
83
- .then(function (_template) { return resolve(_template); }, function (e) { return reject(common.fail(e)); });
84
- }
85
- else {
86
- // Update the estimated cost factor to deploy this item
87
- template.estimatedDeploymentCostFactor = 10;
88
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
89
- common.getItemDataAsJson(template.item.id, authentication).then(function (data) {
90
- template.data = data;
91
- common.getServiceLayersAndTables(template, authentication).then(function (itemTemplate) {
92
- // Extract dependencies
93
- common.extractDependencies(itemTemplate, authentication).then(function (dependencies) {
94
- // set the dependencies as an array of IDs from the array of IDependency
95
- itemTemplate.dependencies = dependencies.map(function (dep) { return dep.id; });
96
- // resolve the template with templatized values
97
- resolve(common.templatize(itemTemplate, dependencies, false, templateDictionary));
98
- }, function (e) { return reject(common.fail(e)); });
99
- }, function (e) { return reject(common.fail(e)); });
100
- });
101
- }
102
- });
103
- }
104
- //#endregion
105
- //#region Deploy Process ---------------------------------------------------------------------------------------//
106
- /**
107
- * Creates an item in a specified folder (except for Group item type).
108
- *
109
- * @param itemTemplate Item to be created; n.b.: this item is modified
110
- * @param folderId Id of folder to receive item; null indicates that the item goes into the root
111
- * folder; ignored for Group item type
112
- * @param settings Hash mapping property names to replacement values
113
- * @param authentication Credentials for the request
114
- * @return A promise that will resolve with the id of the created item
115
- * @protected
116
- */
117
- function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
118
- return new Promise(function (resolve) {
119
- // Interrupt process if progress callback returns `false`
120
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Started, 0)) {
121
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Ignored, 0);
122
- resolve(common.generateEmptyCreationResponse(template.type));
123
- return;
124
- }
125
- // Replace the templatized symbols in a copy of the template
126
- var newItemTemplate = common.cloneObject(template);
127
- newItemTemplate = common.replaceInTemplate(newItemTemplate, templateDictionary);
128
- // Thumbnail has to be updated separately; doesn't work in create service call
129
- delete newItemTemplate.item.thumbnail;
130
- // cache the popup info to be added later
131
- var popupInfos = common.cachePopupInfos(newItemTemplate.data);
132
- // Create the item, then update its URL with its new id
133
- common.createFeatureService(newItemTemplate, destinationAuthentication, templateDictionary)
134
- .then(function (createResponse) {
135
- if (createResponse.success) {
136
- // Interrupt process if progress callback returns `false`
137
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.serviceItemId)) {
138
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Cancelled, 0);
139
- common.removeItem(createResponse.serviceItemId, destinationAuthentication)
140
- .then(function () {
141
- return resolve(common.generateEmptyCreationResponse(template.type));
142
- }, function () {
143
- return resolve(common.generateEmptyCreationResponse(template.type));
144
- });
145
- }
146
- else {
147
- // Detemplatize what we can now that the service has been created
148
- newItemTemplate = common.updateTemplate(newItemTemplate, templateDictionary, createResponse);
149
- // Add the layers and tables to the feature service
150
- common.addFeatureServiceLayersAndTables(newItemTemplate, templateDictionary, popupInfos, destinationAuthentication)
151
- .then(function () {
152
- newItemTemplate = common.updateTemplate(newItemTemplate, templateDictionary, createResponse);
153
- // Update the item with snippet, description, popupInfo, etc.
154
- common.updateItemExtended(__assign(__assign({}, newItemTemplate.item), { url: undefined // can't update the URL of a feature service
155
- }), newItemTemplate.data, destinationAuthentication, template.item.thumbnail)
156
- .then(function () {
157
- // Interrupt process if progress callback returns `false`
158
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor / 2, createResponse.serviceItemId)) {
159
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Cancelled, 0);
160
- common.removeItem(createResponse.serviceItemId, destinationAuthentication)
161
- .then(function () {
162
- return resolve(common.generateEmptyCreationResponse(template.type));
163
- }, function () {
164
- return resolve(common.generateEmptyCreationResponse(template.type));
165
- });
166
- }
167
- else {
168
- // Update the template to match what we've stored in AGO
169
- common.getItemBase(newItemTemplate.itemId, destinationAuthentication)
170
- .then(function (updatedItem) {
171
- newItemTemplate.item = updatedItem;
172
- /* istanbul ignore else */
173
- if (common.getProp(newItemTemplate, "item.url") &&
174
- !newItemTemplate.item.url.endsWith("/")) {
175
- newItemTemplate.item.url += "/";
176
- }
177
- resolve({
178
- item: newItemTemplate,
179
- id: createResponse.serviceItemId,
180
- type: newItemTemplate.type,
181
- postProcess: common.hasUnresolvedVariables({
182
- item: newItemTemplate.item,
183
- data: newItemTemplate.data
184
- }) ||
185
- common.isWorkforceProject(newItemTemplate)
186
- });
187
- }, function () {
188
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
189
- common.removeItem(createResponse.serviceItemId, destinationAuthentication)
190
- .then(function () {
191
- return resolve(common.generateEmptyCreationResponse(template.type));
192
- }, function () {
193
- return resolve(common.generateEmptyCreationResponse(template.type));
194
- });
195
- } // fails to update item
196
- );
197
- }
198
- }, function () {
199
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
200
- common.removeItem(createResponse.serviceItemId, destinationAuthentication)
201
- .then(function () {
202
- return resolve(common.generateEmptyCreationResponse(template.type));
203
- }, function () {
204
- return resolve(common.generateEmptyCreationResponse(template.type));
205
- });
206
- } // fails to update item
207
- );
208
- }, function () {
209
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
210
- common.removeItem(createResponse.serviceItemId, destinationAuthentication)
211
- .then(function () {
212
- return resolve(common.generateEmptyCreationResponse(template.type));
213
- }, function () {
214
- return resolve(common.generateEmptyCreationResponse(template.type));
215
- });
216
- } // fails to add service layers and/or tables
217
- );
218
- }
219
- }
220
- else {
221
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
222
- resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item
223
- }
224
- }, function () {
225
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
226
- resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item
227
- });
228
- });
229
- }
230
- /**
231
- * Feature Layer post-processing actions
232
- *
233
- * @param {string} itemId The item ID
234
- * @param {string} type The template type
235
- * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
236
- * @param {any} templateDictionary The template dictionary
237
- * @param {UserSession} authentication The destination session info
238
- * @returns Promise resolving to successfulness of update
239
- */
240
- function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
241
- return new Promise(function (resolve, reject) {
242
- common.updateItemTemplateFromDictionary(itemId, templateDictionary, authentication)
243
- .then(function (results) {
244
- if (common.isWorkforceProject(template)) {
245
- template = common.replaceInTemplate(template, templateDictionary);
246
- common.fineTuneCreatedWorkforceItem(template, authentication, template.item.url, templateDictionary)
247
- .then(resolve, reject);
248
- }
249
- else {
250
- resolve(results);
251
- }
252
- }, reject);
253
- });
254
- }
255
- //#endregion
42
+ var common__namespace = /*#__PURE__*/_interopNamespace(common);
256
43
 
257
- exports.convertItemToTemplate = convertItemToTemplate;
258
- exports.createItemFromTemplate = createItemFromTemplate;
259
- exports.postProcess = postProcess;
44
+ /** @license
45
+ * Copyright 2018 Esri
46
+ *
47
+ * Licensed under the Apache License, Version 2.0 (the "License");
48
+ * you may not use this file except in compliance with the License.
49
+ * You may obtain a copy of the License at
50
+ *
51
+ * http://www.apache.org/licenses/LICENSE-2.0
52
+ *
53
+ * Unless required by applicable law or agreed to in writing, software
54
+ * distributed under the License is distributed on an "AS IS" BASIS,
55
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56
+ * See the License for the specific language governing permissions and
57
+ * limitations under the License.
58
+ */
59
+ //#endregion
60
+ //#region Publish Process --------------------------------------------------------------------------------------//
61
+ /**
62
+ * Fills in missing data, including full layer and table definitions, in a feature services' definition.
63
+ *
64
+ * @param solutionItemId
65
+ * @param itemInfo Feature service item
66
+ * @param destAuthentication Credentials for requests to the destination organization
67
+ * @param srcAuthentication Credentials for requests to source items
68
+ * @param templateDictionary Hash mapping property names to replacement values
69
+ * @return A promise that will resolve when fullItem has been updated
70
+ */
71
+ function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
72
+ return new Promise((resolve, reject) => {
73
+ // Init template
74
+ const template = common__namespace.createInitializedItemTemplate(itemInfo);
75
+ const hasInvalidDesignations = common__namespace.hasInvalidGroupDesignations(itemInfo.groupDesignations);
76
+ if (hasInvalidDesignations) {
77
+ common__namespace
78
+ .updateTemplateForInvalidDesignations(template, srcAuthentication)
79
+ .then(_template => resolve(_template), e => reject(common__namespace.fail(e)));
80
+ }
81
+ else {
82
+ // Update the estimated cost factor to deploy this item
83
+ template.estimatedDeploymentCostFactor = 10;
84
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
85
+ common__namespace.getItemDataAsJson(template.item.id, srcAuthentication).then(data => {
86
+ template.data = data;
87
+ common__namespace.getServiceLayersAndTables(template, srcAuthentication).then(itemTemplate => {
88
+ // Extract dependencies
89
+ common__namespace.extractDependencies(itemTemplate, srcAuthentication).then((dependencies) => {
90
+ // set the dependencies as an array of IDs from the array of IDependency
91
+ itemTemplate.dependencies = dependencies.map((dep) => dep.id);
92
+ // resolve the template with templatized values
93
+ resolve(common__namespace.templatize(itemTemplate, dependencies, false, templateDictionary));
94
+ }, (e) => reject(common__namespace.fail(e)));
95
+ }, e => reject(common__namespace.fail(e)));
96
+ });
97
+ }
98
+ });
99
+ }
100
+ //#endregion
101
+ //#region Deploy Process ---------------------------------------------------------------------------------------//
102
+ /**
103
+ * Creates an item in a specified folder (except for Group item type).
104
+ *
105
+ * @param itemTemplate Item to be created; n.b.: this item is modified
106
+ * @param folderId Id of folder to receive item; null indicates that the item goes into the root
107
+ * folder; ignored for Group item type
108
+ * @param settings Hash mapping property names to replacement values
109
+ * @param authentication Credentials for the request
110
+ * @return A promise that will resolve with the id of the created item
111
+ * @protected
112
+ */
113
+ function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
114
+ return new Promise(resolve => {
115
+ // Interrupt process if progress callback returns `false`
116
+ if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Started, 0)) {
117
+ itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Ignored, 0);
118
+ resolve(common__namespace.generateEmptyCreationResponse(template.type));
119
+ return;
120
+ }
121
+ // Replace the templatized symbols in a copy of the template
122
+ let newItemTemplate = common__namespace.cloneObject(template);
123
+ newItemTemplate = common__namespace.replaceInTemplate(newItemTemplate, templateDictionary);
124
+ // Thumbnail has to be updated separately; doesn't work in create service call
125
+ delete newItemTemplate.item.thumbnail;
126
+ // cache the popup info to be added later
127
+ const popupInfos = common__namespace.cachePopupInfos(newItemTemplate.data);
128
+ // Create the item, then update its URL with its new id
129
+ common__namespace
130
+ .createFeatureService(newItemTemplate, destinationAuthentication, templateDictionary)
131
+ .then(createResponse => {
132
+ if (createResponse.success) {
133
+ // Interrupt process if progress callback returns `false`
134
+ if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.serviceItemId)) {
135
+ itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
136
+ common__namespace
137
+ .removeItem(createResponse.serviceItemId, destinationAuthentication)
138
+ .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
139
+ }
140
+ else {
141
+ // Detemplatize what we can now that the service has been created
142
+ newItemTemplate = common__namespace.updateTemplate(newItemTemplate, templateDictionary, createResponse);
143
+ // Add the layers and tables to the feature service
144
+ common__namespace
145
+ .addFeatureServiceLayersAndTables(newItemTemplate, templateDictionary, popupInfos, destinationAuthentication)
146
+ .then(() => {
147
+ newItemTemplate = common__namespace.updateTemplate(newItemTemplate, templateDictionary, createResponse);
148
+ // Update the item with snippet, description, popupInfo, etc.
149
+ common__namespace
150
+ .updateItemExtended({
151
+ ...newItemTemplate.item,
152
+ url: undefined // can't update the URL of a feature service
153
+ }, newItemTemplate.data, destinationAuthentication, template.item.thumbnail, undefined, templateDictionary)
154
+ .then(() => {
155
+ // Interrupt process if progress callback returns `false`
156
+ if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor / 2, createResponse.serviceItemId)) {
157
+ itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
158
+ common__namespace
159
+ .removeItem(createResponse.serviceItemId, destinationAuthentication)
160
+ .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
161
+ }
162
+ else {
163
+ // Update the template to match what we've stored in AGO
164
+ common__namespace
165
+ .getItemBase(newItemTemplate.itemId, destinationAuthentication)
166
+ .then(updatedItem => {
167
+ newItemTemplate.item = updatedItem;
168
+ /* istanbul ignore else */
169
+ if (common__namespace.getProp(newItemTemplate, "item.url") &&
170
+ !newItemTemplate.item.url.endsWith("/")) {
171
+ newItemTemplate.item.url += "/";
172
+ }
173
+ resolve({
174
+ item: newItemTemplate,
175
+ id: createResponse.serviceItemId,
176
+ type: newItemTemplate.type,
177
+ postProcess: common__namespace.hasUnresolvedVariables({
178
+ item: newItemTemplate.item,
179
+ data: newItemTemplate.data
180
+ }) ||
181
+ common__namespace.isWorkforceProject(newItemTemplate)
182
+ });
183
+ }, () => {
184
+ itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
185
+ common__namespace
186
+ .removeItem(createResponse.serviceItemId, destinationAuthentication)
187
+ .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
188
+ } // fails to update item
189
+ );
190
+ }
191
+ }, () => {
192
+ itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
193
+ common__namespace
194
+ .removeItem(createResponse.serviceItemId, destinationAuthentication)
195
+ .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
196
+ } // fails to update item
197
+ );
198
+ }, () => {
199
+ itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
200
+ common__namespace
201
+ .removeItem(createResponse.serviceItemId, destinationAuthentication)
202
+ .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
203
+ } // fails to add service layers and/or tables
204
+ );
205
+ }
206
+ }
207
+ else {
208
+ itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
209
+ resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
210
+ }
211
+ }, () => {
212
+ itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
213
+ resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
214
+ });
215
+ });
216
+ }
217
+ /**
218
+ * Feature Layer post-processing actions
219
+ *
220
+ * @param {string} itemId The item ID
221
+ * @param {string} type The template type
222
+ * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
223
+ * @param {any} templateDictionary The template dictionary
224
+ * @param {UserSession} authentication The destination session info
225
+ * @returns Promise resolving to successfulness of update
226
+ */
227
+ function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
228
+ return new Promise((resolve, reject) => {
229
+ common__namespace
230
+ .updateItemTemplateFromDictionary(itemId, templateDictionary, authentication)
231
+ .then(results => {
232
+ if (common__namespace.isWorkforceProject(template)) {
233
+ template = common__namespace.replaceInTemplate(template, templateDictionary);
234
+ common__namespace
235
+ .fineTuneCreatedWorkforceItem(template, authentication, template.item.url, templateDictionary)
236
+ .then(resolve, reject);
237
+ }
238
+ else {
239
+ resolve(results);
240
+ }
241
+ }, reject);
242
+ });
243
+ }
244
+ //#endregion
260
245
 
261
- Object.defineProperty(exports, '__esModule', { value: true });
246
+ exports.convertItemToTemplate = convertItemToTemplate;
247
+ exports.createItemFromTemplate = createItemFromTemplate;
248
+ exports.postProcess = postProcess;
262
249
 
263
- })));
250
+ Object.defineProperty(exports, '__esModule', { value: true });
251
+
252
+ }));
264
253
  //# sourceMappingURL=feature-layer.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature-layer.umd.js","sources":["../../src/feature-layer.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of feature layers and services.\r\n *\r\n * @module feature-layer\r\n */\r\n\r\n//#region Imports ----------------------------------------------------------------------------------------------//\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n//#endregion\r\n\r\n//#region Publish Process --------------------------------------------------------------------------------------//\r\n\r\n/**\r\n * Fills in missing data, including full layer and table definitions, in a feature services' definition.\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo Feature service item\r\n * @param userSession The session used to interact with the service the template is based on\r\n * @param templateDictionary Hash mapping property names to replacement values\r\n * @return A promise that will resolve when fullItem has been updated\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n authentication: common.UserSession,\r\n templateDictionary?: any\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>((resolve, reject) => {\r\n // Init template\r\n const template: common.IItemTemplate = common.createInitializedItemTemplate(\r\n itemInfo\r\n );\r\n\r\n const hasInvalidDesignations: boolean = common.hasInvalidGroupDesignations(\r\n itemInfo.groupDesignations\r\n );\r\n if (hasInvalidDesignations) {\r\n common\r\n .updateTemplateForInvalidDesignations(template, authentication)\r\n .then(\r\n _template => resolve(_template),\r\n e => reject(common.fail(e))\r\n );\r\n } else {\r\n // Update the estimated cost factor to deploy this item\r\n template.estimatedDeploymentCostFactor = 10;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.getItemDataAsJson(template.item.id, authentication).then(data => {\r\n template.data = data;\r\n common.getServiceLayersAndTables(template, authentication).then(\r\n itemTemplate => {\r\n // Extract dependencies\r\n common.extractDependencies(itemTemplate, authentication).then(\r\n (dependencies: common.IDependency[]) => {\r\n // set the dependencies as an array of IDs from the array of IDependency\r\n itemTemplate.dependencies = dependencies.map(\r\n (dep: any) => dep.id\r\n );\r\n\r\n // resolve the template with templatized values\r\n resolve(\r\n common.templatize(\r\n itemTemplate,\r\n dependencies,\r\n false,\r\n templateDictionary\r\n )\r\n );\r\n },\r\n (e: any) => reject(common.fail(e))\r\n );\r\n },\r\n e => reject(common.fail(e))\r\n );\r\n });\r\n }\r\n });\r\n}\r\n\r\n//#endregion\r\n\r\n//#region Deploy Process ---------------------------------------------------------------------------------------//\r\n\r\n/**\r\n * Creates an item in a specified folder (except for Group item type).\r\n *\r\n * @param itemTemplate Item to be created; n.b.: this item is modified\r\n * @param folderId Id of folder to receive item; null indicates that the item goes into the root\r\n * folder; ignored for Group item type\r\n * @param settings Hash mapping property names to replacement values\r\n * @param authentication Credentials for the request\r\n * @return A promise that will resolve with the id of the created item\r\n * @protected\r\n */\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Started,\r\n 0\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Ignored,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n return;\r\n }\r\n\r\n // Replace the templatized symbols in a copy of the template\r\n let newItemTemplate: common.IItemTemplate = common.cloneObject(template);\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n\r\n // Thumbnail has to be updated separately; doesn't work in create service call\r\n delete newItemTemplate.item.thumbnail;\r\n\r\n // cache the popup info to be added later\r\n const popupInfos: common.IPopupInfos = common.cachePopupInfos(\r\n newItemTemplate.data\r\n );\r\n\r\n // Create the item, then update its URL with its new id\r\n common\r\n .createFeatureService(\r\n newItemTemplate,\r\n destinationAuthentication,\r\n templateDictionary\r\n )\r\n .then(\r\n createResponse => {\r\n if (createResponse.success) {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.serviceItemId\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n ),\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type))\r\n );\r\n } else {\r\n // Detemplatize what we can now that the service has been created\r\n newItemTemplate = common.updateTemplate(\r\n newItemTemplate,\r\n templateDictionary,\r\n createResponse\r\n );\r\n // Add the layers and tables to the feature service\r\n common\r\n .addFeatureServiceLayersAndTables(\r\n newItemTemplate,\r\n templateDictionary,\r\n popupInfos,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () => {\r\n newItemTemplate = common.updateTemplate(\r\n newItemTemplate,\r\n templateDictionary,\r\n createResponse\r\n );\r\n // Update the item with snippet, description, popupInfo, etc.\r\n common\r\n .updateItemExtended(\r\n {\r\n ...newItemTemplate.item,\r\n url: undefined // can't update the URL of a feature service\r\n },\r\n newItemTemplate.data,\r\n destinationAuthentication,\r\n template.item.thumbnail\r\n )\r\n .then(\r\n () => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.serviceItemId\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } else {\r\n // Update the template to match what we've stored in AGO\r\n common\r\n .getItemBase(\r\n newItemTemplate.itemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n updatedItem => {\r\n newItemTemplate.item = updatedItem;\r\n /* istanbul ignore else */\r\n if (\r\n common.getProp(\r\n newItemTemplate,\r\n \"item.url\"\r\n ) &&\r\n !newItemTemplate.item.url.endsWith(\"/\")\r\n ) {\r\n newItemTemplate.item.url += \"/\";\r\n }\r\n\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.serviceItemId,\r\n type: newItemTemplate.type,\r\n postProcess:\r\n common.hasUnresolvedVariables({\r\n item: newItemTemplate.item,\r\n data: newItemTemplate.data\r\n }) ||\r\n common.isWorkforceProject(newItemTemplate)\r\n });\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } // fails to update item\r\n );\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } // fails to update item\r\n );\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n )\r\n );\r\n } // fails to add service layers and/or tables\r\n );\r\n }\r\n } else {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Feature Layer post-processing actions\r\n *\r\n * @param {string} itemId The item ID\r\n * @param {string} type The template type\r\n * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} authentication The destination session info\r\n * @returns Promise resolving to successfulness of update\r\n */\r\nexport function postProcess(\r\n itemId: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: common.IItemTemplate,\r\n templates: common.IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: common.UserSession\r\n): Promise<common.IUpdateItemResponse> {\r\n return new Promise<common.IUpdateItemResponse>((resolve, reject) => {\r\n common\r\n .updateItemTemplateFromDictionary(\r\n itemId,\r\n templateDictionary,\r\n authentication\r\n )\r\n .then(results => {\r\n if (common.isWorkforceProject(template)) {\r\n template = common.replaceInTemplate(template, templateDictionary);\r\n common\r\n .fineTuneCreatedWorkforceItem(\r\n template,\r\n authentication,\r\n template.item.url,\r\n templateDictionary\r\n )\r\n .then(resolve, reject);\r\n } else {\r\n resolve(results);\r\n }\r\n }, reject);\r\n });\r\n}\r\n\r\n//#endregion\r\n"],"names":["common.createInitializedItemTemplate","common.hasInvalidGroupDesignations","common\r\n .updateTemplateForInvalidDesignations","common.fail","common.getItemDataAsJson","common.getServiceLayersAndTables","common.extractDependencies","common.templatize","common.EItemProgressStatus","common.generateEmptyCreationResponse","common.cloneObject","common.replaceInTemplate","common.cachePopupInfos","common\r\n .createFeatureService","common\r\n .removeItem","common.updateTemplate","common\r\n .addFeatureServiceLayersAndTables","common\r\n .updateItemExtended","common\r\n .removeItem","common\r\n .getItemBase","common.getProp","common.hasUnresolvedVariables","common.isWorkforceProject","common\r\n .removeItem","common\r\n .removeItem","common\r\n .removeItem","common\r\n .updateItemTemplateFromDictionary","common\r\n .fineTuneCreatedWorkforceItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;;;;;;;;;;;;;;;IA0BA;IAEA;IAEA;;;;;;;;;aASgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,cAAkC,EAClC,kBAAwB;QAExB,OAAO,IAAI,OAAO,CAAuB,UAAC,OAAO,EAAE,MAAM;;YAEvD,IAAM,QAAQ,GAAyBA,oCAAoC,CACzE,QAAQ,CACT,CAAC;YAEF,IAAM,sBAAsB,GAAYC,kCAAkC,CACxE,QAAQ,CAAC,iBAAiB,CAC3B,CAAC;YACF,IAAI,sBAAsB,EAAE;gBAC1BC,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,CACpD;6BAAA,CACJ,CAAC;yBACL;yBACF,CAAC;qBACL;iBACF;qBAAM;oBACL,oBAAoB,CAClB,QAAQ,CAAC,MAAM,EACfD,0BAA0B,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;oBACF,OAAO,CAACC,oCAAoC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;iBAC9D;aACF,EACD;gBACE,oBAAoB,CAClB,QAAQ,CAAC,MAAM,EACfD,0BAA0B,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;gBACF,OAAO,CAACC,oCAAoC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;aAC9D,CACF,CAAC;SACL,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;aAUgB,WAAW,CACzB,MAAc,EACd,IAAY,EACZ,SAAgB,EAChB,QAA8B,EAC9B,SAAiC,EACjC,kBAAuB,EACvB,cAAkC;QAElC,OAAO,IAAI,OAAO,CAA6B,UAAC,OAAO,EAAE,MAAM;YAC7DiB,uCACmC,CAC/B,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf;iBACA,IAAI,CAAC,UAAA,OAAO;gBACX,IAAIJ,yBAAyB,CAAC,QAAQ,CAAC,EAAE;oBACvC,QAAQ,GAAGX,wBAAwB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;oBAClEgB,mCAC+B,CAC3B,QAAQ,EACR,cAAc,EACd,QAAQ,CAAC,IAAI,CAAC,GAAG,EACjB,kBAAkB,CACnB;yBACA,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;iBAC1B;qBAAM;oBACL,OAAO,CAAC,OAAO,CAAC,CAAC;iBAClB;aACF,EAAE,MAAM,CAAC,CAAC;SACd,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"feature-layer.umd.js","sources":["../../src/feature-layer.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of feature layers and services.\r\n *\r\n * @module feature-layer\r\n */\r\n\r\n//#region Imports ----------------------------------------------------------------------------------------------//\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n//#endregion\r\n\r\n//#region Publish Process --------------------------------------------------------------------------------------//\r\n\r\n/**\r\n * Fills in missing data, including full layer and table definitions, in a feature services' definition.\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo Feature service item\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param templateDictionary Hash mapping property names to replacement values\r\n * @return A promise that will resolve when fullItem has been updated\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: common.UserSession,\r\n srcAuthentication: common.UserSession,\r\n templateDictionary?: any\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>((resolve, reject) => {\r\n // Init template\r\n const template: common.IItemTemplate = common.createInitializedItemTemplate(\r\n itemInfo\r\n );\r\n\r\n const hasInvalidDesignations: boolean = common.hasInvalidGroupDesignations(\r\n itemInfo.groupDesignations\r\n );\r\n if (hasInvalidDesignations) {\r\n common\r\n .updateTemplateForInvalidDesignations(template, srcAuthentication)\r\n .then(\r\n _template => resolve(_template),\r\n e => reject(common.fail(e))\r\n );\r\n } else {\r\n // Update the estimated cost factor to deploy this item\r\n template.estimatedDeploymentCostFactor = 10;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.getItemDataAsJson(template.item.id, srcAuthentication).then(data => {\r\n template.data = data;\r\n common.getServiceLayersAndTables(template, srcAuthentication).then(\r\n itemTemplate => {\r\n // Extract dependencies\r\n common.extractDependencies(itemTemplate, srcAuthentication).then(\r\n (dependencies: common.IDependency[]) => {\r\n // set the dependencies as an array of IDs from the array of IDependency\r\n itemTemplate.dependencies = dependencies.map(\r\n (dep: any) => dep.id\r\n );\r\n\r\n // resolve the template with templatized values\r\n resolve(\r\n common.templatize(\r\n itemTemplate,\r\n dependencies,\r\n false,\r\n templateDictionary\r\n )\r\n );\r\n },\r\n (e: any) => reject(common.fail(e))\r\n );\r\n },\r\n e => reject(common.fail(e))\r\n );\r\n });\r\n }\r\n });\r\n}\r\n\r\n//#endregion\r\n\r\n//#region Deploy Process ---------------------------------------------------------------------------------------//\r\n\r\n/**\r\n * Creates an item in a specified folder (except for Group item type).\r\n *\r\n * @param itemTemplate Item to be created; n.b.: this item is modified\r\n * @param folderId Id of folder to receive item; null indicates that the item goes into the root\r\n * folder; ignored for Group item type\r\n * @param settings Hash mapping property names to replacement values\r\n * @param authentication Credentials for the request\r\n * @return A promise that will resolve with the id of the created item\r\n * @protected\r\n */\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Started,\r\n 0\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Ignored,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n return;\r\n }\r\n\r\n // Replace the templatized symbols in a copy of the template\r\n let newItemTemplate: common.IItemTemplate = common.cloneObject(template);\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n\r\n // Thumbnail has to be updated separately; doesn't work in create service call\r\n delete newItemTemplate.item.thumbnail;\r\n\r\n // cache the popup info to be added later\r\n const popupInfos: common.IPopupInfos = common.cachePopupInfos(\r\n newItemTemplate.data\r\n );\r\n\r\n // Create the item, then update its URL with its new id\r\n common\r\n .createFeatureService(\r\n newItemTemplate,\r\n destinationAuthentication,\r\n templateDictionary\r\n )\r\n .then(\r\n createResponse => {\r\n if (createResponse.success) {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.serviceItemId\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n ),\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type))\r\n );\r\n } else {\r\n // Detemplatize what we can now that the service has been created\r\n newItemTemplate = common.updateTemplate(\r\n newItemTemplate,\r\n templateDictionary,\r\n createResponse\r\n );\r\n // Add the layers and tables to the feature service\r\n common\r\n .addFeatureServiceLayersAndTables(\r\n newItemTemplate,\r\n templateDictionary,\r\n popupInfos,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () => {\r\n newItemTemplate = common.updateTemplate(\r\n newItemTemplate,\r\n templateDictionary,\r\n createResponse\r\n );\r\n // Update the item with snippet, description, popupInfo, etc.\r\n common\r\n .updateItemExtended(\r\n {\r\n ...newItemTemplate.item,\r\n url: undefined // can't update the URL of a feature service\r\n },\r\n newItemTemplate.data,\r\n destinationAuthentication,\r\n template.item.thumbnail,\r\n undefined,\r\n templateDictionary\r\n )\r\n .then(\r\n () => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.serviceItemId\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } else {\r\n // Update the template to match what we've stored in AGO\r\n common\r\n .getItemBase(\r\n newItemTemplate.itemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n updatedItem => {\r\n newItemTemplate.item = updatedItem;\r\n /* istanbul ignore else */\r\n if (\r\n common.getProp(\r\n newItemTemplate,\r\n \"item.url\"\r\n ) &&\r\n !newItemTemplate.item.url.endsWith(\"/\")\r\n ) {\r\n newItemTemplate.item.url += \"/\";\r\n }\r\n\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.serviceItemId,\r\n type: newItemTemplate.type,\r\n postProcess:\r\n common.hasUnresolvedVariables({\r\n item: newItemTemplate.item,\r\n data: newItemTemplate.data\r\n }) ||\r\n common.isWorkforceProject(newItemTemplate)\r\n });\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } // fails to update item\r\n );\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(\r\n template.type\r\n )\r\n )\r\n );\r\n } // fails to update item\r\n );\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n common\r\n .removeItem(\r\n createResponse.serviceItemId,\r\n destinationAuthentication\r\n )\r\n .then(\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n ),\r\n () =>\r\n resolve(\r\n common.generateEmptyCreationResponse(template.type)\r\n )\r\n );\r\n } // fails to add service layers and/or tables\r\n );\r\n }\r\n } else {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n );\r\n });\r\n}\r\n\r\n/**\r\n * Feature Layer post-processing actions\r\n *\r\n * @param {string} itemId The item ID\r\n * @param {string} type The template type\r\n * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} authentication The destination session info\r\n * @returns Promise resolving to successfulness of update\r\n */\r\nexport function postProcess(\r\n itemId: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: common.IItemTemplate,\r\n templates: common.IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: common.UserSession\r\n): Promise<common.IUpdateItemResponse> {\r\n return new Promise<common.IUpdateItemResponse>((resolve, reject) => {\r\n common\r\n .updateItemTemplateFromDictionary(\r\n itemId,\r\n templateDictionary,\r\n authentication\r\n )\r\n .then(results => {\r\n if (common.isWorkforceProject(template)) {\r\n template = common.replaceInTemplate(template, templateDictionary);\r\n common\r\n .fineTuneCreatedWorkforceItem(\r\n template,\r\n authentication,\r\n template.item.url,\r\n templateDictionary\r\n )\r\n .then(resolve, reject);\r\n } else {\r\n resolve(results);\r\n }\r\n }, reject);\r\n });\r\n}\r\n\r\n//#endregion\r\n"],"names":["common"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;EA0BA;EAEA;EAEA;;;;;;;;;;WAUgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iBAAqC,EACrC,kBAAwB;MAExB,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM;;UAEvD,MAAM,QAAQ,GAAyBA,iBAAM,CAAC,6BAA6B,CACzE,QAAQ,CACT,CAAC;UAEF,MAAM,sBAAsB,GAAYA,iBAAM,CAAC,2BAA2B,CACxE,QAAQ,CAAC,iBAAiB,CAC3B,CAAC;UACF,IAAI,sBAAsB,EAAE;cAC1BA,iBAAM;mBACH,oCAAoC,CAAC,QAAQ,EAAE,iBAAiB,CAAC;mBACjE,IAAI,CACH,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,EAC/B,CAAC,IAAI,MAAM,CAACA,iBAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAC5B,CAAC;WACL;eAAM;;cAEL,QAAQ,CAAC,6BAA6B,GAAG,EAAE,CAAC;;cAG5CA,iBAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI;kBACrE,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;kBACrBA,iBAAM,CAAC,yBAAyB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAChE,YAAY;;sBAEVA,iBAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,iBAAiB,CAAC,CA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