@esri/solution-feature-layer 1.3.5 → 1.3.9

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.
@@ -53,3 +53,4 @@ export declare function createItemFromTemplate(template: common.IItemTemplate, t
53
53
  * @returns Promise resolving to successfulness of update
54
54
  */
55
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;
@@ -49,6 +49,10 @@ export function convertItemToTemplate(solutionItemId, itemInfo, destAuthenticati
49
49
  common.getItemDataAsJson(template.item.id, srcAuthentication).then(data => {
50
50
  template.data = data;
51
51
  common.getServiceLayersAndTables(template, srcAuthentication).then(itemTemplate => {
52
+ // Update item's modified date to the latest of its modified date and the last edit date
53
+ // of each of its layers or tables
54
+ itemTemplate.item.modified =
55
+ Math.max(itemTemplate.item.modified, _mostRecentlyEditedLayer(template.properties.layers), _mostRecentlyEditedLayer(template.properties.tables));
52
56
  // Extract dependencies
53
57
  common.extractDependencies(itemTemplate, srcAuthentication).then((dependencies) => {
54
58
  // set the dependencies as an array of IDs from the array of IDependency
@@ -206,4 +210,16 @@ export function postProcess(itemId, type, itemInfos, template, templates, templa
206
210
  });
207
211
  }
208
212
  //#endregion
213
+ //#region Internal functions -----------------------------------------------------------------------------------------//
214
+ export function _mostRecentlyEditedLayer(layerOrTableList) {
215
+ let mostRecentlyEdited = 0;
216
+ layerOrTableList.forEach((layer) => {
217
+ mostRecentlyEdited =
218
+ layer.editingInfo?.lastEditDate ?
219
+ Math.max(mostRecentlyEdited, layer.editingInfo.lastEditDate) :
220
+ mostRecentlyEdited;
221
+ });
222
+ return mostRecentlyEdited;
223
+ }
224
+ //#endregion
209
225
  //# sourceMappingURL=feature-layer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature-layer.js","sourceRoot":"","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AAK,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC9D,kBAAkB,CAAC;IACvB,CAAC,CACF,CAAC;IACF,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,YAAY"}
@@ -53,3 +53,4 @@ export declare function createItemFromTemplate(template: common.IItemTemplate, t
53
53
  * @returns Promise resolving to successfulness of update
54
54
  */
55
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;
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.postProcess = exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
18
+ exports._mostRecentlyEditedLayer = exports.postProcess = exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
19
19
  const tslib_1 = require("tslib");
20
20
  /**
21
21
  * Manages the creation and deployment of feature layers and services.
@@ -23,7 +23,7 @@ const tslib_1 = require("tslib");
23
23
  * @module feature-layer
24
24
  */
25
25
  //#region Imports ----------------------------------------------------------------------------------------------//
26
- const common = (0, tslib_1.__importStar)(require("@esri/solution-common"));
26
+ const common = tslib_1.__importStar(require("@esri/solution-common"));
27
27
  //#endregion
28
28
  //#region Publish Process --------------------------------------------------------------------------------------//
29
29
  /**
@@ -53,6 +53,10 @@ function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, src
53
53
  common.getItemDataAsJson(template.item.id, srcAuthentication).then(data => {
54
54
  template.data = data;
55
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));
56
60
  // Extract dependencies
57
61
  common.extractDependencies(itemTemplate, srcAuthentication).then((dependencies) => {
58
62
  // set the dependencies as an array of IDs from the array of IDependency
@@ -213,4 +217,17 @@ function postProcess(itemId, type, itemInfos, template, templates, templateDicti
213
217
  }
214
218
  exports.postProcess = postProcess;
215
219
  //#endregion
220
+ //#region Internal functions -----------------------------------------------------------------------------------------//
221
+ function _mostRecentlyEditedLayer(layerOrTableList) {
222
+ let mostRecentlyEdited = 0;
223
+ layerOrTableList.forEach((layer) => {
224
+ mostRecentlyEdited =
225
+ layer.editingInfo?.lastEditDate ?
226
+ Math.max(mostRecentlyEdited, layer.editingInfo.lastEditDate) :
227
+ mostRecentlyEdited;
228
+ });
229
+ return mostRecentlyEdited;
230
+ }
231
+ exports._mostRecentlyEditedLayer = _mostRecentlyEditedLayer;
232
+ //#endregion
216
233
  //# sourceMappingURL=feature-layer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature-layer.js","sourceRoot":"","sources":["../../src/feature-layer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH,kHAAkH;AAElH,2EAAgD;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,sBAAsB,GAAY,MAAM,CAAC,2BAA2B,CACxE,QAAQ,CAAC,iBAAiB,CAC3B,CAAC;QACF,IAAI,sBAAsB,EAAE;YAC1B,MAAM;iBACH,oCAAoC,CAAC,QAAQ,EAAE,iBAAiB,CAAC;iBACjE,IAAI,CACH,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC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,CAAC,CACF,CAAC;YACF,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,uBAAuB;QACvF,CAAC,CACF,CAAC;IACN,CAAC,CAAC,CAAC;AACL,CAAC;AAvRD,wDAuRC;AAED;;;;;;;;;GASG;AACH,SAAgB,WAAW,CACzB,MAAc,EACd,IAAY,EACZ,SAAgB,EAChB,QAA8B,EAC9B,SAAiC,EACjC,kBAAuB,EACvB,cAAkC;IAElC,OAAO,IAAI,OAAO,CAA6B,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACjE,MAAM;aACH,gCAAgC,CAC/B,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf;aACA,IAAI,CAAC,OAAO,CAAC,EAAE;YACd,IAAI,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE;gBACvC,QAAQ,GAAG,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;gBAClE,MAAM;qBACH,4BAA4B,CAC3B,QAAQ,EACR,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"}
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,I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Q,EAAE,kBAAkB,CAAC,CAAC;gBAClE,MAAM;qBACH,4BAA4B,CAC3B,QAAQ,EACR,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,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"}
@@ -21,5 +21,5 @@ const tslib_1 = require("tslib");
21
21
  *
22
22
  * @module feature-layer
23
23
  */
24
- (0, tslib_1.__exportStar)(require("./feature-layer"), exports);
24
+ tslib_1.__exportStar(require("./feature-layer"), exports);
25
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,+DAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,0DAAgC"}
@@ -53,3 +53,4 @@ export declare function createItemFromTemplate(template: common.IItemTemplate, t
53
53
  * @returns Promise resolving to successfulness of update
54
54
  */
55
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,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-feature-layer - v1.3.5 - Apache-2.0
2
+ * @esri/solution-feature-layer - v1.3.9 - Apache-2.0
3
3
  * Copyright (c) 2018-2022 Esri, Inc.
4
- * Fri Mar 04 2022 21:15:32 GMT-0800 (Pacific Standard Time)
4
+ * Fri Mar 25 2022 15:22:51 GMT-0700 (Pacific Daylight 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.
@@ -85,6 +85,10 @@
85
85
  common__namespace.getItemDataAsJson(template.item.id, srcAuthentication).then(data => {
86
86
  template.data = data;
87
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));
88
92
  // Extract dependencies
89
93
  common__namespace.extractDependencies(itemTemplate, srcAuthentication).then((dependencies) => {
90
94
  // set the dependencies as an array of IDs from the array of IDependency
@@ -241,8 +245,21 @@
241
245
  }, reject);
242
246
  });
243
247
  }
248
+ //#endregion
249
+ //#region Internal functions -----------------------------------------------------------------------------------------//
250
+ function _mostRecentlyEditedLayer(layerOrTableList) {
251
+ let mostRecentlyEdited = 0;
252
+ layerOrTableList.forEach((layer) => {
253
+ mostRecentlyEdited =
254
+ layer.editingInfo?.lastEditDate ?
255
+ Math.max(mostRecentlyEdited, layer.editingInfo.lastEditDate) :
256
+ mostRecentlyEdited;
257
+ });
258
+ return mostRecentlyEdited;
259
+ }
244
260
  //#endregion
245
261
 
262
+ exports._mostRecentlyEditedLayer = _mostRecentlyEditedLayer;
246
263
  exports.convertItemToTemplate = convertItemToTemplate;
247
264
  exports.createItemFromTemplate = createItemFromTemplate;
248
265
  exports.postProcess = postProcess;
@@ -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 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;;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ACF,EAAE,MAAM,CAAC,CAAC;OACd,CAAC,CAAC;EACL,CAAC;EAED;;;;;;;;;;;;"}
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 // 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 * @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\r\n//#region Internal functions -----------------------------------------------------------------------------------------//\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;;;;;;;;;;;;;;;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,sBAA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AAc,EACd,IAAY,EACZ,SAAgB,EAChB,QAA8B,EAC9B,SAAiC,EACjC,kBAAuB,EACvB,cAAkC;MAElC,OAAO,IAAI,OAAO,CAA6B,CAAC,OAAO,EAAE,MAAM;UAC7DA,iBAAM;eACH,gCAAgC,CAC/B,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf;eACA,IAAI,CAAC,OAAO;cACX,IAAIA,iBAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE;kBACvC,QAAQ,GAAGA,iBAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;kBAClEA,iBAAM;uBACH,4BAA4B,CAC3B,QAAQ,EACR,cAAc,EACd,QAAQ,CAAC,IAAI,CAAC,GAAG,EACjB,kBAAkB,CACnB;uBACA,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;eAC1B;mBAAM;kBACL,OAAO,CAAC,OAAO,CAAC,CAAC;eAClB;WACF,EAAE,MAAM,CAAC,CAAC;OACd,CAAC,CAAC;EACL,CAAC;EAED;EAEA;WAEgB,wBAAwB,CACtC,gBAAuB;MAEvB,IAAI,kBAAkB,GAAG,CAAC,CAAC;MAC3B,gBAAgB,CAAC,OAAO,CACtB,CAAC,KAAK;UACJ,kBAAkB;cAChB,KAAK,CAAC,WAAW,EAAE,YAAY;kBAC/B,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC;kBAC5D,kBAAkB,CAAC;OACtB,CACF,CAAC;MACF,OAAO,kBAAkB,CAAC;EAC5B,CAAC;EAED;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-feature-layer - v1.3.5 - Apache-2.0
2
+ * @esri/solution-feature-layer - v1.3.9 - Apache-2.0
3
3
  * Copyright (c) 2018-2022 Esri, Inc.
4
- * Fri Mar 04 2022 21:15:39 GMT-0800 (Pacific Standard Time)
4
+ * Fri Mar 25 2022 15:22:54 GMT-0700 (Pacific Daylight 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.
@@ -15,5 +15,5 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
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 n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(t);e.convertItemToTemplate=function(e,t,r,s,o){return new Promise(((e,r)=>{const i=n.createInitializedItemTemplate(t);n.hasInvalidGroupDesignations(t.groupDesignations)?n.updateTemplateForInvalidDesignations(i,s).then((t=>e(t)),(e=>r(n.fail(e)))):(i.estimatedDeploymentCostFactor=10,n.getItemDataAsJson(i.item.id,s).then((t=>{i.data=t,n.getServiceLayersAndTables(i,s).then((t=>{n.extractDependencies(t,s).then((r=>{t.dependencies=r.map((e=>e.id)),e(n.templatize(t,r,!1,o))}),(e=>r(n.fail(e))))}),(e=>r(n.fail(e))))})))}))},e.createItemFromTemplate=function(e,t,r,s){return new Promise((o=>{if(!s(e.itemId,n.EItemProgressStatus.Started,0))return s(e.itemId,n.EItemProgressStatus.Ignored,0),void o(n.generateEmptyCreationResponse(e.type));let i=n.cloneObject(e);i=n.replaceInTemplate(i,t),delete i.item.thumbnail;const a=n.cachePopupInfos(i.data);n.createFeatureService(i,r,t).then((m=>{m.success?s(e.itemId,n.EItemProgressStatus.Created,e.estimatedDeploymentCostFactor/2,m.serviceItemId)?(i=n.updateTemplate(i,t,m),n.addFeatureServiceLayersAndTables(i,t,a,r).then((()=>{i=n.updateTemplate(i,t,m),n.updateItemExtended({...i.item,url:void 0},i.data,r,e.item.thumbnail,void 0,t).then((()=>{s(e.itemId,n.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor/2,m.serviceItemId)?n.getItemBase(i.itemId,r).then((e=>{i.item=e,n.getProp(i,"item.url")&&!i.item.url.endsWith("/")&&(i.item.url+="/"),o({item:i,id:m.serviceItemId,type:i.type,postProcess:n.hasUnresolvedVariables({item:i.item,data:i.data})||n.isWorkforceProject(i)})}),(()=>{s(e.itemId,n.EItemProgressStatus.Failed,0),n.removeItem(m.serviceItemId,r).then((()=>o(n.generateEmptyCreationResponse(e.type))),(()=>o(n.generateEmptyCreationResponse(e.type))))})):(s(e.itemId,n.EItemProgressStatus.Cancelled,0),n.removeItem(m.serviceItemId,r).then((()=>o(n.generateEmptyCreationResponse(e.type))),(()=>o(n.generateEmptyCreationResponse(e.type)))))}),(()=>{s(e.itemId,n.EItemProgressStatus.Failed,0),n.removeItem(m.serviceItemId,r).then((()=>o(n.generateEmptyCreationResponse(e.type))),(()=>o(n.generateEmptyCreationResponse(e.type))))}))}),(()=>{s(e.itemId,n.EItemProgressStatus.Failed,0),n.removeItem(m.serviceItemId,r).then((()=>o(n.generateEmptyCreationResponse(e.type))),(()=>o(n.generateEmptyCreationResponse(e.type))))}))):(s(e.itemId,n.EItemProgressStatus.Cancelled,0),n.removeItem(m.serviceItemId,r).then((()=>o(n.generateEmptyCreationResponse(e.type))),(()=>o(n.generateEmptyCreationResponse(e.type))))):(s(e.itemId,n.EItemProgressStatus.Failed,0),o(n.generateEmptyCreationResponse(e.type)))}),(()=>{s(e.itemId,n.EItemProgressStatus.Failed,0),o(n.generateEmptyCreationResponse(e.type))}))}))},e.postProcess=function(e,t,r,s,o,i,a){return new Promise(((t,r)=>{n.updateItemTemplateFromDictionary(e,i,a).then((e=>{n.isWorkforceProject(s)?(s=n.replaceInTemplate(s,i),n.fineTuneCreatedWorkforceItem(s,a,s.item.url,i).then(t,r)):t(e)}),r)}))},Object.defineProperty(e,"__esModule",{value:!0})}));
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 n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(t);function i(e){let t=0;return e.forEach((e=>{t=e.editingInfo?.lastEditDate?Math.max(t,e.editingInfo.lastEditDate):t})),t}e._mostRecentlyEditedLayer=i,e.convertItemToTemplate=function(e,t,r,a,o){return new Promise(((e,r)=>{const s=n.createInitializedItemTemplate(t);n.hasInvalidGroupDesignations(t.groupDesignations)?n.updateTemplateForInvalidDesignations(s,a).then((t=>e(t)),(e=>r(n.fail(e)))):(s.estimatedDeploymentCostFactor=10,n.getItemDataAsJson(s.item.id,a).then((t=>{s.data=t,n.getServiceLayersAndTables(s,a).then((t=>{t.item.modified=Math.max(t.item.modified,i(s.properties.layers),i(s.properties.tables)),n.extractDependencies(t,a).then((r=>{t.dependencies=r.map((e=>e.id)),e(n.templatize(t,r,!1,o))}),(e=>r(n.fail(e))))}),(e=>r(n.fail(e))))})))}))},e.createItemFromTemplate=function(e,t,r,i){return new Promise((a=>{if(!i(e.itemId,n.EItemProgressStatus.Started,0))return i(e.itemId,n.EItemProgressStatus.Ignored,0),void a(n.generateEmptyCreationResponse(e.type));let o=n.cloneObject(e);o=n.replaceInTemplate(o,t),delete o.item.thumbnail;const s=n.cachePopupInfos(o.data);n.createFeatureService(o,r,t).then((m=>{m.success?i(e.itemId,n.EItemProgressStatus.Created,e.estimatedDeploymentCostFactor/2,m.serviceItemId)?(o=n.updateTemplate(o,t,m),n.addFeatureServiceLayersAndTables(o,t,s,r).then((()=>{o=n.updateTemplate(o,t,m),n.updateItemExtended({...o.item,url:void 0},o.data,r,e.item.thumbnail,void 0,t).then((()=>{i(e.itemId,n.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor/2,m.serviceItemId)?n.getItemBase(o.itemId,r).then((e=>{o.item=e,n.getProp(o,"item.url")&&!o.item.url.endsWith("/")&&(o.item.url+="/"),a({item:o,id:m.serviceItemId,type:o.type,postProcess:n.hasUnresolvedVariables({item:o.item,data:o.data})||n.isWorkforceProject(o)})}),(()=>{i(e.itemId,n.EItemProgressStatus.Failed,0),n.removeItem(m.serviceItemId,r).then((()=>a(n.generateEmptyCreationResponse(e.type))),(()=>a(n.generateEmptyCreationResponse(e.type))))})):(i(e.itemId,n.EItemProgressStatus.Cancelled,0),n.removeItem(m.serviceItemId,r).then((()=>a(n.generateEmptyCreationResponse(e.type))),(()=>a(n.generateEmptyCreationResponse(e.type)))))}),(()=>{i(e.itemId,n.EItemProgressStatus.Failed,0),n.removeItem(m.serviceItemId,r).then((()=>a(n.generateEmptyCreationResponse(e.type))),(()=>a(n.generateEmptyCreationResponse(e.type))))}))}),(()=>{i(e.itemId,n.EItemProgressStatus.Failed,0),n.removeItem(m.serviceItemId,r).then((()=>a(n.generateEmptyCreationResponse(e.type))),(()=>a(n.generateEmptyCreationResponse(e.type))))}))):(i(e.itemId,n.EItemProgressStatus.Cancelled,0),n.removeItem(m.serviceItemId,r).then((()=>a(n.generateEmptyCreationResponse(e.type))),(()=>a(n.generateEmptyCreationResponse(e.type))))):(i(e.itemId,n.EItemProgressStatus.Failed,0),a(n.generateEmptyCreationResponse(e.type)))}),(()=>{i(e.itemId,n.EItemProgressStatus.Failed,0),a(n.generateEmptyCreationResponse(e.type))}))}))},e.postProcess=function(e,t,r,i,a,o,s){return new Promise(((t,r)=>{n.updateItemTemplateFromDictionary(e,o,s).then((e=>{n.isWorkforceProject(i)?(i=n.replaceInTemplate(i,o),n.fineTuneCreatedWorkforceItem(i,s,i.item.url,o).then(t,r)):t(e)}),r)}))},Object.defineProperty(e,"__esModule",{value:!0})}));
19
19
  //# sourceMappingURL=feature-layer.umd.min.js.map
@@ -1 +1 @@
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 * @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":["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","extractDependencies","dependencies","map","dep","templatize","destinationAuthentication","itemProgressCallback","itemId","EItemProgressStatus","Started","Ignored","generateEmptyCreationResponse","type","newItemTemplate","cloneObject","replaceInTemplate","thumbnail","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":";;;;;;;;;;;;;;;;;+pBAyCEA,EACAC,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIC,SAA8B,CAACC,EAASC,KAEjD,MAAMC,EAAiCC,EAAOC,8BAC5CT,GAGsCQ,EAAOE,4BAC7CV,EAASW,mBAGTH,EACGI,qCAAqCL,EA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2B,8BAA8B5B,EAAS6B,cApM5DN,EACEvB,EAASwB,OACTvB,EAAOwB,oBAAoB+B,UAC3B,GAEFvD,EACGsD,WACClB,EAAeG,cACflB,GAEDhB,MACC,IACER,EACEG,EAAO2B,8BAA8B5B,EAAS6B,SAElD,IACE/B,EAAQG,EAAO2B,8BAA8B5B,EAAS6B,WA2L9DN,EACEvB,EAASwB,OACTvB,EAAOwB,oBAAoB6B,OAC3B,GAEFxD,EAAQG,EAAO2B,8BAA8B5B,EAAS6B,WAG1D,KACEN,EACEvB,EAASwB,OACTvB,EAAOwB,oBAAoB6B,OAC3B,GAEFxD,EAAQG,EAAO2B,8BAA8B5B,EAAS6B,qCAiB9DL,EACAK,EACA4B,EACAzD,EACA0D,EACA9D,EACA+D,GAEA,OAAO,IAAI9D,SAAoC,CAACC,EAASC,KACvDE,EACG2D,iCACCpC,EACA5B,EACA+D,GAEDrD,MAAKuD,IACA5D,EAAOoD,mBAAmBrD,IAC5BA,EAAWC,EAAO+B,kBAAkBhC,EAAUJ,GAC9CK,EACG6D,6BACC9D,EACA2D,EACA3D,EAASY,KAAKgC,IACdhD,GAEDU,KAAKR,EAASC,IAEjBD,EAAQ+D,KAET9D"}
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 * @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 // 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 * @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\r\n//#region Internal functions -----------------------------------------------------------------------------------------//\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","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":";;;;;;;;;;;;;;;;;uoBAocgBA,EACdC,GAEA,IAAIC,EAAqB,EASzB,OARAD,EAAiBE,SACdC,IACCF,EACEE,EAAMC,aAAaC,aACnBC,KAAKC,IAAIN,EAAoBE,EAAMC,YAAYC,cAC/CJ,KAGCA,gEAvaPO,EACAC,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIC,SAA8B,CAACC,EAASC,KAEjD,MAAMC,EAAiCC,EA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C,EACEG,EAAO+B,8BACLhC,EAASiC,eAO3B,KACEN,EACE3B,EAAS4B,OACT3B,EAAO4B,oBAAoB6B,OAC3B,GAEFzD,EACG0D,WACClB,EAAeG,cACflB,GAEDpB,MACC,IACER,EACEG,EAAO+B,8BAA8BhC,EAASiC,SAElD,IACEnC,EACEG,EAAO+B,8BAA8BhC,EAASiC,cApM5DN,EACE3B,EAAS4B,OACT3B,EAAO4B,oBAAoB+B,UAC3B,GAEF3D,EACG0D,WACClB,EAAeG,cACflB,GAEDpB,MACC,IACER,EACEG,EAAO+B,8BAA8BhC,EAASiC,SAElD,IACEnC,EAAQG,EAAO+B,8BAA8BhC,EAASiC,WA2L9DN,EACE3B,EAAS4B,OACT3B,EAAO4B,oBAAoB6B,OAC3B,GAEF5D,EAAQG,EAAO+B,8BAA8BhC,EAASiC,WAG1D,KACEN,EACE3B,EAAS4B,OACT3B,EAAO4B,oBAAoB6B,OAC3B,GAEF5D,EAAQG,EAAO+B,8BAA8BhC,EAASiC,qCAiB9DL,EACAK,EACA4B,EACA7D,EACA8D,EACAlE,EACAmE,GAEA,OAAO,IAAIlE,SAAoC,CAACC,EAASC,KACvDE,EACG+D,iCACCpC,EACAhC,EACAmE,GAEDzD,MAAK2D,IACAhE,EAAOwD,mBAAmBzD,IAC5BA,EAAWC,EAAOmC,kBAAkBpC,EAAUJ,GAC9CK,EACGiE,6BACClE,EACA+D,EACA/D,EAASY,KAAKoC,IACdpD,GAEDU,KAAKR,EAASC,IAEjBD,EAAQmE,KAETlE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-feature-layer",
3
- "version": "1.3.5",
3
+ "version": "1.3.9",
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",
@@ -36,7 +36,7 @@
36
36
  "@esri/hub-teams": "9.15.0"
37
37
  },
38
38
  "dependencies": {
39
- "@esri/solution-common": "^1.3.5",
39
+ "@esri/solution-common": "^1.3.9",
40
40
  "tslib": "1.13.0"
41
41
  },
42
42
  "scripts": {
@@ -89,5 +89,5 @@
89
89
  "esri",
90
90
  "ES6"
91
91
  ],
92
- "gitHead": "9f2f2c69043777abd94120acad0b7c45d172301d"
92
+ "gitHead": "b6373fcbf48472b35e833564440ecec8665cd734"
93
93
  }