@esri/solution-feature-layer 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-feature-layer",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Manages the creation and deployment of feature layers and services for @esri/solution.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "unpkg": "dist/umd/feature-layer.umd.min.js",
@@ -18,7 +18,7 @@
18
18
  "@esri/arcgis-rest-portal": "~3.5.0",
19
19
  "@esri/arcgis-rest-request": "~3.5.0",
20
20
  "@esri/arcgis-rest-service-admin": "~3.5.0",
21
- "@esri/solution-common": "^3.0.0",
21
+ "@esri/solution-common": "^3.1.0",
22
22
  "rollup": "2.79.1"
23
23
  },
24
24
  "peerDependencies": {
@@ -29,7 +29,7 @@
29
29
  "@esri/arcgis-rest-service-admin": "~3.5.0"
30
30
  },
31
31
  "dependencies": {
32
- "@esri/hub-common": "^12.31.1",
32
+ "@esri/hub-common": "^12.37.1",
33
33
  "@esri/hub-initiatives": "^12.4.1",
34
34
  "@esri/hub-sites": "^12.6.0",
35
35
  "@esri/hub-teams": "^12.4.1",
@@ -81,5 +81,5 @@
81
81
  "esri",
82
82
  "ES6"
83
83
  ],
84
- "gitHead": "566b1c0fa884f94279a70d932dda3cd8a55ba050"
84
+ "gitHead": "d7bddb4b7c7b98ef00eac060c639a22d0654a03f"
85
85
  }
