@esri/solution-group 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-group",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Manages the creation and deployment of group item types for @esri/solution.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "unpkg": "dist/umd/group.umd.min.js",
@@ -18,7 +18,7 @@
18
18
  "@esri/arcgis-rest-portal": "~3.5.0",
19
19
  "@esri/arcgis-rest-request": "~3.5.0",
20
20
  "@esri/arcgis-rest-service-admin": "~3.5.0",
21
- "@esri/solution-common": "^3.0.0",
21
+ "@esri/solution-common": "^3.1.0",
22
22
  "rollup": "2.79.1"
23
23
  },
24
24
  "peerDependencies": {
@@ -29,7 +29,7 @@
29
29
  "@esri/arcgis-rest-service-admin": "~3.5.0"
30
30
  },
31
31
  "dependencies": {
32
- "@esri/hub-common": "^12.31.1",
32
+ "@esri/hub-common": "^12.37.1",
33
33
  "@esri/hub-initiatives": "^12.4.1",
34
34
  "@esri/hub-sites": "^12.6.0",
35
35
  "@esri/hub-teams": "^12.4.1",
@@ -81,5 +81,5 @@
81
81
  "esri",
82
82
  "ES6"
83
83
  ],
84
- "gitHead": "566b1c0fa884f94279a70d932dda3cd8a55ba050"
84
+ "gitHead": "d7bddb4b7c7b98ef00eac060c639a22d0654a03f"
85
85
  }
