@esri/solution-group 1.4.1 → 1.5.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/dist/esm/group.d.ts +1 -1
- package/dist/esm/group.js +1 -1
- package/dist/node/group.d.ts +1 -1
- package/dist/node/group.js +1 -1
- package/dist/umd/{group.d.ts → group/src/group.d.ts} +1 -1
- package/dist/umd/{index.d.ts → group/src/index.d.ts} +0 -0
- package/dist/umd/group.umd.js +3 -3
- package/dist/umd/group.umd.js.map +1 -1
- package/dist/umd/group.umd.min.js +2 -2
- package/dist/umd/group.umd.min.js.map +1 -1
- package/package.json +94 -94
package/dist/esm/group.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare function createItemFromTemplate(template: common.IItemTemplate, t
|
|
|
35
35
|
*
|
|
36
36
|
* @param {string} id The item ID
|
|
37
37
|
* @param {string} type The template type
|
|
38
|
-
* @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
|
|
38
|
+
* @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
|
|
39
39
|
* @param {common.IItemTemplate} template The original template
|
|
40
40
|
* @param {common.IItemTemplate[]} templates The original templates
|
|
41
41
|
* @param {any} templateDictionary The template dictionary
|
package/dist/esm/group.js
CHANGED
|
@@ -189,7 +189,7 @@ export function createItemFromTemplate(template, templateDictionary, destination
|
|
|
189
189
|
*
|
|
190
190
|
* @param {string} id The item ID
|
|
191
191
|
* @param {string} type The template type
|
|
192
|
-
* @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
|
|
192
|
+
* @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
|
|
193
193
|
* @param {common.IItemTemplate} template The original template
|
|
194
194
|
* @param {common.IItemTemplate[]} templates The original templates
|
|
195
195
|
* @param {any} templateDictionary The template dictionary
|
package/dist/node/group.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare function createItemFromTemplate(template: common.IItemTemplate, t
|
|
|
35
35
|
*
|
|
36
36
|
* @param {string} id The item ID
|
|
37
37
|
* @param {string} type The template type
|
|
38
|
-
* @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
|
|
38
|
+
* @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
|
|
39
39
|
* @param {common.IItemTemplate} template The original template
|
|
40
40
|
* @param {common.IItemTemplate[]} templates The original templates
|
|
41
41
|
* @param {any} templateDictionary The template dictionary
|
package/dist/node/group.js
CHANGED
|
@@ -195,7 +195,7 @@ exports.createItemFromTemplate = createItemFromTemplate;
|
|
|
195
195
|
*
|
|
196
196
|
* @param {string} id The item ID
|
|
197
197
|
* @param {string} type The template type
|
|
198
|
-
* @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
|
|
198
|
+
* @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
|
|
199
199
|
* @param {common.IItemTemplate} template The original template
|
|
200
200
|
* @param {common.IItemTemplate[]} templates The original templates
|
|
201
201
|
* @param {any} templateDictionary The template dictionary
|
|
@@ -35,7 +35,7 @@ export declare function createItemFromTemplate(template: common.IItemTemplate, t
|
|
|
35
35
|
*
|
|
36
36
|
* @param {string} id The item ID
|
|
37
37
|
* @param {string} type The template type
|
|
38
|
-
* @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
|
|
38
|
+
* @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
|
|
39
39
|
* @param {common.IItemTemplate} template The original template
|
|
40
40
|
* @param {common.IItemTemplate[]} templates The original templates
|
|
41
41
|
* @param {any} templateDictionary The template dictionary
|
|
File without changes
|
package/dist/umd/group.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-group - v1.
|
|
2
|
+
* @esri/solution-group - v1.3.16 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
-
*
|
|
4
|
+
* Thu Sep 22 2022 11:03:38 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.
|
|
@@ -226,7 +226,7 @@
|
|
|
226
226
|
*
|
|
227
227
|
* @param {string} id The item ID
|
|
228
228
|
* @param {string} type The template type
|
|
229
|
-
* @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
|
|
229
|
+
* @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
|
|
230
230
|
* @param {common.IItemTemplate} template The original template
|
|
231
231
|
* @param {common.IItemTemplate[]} templates The original templates
|
|
232
232
|
* @param {any} templateDictionary The template dictionary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.umd.js","sources":["../../src/group.ts"],"sourcesContent":["/** @license\r\n * Copyright 2019 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 groups.\r\n *\r\n * @module group\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Converts a group item into a template.\r\n *\r\n * @param solutionItemId The solution to contain the template\r\n * @param itemInfo Info about the item\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @returns A promise that will resolve when the template has been created\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): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>(resolve => {\r\n // Init template\r\n const itemTemplate: common.IItemTemplate = common.createInitializedGroupTemplate(\r\n itemInfo\r\n );\r\n\r\n // Templatize item info property values\r\n itemTemplate.item.id = common.templatizeTerm(\r\n itemTemplate.item.id,\r\n itemTemplate.item.id,\r\n \".itemId\"\r\n );\r\n\r\n // Get the group's items--its dependencies\r\n common.getGroupContents(itemInfo.id, srcAuthentication).then(\r\n groupContents => {\r\n itemTemplate.type = \"Group\";\r\n itemTemplate.dependencies = groupContents;\r\n common.getGroupBase(itemInfo.id, srcAuthentication).then(\r\n groupResponse => {\r\n groupResponse.id = itemTemplate.item.id;\r\n itemTemplate.item = {\r\n ...groupResponse,\r\n type: \"Group\"\r\n };\r\n resolve(itemTemplate);\r\n },\r\n () => resolve(itemTemplate)\r\n );\r\n },\r\n () => resolve(itemTemplate)\r\n );\r\n });\r\n}\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 // Need to manually reset thumbnail because adlib in replaceInTemplate breaks it\r\n newItemTemplate.item.thumbnail = template.item.thumbnail;\r\n\r\n // Set up properties needed to create group\r\n const newGroup: common.IGroupAdd = {\r\n title: newItemTemplate.item.title || \"\",\r\n access: \"private\",\r\n owner: newItemTemplate.item.owner,\r\n tags: newItemTemplate.item.tags,\r\n typeKeywords: newItemTemplate.item.typeKeywords,\r\n description: newItemTemplate.item.description,\r\n thumbnail: newItemTemplate.item.thumbnail,\r\n snippet: newItemTemplate.item.snippet\r\n };\r\n\r\n const props: string[] = [\r\n \"isInvitationOnly\", \"autoJoin\", \"membershipAccess\", \"isViewOnly\", \"sortField\", \"sortOrder\", \"isOpenData\", \"displaySettings\"\r\n ];\r\n props.forEach(p => {\r\n /* istanbul ignore else */\r\n if (newItemTemplate.item.hasOwnProperty(p)) {\r\n newGroup[p] = newItemTemplate.item[p];\r\n }\r\n })\r\n\r\n // Create a group, appending a sequential suffix to its name if the group exists, e.g.,\r\n // * Manage Right of Way Activities\r\n // * Manage Right of Way Activities 1\r\n // * Manage Right of Way Activities 2\r\n common\r\n .createUniqueGroup(\r\n newGroup.title,\r\n newGroup,\r\n templateDictionary,\r\n destinationAuthentication,\r\n common.isTrackingViewGroup(newItemTemplate) ? templateDictionary.locationTracking.owner : undefined\r\n )\r\n .then(\r\n (createResponse: common.IAddGroupResponse) => {\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.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(createResponse.group.id, destinationAuthentication)\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 newItemTemplate.itemId = createResponse.group.id;\r\n templateDictionary[template.itemId] = {\r\n itemId: createResponse.group.id\r\n };\r\n\r\n // Update the template again now that we have the new item id\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n\r\n // Update the template dictionary with the new id\r\n templateDictionary[template.itemId].itemId =\r\n createResponse.group.id;\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.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(\r\n createResponse.group.id,\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 } else {\r\n if (common.isTrackingViewGroup(newItemTemplate)) {\r\n const owner: string = templateDictionary.locationTracking.owner;\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.reassignGroup(\r\n createResponse.group.id,\r\n owner,\r\n destinationAuthentication\r\n ).then(assignResults => {\r\n if (assignResults.success) {\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(createResponse.group.id, destinationAuthentication)\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 // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.removeUsers(\r\n createResponse.group.id,\r\n [destinationAuthentication.username],\r\n destinationAuthentication\r\n ).then(removeResults => {\r\n if (Array.isArray(removeResults.notRemoved) && removeResults.notRemoved.length === 0) {\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(createResponse.group.id, destinationAuthentication)\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 resolve({\r\n item: newItemTemplate,\r\n id: createResponse.group.id,\r\n type: newItemTemplate.type,\r\n postProcess: common.hasUnresolvedVariables(\r\n newItemTemplate\r\n )\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 } 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 } else {\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.group.id,\r\n type: newItemTemplate.type,\r\n postProcess: common.hasUnresolvedVariables(\r\n newItemTemplate\r\n )\r\n });\r\n }\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 * Group post-processing actions\r\n *\r\n * @param {string} id 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 {common.IItemTemplate} template The original template\r\n * @param {common.IItemTemplate[]} templates The original templates\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 id: 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: any\r\n): Promise<any> {\r\n let promise = Promise.resolve({success: true});\r\n itemInfos.some(t => {\r\n /* istanbul ignore else */\r\n if (t.id === id) {\r\n let group = t.item.item;\r\n /* istanbul ignore else */\r\n if (common.hasUnresolvedVariables(group)) {\r\n group = common.replaceInTemplate(group, templateDictionary);\r\n // update the group\r\n promise = common.updateGroup(group, authentication);\r\n }\r\n return true;\r\n }\r\n });\r\n return promise;\r\n}\r\n"],"names":["common"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;EAwBA;EAEA;;;;;;;;;WASgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iBAAqC;MAErC,OAAO,IAAI,OAAO,CAAuB,OAAO;;UAE9C,MAAM,YAAY,GAAyBA,iBAAM,CAAC,8BAA8B,CAC9E,QAAQ,CACT,CAAC;;UAGF,YAAY,CAAC,IAAI,CAAC,EAAE,GAAGA,iBAAM,CAAC,cAAc,CAC1C,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,SAAS,CACV,CAAC;;UAGFA,iBAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC,C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CAAC,CAAC;MACH,OAAO,OAAO,CAAC;EACjB;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"group.umd.js","sources":["../../src/group.ts"],"sourcesContent":["/** @license\r\n * Copyright 2019 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 groups.\r\n *\r\n * @module group\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Converts a group item into a template.\r\n *\r\n * @param solutionItemId The solution to contain the template\r\n * @param itemInfo Info about the item\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @returns A promise that will resolve when the template has been created\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): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>(resolve => {\r\n // Init template\r\n const itemTemplate: common.IItemTemplate = common.createInitializedGroupTemplate(\r\n itemInfo\r\n );\r\n\r\n // Templatize item info property values\r\n itemTemplate.item.id = common.templatizeTerm(\r\n itemTemplate.item.id,\r\n itemTemplate.item.id,\r\n \".itemId\"\r\n );\r\n\r\n // Get the group's items--its dependencies\r\n common.getGroupContents(itemInfo.id, srcAuthentication).then(\r\n groupContents => {\r\n itemTemplate.type = \"Group\";\r\n itemTemplate.dependencies = groupContents;\r\n common.getGroupBase(itemInfo.id, srcAuthentication).then(\r\n groupResponse => {\r\n groupResponse.id = itemTemplate.item.id;\r\n itemTemplate.item = {\r\n ...groupResponse,\r\n type: \"Group\"\r\n };\r\n resolve(itemTemplate);\r\n },\r\n () => resolve(itemTemplate)\r\n );\r\n },\r\n () => resolve(itemTemplate)\r\n );\r\n });\r\n}\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 // Need to manually reset thumbnail because adlib in replaceInTemplate breaks it\r\n newItemTemplate.item.thumbnail = template.item.thumbnail;\r\n\r\n // Set up properties needed to create group\r\n const newGroup: common.IGroupAdd = {\r\n title: newItemTemplate.item.title || \"\",\r\n access: \"private\",\r\n owner: newItemTemplate.item.owner,\r\n tags: newItemTemplate.item.tags,\r\n typeKeywords: newItemTemplate.item.typeKeywords,\r\n description: newItemTemplate.item.description,\r\n thumbnail: newItemTemplate.item.thumbnail,\r\n snippet: newItemTemplate.item.snippet\r\n };\r\n\r\n const props: string[] = [\r\n \"isInvitationOnly\", \"autoJoin\", \"membershipAccess\", \"isViewOnly\", \"sortField\", \"sortOrder\", \"isOpenData\", \"displaySettings\"\r\n ];\r\n props.forEach(p => {\r\n /* istanbul ignore else */\r\n if (newItemTemplate.item.hasOwnProperty(p)) {\r\n newGroup[p] = newItemTemplate.item[p];\r\n }\r\n })\r\n\r\n // Create a group, appending a sequential suffix to its name if the group exists, e.g.,\r\n // * Manage Right of Way Activities\r\n // * Manage Right of Way Activities 1\r\n // * Manage Right of Way Activities 2\r\n common\r\n .createUniqueGroup(\r\n newGroup.title,\r\n newGroup,\r\n templateDictionary,\r\n destinationAuthentication,\r\n common.isTrackingViewGroup(newItemTemplate) ? templateDictionary.locationTracking.owner : undefined\r\n )\r\n .then(\r\n (createResponse: common.IAddGroupResponse) => {\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.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(createResponse.group.id, destinationAuthentication)\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 newItemTemplate.itemId = createResponse.group.id;\r\n templateDictionary[template.itemId] = {\r\n itemId: createResponse.group.id\r\n };\r\n\r\n // Update the template again now that we have the new item id\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n\r\n // Update the template dictionary with the new id\r\n templateDictionary[template.itemId].itemId =\r\n createResponse.group.id;\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.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(\r\n createResponse.group.id,\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 } else {\r\n if (common.isTrackingViewGroup(newItemTemplate)) {\r\n const owner: string = templateDictionary.locationTracking.owner;\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.reassignGroup(\r\n createResponse.group.id,\r\n owner,\r\n destinationAuthentication\r\n ).then(assignResults => {\r\n if (assignResults.success) {\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(createResponse.group.id, destinationAuthentication)\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 // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.removeUsers(\r\n createResponse.group.id,\r\n [destinationAuthentication.username],\r\n destinationAuthentication\r\n ).then(removeResults => {\r\n if (Array.isArray(removeResults.notRemoved) && removeResults.notRemoved.length === 0) {\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(createResponse.group.id, destinationAuthentication)\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 resolve({\r\n item: newItemTemplate,\r\n id: createResponse.group.id,\r\n type: newItemTemplate.type,\r\n postProcess: common.hasUnresolvedVariables(\r\n newItemTemplate\r\n )\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 } 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 } else {\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.group.id,\r\n type: newItemTemplate.type,\r\n postProcess: common.hasUnresolvedVariables(\r\n newItemTemplate\r\n )\r\n });\r\n }\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 * Group post-processing actions\r\n *\r\n * @param {string} id 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 {common.IItemTemplate} template The original template\r\n * @param {common.IItemTemplate[]} templates The original templates\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 id: 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: any\r\n): Promise<any> {\r\n let promise = Promise.resolve({success: true});\r\n itemInfos.some(t => {\r\n /* istanbul ignore else */\r\n if (t.id === id) {\r\n let group = t.item.item;\r\n /* istanbul ignore else */\r\n if (common.hasUnresolvedVariables(group)) {\r\n group = common.replaceInTemplate(group, templateDictionary);\r\n // update the group\r\n promise = common.updateGroup(group, authentication);\r\n }\r\n return true;\r\n }\r\n });\r\n return promise;\r\n}\r\n"],"names":["common"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;EAcG;EAUH;EAEA;;;;;;;;EAQG;EACG,SAAU,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iBAAqC,EAAA;EAErC,IAAA,OAAO,IAAI,OAAO,CAAuB,OAAO,IAAG;;UAEjD,MAAM,YAAY,GAAyBA,iBAAM,CAAC,8BAA8B,CAC9E,QAAQ,CACT,CAAC;;UAGF,YAAY,CAAC,IAAI,CAAC,EAAE,GAAGA,iBAAM,CAAC,cAAc,CAC1C,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,SAAS,CACV,CAAC;;EAGF,QAAAA,iBAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAC1D,aAAa,IAAG;EACd,YAAA,YAAY,CAAC,IAAI,GAAG,OAAO,CAAC;EAC5B,YAAA,YAAY,CAAC,YAAY,GAAG,aAAa,CAAC;EAC1C,YAAAA,iBAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC,IAAI,CACtD,aAAa,IAAG;kBACd,aAAa,CAAC,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;kBACxC,YAAY,CAAC,IAAI,GAAG;EAClB,oBAAA,GAAG,aAAa;EAChB,oBAAA,IAAI,EAAE,OAAO;mBAC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,IAAIA,iBAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,EAAE;kBACxC,KAAK,GAAGA,iBAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;;kBAE5D,OAAO,GAAGA,iBAAM,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;EACrD,aAAA;EACD,YAAA,OAAO,IAAI,CAAC;EACb,SAAA;EACH,KAAC,CAAC,CAAC;EACH,IAAA,OAAO,OAAO,CAAC;EACjB;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-group - v1.
|
|
2
|
+
* @esri/solution-group - v1.3.16 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
-
*
|
|
4
|
+
* Thu Sep 22 2022 11:03:42 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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.umd.min.js","sources":["../../src/group.ts"],"sourcesContent":["/** @license\r\n * Copyright 2019 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 groups.\r\n *\r\n * @module group\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Converts a group item into a template.\r\n *\r\n * @param solutionItemId The solution to contain the template\r\n * @param itemInfo Info about the item\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @returns A promise that will resolve when the template has been created\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): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>(resolve => {\r\n // Init template\r\n const itemTemplate: common.IItemTemplate = common.createInitializedGroupTemplate(\r\n itemInfo\r\n );\r\n\r\n // Templatize item info property values\r\n itemTemplate.item.id = common.templatizeTerm(\r\n itemTemplate.item.id,\r\n itemTemplate.item.id,\r\n \".itemId\"\r\n );\r\n\r\n // Get the group's items--its dependencies\r\n common.getGroupContents(itemInfo.id, srcAuthentication).then(\r\n groupContents => {\r\n itemTemplate.type = \"Group\";\r\n itemTemplate.dependencies = groupContents;\r\n common.getGroupBase(itemInfo.id, srcAuthentication).then(\r\n groupResponse => {\r\n groupResponse.id = itemTemplate.item.id;\r\n itemTemplate.item = {\r\n ...groupResponse,\r\n type: \"Group\"\r\n };\r\n resolve(itemTemplate);\r\n },\r\n () => resolve(itemTemplate)\r\n );\r\n },\r\n () => resolve(itemTemplate)\r\n );\r\n });\r\n}\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 // Need to manually reset thumbnail because adlib in replaceInTemplate breaks it\r\n newItemTemplate.item.thumbnail = template.item.thumbnail;\r\n\r\n // Set up properties needed to create group\r\n const newGroup: common.IGroupAdd = {\r\n title: newItemTemplate.item.title || \"\",\r\n access: \"private\",\r\n owner: newItemTemplate.item.owner,\r\n tags: newItemTemplate.item.tags,\r\n typeKeywords: newItemTemplate.item.typeKeywords,\r\n description: newItemTemplate.item.description,\r\n thumbnail: newItemTemplate.item.thumbnail,\r\n snippet: newItemTemplate.item.snippet\r\n };\r\n\r\n const props: string[] = [\r\n \"isInvitationOnly\", \"autoJoin\", \"membershipAccess\", \"isViewOnly\", \"sortField\", \"sortOrder\", \"isOpenData\", \"displaySettings\"\r\n ];\r\n props.forEach(p => {\r\n /* istanbul ignore else */\r\n if (newItemTemplate.item.hasOwnProperty(p)) {\r\n newGroup[p] = newItemTemplate.item[p];\r\n }\r\n })\r\n\r\n // Create a group, appending a sequential suffix to its name if the group exists, e.g.,\r\n // * Manage Right of Way Activities\r\n // * Manage Right of Way Activities 1\r\n // * Manage Right of Way Activities 2\r\n common\r\n .createUniqueGroup(\r\n newGroup.title,\r\n newGroup,\r\n templateDictionary,\r\n destinationAuthentication,\r\n common.isTrackingViewGroup(newItemTemplate) ? templateDictionary.locationTracking.owner : undefined\r\n )\r\n .then(\r\n (createResponse: common.IAddGroupResponse) => {\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.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(createResponse.group.id, destinationAuthentication)\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 newItemTemplate.itemId = createResponse.group.id;\r\n templateDictionary[template.itemId] = {\r\n itemId: createResponse.group.id\r\n };\r\n\r\n // Update the template again now that we have the new item id\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n\r\n // Update the template dictionary with the new id\r\n templateDictionary[template.itemId].itemId =\r\n createResponse.group.id;\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.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(\r\n createResponse.group.id,\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 } else {\r\n if (common.isTrackingViewGroup(newItemTemplate)) {\r\n const owner: string = templateDictionary.locationTracking.owner;\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.reassignGroup(\r\n createResponse.group.id,\r\n owner,\r\n destinationAuthentication\r\n ).then(assignResults => {\r\n if (assignResults.success) {\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(createResponse.group.id, destinationAuthentication)\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 // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.removeUsers(\r\n createResponse.group.id,\r\n [destinationAuthentication.username],\r\n destinationAuthentication\r\n ).then(removeResults => {\r\n if (Array.isArray(removeResults.notRemoved) && removeResults.notRemoved.length === 0) {\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(createResponse.group.id, destinationAuthentication)\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 resolve({\r\n item: newItemTemplate,\r\n id: createResponse.group.id,\r\n type: newItemTemplate.type,\r\n postProcess: common.hasUnresolvedVariables(\r\n newItemTemplate\r\n )\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 } 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 } else {\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.group.id,\r\n type: newItemTemplate.type,\r\n postProcess: common.hasUnresolvedVariables(\r\n newItemTemplate\r\n )\r\n });\r\n }\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 * Group post-processing actions\r\n *\r\n * @param {string} id 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 {common.IItemTemplate} template The original template\r\n * @param {common.IItemTemplate[]} templates The original templates\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 id: 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: any\r\n): Promise<any> {\r\n let promise = Promise.resolve({success: true});\r\n itemInfos.some(t => {\r\n /* istanbul ignore else */\r\n if (t.id === id) {\r\n let group = t.item.item;\r\n /* istanbul ignore else */\r\n if (common.hasUnresolvedVariables(group)) {\r\n group = common.replaceInTemplate(group, templateDictionary);\r\n // update the group\r\n promise = common.updateGroup(group, authentication);\r\n }\r\n return true;\r\n }\r\n });\r\n return promise;\r\n}\r\n"],"names":["solutionItemId","itemInfo","destAuthentication","srcAuthentication","Promise","resolve","itemTemplate","common","createInitializedGroupTemplate","item","id","templatizeTerm","getGroupContents","then","groupContents","type","dependencies","getGroupBase","groupResponse","template","templateDictionary","destinationAuthentication","itemProgressCallback","itemId","EItemProgressStatus","Started","Ignored","generateEmptyCreationResponse","newItemTemplate","cloneObject","replaceInTemplate","thumbnail","newGroup","title","access","owner","tags","typeKeywords","description","snippet","forEach","p","hasOwnProperty","createUniqueGroup","isTrackingViewGroup","locationTracking","undefined","createResponse","success","Created","estimatedDeploymentCostFactor","group","Finished","reassignGroup","assignResults","removeUsers","username","removeResults","Array","isArray","notRemoved","length","postProcess","hasUnresolvedVariables","Cancelled","removeGroup","Failed","itemInfos","templates","authentication","promise","some","t","updateGroup"],"mappings":";;;;;;;;;;;;;;;;;+pBAoCEA,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIC,SAA8BC,IAEvC,MAAMC,EAAqCC,EAAOC,+BAChDP,GAIFK,EAAaG,KAAKC,GAAKH,EAAOI,eAC5BL,EAAaG,KAAKC,GAClBJ,EAAaG,KAAKC,GAClB,WAIFH,EAAOK,iBAAiBX,EAASS,GAAIP,GAAmBU,MACtDC,IACER,EAAaS,KAAO,QACpBT,EAAaU,aAAeF,EAC5BP,EAAOU,aAAahB,EAASS,GAAIP,GAAmBU,MAClDK,IACEA,EAAcR,GAAKJ,EAAaG,KAAKC,GACrCJ,EAAaG,KAAO,IACfS,EACHH,KAAM,SAERV,EAAQC,EAAa,IAEvB,IAAMD,EAAQC,IACf,IAEH,IAAMD,EAAQC,IACf,GAEL,oCAGEa,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIlB,SAAgDC,IAEzD,IACGiB,EACCH,EAASI,OACThB,EAAOiB,oBAAoBC,QAC3B,GASF,OANAH,EACEH,EAASI,OACThB,EAAOiB,oBAAoBE,QAC3B,QAEFrB,EAAQE,EAAOoB,8BAA8BR,EAASJ,OAKxD,IAAIa,EAAwCrB,EAAOsB,YAAYV,GAC/DS,EAAkBrB,EAAOuB,kBACvBF,EACAR,GAGFQ,EAAgBnB,KAAKsB,UAAYZ,EAASV,KAAKsB,UAG/C,MAAMC,EAA6B,CACjCC,MAAOL,EAAgBnB,KAAKwB,OAAS,GACrCC,OAAQ,UACRC,MAAOP,EAAgBnB,KAAK0B,MAC5BC,KAAMR,EAAgBnB,KAAK2B,KAC3BC,aAAcT,EAAgBnB,KAAK4B,aACnCC,YAAaV,EAAgBnB,KAAK6B,YAClCP,UAAWH,EAAgBnB,KAAKsB,U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GAEF7D,EAAQE,EAAOoB,8BAA8BR,EAASJ,UAG1D,KACEO,EACEH,EAASI,OACThB,EAAOiB,oBAAoB0C,OAC3B,GAEF7D,EAAQE,EAAOoB,8BAA8BR,EAASJ,MAAM,GAE/D,GAEP,yBAeEL,EACAK,EACAoD,EACAhD,EACAiD,EACAhD,EACAiD,GAEA,IAAIC,EAAUlE,QAAQC,QAAQ,CAAC2C,SAAS,IAcxC,OAbAmB,EAAUI,MAAKC,IAEb,GAAIA,EAAE9D,KAAOA,EAAI,CACf,IAAIyC,EAAQqB,EAAE/D,KAAKA,KAOnB,OALIF,EAAOwD,uBAAuBZ,KAChCA,EAAQ5C,EAAOuB,kBAAkBqB,EAAO/B,GAExCkD,EAAU/D,EAAOkE,YAAYtB,EAAOkB,KAE/B,MAGJC,CACT"}
|
|
1
|
+
{"version":3,"file":"group.umd.min.js","sources":["../../src/group.ts"],"sourcesContent":["/** @license\r\n * Copyright 2019 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 groups.\r\n *\r\n * @module group\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Converts a group item into a template.\r\n *\r\n * @param solutionItemId The solution to contain the template\r\n * @param itemInfo Info about the item\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @returns A promise that will resolve when the template has been created\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): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>(resolve => {\r\n // Init template\r\n const itemTemplate: common.IItemTemplate = common.createInitializedGroupTemplate(\r\n itemInfo\r\n );\r\n\r\n // Templatize item info property values\r\n itemTemplate.item.id = common.templatizeTerm(\r\n itemTemplate.item.id,\r\n itemTemplate.item.id,\r\n \".itemId\"\r\n );\r\n\r\n // Get the group's items--its dependencies\r\n common.getGroupContents(itemInfo.id, srcAuthentication).then(\r\n groupContents => {\r\n itemTemplate.type = \"Group\";\r\n itemTemplate.dependencies = groupContents;\r\n common.getGroupBase(itemInfo.id, srcAuthentication).then(\r\n groupResponse => {\r\n groupResponse.id = itemTemplate.item.id;\r\n itemTemplate.item = {\r\n ...groupResponse,\r\n type: \"Group\"\r\n };\r\n resolve(itemTemplate);\r\n },\r\n () => resolve(itemTemplate)\r\n );\r\n },\r\n () => resolve(itemTemplate)\r\n );\r\n });\r\n}\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 // Need to manually reset thumbnail because adlib in replaceInTemplate breaks it\r\n newItemTemplate.item.thumbnail = template.item.thumbnail;\r\n\r\n // Set up properties needed to create group\r\n const newGroup: common.IGroupAdd = {\r\n title: newItemTemplate.item.title || \"\",\r\n access: \"private\",\r\n owner: newItemTemplate.item.owner,\r\n tags: newItemTemplate.item.tags,\r\n typeKeywords: newItemTemplate.item.typeKeywords,\r\n description: newItemTemplate.item.description,\r\n thumbnail: newItemTemplate.item.thumbnail,\r\n snippet: newItemTemplate.item.snippet\r\n };\r\n\r\n const props: string[] = [\r\n \"isInvitationOnly\", \"autoJoin\", \"membershipAccess\", \"isViewOnly\", \"sortField\", \"sortOrder\", \"isOpenData\", \"displaySettings\"\r\n ];\r\n props.forEach(p => {\r\n /* istanbul ignore else */\r\n if (newItemTemplate.item.hasOwnProperty(p)) {\r\n newGroup[p] = newItemTemplate.item[p];\r\n }\r\n })\r\n\r\n // Create a group, appending a sequential suffix to its name if the group exists, e.g.,\r\n // * Manage Right of Way Activities\r\n // * Manage Right of Way Activities 1\r\n // * Manage Right of Way Activities 2\r\n common\r\n .createUniqueGroup(\r\n newGroup.title,\r\n newGroup,\r\n templateDictionary,\r\n destinationAuthentication,\r\n common.isTrackingViewGroup(newItemTemplate) ? templateDictionary.locationTracking.owner : undefined\r\n )\r\n .then(\r\n (createResponse: common.IAddGroupResponse) => {\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.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(createResponse.group.id, destinationAuthentication)\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 newItemTemplate.itemId = createResponse.group.id;\r\n templateDictionary[template.itemId] = {\r\n itemId: createResponse.group.id\r\n };\r\n\r\n // Update the template again now that we have the new item id\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n\r\n // Update the template dictionary with the new id\r\n templateDictionary[template.itemId].itemId =\r\n createResponse.group.id;\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.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(\r\n createResponse.group.id,\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 } else {\r\n if (common.isTrackingViewGroup(newItemTemplate)) {\r\n const owner: string = templateDictionary.locationTracking.owner;\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.reassignGroup(\r\n createResponse.group.id,\r\n owner,\r\n destinationAuthentication\r\n ).then(assignResults => {\r\n if (assignResults.success) {\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(createResponse.group.id, destinationAuthentication)\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 // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common.removeUsers(\r\n createResponse.group.id,\r\n [destinationAuthentication.username],\r\n destinationAuthentication\r\n ).then(removeResults => {\r\n if (Array.isArray(removeResults.notRemoved) && removeResults.notRemoved.length === 0) {\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.group.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .removeGroup(createResponse.group.id, destinationAuthentication)\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 resolve({\r\n item: newItemTemplate,\r\n id: createResponse.group.id,\r\n type: newItemTemplate.type,\r\n postProcess: common.hasUnresolvedVariables(\r\n newItemTemplate\r\n )\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 } 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 } else {\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.group.id,\r\n type: newItemTemplate.type,\r\n postProcess: common.hasUnresolvedVariables(\r\n newItemTemplate\r\n )\r\n });\r\n }\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 * Group post-processing actions\r\n *\r\n * @param {string} id 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 {common.IItemTemplate} template The original template\r\n * @param {common.IItemTemplate[]} templates The original templates\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 id: 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: any\r\n): Promise<any> {\r\n let promise = Promise.resolve({success: true});\r\n itemInfos.some(t => {\r\n /* istanbul ignore else */\r\n if (t.id === id) {\r\n let group = t.item.item;\r\n /* istanbul ignore else */\r\n if (common.hasUnresolvedVariables(group)) {\r\n group = common.replaceInTemplate(group, templateDictionary);\r\n // update the group\r\n promise = common.updateGroup(group, authentication);\r\n }\r\n return true;\r\n }\r\n });\r\n return promise;\r\n}\r\n"],"names":["solutionItemId","itemInfo","destAuthentication","srcAuthentication","Promise","resolve","itemTemplate","common","createInitializedGroupTemplate","item","id","templatizeTerm","getGroupContents","then","groupContents","type","dependencies","getGroupBase","groupResponse","template","templateDictionary","destinationAuthentication","itemProgressCallback","itemId","EItemProgressStatus","Started","Ignored","generateEmptyCreationResponse","newItemTemplate","cloneObject","replaceInTemplate","thumbnail","newGroup","title","access","owner","tags","typeKeywords","description","snippet","forEach","p","hasOwnProperty","createUniqueGroup","isTrackingViewGroup","locationTracking","undefined","createResponse","success","Created","estimatedDeploymentCostFactor","group","Finished","reassignGroup","assignResults","removeUsers","username","removeResults","Array","isArray","notRemoved","length","postProcess","hasUnresolvedVariables","Cancelled","removeGroup","Failed","itemInfos","templates","authentication","promise","some","t","updateGroup"],"mappings":";;;;;;;;;;;;;;;;;sp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AM,GAE/D,GAEP,gBAcgB,SACdL,EACAK,EACAoD,EACAhD,EACAiD,EACAhD,EACAiD,GAEA,IAAIC,EAAUlE,QAAQC,QAAQ,CAAC2C,SAAS,IAcxC,OAbAmB,EAAUI,MAAKC,IAEb,GAAIA,EAAE9D,KAAOA,EAAI,CACf,IAAIyC,EAAQqB,EAAE/D,KAAKA,KAOnB,OALIF,EAAOwD,uBAAuBZ,KAChCA,EAAQ5C,EAAOuB,kBAAkBqB,EAAO/B,GAExCkD,EAAU/D,EAAOkE,YAAYtB,EAAOkB,KAE/B,CACR,KAEIC,CACT"}
|
package/package.json
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@esri/solution-group",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Manages the creation and deployment of group item types for @esri/solution.js.",
|
|
5
|
-
"main": "dist/node/index.js",
|
|
6
|
-
"unpkg": "dist/umd/group.umd.min.js",
|
|
7
|
-
"module": "dist/esm/index.js",
|
|
8
|
-
"js:next": "dist/esm/index.js",
|
|
9
|
-
"types": "dist/esm/index.d.ts",
|
|
10
|
-
"author": "Esri",
|
|
11
|
-
"license": "Apache-2.0",
|
|
12
|
-
"files": [
|
|
13
|
-
"dist/**"
|
|
14
|
-
],
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@esri/arcgis-rest-auth": "3.
|
|
17
|
-
"@esri/arcgis-rest-feature-layer": "3.
|
|
18
|
-
"@esri/arcgis-rest-portal": "3.
|
|
19
|
-
"@esri/arcgis-rest-request": "3.
|
|
20
|
-
"@esri/arcgis-rest-service-admin": "3.
|
|
21
|
-
"@esri/hub-common": "
|
|
22
|
-
"@esri/hub-initiatives": "
|
|
23
|
-
"@esri/hub-sites": "
|
|
24
|
-
"@esri/hub-teams": "
|
|
25
|
-
"rollup": "2.
|
|
26
|
-
},
|
|
27
|
-
"peerDependencies": {
|
|
28
|
-
"@esri/arcgis-rest-auth": "3.
|
|
29
|
-
"@esri/arcgis-rest-feature-layer": "3.
|
|
30
|
-
"@esri/arcgis-rest-portal": "3.
|
|
31
|
-
"@esri/arcgis-rest-request": "3.
|
|
32
|
-
"@esri/arcgis-rest-service-admin": "3.
|
|
33
|
-
"@esri/hub-common": "
|
|
34
|
-
"@esri/hub-initiatives": "
|
|
35
|
-
"@esri/hub-sites": "
|
|
36
|
-
"@esri/hub-teams": "
|
|
37
|
-
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"@esri/solution-common": "
|
|
40
|
-
"tslib": "1.14.1"
|
|
41
|
-
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"prepare": "npm run build",
|
|
44
|
-
"build": "npm run build:node && npm run build:umd && npm run build:esm",
|
|
45
|
-
"build:esm": "tsc -p ./tsconfig.json --module esnext --outDir ./dist/esm --declaration",
|
|
46
|
-
"build:umd": "rollup -c ../../umd-base-profile.js && rollup -c ../../umd-production-profile.js",
|
|
47
|
-
"build:node": "tsc -p ./tsconfig.json --module commonjs --outDir ./dist/node",
|
|
48
|
-
"dev:esm": "tsc -w --module esnext --outDir ./dist/esm --declaration",
|
|
49
|
-
"dev:umd": "rollup -w -c ../../umd-base-profile.js",
|
|
50
|
-
"dev:node": "tsc -w --module commonjs --outDir ./dist/node",
|
|
51
|
-
"getupdates": "npm-check-updates --upgrade"
|
|
52
|
-
},
|
|
53
|
-
"publishConfig": {
|
|
54
|
-
"access": "public"
|
|
55
|
-
},
|
|
56
|
-
"repository": {
|
|
57
|
-
"type": "git",
|
|
58
|
-
"url": "git+https://github.com/Esri/solution.js.git"
|
|
59
|
-
},
|
|
60
|
-
"contributors": [
|
|
61
|
-
{
|
|
62
|
-
"name": "Mike Tschudi",
|
|
63
|
-
"email": "mtschudi@esri.com"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"name": "Chris Fox",
|
|
67
|
-
"email": "cfox@esri.com"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"name": "John Hauck",
|
|
71
|
-
"email": "jhauck@esri.com"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"name": "Dave Bouwman",
|
|
75
|
-
"email": "dbouwman@esri.com"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"name": "John Gravois"
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
"bugs": {
|
|
82
|
-
"url": "https://github.com/Esri/solution.js/issues"
|
|
83
|
-
},
|
|
84
|
-
"homepage": "https://github.com/Esri/solution.js#readme",
|
|
85
|
-
"keywords": [
|
|
86
|
-
"typescript",
|
|
87
|
-
"promise",
|
|
88
|
-
"fetch",
|
|
89
|
-
"arcgis",
|
|
90
|
-
"esri",
|
|
91
|
-
"ES6"
|
|
92
|
-
],
|
|
93
|
-
"gitHead": "
|
|
94
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@esri/solution-group",
|
|
3
|
+
"version": "1.3.16",
|
|
4
|
+
"description": "Manages the creation and deployment of group item types for @esri/solution.js.",
|
|
5
|
+
"main": "dist/node/index.js",
|
|
6
|
+
"unpkg": "dist/umd/group.umd.min.js",
|
|
7
|
+
"module": "dist/esm/index.js",
|
|
8
|
+
"js:next": "dist/esm/index.js",
|
|
9
|
+
"types": "dist/esm/index.d.ts",
|
|
10
|
+
"author": "Esri",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/**"
|
|
14
|
+
],
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@esri/arcgis-rest-auth": "3.5.0",
|
|
17
|
+
"@esri/arcgis-rest-feature-layer": "3.5.0",
|
|
18
|
+
"@esri/arcgis-rest-portal": "3.5.0",
|
|
19
|
+
"@esri/arcgis-rest-request": "3.5.0",
|
|
20
|
+
"@esri/arcgis-rest-service-admin": "3.5.0",
|
|
21
|
+
"@esri/hub-common": "9.29.0",
|
|
22
|
+
"@esri/hub-initiatives": "9.29.0",
|
|
23
|
+
"@esri/hub-sites": "9.29.0",
|
|
24
|
+
"@esri/hub-teams": "9.29.0",
|
|
25
|
+
"rollup": "2.79.0"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@esri/arcgis-rest-auth": "3.5.0",
|
|
29
|
+
"@esri/arcgis-rest-feature-layer": "3.5.0",
|
|
30
|
+
"@esri/arcgis-rest-portal": "3.5.0",
|
|
31
|
+
"@esri/arcgis-rest-request": "3.5.0",
|
|
32
|
+
"@esri/arcgis-rest-service-admin": "3.5.0",
|
|
33
|
+
"@esri/hub-common": "9.29.0",
|
|
34
|
+
"@esri/hub-initiatives": "9.29.0",
|
|
35
|
+
"@esri/hub-sites": "9.29.0",
|
|
36
|
+
"@esri/hub-teams": "9.29.0"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@esri/solution-common": "1.3.16",
|
|
40
|
+
"tslib": "1.14.1"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"prepare": "npm run build",
|
|
44
|
+
"build": "npm run build:node && npm run build:umd && npm run build:esm",
|
|
45
|
+
"build:esm": "tsc -p ./tsconfig.json --module esnext --outDir ./dist/esm --declaration",
|
|
46
|
+
"build:umd": "rollup -c ../../umd-base-profile.js && rollup -c ../../umd-production-profile.js",
|
|
47
|
+
"build:node": "tsc -p ./tsconfig.json --module commonjs --outDir ./dist/node",
|
|
48
|
+
"dev:esm": "tsc -w --module esnext --outDir ./dist/esm --declaration",
|
|
49
|
+
"dev:umd": "rollup -w -c ../../umd-base-profile.js",
|
|
50
|
+
"dev:node": "tsc -w --module commonjs --outDir ./dist/node",
|
|
51
|
+
"getupdates": "npm-check-updates --upgrade"
|
|
52
|
+
},
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "git+https://github.com/Esri/solution.js.git"
|
|
59
|
+
},
|
|
60
|
+
"contributors": [
|
|
61
|
+
{
|
|
62
|
+
"name": "Mike Tschudi",
|
|
63
|
+
"email": "mtschudi@esri.com"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "Chris Fox",
|
|
67
|
+
"email": "cfox@esri.com"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "John Hauck",
|
|
71
|
+
"email": "jhauck@esri.com"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "Dave Bouwman",
|
|
75
|
+
"email": "dbouwman@esri.com"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "John Gravois"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"bugs": {
|
|
82
|
+
"url": "https://github.com/Esri/solution.js/issues"
|
|
83
|
+
},
|
|
84
|
+
"homepage": "https://github.com/Esri/solution.js#readme",
|
|
85
|
+
"keywords": [
|
|
86
|
+
"typescript",
|
|
87
|
+
"promise",
|
|
88
|
+
"fetch",
|
|
89
|
+
"arcgis",
|
|
90
|
+
"esri",
|
|
91
|
+
"ES6"
|
|
92
|
+
],
|
|
93
|
+
"gitHead": "c87f04e58c80558f19a6d79086b69a965b17db93"
|
|
94
|
+
}
|