@@ -1,56 +0,0 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Manages the creation and deployment of feature layers and services.
18
- *
19
- * @module feature-layer
20
- */
21
- import * as common from "@esri/solution-common";
22
- /**
23
- * Fills in missing data, including full layer and table definitions, in a feature services' definition.
24
- *
25
- * @param solutionItemId
26
- * @param itemInfo Feature service item
27
- * @param destAuthentication Credentials for requests to the destination organization
28
- * @param srcAuthentication Credentials for requests to source items
29
- * @param templateDictionary Hash mapping property names to replacement values
30
- * @returns A promise that will resolve when fullItem has been updated
31
- */
32
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession, templateDictionary?: any): Promise<common.IItemTemplate>;
33
- /**
34
- * Creates an item in a specified folder (except for Group item type).
35
- *
36
- * @param itemTemplate Item to be created; n.b.: this item is modified
37
- * @param folderId Id of folder to receive item; null indicates that the item goes into the root
38
- * folder; ignored for Group item type
39
- * @param settings Hash mapping property names to replacement values
40
- * @param authentication Credentials for the request
41
- * @returns A promise that will resolve with the id of the created item
42
- * @private
43
- */
44
- export declare function createItemFromTemplate(template: common.IItemTemplate, templateDictionary: any, destinationAuthentication: common.UserSession, itemProgressCallback: common.IItemProgressCallback): Promise<common.ICreateItemFromTemplateResponse>;
45
- /**
46
- * Feature Layer post-processing actions
47
- *
48
- * @param {string} itemId The item ID
49
- * @param {string} type The template type
50
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
51
- * @param {any} templateDictionary The template dictionary
52
- * @param {UserSession} authentication The destination session info
53
- * @returns Promise resolving to successfulness of update
54
- */
55
- export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: common.IItemTemplate, templates: common.IItemTemplate[], templateDictionary: any, authentication: common.UserSession): Promise<common.IUpdateItemResponse>;
56
- export declare function _mostRecentlyEditedLayer(layerOrTableList: any[]): any;
@@ -1,236 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2018 Esri
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports._mostRecentlyEditedLayer = exports.postProcess = exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
19
- const tslib_1 = require("tslib");
20
- /**
21
- * Manages the creation and deployment of feature layers and services.
22
- *
23
- * @module feature-layer
24
- */
25
- //#region Imports ----------------------------------------------------------------------------------------------//
26
- const common = tslib_1.__importStar(require("@esri/solution-common"));
27
- //#endregion
28
- //#region Publish Process --------------------------------------------------------------------------------------//
29
- /**
30
- * Fills in missing data, including full layer and table definitions, in a feature services' definition.
31
- *
32
- * @param solutionItemId
33
- * @param itemInfo Feature service item
34
- * @param destAuthentication Credentials for requests to the destination organization
35
- * @param srcAuthentication Credentials for requests to source items
36
- * @param templateDictionary Hash mapping property names to replacement values
37
- * @returns A promise that will resolve when fullItem has been updated
38
- */
39
- function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
40
- return new Promise((resolve, reject) => {
41
- // Init template
42
- const template = common.createInitializedItemTemplate(itemInfo);
43
- const hasInvalidDesignations = common.hasInvalidGroupDesignations(itemInfo.groupDesignations);
44
- if (hasInvalidDesignations) {
45
- common
46
- .updateTemplateForInvalidDesignations(template, srcAuthentication)
47
- .then(_template => resolve(_template), e => reject(common.fail(e)));
48
- }
49
- else {
50
- // Update the estimated cost factor to deploy this item
51
- template.estimatedDeploymentCostFactor = 10;
52
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
53
- common.getItemDataAsJson(template.item.id, srcAuthentication).then(data => {
54
- template.data = data;
55
- common.getServiceLayersAndTables(template, srcAuthentication).then(itemTemplate => {
56
- // Update item's modified date to the latest of its modified date and the last edit date
57
- // of each of its layers or tables
58
- itemTemplate.item.modified =
59
- Math.max(itemTemplate.item.modified, _mostRecentlyEditedLayer(template.properties.layers), _mostRecentlyEditedLayer(template.properties.tables));
60
- // Extract dependencies
61
- common.extractDependencies(itemTemplate, srcAuthentication).then((dependencies) => {
62
- // set the dependencies as an array of IDs from the array of IDependency
63
- itemTemplate.dependencies = dependencies.map((dep) => dep.id);
64
- // resolve the template with templatized values
65
- resolve(common.templatize(itemTemplate, dependencies, false, templateDictionary));
66
- }, (e) => reject(common.fail(e)));
67
- }, e => reject(common.fail(e)));
68
- });
69
- }
70
- });
71
- }
72
- exports.convertItemToTemplate = convertItemToTemplate;
73
- //#endregion
74
- //#region Deploy Process ---------------------------------------------------------------------------------------//
75
- /**
76
- * Creates an item in a specified folder (except for Group item type).
77
- *
78
- * @param itemTemplate Item to be created; n.b.: this item is modified
79
- * @param folderId Id of folder to receive item; null indicates that the item goes into the root
80
- * folder; ignored for Group item type
81
- * @param settings Hash mapping property names to replacement values
82
- * @param authentication Credentials for the request
83
- * @returns A promise that will resolve with the id of the created item
84
- * @private
85
- */
86
- function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
87
- return new Promise(resolve => {
88
- // Interrupt process if progress callback returns `false`
89
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Started, 0)) {
90
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Ignored, 0);
91
- resolve(common.generateEmptyCreationResponse(template.type));
92
- return;
93
- }
94
- // Replace the templatized symbols in a copy of the template
95
- let newItemTemplate = common.cloneObject(template);
96
- newItemTemplate = common.replaceInTemplate(newItemTemplate, templateDictionary);
97
- // Thumbnail has to be updated separately; doesn't work in create service call
98
- delete newItemTemplate.item.thumbnail;
99
- // added for issue #928
100
- common.deleteProp(newItemTemplate, "properties.service.size");
101
- // cache the popup info to be added later
102
- const popupInfos = common.cachePopupInfos(newItemTemplate.data);
103
- // Create the item, then update its URL with its new id
104
- common
105
- .createFeatureService(newItemTemplate, destinationAuthentication, templateDictionary)
106
- .then(createResponse => {
107
- if (createResponse.success) {
108
- // Interrupt process if progress callback returns `false`
109
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.serviceItemId)) {
110
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Cancelled, 0);
111
- common
112
- .removeItem(createResponse.serviceItemId, destinationAuthentication)
113
- .then(() => resolve(common.generateEmptyCreationResponse(template.type)), () => resolve(common.generateEmptyCreationResponse(template.type)));
114
- }
115
- else {
116
- // Detemplatize what we can now that the service has been created
117
- newItemTemplate = common.updateTemplate(newItemTemplate, templateDictionary, createResponse);
118
- // Add the layers and tables to the feature service
119
- common
120
- .addFeatureServiceLayersAndTables(newItemTemplate, templateDictionary, popupInfos, destinationAuthentication)
121
- .then(() => {
122
- newItemTemplate = common.updateTemplate(newItemTemplate, templateDictionary, createResponse);
123
- // Update the item with snippet, description, popupInfo, etc.
124
- common
125
- .updateItemExtended({
126
- ...newItemTemplate.item,
127
- url: undefined // can't update the URL of a feature service
128
- }, newItemTemplate.data, destinationAuthentication, template.item.thumbnail, undefined, templateDictionary)
129
- .then(() => {
130
- // Interrupt process if progress callback returns `false`
131
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor / 2, createResponse.serviceItemId)) {
132
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Cancelled, 0);
133
- common
134
- .removeItem(createResponse.serviceItemId, destinationAuthentication)
135
- .then(() => resolve(common.generateEmptyCreationResponse(template.type)), () => resolve(common.generateEmptyCreationResponse(template.type)));
136
- }
137
- else {
138
- // Update the template to match what we've stored in AGO
139
- common
140
- .getItemBase(newItemTemplate.itemId, destinationAuthentication)
141
- .then(updatedItem => {
142
- newItemTemplate.item = updatedItem;
143
- /* istanbul ignore else */
144
- if (common.getProp(newItemTemplate, "item.url") &&
145
- !newItemTemplate.item.url.endsWith("/")) {
146
- newItemTemplate.item.url += "/";
147
- }
148
- resolve({
149
- item: newItemTemplate,
150
- id: createResponse.serviceItemId,
151
- type: newItemTemplate.type,
152
- postProcess: common.hasUnresolvedVariables({
153
- item: newItemTemplate.item,
154
- data: newItemTemplate.data
155
- }) ||
156
- common.isWorkforceProject(newItemTemplate)
157
- });
158
- }, () => {
159
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
160
- common
161
- .removeItem(createResponse.serviceItemId, destinationAuthentication)
162
- .then(() => resolve(common.generateEmptyCreationResponse(template.type)), () => resolve(common.generateEmptyCreationResponse(template.type)));
163
- } // fails to update item
164
- );
165
- }
166
- }, () => {
167
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
168
- common
169
- .removeItem(createResponse.serviceItemId, destinationAuthentication)
170
- .then(() => resolve(common.generateEmptyCreationResponse(template.type)), () => resolve(common.generateEmptyCreationResponse(template.type)));
171
- } // fails to update item
172
- );
173
- }, () => {
174
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
175
- common
176
- .removeItem(createResponse.serviceItemId, destinationAuthentication)
177
- .then(() => resolve(common.generateEmptyCreationResponse(template.type)), () => resolve(common.generateEmptyCreationResponse(template.type)));
178
- } // fails to add service layers and/or tables
179
- );
180
- }
181
- }
182
- else {
183
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
184
- resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item
185
- }
186
- }, () => {
187
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
188
- resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item
189
- });
190
- });
191
- }
192
- exports.createItemFromTemplate = createItemFromTemplate;
193
- /**
194
- * Feature Layer post-processing actions
195
- *
196
- * @param {string} itemId The item ID
197
- * @param {string} type The template type
198
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
199
- * @param {any} templateDictionary The template dictionary
200
- * @param {UserSession} authentication The destination session info
201
- * @returns Promise resolving to successfulness of update
202
- */
203
- function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
204
- return new Promise((resolve, reject) => {
205
- common
206
- .updateItemTemplateFromDictionary(itemId, templateDictionary, authentication)
207
- .then(results => {
208
- if (common.isWorkforceProject(template)) {
209
- template = common.replaceInTemplate(template, templateDictionary);
210
- common
211
- .fineTuneCreatedWorkforceItem(template, authentication, template.item.url, templateDictionary)
212
- .then(resolve, reject);
213
- }
214
- else {
215
- resolve(results);
216
- }
217
- }, reject);
218
- });
219
- }
220
- exports.postProcess = postProcess;
221
- //#endregion
222
- //#region Internal functions -----------------------------------------------------------------------------------------//
223
- //???
224
- function _mostRecentlyEditedLayer(layerOrTableList) {
225
- let mostRecentlyEdited = 0;
226
- layerOrTableList.forEach((layer) => {
227
- mostRecentlyEdited =
228
- layer.editingInfo?.lastEditDate ?
229
- Math.max(mostRecentlyEdited, layer.editingInfo.lastEditDate) :
230
- mostRecentlyEdited;
231
- });
232
- return mostRecentlyEdited;
233
- }
234
- exports._mostRecentlyEditedLayer = _mostRecentlyEditedLayer;
235
- //#endregion
236
- //# sourceMappingURL=feature-layer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"feature-layer.js","sourceRoot":"","sources":["../../src/feature-layer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH,kHAAkH;AAElH,sEAAgD;AAEhD,YAAY;AAEZ,kHAAkH;AAElH;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iBAAqC,EACrC,kBAAwB;IAExB,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3D,gBAAgB;QAChB,MAAM,QAAQ,GAAyB,MAAM,CAAC,6BAA6B,CACzE,QAAQ,CACT,CAAC;QAEF,MAAM,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R,cAAc,EACd,QAAQ,CAAC,IAAI,CAAC,GAAG,EACjB,kBAAkB,CACnB;qBACA,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;aAC1B;iBAAM;gBACL,OAAO,CAAC,OAAO,CAAC,CAAC;aAClB;QACH,CAAC,EAAE,MAAM,CAAC,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC;AAhCD,kCAgCC;AAED,YAAY;AAEZ,wHAAwH;AAExH,KAAK;AACL,SAAgB,wBAAwB,CACtC,gBAAuB;IAEvB,IAAI,kBAAkB,GAAG,CAAC,CAAC;IAC3B,gBAAgB,CAAC,OAAO,CACtB,CAAC,KAAK,EAAE,EAAE;QACR,kBAAkB;YAChB,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;gBACjC,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC9D,kBAAkB,CAAC;IACvB,CAAC,CACF,CAAC;IACF,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAbD,4DAaC;AAED,YAAY"}
@@ -1,21 +0,0 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Manages the creation and deployment of feature layers and services.
18
- *
19
- * @module feature-layer
20
- */
21
- export * from "./feature-layer";
@@ -1,25 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2018 Esri
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const tslib_1 = require("tslib");
19
- /**
20
- * Manages the creation and deployment of feature layers and services.
21
- *
22
- * @module feature-layer
23
- */
24
- tslib_1.__exportStar(require("./feature-layer"), exports);
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,0DAAgC"}
@@ -1,56 +0,0 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Manages the creation and deployment of feature layers and services.
18
- *
19
- * @module feature-layer
20
- */
21
- import * as common from "@esri/solution-common";
22
- /**
23
- * Fills in missing data, including full layer and table definitions, in a feature services' definition.
24
- *
25
- * @param solutionItemId
26
- * @param itemInfo Feature service item
27
- * @param destAuthentication Credentials for requests to the destination organization
28
- * @param srcAuthentication Credentials for requests to source items
29
- * @param templateDictionary Hash mapping property names to replacement values
30
- * @returns A promise that will resolve when fullItem has been updated
31
- */
32
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession, templateDictionary?: any): Promise<common.IItemTemplate>;
33
- /**
34
- * Creates an item in a specified folder (except for Group item type).
35
- *
36
- * @param itemTemplate Item to be created; n.b.: this item is modified
37
- * @param folderId Id of folder to receive item; null indicates that the item goes into the root
38
- * folder; ignored for Group item type
39
- * @param settings Hash mapping property names to replacement values
40
- * @param authentication Credentials for the request
41
- * @returns A promise that will resolve with the id of the created item
42
- * @private
43
- */
44
- export declare function createItemFromTemplate(template: common.IItemTemplate, templateDictionary: any, destinationAuthentication: common.UserSession, itemProgressCallback: common.IItemProgressCallback): Promise<common.ICreateItemFromTemplateResponse>;
45
- /**
46
- * Feature Layer post-processing actions
47
- *
48
- * @param {string} itemId The item ID
49
- * @param {string} type The template type
50
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
51
- * @param {any} templateDictionary The template dictionary
52
- * @param {UserSession} authentication The destination session info
53
- * @returns Promise resolving to successfulness of update
54
- */
55
- export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: common.IItemTemplate, templates: common.IItemTemplate[], templateDictionary: any, authentication: common.UserSession): Promise<common.IUpdateItemResponse>;
56
- export declare function _mostRecentlyEditedLayer(layerOrTableList: any[]): any;
@@ -1,21 +0,0 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Manages the creation and deployment of feature layers and services.
18
- *
19
- * @module feature-layer
20
- */
21
- export * from "./feature-layer";
@@ -1,273 +0,0 @@
1
- /* @preserve
2
- * @esri/solution-feature-layer - v1.7.0 - Apache-2.0
3
- * Copyright (c) 2018-2023 Esri, Inc.
4
- * Fri Apr 28 2023 11:21:00 GMT-0700 (Pacific Daylight Time)
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
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 = 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);
43
-
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
- * @returns 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
- // Update item's modified date to the latest of its modified date and the last edit date
89
- // of each of its layers or tables
90
- itemTemplate.item.modified =
91
- Math.max(itemTemplate.item.modified, _mostRecentlyEditedLayer(template.properties.layers), _mostRecentlyEditedLayer(template.properties.tables));
92
- // Extract dependencies
93
- common__namespace.extractDependencies(itemTemplate, srcAuthentication).then((dependencies) => {
94
- // set the dependencies as an array of IDs from the array of IDependency
95
- itemTemplate.dependencies = dependencies.map((dep) => dep.id);
96
- // resolve the template with templatized values
97
- resolve(common__namespace.templatize(itemTemplate, dependencies, false, templateDictionary));
98
- }, (e) => reject(common__namespace.fail(e)));
99
- }, e => reject(common__namespace.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
- * @returns A promise that will resolve with the id of the created item
115
- * @private
116
- */
117
- function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
118
- return new Promise(resolve => {
119
- // Interrupt process if progress callback returns `false`
120
- if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Started, 0)) {
121
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Ignored, 0);
122
- resolve(common__namespace.generateEmptyCreationResponse(template.type));
123
- return;
124
- }
125
- // Replace the templatized symbols in a copy of the template
126
- let newItemTemplate = common__namespace.cloneObject(template);
127
- newItemTemplate = common__namespace.replaceInTemplate(newItemTemplate, templateDictionary);
128
- // Thumbnail has to be updated separately; doesn't work in create service call
129
- delete newItemTemplate.item.thumbnail;
130
- // added for issue #928
131
- common__namespace.deleteProp(newItemTemplate, "properties.service.size");
132
- // cache the popup info to be added later
133
- const popupInfos = common__namespace.cachePopupInfos(newItemTemplate.data);
134
- // Create the item, then update its URL with its new id
135
- common__namespace
136
- .createFeatureService(newItemTemplate, destinationAuthentication, templateDictionary)
137
- .then(createResponse => {
138
- if (createResponse.success) {
139
- // Interrupt process if progress callback returns `false`
140
- if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.serviceItemId)) {
141
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
142
- common__namespace
143
- .removeItem(createResponse.serviceItemId, destinationAuthentication)
144
- .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
145
- }
146
- else {
147
- // Detemplatize what we can now that the service has been created
148
- newItemTemplate = common__namespace.updateTemplate(newItemTemplate, templateDictionary, createResponse);
149
- // Add the layers and tables to the feature service
150
- common__namespace
151
- .addFeatureServiceLayersAndTables(newItemTemplate, templateDictionary, popupInfos, destinationAuthentication)
152
- .then(() => {
153
- newItemTemplate = common__namespace.updateTemplate(newItemTemplate, templateDictionary, createResponse);
154
- // Update the item with snippet, description, popupInfo, etc.
155
- common__namespace
156
- .updateItemExtended({
157
- ...newItemTemplate.item,
158
- url: undefined // can't update the URL of a feature service
159
- }, newItemTemplate.data, destinationAuthentication, template.item.thumbnail, undefined, templateDictionary)
160
- .then(() => {
161
- // Interrupt process if progress callback returns `false`
162
- if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor / 2, createResponse.serviceItemId)) {
163
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
164
- common__namespace
165
- .removeItem(createResponse.serviceItemId, destinationAuthentication)
166
- .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
167
- }
168
- else {
169
- // Update the template to match what we've stored in AGO
170
- common__namespace
171
- .getItemBase(newItemTemplate.itemId, destinationAuthentication)
172
- .then(updatedItem => {
173
- newItemTemplate.item = updatedItem;
174
- /* istanbul ignore else */
175
- if (common__namespace.getProp(newItemTemplate, "item.url") &&
176
- !newItemTemplate.item.url.endsWith("/")) {
177
- newItemTemplate.item.url += "/";
178
- }
179
- resolve({
180
- item: newItemTemplate,
181
- id: createResponse.serviceItemId,
182
- type: newItemTemplate.type,
183
- postProcess: common__namespace.hasUnresolvedVariables({
184
- item: newItemTemplate.item,
185
- data: newItemTemplate.data
186
- }) ||
187
- common__namespace.isWorkforceProject(newItemTemplate)
188
- });
189
- }, () => {
190
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
191
- common__namespace
192
- .removeItem(createResponse.serviceItemId, destinationAuthentication)
193
- .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
194
- } // fails to update item
195
- );
196
- }
197
- }, () => {
198
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
199
- common__namespace
200
- .removeItem(createResponse.serviceItemId, destinationAuthentication)
201
- .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
202
- } // fails to update item
203
- );
204
- }, () => {
205
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
206
- common__namespace
207
- .removeItem(createResponse.serviceItemId, destinationAuthentication)
208
- .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
209
- } // fails to add service layers and/or tables
210
- );
211
- }
212
- }
213
- else {
214
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
215
- resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
216
- }
217
- }, () => {
218
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
219
- resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
220
- });
221
- });
222
- }
223
- /**
224
- * Feature Layer post-processing actions
225
- *
226
- * @param {string} itemId The item ID
227
- * @param {string} type The template type
228
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
229
- * @param {any} templateDictionary The template dictionary
230
- * @param {UserSession} authentication The destination session info
231
- * @returns Promise resolving to successfulness of update
232
- */
233
- function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
234
- return new Promise((resolve, reject) => {
235
- common__namespace
236
- .updateItemTemplateFromDictionary(itemId, templateDictionary, authentication)
237
- .then(results => {
238
- if (common__namespace.isWorkforceProject(template)) {
239
- template = common__namespace.replaceInTemplate(template, templateDictionary);
240
- common__namespace
241
- .fineTuneCreatedWorkforceItem(template, authentication, template.item.url, templateDictionary)
242
- .then(resolve, reject);
243
- }
244
- else {
245
- resolve(results);
246
- }
247
- }, reject);
248
- });
249
- }
250
- //#endregion
251
- //#region Internal functions -----------------------------------------------------------------------------------------//
252
- //???
253
- function _mostRecentlyEditedLayer(layerOrTableList) {
254
- let mostRecentlyEdited = 0;
255
- layerOrTableList.forEach((layer) => {
256
- mostRecentlyEdited =
257
- layer.editingInfo?.lastEditDate ?
258
- Math.max(mostRecentlyEdited, layer.editingInfo.lastEditDate) :
259
- mostRecentlyEdited;
260
- });
261
- return mostRecentlyEdited;
262
- }
263
- //#endregion
264
-
265
- exports._mostRecentlyEditedLayer = _mostRecentlyEditedLayer;
266
- exports.convertItemToTemplate = convertItemToTemplate;
267
- exports.createItemFromTemplate = createItemFromTemplate;
268
- exports.postProcess = postProcess;
269
-
270
- Object.defineProperty(exports, '__esModule', { value: true });
271
-
272
- }));
273
- //# sourceMappingURL=feature-layer.umd.js.map
@@ -1 +0,0 @@
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 * @returns 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 // Update item's modified date to the latest of its modified date and the last edit date\r\n // of each of its layers or tables\r\n itemTemplate.item.modified =\r\n Math.max(itemTemplate.item.modified,\r\n _mostRecentlyEditedLayer(template.properties.layers),\r\n _mostRecentlyEditedLayer(template.properties.tables)\r\n );\r\n\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 * @returns A promise that will resolve with the id of the created item\r\n * @private\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 // added for issue #928\r\n common.deleteProp(newItemTemplate, \"properties.service.size\");\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\r\n//#region Internal functions -----------------------------------------------------------------------------------------//\r\n\r\n//???\r\nexport function _mostRecentlyEditedLayer(\r\n layerOrTableList: any[]\r\n): any {\r\n let mostRecentlyEdited = 0;\r\n layerOrTableList.forEach(\r\n (layer) => {\r\n mostRecentlyEdited =\r\n layer.editingInfo?.lastEditDate ?\r\n Math.max(mostRecentlyEdited, layer.editingInfo.lastEditDate) :\r\n mostRecentlyEdited;\r\n }\r\n );\r\n return mostRecentlyEdited;\r\n}\r\n\r\n//#endregion\r\n"],"names":["common"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;EAcG;EAYH;EAEA;EAEA;;;;;;;;;EASG;EACG,SAAU,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iBAAqC,EACrC,kBAAwB,EAAA;MAExB,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,KAAI;;UAE3D,MAAM,QAAQ,GAAyBA,iBAAM,CAAC,6BAA6B,CACzE,QAAQ,CACT,CAAC;UAEF,MAAM,sBAAsB,GAAYA,iBAAM,CAAC,2BAA2B,CACxE,QAAQ,CAAC,iBAAiB,CAC3B,CAAC;EACF,QAAA,IAAI,sBAAsB,EAAE;cAC1BA,iBAAM;EACH,iBAAA,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;EACL,SAAA;EAAM,aAAA;;EAEL,YAAA,QAAQ,CAAC,6BAA6B,GAAG,EAAE,CAAC;;EAG5C,YAAAA,iBAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,IAAG;EACxE,gBAAA,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;EACrB,gBAAAA,iBAAM,CAAC,yBAAyB,CAAC,QAAQ,EAAE,iBAAiB,CAAC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- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-common")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=r(t);function n(e){let t=0;return e.forEach((e=>{t=e.editingInfo?.lastEditDate?Math.max(t,e.editingInfo.lastEditDate):t})),t}e._mostRecentlyEditedLayer=n,e.convertItemToTemplate=function(e,t,r,o,s){return new Promise(((e,r)=>{const a=i.createInitializedItemTemplate(t);i.hasInvalidGroupDesignations(t.groupDesignations)?i.updateTemplateForInvalidDesignations(a,o).then((t=>e(t)),(e=>r(i.fail(e)))):(a.estimatedDeploymentCostFactor=10,i.getItemDataAsJson(a.item.id,o).then((t=>{a.data=t,i.getServiceLayersAndTables(a,o).then((t=>{t.item.modified=Math.max(t.item.modified,n(a.properties.layers),n(a.properties.tables)),i.extractDependencies(t,o).then((r=>{t.dependencies=r.map((e=>e.id)),e(i.templatize(t,r,!1,s))}),(e=>r(i.fail(e))))}),(e=>r(i.fail(e))))})))}))},e.createItemFromTemplate=function(e,t,r,n){return new Promise((o=>{if(!n(e.itemId,i.EItemProgressStatus.Started,0))return n(e.itemId,i.EItemProgressStatus.Ignored,0),void o(i.generateEmptyCreationResponse(e.type));let s=i.cloneObject(e);s=i.replaceInTemplate(s,t),delete s.item.thumbnail,i.deleteProp(s,"properties.service.size");const a=i.cachePopupInfos(s.data);i.createFeatureService(s,r,t).then((m=>{m.success?n(e.itemId,i.EItemProgressStatus.Created,e.estimatedDeploymentCostFactor/2,m.serviceItemId)?(s=i.updateTemplate(s,t,m),i.addFeatureServiceLayersAndTables(s,t,a,r).then((()=>{s=i.updateTemplate(s,t,m),i.updateItemExtended({...s.item,url:void 0},s.data,r,e.item.thumbnail,void 0,t).then((()=>{n(e.itemId,i.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor/2,m.serviceItemId)?i.getItemBase(s.itemId,r).then((e=>{s.item=e,i.getProp(s,"item.url")&&!s.item.url.endsWith("/")&&(s.item.url+="/"),o({item:s,id:m.serviceItemId,type:s.type,postProcess:i.hasUnresolvedVariables({item:s.item,data:s.data})||i.isWorkforceProject(s)})}),(()=>{n(e.itemId,i.EItemProgressStatus.Failed,0),i.removeItem(m.serviceItemId,r).then((()=>o(i.generateEmptyCreationResponse(e.type))),(()=>o(i.generateEmptyCreationResponse(e.type))))})):(n(e.itemId,i.EItemProgressStatus.Cancelled,0),i.removeItem(m.serviceItemId,r).then((()=>o(i.generateEmptyCreationResponse(e.type))),(()=>o(i.generateEmptyCreationResponse(e.type)))))}),(()=>{n(e.itemId,i.EItemProgressStatus.Failed,0),i.removeItem(m.serviceItemId,r).then((()=>o(i.generateEmptyCreationResponse(e.type))),(()=>o(i.generateEmptyCreationResponse(e.type))))}))}),(()=>{n(e.itemId,i.EItemProgressStatus.Failed,0),i.removeItem(m.serviceItemId,r).then((()=>o(i.generateEmptyCreationResponse(e.type))),(()=>o(i.generateEmptyCreationResponse(e.type))))}))):(n(e.itemId,i.EItemProgressStatus.Cancelled,0),i.removeItem(m.serviceItemId,r).then((()=>o(i.generateEmptyCreationResponse(e.type))),(()=>o(i.generateEmptyCreationResponse(e.type))))):(n(e.itemId,i.EItemProgressStatus.Failed,0),o(i.generateEmptyCreationResponse(e.type)))}),(()=>{n(e.itemId,i.EItemProgressStatus.Failed,0),o(i.generateEmptyCreationResponse(e.type))}))}))},e.postProcess=function(e,t,r,n,o,s,a){return new Promise(((t,r)=>{i.updateItemTemplateFromDictionary(e,s,a).then((e=>{i.isWorkforceProject(n)?(n=i.replaceInTemplate(n,s),i.fineTuneCreatedWorkforceItem(n,a,n.item.url,s).then(t,r)):t(e)}),r)}))},Object.defineProperty(e,"__esModule",{value:!0})}));
19
- //# sourceMappingURL=feature-layer.umd.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"feature-layer.umd.min.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 * @returns 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 // Update item's modified date to the latest of its modified date and the last edit date\r\n // of each of its layers or tables\r\n itemTemplate.item.modified =\r\n Math.max(itemTemplate.item.modified,\r\n _mostRecentlyEditedLayer(template.properties.layers),\r\n _mostRecentlyEditedLayer(template.properties.tables)\r\n );\r\n\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 * @returns A promise that will resolve with the id of the created item\r\n * @private\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 // added for issue #928\r\n common.deleteProp(newItemTemplate, \"properties.service.size\");\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\r\n//#region Internal functions -----------------------------------------------------------------------------------------//\r\n\r\n//???\r\nexport function _mostRecentlyEditedLayer(\r\n layerOrTableList: any[]\r\n): any {\r\n let mostRecentlyEdited = 0;\r\n layerOrTableList.forEach(\r\n (layer) => {\r\n mostRecentlyEdited =\r\n layer.editingInfo?.lastEditDate ?\r\n Math.max(mostRecentlyEdited, layer.editingInfo.lastEditDate) :\r\n mostRecentlyEdited;\r\n }\r\n );\r\n return mostRecentlyEdited;\r\n}\r\n\r\n//#endregion\r\n"],"names":["_mostRecentlyEditedLayer","layerOrTableList","mostRecentlyEdited","forEach","layer","editingInfo","lastEditDate","Math","max","solutionItemId","itemInfo","destAuthentication","srcAuthentication","templateDictionary","Promise","resolve","reject","template","common","createInitializedItemTemplate","hasInvalidGroupDesignations","groupDesignations","updateTemplateForInvalidDesignations","then","_template","e","fail","estimatedDeploymentCostFactor","getItemDataAsJson","item","id","data","getServiceLayersAndTables","itemTemplate","modified","properties","layers","tables","extractDependencies","dependencies","map","dep","templatize","destinationAuthentication","itemProgressCallback","itemId","EItemProgressStatus","Started","Ignored","generateEmptyCreationResponse","type","newItemTemplate","cloneObject","replaceInTemplate","thumbnail","deleteProp","popupInfos","cachePopupInfos","createFeatureService","createResponse","success","Created","serviceItemId","updateTemplate","addFeatureServiceLayersAndTables","updateItemExtended","url","undefined","Finished","getItemBase","updatedItem","getProp","endsWith","postProcess","hasUnresolvedVariables","isWorkforceProject","Failed","removeItem","Cancelled","itemInfos","templates","authentication","updateItemTemplateFromDictionary","results","fineTuneCreatedWorkforceItem"],"mappings":";;;;;;;;;;;;;;;;;8nBAwcM,SAAUA,EACdC,GAEA,IAAIC,EAAqB,EASzB,OARAD,EAAiBE,SACdC,IACCF,EACEE,EAAMC,aAAaC,aACnBC,KAAKC,IAAIN,EAAoBE,EAAMC,YAAYC,cAC/CJ,CAAkB,IAGjBA,CACT,sDA7aM,SACJO,EACAC,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIC,SAA8B,CAACC,EAASC,KAEjD,MAAMC,EAAiCC,EAAOC,8BAC5CT,GAGsCQ,EAAOE,4BAC7CV,EAASW,mBAGTH,EACGI,qCAAqCL,EAAUL,GAC/CW,MACCC,GAAaT,EAAQS,KACrBC,GAAKT,EAAOE,EAAOQ,KAAKD,OAI5BR,EAASU,8BAAgC,GAGzCT,EAAOU,kBAAkBX,EAASY,KAAKC,GAAIlB,GAAmBW,MAAKQ,IACjEd,EAASc,KAAOA,EACh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