@@ -1,45 +0,0 @@
1
- /** @license
2
- * Copyright 2019 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Manages the creation and deployment of groups.
18
- *
19
- * @module group
20
- */
21
- import * as common from "@esri/solution-common";
22
- /**
23
- * Converts a group item into a template.
24
- *
25
- * @param solutionItemId The solution to contain the template
26
- * @param itemInfo Info about the item
27
- * @param destAuthentication Credentials for requests to the destination organization
28
- * @param srcAuthentication Credentials for requests to source items
29
- * @returns A promise that will resolve when the template has been created
30
- */
31
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession): Promise<common.IItemTemplate>;
32
- export declare function createItemFromTemplate(template: common.IItemTemplate, templateDictionary: any, destinationAuthentication: common.UserSession, itemProgressCallback: common.IItemProgressCallback): Promise<common.ICreateItemFromTemplateResponse>;
33
- /**
34
- * Group post-processing actions
35
- *
36
- * @param {string} id The item ID
37
- * @param {string} type The template type
38
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
39
- * @param {common.IItemTemplate} template The original template
40
- * @param {common.IItemTemplate[]} templates The original templates
41
- * @param {any} templateDictionary The template dictionary
42
- * @param {UserSession} authentication The destination session info
43
- * @returns Promise resolving to successfulness of update
44
- */
45
- export declare function postProcess(id: string, type: string, itemInfos: any[], template: common.IItemTemplate, templates: common.IItemTemplate[], templateDictionary: any, authentication: any): Promise<any>;
@@ -1,223 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2019 Esri
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.postProcess = exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
19
- const tslib_1 = require("tslib");
20
- /**
21
- * Manages the creation and deployment of groups.
22
- *
23
- * @module group
24
- */
25
- const common = tslib_1.__importStar(require("@esri/solution-common"));
26
- // ------------------------------------------------------------------------------------------------------------------ //
27
- /**
28
- * Converts a group item into a template.
29
- *
30
- * @param solutionItemId The solution to contain the template
31
- * @param itemInfo Info about the item
32
- * @param destAuthentication Credentials for requests to the destination organization
33
- * @param srcAuthentication Credentials for requests to source items
34
- * @returns A promise that will resolve when the template has been created
35
- */
36
- function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
37
- return new Promise(resolve => {
38
- // Init template
39
- const itemTemplate = common.createInitializedGroupTemplate(itemInfo);
40
- // Templatize item info property values
41
- itemTemplate.item.id = common.templatizeTerm(itemTemplate.item.id, itemTemplate.item.id, ".itemId");
42
- // Get the group's items--its dependencies
43
- common.getGroupContents(itemInfo.id, srcAuthentication).then(groupContents => {
44
- itemTemplate.type = "Group";
45
- itemTemplate.dependencies = groupContents;
46
- common.getGroupBase(itemInfo.id, srcAuthentication).then(groupResponse => {
47
- groupResponse.id = itemTemplate.item.id;
48
- itemTemplate.item = {
49
- ...groupResponse,
50
- type: "Group"
51
- };
52
- resolve(itemTemplate);
53
- }, () => resolve(itemTemplate));
54
- }, () => resolve(itemTemplate));
55
- });
56
- }
57
- exports.convertItemToTemplate = convertItemToTemplate;
58
- function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
59
- return new Promise(resolve => {
60
- // Interrupt process if progress callback returns `false`
61
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Started, 0)) {
62
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Ignored, 0);
63
- resolve(common.generateEmptyCreationResponse(template.type));
64
- return;
65
- }
66
- // Replace the templatized symbols in a copy of the template
67
- let newItemTemplate = common.cloneObject(template);
68
- newItemTemplate = common.replaceInTemplate(newItemTemplate, templateDictionary);
69
- // Need to manually reset thumbnail because adlib in replaceInTemplate breaks it
70
- newItemTemplate.item.thumbnail = template.item.thumbnail;
71
- // Set up properties needed to create group
72
- const newGroup = {
73
- title: newItemTemplate.item.title || "",
74
- access: "private",
75
- owner: newItemTemplate.item.owner,
76
- tags: newItemTemplate.item.tags,
77
- typeKeywords: newItemTemplate.item.typeKeywords,
78
- description: newItemTemplate.item.description,
79
- thumbnail: newItemTemplate.item.thumbnail,
80
- snippet: newItemTemplate.item.snippet
81
- };
82
- const props = [
83
- "isInvitationOnly", "autoJoin", "membershipAccess", "isViewOnly", "sortField", "sortOrder", "isOpenData", "displaySettings"
84
- ];
85
- props.forEach(p => {
86
- /* istanbul ignore else */
87
- if (newItemTemplate.item.hasOwnProperty(p)) {
88
- newGroup[p] = newItemTemplate.item[p];
89
- }
90
- });
91
- // Create a group, appending a sequential suffix to its name if the group exists, e.g.,
92
- // * Manage Right of Way Activities
93
- // * Manage Right of Way Activities 1
94
- // * Manage Right of Way Activities 2
95
- common
96
- .createUniqueGroup(newGroup.title, newGroup, templateDictionary, destinationAuthentication, common.isTrackingViewGroup(newItemTemplate) ? templateDictionary.locationTracking.owner : undefined)
97
- .then((createResponse) => {
98
- if (createResponse.success) {
99
- // Interrupt process if progress callback returns `false`
100
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.group.id)) {
101
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Cancelled, 0);
102
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
103
- common
104
- .removeGroup(createResponse.group.id, destinationAuthentication)
105
- .then(() => resolve(common.generateEmptyCreationResponse(template.type)), () => resolve(common.generateEmptyCreationResponse(template.type)));
106
- }
107
- else {
108
- newItemTemplate.itemId = createResponse.group.id;
109
- templateDictionary[template.itemId] = {
110
- itemId: createResponse.group.id
111
- };
112
- // Update the template again now that we have the new item id
113
- newItemTemplate = common.replaceInTemplate(newItemTemplate, templateDictionary);
114
- // Update the template dictionary with the new id
115
- templateDictionary[template.itemId].itemId =
116
- createResponse.group.id;
117
- // Interrupt process if progress callback returns `false`
118
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor / 2, createResponse.group.id)) {
119
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Cancelled, 0);
120
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
121
- common
122
- .removeGroup(createResponse.group.id, destinationAuthentication)
123
- .then(() => resolve(common.generateEmptyCreationResponse(template.type)), () => resolve(common.generateEmptyCreationResponse(template.type)));
124
- }
125
- else {
126
- if (common.isTrackingViewGroup(newItemTemplate)) {
127
- const owner = templateDictionary.locationTracking.owner;
128
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
129
- common.reassignGroup(createResponse.group.id, owner, destinationAuthentication).then(assignResults => {
130
- if (assignResults.success) {
131
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.group.id)) {
132
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Cancelled, 0);
133
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
134
- common
135
- .removeGroup(createResponse.group.id, destinationAuthentication)
136
- .then(() => resolve(common.generateEmptyCreationResponse(template.type)), () => resolve(common.generateEmptyCreationResponse(template.type)));
137
- }
138
- else {
139
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
140
- common.removeUsers(createResponse.group.id, [destinationAuthentication.username], destinationAuthentication).then(removeResults => {
141
- if (Array.isArray(removeResults.notRemoved) && removeResults.notRemoved.length === 0) {
142
- if (!itemProgressCallback(template.itemId, common.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.group.id)) {
143
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Cancelled, 0);
144
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
145
- common
146
- .removeGroup(createResponse.group.id, destinationAuthentication)
147
- .then(() => resolve(common.generateEmptyCreationResponse(template.type)), () => resolve(common.generateEmptyCreationResponse(template.type)));
148
- }
149
- else {
150
- resolve({
151
- item: newItemTemplate,
152
- id: createResponse.group.id,
153
- type: newItemTemplate.type,
154
- postProcess: common.hasUnresolvedVariables(newItemTemplate)
155
- });
156
- }
157
- }
158
- else {
159
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
160
- resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item
161
- }
162
- });
163
- }
164
- }
165
- else {
166
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
167
- resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item
168
- }
169
- });
170
- }
171
- else {
172
- resolve({
173
- item: newItemTemplate,
174
- id: createResponse.group.id,
175
- type: newItemTemplate.type,
176
- postProcess: common.hasUnresolvedVariables(newItemTemplate)
177
- });
178
- }
179
- }
180
- }
181
- }
182
- else {
183
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
184
- resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item
185
- }
186
- }, () => {
187
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
188
- resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item
189
- });
190
- });
191
- }
192
- exports.createItemFromTemplate = createItemFromTemplate;
193
- /**
194
- * Group post-processing actions
195
- *
196
- * @param {string} id The item ID
197
- * @param {string} type The template type
198
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
199
- * @param {common.IItemTemplate} template The original template
200
- * @param {common.IItemTemplate[]} templates The original templates
201
- * @param {any} templateDictionary The template dictionary
202
- * @param {UserSession} authentication The destination session info
203
- * @returns Promise resolving to successfulness of update
204
- */
205
- function postProcess(id, type, itemInfos, template, templates, templateDictionary, authentication) {
206
- let promise = Promise.resolve({ success: true });
207
- itemInfos.some(t => {
208
- /* istanbul ignore else */
209
- if (t.id === id) {
210
- let group = t.item.item;
211
- /* istanbul ignore else */
212
- if (common.hasUnresolvedVariables(group)) {
213
- group = common.replaceInTemplate(group, templateDictionary);
214
- // update the group
215
- promise = common.updateGroup(group, authentication);
216
- }
217
- return true;
218
- }
219
- });
220
- return promise;
221
- }
222
- exports.postProcess = postProcess;
223
- //# sourceMappingURL=group.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/group.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH,sEAAgD;AAEhD,wHAAwH;AAExH;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iBAAqC;IAErC,OAAO,IAAI,OAAO,CAAuB,OAAO,CAAC,EAAE;QACjD,gBAAgB;QAChB,MAAM,YAAY,GAAyB,MAAM,CAAC,8BAA8B,CAC9E,QAAQ,CACT,CAAC;QAEF,uCAAuC;QACvC,YAAY,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,cAAc,CAC1C,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,SAAS,CACV,CAAC;QAEF,0CAA0C;QAC1C,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAC1D,aAAa,CAAC,EAAE;YACd,YAAY,CAAC,IAAI,GAAG,OAAO,CAAC;YAC5B,YAAY,CAAC,YAAY,GAAG,aAAa,CAAC;YAC1C,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC,IAAI,CACtD,aAAa,CAAC,EAAE;gBACd,aAAa,CAAC,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxC,YAAY,CAAC,IAAI,GAAG;oBAClB,GAAG,aAAa;oBAChB,IAAI,EAAE,OAAO;iBACd,CAAC;gBACF,OAAO,CAAC,YAAY,CAAC,CAAC;YACxB,CAAC,EACD,GAAG,EAAE,CAAC,OAAO,CAAC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,kBAAkB,CAAC,CAAC;gBAC5D,mBAAmB;gBACnB,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;aACrD;YACD,OAAO,IAAI,CAAC;SACb;IACH,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC;AAxBD,kCAwBC"}
@@ -1,21 +0,0 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Manages the creation and deployment of simple item types.
18
- *
19
- * @module simple-types
20
- */
21
- export * from "./group";
@@ -1,25 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2018 Esri
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const tslib_1 = require("tslib");
19
- /**
20
- * Manages the creation and deployment of simple item types.
21
- *
22
- * @module simple-types
23
- */
24
- tslib_1.__exportStar(require("./group"), exports);
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,kDAAwB"}
@@ -1,45 +0,0 @@
1
- /** @license
2
- * Copyright 2019 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Manages the creation and deployment of groups.
18
- *
19
- * @module group
20
- */
21
- import * as common from "@esri/solution-common";
22
- /**
23
- * Converts a group item into a template.
24
- *
25
- * @param solutionItemId The solution to contain the template
26
- * @param itemInfo Info about the item
27
- * @param destAuthentication Credentials for requests to the destination organization
28
- * @param srcAuthentication Credentials for requests to source items
29
- * @returns A promise that will resolve when the template has been created
30
- */
31
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession): Promise<common.IItemTemplate>;
32
- export declare function createItemFromTemplate(template: common.IItemTemplate, templateDictionary: any, destinationAuthentication: common.UserSession, itemProgressCallback: common.IItemProgressCallback): Promise<common.ICreateItemFromTemplateResponse>;
33
- /**
34
- * Group post-processing actions
35
- *
36
- * @param {string} id The item ID
37
- * @param {string} type The template type
38
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
39
- * @param {common.IItemTemplate} template The original template
40
- * @param {common.IItemTemplate[]} templates The original templates
41
- * @param {any} templateDictionary The template dictionary
42
- * @param {UserSession} authentication The destination session info
43
- * @returns Promise resolving to successfulness of update
44
- */
45
- export declare function postProcess(id: string, type: string, itemInfos: any[], template: common.IItemTemplate, templates: common.IItemTemplate[], templateDictionary: any, authentication: any): Promise<any>;
@@ -1,21 +0,0 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Manages the creation and deployment of simple item types.
18
- *
19
- * @module simple-types
20
- */
21
- export * from "./group";
@@ -1,261 +0,0 @@
1
- /* @preserve
2
- * @esri/solution-group - v1.7.0 - Apache-2.0
3
- * Copyright (c) 2018-2023 Esri, Inc.
4
- * Fri Apr 28 2023 11:21:27 GMT-0700 (Pacific Daylight Time)
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- (function (global, factory) {
19
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common')) :
20
- typeof define === 'function' && define.amd ? define(['exports', '@esri/solution-common'], factory) :
21
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution));
22
- })(this, (function (exports, common) { 'use strict';
23
-
24
- function _interopNamespace(e) {
25
- if (e && e.__esModule) return e;
26
- var n = Object.create(null);
27
- if (e) {
28
- Object.keys(e).forEach(function (k) {
29
- if (k !== 'default') {
30
- var d = Object.getOwnPropertyDescriptor(e, k);
31
- Object.defineProperty(n, k, d.get ? d : {
32
- enumerable: true,
33
- get: function () { return e[k]; }
34
- });
35
- }
36
- });
37
- }
38
- n["default"] = e;
39
- return Object.freeze(n);
40
- }
41
-
42
- var common__namespace = /*#__PURE__*/_interopNamespace(common);
43
-
44
- /** @license
45
- * Copyright 2019 Esri
46
- *
47
- * Licensed under the Apache License, Version 2.0 (the "License");
48
- * you may not use this file except in compliance with the License.
49
- * You may obtain a copy of the License at
50
- *
51
- * http://www.apache.org/licenses/LICENSE-2.0
52
- *
53
- * Unless required by applicable law or agreed to in writing, software
54
- * distributed under the License is distributed on an "AS IS" BASIS,
55
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56
- * See the License for the specific language governing permissions and
57
- * limitations under the License.
58
- */
59
- // ------------------------------------------------------------------------------------------------------------------ //
60
- /**
61
- * Converts a group item into a template.
62
- *
63
- * @param solutionItemId The solution to contain the template
64
- * @param itemInfo Info about the item
65
- * @param destAuthentication Credentials for requests to the destination organization
66
- * @param srcAuthentication Credentials for requests to source items
67
- * @returns A promise that will resolve when the template has been created
68
- */
69
- function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
70
- return new Promise(resolve => {
71
- // Init template
72
- const itemTemplate = common__namespace.createInitializedGroupTemplate(itemInfo);
73
- // Templatize item info property values
74
- itemTemplate.item.id = common__namespace.templatizeTerm(itemTemplate.item.id, itemTemplate.item.id, ".itemId");
75
- // Get the group's items--its dependencies
76
- common__namespace.getGroupContents(itemInfo.id, srcAuthentication).then(groupContents => {
77
- itemTemplate.type = "Group";
78
- itemTemplate.dependencies = groupContents;
79
- common__namespace.getGroupBase(itemInfo.id, srcAuthentication).then(groupResponse => {
80
- groupResponse.id = itemTemplate.item.id;
81
- itemTemplate.item = {
82
- ...groupResponse,
83
- type: "Group"
84
- };
85
- resolve(itemTemplate);
86
- }, () => resolve(itemTemplate));
87
- }, () => resolve(itemTemplate));
88
- });
89
- }
90
- function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
91
- return new Promise(resolve => {
92
- // Interrupt process if progress callback returns `false`
93
- if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Started, 0)) {
94
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Ignored, 0);
95
- resolve(common__namespace.generateEmptyCreationResponse(template.type));
96
- return;
97
- }
98
- // Replace the templatized symbols in a copy of the template
99
- let newItemTemplate = common__namespace.cloneObject(template);
100
- newItemTemplate = common__namespace.replaceInTemplate(newItemTemplate, templateDictionary);
101
- // Need to manually reset thumbnail because adlib in replaceInTemplate breaks it
102
- newItemTemplate.item.thumbnail = template.item.thumbnail;
103
- // Set up properties needed to create group
104
- const newGroup = {
105
- title: newItemTemplate.item.title || "",
106
- access: "private",
107
- owner: newItemTemplate.item.owner,
108
- tags: newItemTemplate.item.tags,
109
- typeKeywords: newItemTemplate.item.typeKeywords,
110
- description: newItemTemplate.item.description,
111
- thumbnail: newItemTemplate.item.thumbnail,
112
- snippet: newItemTemplate.item.snippet
113
- };
114
- const props = [
115
- "isInvitationOnly", "autoJoin", "membershipAccess", "isViewOnly", "sortField", "sortOrder", "isOpenData", "displaySettings"
116
- ];
117
- props.forEach(p => {
118
- /* istanbul ignore else */
119
- if (newItemTemplate.item.hasOwnProperty(p)) {
120
- newGroup[p] = newItemTemplate.item[p];
121
- }
122
- });
123
- // Create a group, appending a sequential suffix to its name if the group exists, e.g.,
124
- // * Manage Right of Way Activities
125
- // * Manage Right of Way Activities 1
126
- // * Manage Right of Way Activities 2
127
- common__namespace
128
- .createUniqueGroup(newGroup.title, newGroup, templateDictionary, destinationAuthentication, common__namespace.isTrackingViewGroup(newItemTemplate) ? templateDictionary.locationTracking.owner : undefined)
129
- .then((createResponse) => {
130
- if (createResponse.success) {
131
- // Interrupt process if progress callback returns `false`
132
- if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.group.id)) {
133
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
134
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
135
- common__namespace
136
- .removeGroup(createResponse.group.id, destinationAuthentication)
137
- .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
138
- }
139
- else {
140
- newItemTemplate.itemId = createResponse.group.id;
141
- templateDictionary[template.itemId] = {
142
- itemId: createResponse.group.id
143
- };
144
- // Update the template again now that we have the new item id
145
- newItemTemplate = common__namespace.replaceInTemplate(newItemTemplate, templateDictionary);
146
- // Update the template dictionary with the new id
147
- templateDictionary[template.itemId].itemId =
148
- createResponse.group.id;
149
- // Interrupt process if progress callback returns `false`
150
- if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor / 2, createResponse.group.id)) {
151
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
152
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
153
- common__namespace
154
- .removeGroup(createResponse.group.id, destinationAuthentication)
155
- .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
156
- }
157
- else {
158
- if (common__namespace.isTrackingViewGroup(newItemTemplate)) {
159
- const owner = templateDictionary.locationTracking.owner;
160
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
161
- common__namespace.reassignGroup(createResponse.group.id, owner, destinationAuthentication).then(assignResults => {
162
- if (assignResults.success) {
163
- if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.group.id)) {
164
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
165
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
166
- common__namespace
167
- .removeGroup(createResponse.group.id, destinationAuthentication)
168
- .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
169
- }
170
- else {
171
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
172
- common__namespace.removeUsers(createResponse.group.id, [destinationAuthentication.username], destinationAuthentication).then(removeResults => {
173
- if (Array.isArray(removeResults.notRemoved) && removeResults.notRemoved.length === 0) {
174
- if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.group.id)) {
175
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
176
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
177
- common__namespace
178
- .removeGroup(createResponse.group.id, destinationAuthentication)
179
- .then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
180
- }
181
- else {
182
- resolve({
183
- item: newItemTemplate,
184
- id: createResponse.group.id,
185
- type: newItemTemplate.type,
186
- postProcess: common__namespace.hasUnresolvedVariables(newItemTemplate)
187
- });
188
- }
189
- }
190
- else {
191
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
192
- resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
193
- }
194
- });
195
- }
196
- }
197
- else {
198
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
199
- resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
200
- }
201
- });
202
- }
203
- else {
204
- resolve({
205
- item: newItemTemplate,
206
- id: createResponse.group.id,
207
- type: newItemTemplate.type,
208
- postProcess: common__namespace.hasUnresolvedVariables(newItemTemplate)
209
- });
210
- }
211
- }
212
- }
213
- }
214
- else {
215
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
216
- resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
217
- }
218
- }, () => {
219
- itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
220
- resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
221
- });
222
- });
223
- }
224
- /**
225
- * Group post-processing actions
226
- *
227
- * @param {string} id The item ID
228
- * @param {string} type The template type
229
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
230
- * @param {common.IItemTemplate} template The original template
231
- * @param {common.IItemTemplate[]} templates The original templates
232
- * @param {any} templateDictionary The template dictionary
233
- * @param {UserSession} authentication The destination session info
234
- * @returns Promise resolving to successfulness of update
235
- */
236
- function postProcess(id, type, itemInfos, template, templates, templateDictionary, authentication) {
237
- let promise = Promise.resolve({ success: true });
238
- itemInfos.some(t => {
239
- /* istanbul ignore else */
240
- if (t.id === id) {
241
- let group = t.item.item;
242
- /* istanbul ignore else */
243
- if (common__namespace.hasUnresolvedVariables(group)) {
244
- group = common__namespace.replaceInTemplate(group, templateDictionary);
245
- // update the group
246
- promise = common__namespace.updateGroup(group, authentication);
247
- }
248
- return true;
249
- }
250
- });
251
- return promise;
252
- }
253
-
254
- exports.convertItemToTemplate = convertItemToTemplate;
255
- exports.createItemFromTemplate = createItemFromTemplate;
256
- exports.postProcess = postProcess;
257
-
258
- Object.defineProperty(exports, '__esModule', { value: true });
259
-
260
- }));
261
- //# sourceMappingURL=group.umd.js.map
@@ -1 +0,0 @@
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,Q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B,CAClB,QAAQ,CAAC,MAAM,EACfA,iBAAM,CAAC,mBAAmB,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;EACF,YAAA,OAAO,CAACA,iBAAM,CAAC,6BAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;EAC/D,SAAC,CACF,CAAC;EACN,KAAC,CAAC,CAAC;EACL,CAAC;EAED;;;;;;;;;;;EAWG;EACa,SAAA,WAAW,CACzB,EAAU,EACV,IAAY,EACZ,SAAgB,EAChB,QAA8B,EAC9B,SAAiC,EACjC,kBAAuB,EACvB,cAAmB,EAAA;EAEnB,IAAA,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;EAC/C,IAAA,SAAS,CAAC,IAAI,CAAC,CAAC,IAAG;;EAEjB,QAAA,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;EACf,YAAA,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;EAExB,YAAA,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,19 +0,0 @@
1
- /* @preserve
2
- * @esri/solution-group - v1.7.0 - Apache-2.0
3
- * Copyright (c) 2018-2023 Esri, Inc.
4
- * Fri Apr 28 2023 11:21:30 GMT-0700 (Pacific Daylight Time)
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-common")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=r(t);e.convertItemToTemplate=function(e,t,r,o){return new Promise((e=>{const r=i.createInitializedGroupTemplate(t);r.item.id=i.templatizeTerm(r.item.id,r.item.id,".itemId"),i.getGroupContents(t.id,o).then((s=>{r.type="Group",r.dependencies=s,i.getGroupBase(t.id,o).then((t=>{t.id=r.item.id,r.item={...t,type:"Group"},e(r)}),(()=>e(r)))}),(()=>e(r)))}))},e.createItemFromTemplate=function(e,t,r,o){return new Promise((s=>{if(!o(e.itemId,i.EItemProgressStatus.Started,0))return o(e.itemId,i.EItemProgressStatus.Ignored,0),void s(i.generateEmptyCreationResponse(e.type));let n=i.cloneObject(e);n=i.replaceInTemplate(n,t),n.item.thumbnail=e.item.thumbnail;const a={title:n.item.title||"",access:"private",owner:n.item.owner,tags:n.item.tags,typeKeywords:n.item.typeKeywords,description:n.item.description,thumbnail:n.item.thumbnail,snippet:n.item.snippet};["isInvitationOnly","autoJoin","membershipAccess","isViewOnly","sortField","sortOrder","isOpenData","displaySettings"].forEach((e=>{n.item.hasOwnProperty(e)&&(a[e]=n.item[e])})),i.createUniqueGroup(a.title,a,t,r,i.isTrackingViewGroup(n)?t.locationTracking.owner:void 0).then((a=>{if(a.success)if(o(e.itemId,i.EItemProgressStatus.Created,e.estimatedDeploymentCostFactor/2,a.group.id))if(n.itemId=a.group.id,t[e.itemId]={itemId:a.group.id},n=i.replaceInTemplate(n,t),t[e.itemId].itemId=a.group.id,o(e.itemId,i.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor/2,a.group.id))if(i.isTrackingViewGroup(n)){const p=t.locationTracking.owner;i.reassignGroup(a.group.id,p,r).then((t=>{t.success?o(e.itemId,i.EItemProgressStatus.Created,e.estimatedDeploymentCostFactor/2,a.group.id)?i.removeUsers(a.group.id,[r.username],r).then((t=>{Array.isArray(t.notRemoved)&&0===t.notRemoved.length?o(e.itemId,i.EItemProgressStatus.Created,e.estimatedDeploymentCostFactor/2,a.group.id)?s({item:n,id:a.group.id,type:n.type,postProcess:i.hasUnresolvedVariables(n)}):(o(e.itemId,i.EItemProgressStatus.Cancelled,0),i.removeGroup(a.group.id,r).then((()=>s(i.generateEmptyCreationResponse(e.type))),(()=>s(i.generateEmptyCreationResponse(e.type))))):(o(e.itemId,i.EItemProgressStatus.Failed,0),s(i.generateEmptyCreationResponse(e.type)))})):(o(e.itemId,i.EItemProgressStatus.Cancelled,0),i.removeGroup(a.group.id,r).then((()=>s(i.generateEmptyCreationResponse(e.type))),(()=>s(i.generateEmptyCreationResponse(e.type))))):(o(e.itemId,i.EItemProgressStatus.Failed,0),s(i.generateEmptyCreationResponse(e.type)))}))}else s({item:n,id:a.group.id,type:n.type,postProcess:i.hasUnresolvedVariables(n)});else o(e.itemId,i.EItemProgressStatus.Cancelled,0),i.removeGroup(a.group.id,r).then((()=>s(i.generateEmptyCreationResponse(e.type))),(()=>s(i.generateEmptyCreationResponse(e.type))));else o(e.itemId,i.EItemProgressStatus.Cancelled,0),i.removeGroup(a.group.id,r).then((()=>s(i.generateEmptyCreationResponse(e.type))),(()=>s(i.generateEmptyCreationResponse(e.type))));else o(e.itemId,i.EItemProgressStatus.Failed,0),s(i.generateEmptyCreationResponse(e.type))}),(()=>{o(e.itemId,i.EItemProgressStatus.Failed,0),s(i.generateEmptyCreationResponse(e.type))}))}))},e.postProcess=function(e,t,r,o,s,n,a){let p=Promise.resolve({success:!0});return r.some((t=>{if(t.id===e){let e=t.item.item;return i.hasUnresolvedVariables(e)&&(e=i.replaceInTemplate(e,n),p=i.updateGroup(e,a)),!0}})),p},Object.defineProperty(e,"__esModule",{value:!0})}));
19
- //# sourceMappingURL=group.umd.min.js.map
@@ -1 +0,0 @@
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":";;;;;;;;;;;;;;;;;spBAmCM,SACJA,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIC,SAA8BC,IAEvC,MAAMC,EAAqCC,EAAOC,+BAChDP,GAIFK,EAAaG,KAAKC,GAAKH,EAAOI,eAC5BL,EAAaG,KAAKC,GAClBJ,EAAa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