@esri/solution-group 1.1.4 → 1.3.1
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 +16 -2
- package/dist/esm/group.js +46 -6
- package/dist/esm/group.js.map +1 -1
- package/dist/node/group.d.ts +16 -2
- package/dist/node/group.js +50 -8
- package/dist/node/group.js.map +1 -1
- package/dist/umd/group.d.ts +16 -2
- package/dist/umd/group.umd.js +114 -48
- package/dist/umd/group.umd.js.map +1 -1
- package/dist/umd/group.umd.min.js +4 -4
- package/dist/umd/group.umd.min.js.map +1 -1
- package/package.json +23 -24
package/dist/esm/group.d.ts
CHANGED
|
@@ -24,8 +24,22 @@ import * as common from "@esri/solution-common";
|
|
|
24
24
|
*
|
|
25
25
|
* @param solutionItemId The solution to contain the template
|
|
26
26
|
* @param itemInfo Info about the item
|
|
27
|
-
* @param
|
|
27
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
28
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
28
29
|
* @return A promise that will resolve when the template has been created
|
|
29
30
|
*/
|
|
30
|
-
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any,
|
|
31
|
+
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession): Promise<common.IItemTemplate>;
|
|
31
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>;
|
package/dist/esm/group.js
CHANGED
|
@@ -25,20 +25,21 @@ import * as common from "@esri/solution-common";
|
|
|
25
25
|
*
|
|
26
26
|
* @param solutionItemId The solution to contain the template
|
|
27
27
|
* @param itemInfo Info about the item
|
|
28
|
-
* @param
|
|
28
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
29
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
29
30
|
* @return A promise that will resolve when the template has been created
|
|
30
31
|
*/
|
|
31
|
-
export function convertItemToTemplate(solutionItemId, itemInfo,
|
|
32
|
+
export function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
|
|
32
33
|
return new Promise(resolve => {
|
|
33
34
|
// Init template
|
|
34
35
|
const itemTemplate = common.createInitializedGroupTemplate(itemInfo);
|
|
35
36
|
// Templatize item info property values
|
|
36
37
|
itemTemplate.item.id = common.templatizeTerm(itemTemplate.item.id, itemTemplate.item.id, ".itemId");
|
|
37
38
|
// Get the group's items--its dependencies
|
|
38
|
-
common.getGroupContents(itemInfo.id,
|
|
39
|
+
common.getGroupContents(itemInfo.id, srcAuthentication).then(groupContents => {
|
|
39
40
|
itemTemplate.type = "Group";
|
|
40
41
|
itemTemplate.dependencies = groupContents;
|
|
41
|
-
common.getGroupBase(itemInfo.id,
|
|
42
|
+
common.getGroupBase(itemInfo.id, srcAuthentication).then(groupResponse => {
|
|
42
43
|
groupResponse.id = itemTemplate.item.id;
|
|
43
44
|
itemTemplate.item = {
|
|
44
45
|
...groupResponse,
|
|
@@ -68,10 +69,20 @@ export function createItemFromTemplate(template, templateDictionary, destination
|
|
|
68
69
|
access: "private",
|
|
69
70
|
owner: newItemTemplate.item.owner,
|
|
70
71
|
tags: newItemTemplate.item.tags,
|
|
72
|
+
typeKeywords: newItemTemplate.item.typeKeywords,
|
|
71
73
|
description: newItemTemplate.item.description,
|
|
72
74
|
thumbnail: newItemTemplate.item.thumbnail,
|
|
73
75
|
snippet: newItemTemplate.item.snippet
|
|
74
76
|
};
|
|
77
|
+
const props = [
|
|
78
|
+
"isInvitationOnly", "autoJoin", "membershipAccess", "isViewOnly", "sortField", "sortOrder", "isOpenData", "displaySettings"
|
|
79
|
+
];
|
|
80
|
+
props.forEach(p => {
|
|
81
|
+
/* istanbul ignore else */
|
|
82
|
+
if (newItemTemplate.item.hasOwnProperty(p)) {
|
|
83
|
+
newGroup[p] = newItemTemplate.item[p];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
75
86
|
// Create a group, appending a sequential suffix to its name if the group exists, e.g.,
|
|
76
87
|
// * Manage Right of Way Activities
|
|
77
88
|
// * Manage Right of Way Activities 1
|
|
@@ -135,7 +146,7 @@ export function createItemFromTemplate(template, templateDictionary, destination
|
|
|
135
146
|
item: newItemTemplate,
|
|
136
147
|
id: createResponse.group.id,
|
|
137
148
|
type: newItemTemplate.type,
|
|
138
|
-
postProcess:
|
|
149
|
+
postProcess: common.hasUnresolvedVariables(newItemTemplate)
|
|
139
150
|
});
|
|
140
151
|
}
|
|
141
152
|
}
|
|
@@ -157,7 +168,7 @@ export function createItemFromTemplate(template, templateDictionary, destination
|
|
|
157
168
|
item: newItemTemplate,
|
|
158
169
|
id: createResponse.group.id,
|
|
159
170
|
type: newItemTemplate.type,
|
|
160
|
-
postProcess:
|
|
171
|
+
postProcess: common.hasUnresolvedVariables(newItemTemplate)
|
|
161
172
|
});
|
|
162
173
|
}
|
|
163
174
|
}
|
|
@@ -173,4 +184,33 @@ export function createItemFromTemplate(template, templateDictionary, destination
|
|
|
173
184
|
});
|
|
174
185
|
});
|
|
175
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Group post-processing actions
|
|
189
|
+
*
|
|
190
|
+
* @param {string} id The item ID
|
|
191
|
+
* @param {string} type The template type
|
|
192
|
+
* @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
|
|
193
|
+
* @param {common.IItemTemplate} template The original template
|
|
194
|
+
* @param {common.IItemTemplate[]} templates The original templates
|
|
195
|
+
* @param {any} templateDictionary The template dictionary
|
|
196
|
+
* @param {UserSession} authentication The destination session info
|
|
197
|
+
* @returns Promise resolving to successfulness of update
|
|
198
|
+
*/
|
|
199
|
+
export function postProcess(id, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
200
|
+
let promise = Promise.resolve({ success: true });
|
|
201
|
+
itemInfos.some(t => {
|
|
202
|
+
/* istanbul ignore else */
|
|
203
|
+
if (t.id === id) {
|
|
204
|
+
let group = t.item.item;
|
|
205
|
+
/* istanbul ignore else */
|
|
206
|
+
if (common.hasUnresolvedVariables(group)) {
|
|
207
|
+
group = common.replaceInTemplate(group, templateDictionary);
|
|
208
|
+
// update the group
|
|
209
|
+
promise = common.updateGroup(group, authentication);
|
|
210
|
+
}
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
return promise;
|
|
215
|
+
}
|
|
176
216
|
//# sourceMappingURL=group.js.map
|
package/dist/esm/group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/group.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,wHAAwH;AAExH
|
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/group.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,wHAAwH;AAExH;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,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,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,uBAAuB;aACtF;QACH,CAAC,EACD,GAAG,EAAE;YACH,oBAAoB,CAClB,QAAQ,CAAC,MAAM,EACf,MAAM,CAAC,mBAAmB,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;YACF,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,uBAAuB;QACvF,CAAC,CACF,CAAC;IACN,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CACzB,EAAU,EACV,IAAY,EACZ,SAAgB,EAChB,QAA8B,EAC9B,SAAiC,EACjC,kBAAuB,EACvB,cAAmB;IAEnB,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;IAC/C,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QACjB,0BAA0B;QAC1B,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;YACf,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YACxB,0BAA0B;YAC1B,IAAI,MAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,EAAE;gBACxC,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,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"}
|
package/dist/node/group.d.ts
CHANGED
|
@@ -24,8 +24,22 @@ import * as common from "@esri/solution-common";
|
|
|
24
24
|
*
|
|
25
25
|
* @param solutionItemId The solution to contain the template
|
|
26
26
|
* @param itemInfo Info about the item
|
|
27
|
-
* @param
|
|
27
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
28
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
28
29
|
* @return A promise that will resolve when the template has been created
|
|
29
30
|
*/
|
|
30
|
-
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any,
|
|
31
|
+
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession): Promise<common.IItemTemplate>;
|
|
31
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>;
|
package/dist/node/group.js
CHANGED
|
@@ -15,33 +15,35 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
|
|
18
|
+
exports.postProcess = exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
19
20
|
/**
|
|
20
21
|
* Manages the creation and deployment of groups.
|
|
21
22
|
*
|
|
22
23
|
* @module group
|
|
23
24
|
*/
|
|
24
|
-
const common = require("@esri/solution-common");
|
|
25
|
+
const common = (0, tslib_1.__importStar)(require("@esri/solution-common"));
|
|
25
26
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
26
27
|
/**
|
|
27
28
|
* Converts a group item into a template.
|
|
28
29
|
*
|
|
29
30
|
* @param solutionItemId The solution to contain the template
|
|
30
31
|
* @param itemInfo Info about the item
|
|
31
|
-
* @param
|
|
32
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
33
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
32
34
|
* @return A promise that will resolve when the template has been created
|
|
33
35
|
*/
|
|
34
|
-
function convertItemToTemplate(solutionItemId, itemInfo,
|
|
36
|
+
function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
|
|
35
37
|
return new Promise(resolve => {
|
|
36
38
|
// Init template
|
|
37
39
|
const itemTemplate = common.createInitializedGroupTemplate(itemInfo);
|
|
38
40
|
// Templatize item info property values
|
|
39
41
|
itemTemplate.item.id = common.templatizeTerm(itemTemplate.item.id, itemTemplate.item.id, ".itemId");
|
|
40
42
|
// Get the group's items--its dependencies
|
|
41
|
-
common.getGroupContents(itemInfo.id,
|
|
43
|
+
common.getGroupContents(itemInfo.id, srcAuthentication).then(groupContents => {
|
|
42
44
|
itemTemplate.type = "Group";
|
|
43
45
|
itemTemplate.dependencies = groupContents;
|
|
44
|
-
common.getGroupBase(itemInfo.id,
|
|
46
|
+
common.getGroupBase(itemInfo.id, srcAuthentication).then(groupResponse => {
|
|
45
47
|
groupResponse.id = itemTemplate.item.id;
|
|
46
48
|
itemTemplate.item = {
|
|
47
49
|
...groupResponse,
|
|
@@ -72,10 +74,20 @@ function createItemFromTemplate(template, templateDictionary, destinationAuthent
|
|
|
72
74
|
access: "private",
|
|
73
75
|
owner: newItemTemplate.item.owner,
|
|
74
76
|
tags: newItemTemplate.item.tags,
|
|
77
|
+
typeKeywords: newItemTemplate.item.typeKeywords,
|
|
75
78
|
description: newItemTemplate.item.description,
|
|
76
79
|
thumbnail: newItemTemplate.item.thumbnail,
|
|
77
80
|
snippet: newItemTemplate.item.snippet
|
|
78
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
|
+
});
|
|
79
91
|
// Create a group, appending a sequential suffix to its name if the group exists, e.g.,
|
|
80
92
|
// * Manage Right of Way Activities
|
|
81
93
|
// * Manage Right of Way Activities 1
|
|
@@ -139,7 +151,7 @@ function createItemFromTemplate(template, templateDictionary, destinationAuthent
|
|
|
139
151
|
item: newItemTemplate,
|
|
140
152
|
id: createResponse.group.id,
|
|
141
153
|
type: newItemTemplate.type,
|
|
142
|
-
postProcess:
|
|
154
|
+
postProcess: common.hasUnresolvedVariables(newItemTemplate)
|
|
143
155
|
});
|
|
144
156
|
}
|
|
145
157
|
}
|
|
@@ -161,7 +173,7 @@ function createItemFromTemplate(template, templateDictionary, destinationAuthent
|
|
|
161
173
|
item: newItemTemplate,
|
|
162
174
|
id: createResponse.group.id,
|
|
163
175
|
type: newItemTemplate.type,
|
|
164
|
-
postProcess:
|
|
176
|
+
postProcess: common.hasUnresolvedVariables(newItemTemplate)
|
|
165
177
|
});
|
|
166
178
|
}
|
|
167
179
|
}
|
|
@@ -178,4 +190,34 @@ function createItemFromTemplate(template, templateDictionary, destinationAuthent
|
|
|
178
190
|
});
|
|
179
191
|
}
|
|
180
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;
|
|
181
223
|
//# sourceMappingURL=group.js.map
|
package/dist/node/group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/group.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/group.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH,2EAAgD;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,CA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CAAC,MAAM,EACjC,CAAC,CACF,CAAC;YACF,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,uBAAuB;QACvF,CAAC,CACF,CAAC;IACN,CAAC,CAAC,CAAC;AACL,CAAC;AA3QD,wDA2QC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,WAAW,CACzB,EAAU,EACV,IAAY,EACZ,SAAgB,EAChB,QAA8B,EAC9B,SAAiC,EACjC,kBAAuB,EACvB,cAAmB;IAEnB,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;IAC/C,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QACjB,0BAA0B;QAC1B,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;YACf,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YACxB,0BAA0B;YAC1B,IAAI,MAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,EAAE;gBACxC,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,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"}
|
package/dist/umd/group.d.ts
CHANGED
|
@@ -24,8 +24,22 @@ import * as common from "@esri/solution-common";
|
|
|
24
24
|
*
|
|
25
25
|
* @param solutionItemId The solution to contain the template
|
|
26
26
|
* @param itemInfo Info about the item
|
|
27
|
-
* @param
|
|
27
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
28
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
28
29
|
* @return A promise that will resolve when the template has been created
|
|
29
30
|
*/
|
|
30
|
-
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any,
|
|
31
|
+
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession): Promise<common.IItemTemplate>;
|
|
31
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>;
|
package/dist/umd/group.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-group - v1.1
|
|
3
|
-
* Copyright (c) 2018-
|
|
4
|
-
*
|
|
2
|
+
* @esri/solution-group - v1.3.1 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
+
* Thu Feb 17 2022 10:41:58 GMT-0800 (Pacific Standard Time)
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -18,8 +18,28 @@
|
|
|
18
18
|
(function (global, factory) {
|
|
19
19
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common')) :
|
|
20
20
|
typeof define === 'function' && define.amd ? define(['exports', '@esri/solution-common'], factory) :
|
|
21
|
-
(global = global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution));
|
|
22
|
-
}(this, (function (exports, common) { 'use strict';
|
|
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);
|
|
23
43
|
|
|
24
44
|
/** @license
|
|
25
45
|
* Copyright 2019 Esri
|
|
@@ -42,20 +62,21 @@
|
|
|
42
62
|
*
|
|
43
63
|
* @param solutionItemId The solution to contain the template
|
|
44
64
|
* @param itemInfo Info about the item
|
|
45
|
-
* @param
|
|
65
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
66
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
46
67
|
* @return A promise that will resolve when the template has been created
|
|
47
68
|
*/
|
|
48
|
-
function convertItemToTemplate(solutionItemId, itemInfo,
|
|
69
|
+
function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
|
|
49
70
|
return new Promise(resolve => {
|
|
50
71
|
// Init template
|
|
51
|
-
const itemTemplate =
|
|
72
|
+
const itemTemplate = common__namespace.createInitializedGroupTemplate(itemInfo);
|
|
52
73
|
// Templatize item info property values
|
|
53
|
-
itemTemplate.item.id =
|
|
74
|
+
itemTemplate.item.id = common__namespace.templatizeTerm(itemTemplate.item.id, itemTemplate.item.id, ".itemId");
|
|
54
75
|
// Get the group's items--its dependencies
|
|
55
|
-
|
|
76
|
+
common__namespace.getGroupContents(itemInfo.id, srcAuthentication).then(groupContents => {
|
|
56
77
|
itemTemplate.type = "Group";
|
|
57
78
|
itemTemplate.dependencies = groupContents;
|
|
58
|
-
|
|
79
|
+
common__namespace.getGroupBase(itemInfo.id, srcAuthentication).then(groupResponse => {
|
|
59
80
|
groupResponse.id = itemTemplate.item.id;
|
|
60
81
|
itemTemplate.item = {
|
|
61
82
|
...groupResponse,
|
|
@@ -69,14 +90,14 @@
|
|
|
69
90
|
function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
70
91
|
return new Promise(resolve => {
|
|
71
92
|
// Interrupt process if progress callback returns `false`
|
|
72
|
-
if (!itemProgressCallback(template.itemId,
|
|
73
|
-
itemProgressCallback(template.itemId,
|
|
74
|
-
resolve(
|
|
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));
|
|
75
96
|
return;
|
|
76
97
|
}
|
|
77
98
|
// Replace the templatized symbols in a copy of the template
|
|
78
|
-
let newItemTemplate =
|
|
79
|
-
newItemTemplate =
|
|
99
|
+
let newItemTemplate = common__namespace.cloneObject(template);
|
|
100
|
+
newItemTemplate = common__namespace.replaceInTemplate(newItemTemplate, templateDictionary);
|
|
80
101
|
// Need to manually reset thumbnail because adlib in replaceInTemplate breaks it
|
|
81
102
|
newItemTemplate.item.thumbnail = template.item.thumbnail;
|
|
82
103
|
// Set up properties needed to create group
|
|
@@ -85,23 +106,35 @@
|
|
|
85
106
|
access: "private",
|
|
86
107
|
owner: newItemTemplate.item.owner,
|
|
87
108
|
tags: newItemTemplate.item.tags,
|
|
109
|
+
typeKeywords: newItemTemplate.item.typeKeywords,
|
|
88
110
|
description: newItemTemplate.item.description,
|
|
89
111
|
thumbnail: newItemTemplate.item.thumbnail,
|
|
90
112
|
snippet: newItemTemplate.item.snippet
|
|
91
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
|
+
});
|
|
92
123
|
// Create a group, appending a sequential suffix to its name if the group exists, e.g.,
|
|
93
124
|
// * Manage Right of Way Activities
|
|
94
125
|
// * Manage Right of Way Activities 1
|
|
95
126
|
// * Manage Right of Way Activities 2
|
|
96
|
-
|
|
127
|
+
common__namespace
|
|
128
|
+
.createUniqueGroup(newGroup.title, newGroup, templateDictionary, destinationAuthentication, common__namespace.isTrackingViewGroup(newItemTemplate) ? templateDictionary.locationTracking.owner : undefined)
|
|
97
129
|
.then((createResponse) => {
|
|
98
130
|
if (createResponse.success) {
|
|
99
131
|
// Interrupt process if progress callback returns `false`
|
|
100
|
-
if (!itemProgressCallback(template.itemId,
|
|
101
|
-
itemProgressCallback(template.itemId,
|
|
132
|
+
if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.group.id)) {
|
|
133
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
|
|
102
134
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
103
|
-
|
|
104
|
-
.
|
|
135
|
+
common__namespace
|
|
136
|
+
.removeGroup(createResponse.group.id, destinationAuthentication)
|
|
137
|
+
.then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
|
|
105
138
|
}
|
|
106
139
|
else {
|
|
107
140
|
newItemTemplate.itemId = createResponse.group.id;
|
|
@@ -109,58 +142,61 @@
|
|
|
109
142
|
itemId: createResponse.group.id
|
|
110
143
|
};
|
|
111
144
|
// Update the template again now that we have the new item id
|
|
112
|
-
newItemTemplate =
|
|
145
|
+
newItemTemplate = common__namespace.replaceInTemplate(newItemTemplate, templateDictionary);
|
|
113
146
|
// Update the template dictionary with the new id
|
|
114
147
|
templateDictionary[template.itemId].itemId =
|
|
115
148
|
createResponse.group.id;
|
|
116
149
|
// Interrupt process if progress callback returns `false`
|
|
117
|
-
if (!itemProgressCallback(template.itemId,
|
|
118
|
-
itemProgressCallback(template.itemId,
|
|
150
|
+
if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor / 2, createResponse.group.id)) {
|
|
151
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
|
|
119
152
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
120
|
-
|
|
121
|
-
.
|
|
153
|
+
common__namespace
|
|
154
|
+
.removeGroup(createResponse.group.id, destinationAuthentication)
|
|
155
|
+
.then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
|
|
122
156
|
}
|
|
123
157
|
else {
|
|
124
|
-
if (
|
|
158
|
+
if (common__namespace.isTrackingViewGroup(newItemTemplate)) {
|
|
125
159
|
const owner = templateDictionary.locationTracking.owner;
|
|
126
160
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
127
|
-
|
|
161
|
+
common__namespace.reassignGroup(createResponse.group.id, owner, destinationAuthentication).then(assignResults => {
|
|
128
162
|
if (assignResults.success) {
|
|
129
|
-
if (!itemProgressCallback(template.itemId,
|
|
130
|
-
itemProgressCallback(template.itemId,
|
|
163
|
+
if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.group.id)) {
|
|
164
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
|
|
131
165
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
132
|
-
|
|
133
|
-
.
|
|
166
|
+
common__namespace
|
|
167
|
+
.removeGroup(createResponse.group.id, destinationAuthentication)
|
|
168
|
+
.then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
|
|
134
169
|
}
|
|
135
170
|
else {
|
|
136
171
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
137
|
-
|
|
172
|
+
common__namespace.removeUsers(createResponse.group.id, [destinationAuthentication.username], destinationAuthentication).then(removeResults => {
|
|
138
173
|
if (Array.isArray(removeResults.notRemoved) && removeResults.notRemoved.length === 0) {
|
|
139
|
-
if (!itemProgressCallback(template.itemId,
|
|
140
|
-
itemProgressCallback(template.itemId,
|
|
174
|
+
if (!itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Created, template.estimatedDeploymentCostFactor / 2, createResponse.group.id)) {
|
|
175
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Cancelled, 0);
|
|
141
176
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
142
|
-
|
|
143
|
-
.
|
|
177
|
+
common__namespace
|
|
178
|
+
.removeGroup(createResponse.group.id, destinationAuthentication)
|
|
179
|
+
.then(() => resolve(common__namespace.generateEmptyCreationResponse(template.type)), () => resolve(common__namespace.generateEmptyCreationResponse(template.type)));
|
|
144
180
|
}
|
|
145
181
|
else {
|
|
146
182
|
resolve({
|
|
147
183
|
item: newItemTemplate,
|
|
148
184
|
id: createResponse.group.id,
|
|
149
185
|
type: newItemTemplate.type,
|
|
150
|
-
postProcess:
|
|
186
|
+
postProcess: common__namespace.hasUnresolvedVariables(newItemTemplate)
|
|
151
187
|
});
|
|
152
188
|
}
|
|
153
189
|
}
|
|
154
190
|
else {
|
|
155
|
-
itemProgressCallback(template.itemId,
|
|
156
|
-
resolve(
|
|
191
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
192
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
|
|
157
193
|
}
|
|
158
194
|
});
|
|
159
195
|
}
|
|
160
196
|
}
|
|
161
197
|
else {
|
|
162
|
-
itemProgressCallback(template.itemId,
|
|
163
|
-
resolve(
|
|
198
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
199
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
|
|
164
200
|
}
|
|
165
201
|
});
|
|
166
202
|
}
|
|
@@ -169,27 +205,57 @@
|
|
|
169
205
|
item: newItemTemplate,
|
|
170
206
|
id: createResponse.group.id,
|
|
171
207
|
type: newItemTemplate.type,
|
|
172
|
-
postProcess:
|
|
208
|
+
postProcess: common__namespace.hasUnresolvedVariables(newItemTemplate)
|
|
173
209
|
});
|
|
174
210
|
}
|
|
175
211
|
}
|
|
176
212
|
}
|
|
177
213
|
}
|
|
178
214
|
else {
|
|
179
|
-
itemProgressCallback(template.itemId,
|
|
180
|
-
resolve(
|
|
215
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
216
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
|
|
181
217
|
}
|
|
182
218
|
}, () => {
|
|
183
|
-
itemProgressCallback(template.itemId,
|
|
184
|
-
resolve(
|
|
219
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
220
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type)); // fails to create item
|
|
185
221
|
});
|
|
186
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;
|
|
187
252
|
}
|
|
188
253
|
|
|
189
254
|
exports.convertItemToTemplate = convertItemToTemplate;
|
|
190
255
|
exports.createItemFromTemplate = createItemFromTemplate;
|
|
256
|
+
exports.postProcess = postProcess;
|
|
191
257
|
|
|
192
258
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
193
259
|
|
|
194
|
-
}))
|
|
260
|
+
}));
|
|
195
261
|
//# sourceMappingURL=group.umd.js.map
|
|
@@ -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 authentication Credentials for working with AGO\r\n * @return 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 authentication: 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, authentication).then(\r\n groupContents => {\r\n itemTemplate.type = \"Group\";\r\n itemTemplate.dependencies = groupContents;\r\n common.getGroupBase(itemInfo.id, authentication).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 description: newItemTemplate.item.description,\r\n thumbnail: newItemTemplate.item.thumbnail,\r\n snippet: newItemTemplate.item.snippet\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: false\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: false\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"],"names":["common.createInitializedGroupTemplate","common.templatizeTerm","common.getGroupContents","common.getGroupBase","common.EItemProgressStatus","common.generateEmptyCreationResponse","common.cloneObject","common.replaceInTemplate","common\r\n .createUniqueGroup","common.isTrackingViewGroup","common\r\n .removeGroup","common\r\n .removeGroup","common.reassignGroup","common\r\n .removeGroup","common.removeUsers","common\r\n .removeGroup"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;EAwBA;EAEA;;;;;;;;WAQgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,cAAkC;MAElC,OAAO,IAAI,OAAO,CAAuB,OAAO;;UAE9C,MAAM,YAAY,GAAyBA,qCAAqC,CAC9E,QAAQ,CACT,CAAC;;UAGF,YAAY,CAAC,IAAI,CAAC,EAAE,GAAGC,qBAAqB,CAC1C,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,SAAS,CACV,CAAC;;UAGFC,uBAAuB,CAAC,QAAQ,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC,IAAI,CACvD,aAAa;cACX,YAAY,CAAC,IAAI,GAAG,OAAO,CAAC;cAC5B,YAAY,CAAC,YAAY,GAAG,aAAa,CAAC;cAC1CC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC,IAAI,CACnD,aAAa;kBACX,aAAa,CAAC,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;kBACxC,YAAY,CAAC,IAAI,GAAG;sBAClB,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,IAAI,EAAE,eAAe;kCACrB,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE;kCAC3B,IAAI,EAAE,eAAe,CAAC,IAAI;kCAC1B,WAAW,EAAE,KAAK;+BACnB,CAAC,CAAC;2BACJ;uBACF;mBACF;eACF;mBAAM;kBACL,oBAAoB,CAClB,QAAQ,CAAC,MAAM,EACfD,0BAA0B,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;kBACF,OAAO,CAACC,oCAAoC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;eAC9D;WACF,EACD;cACE,oBAAoB,CAClB,QAAQ,CAAC,MAAM,EACfD,0BAA0B,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;cACF,OAAO,CAACC,oCAAoC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;WAC9D,CACF,CAAC;OACL,CAAC,CAAC;EACL;;;;;;;;;;;;;"}
|
|
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 * @return 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,CAA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AAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;eACrD;cACD,OAAO,IAAI,CAAC;WACb;OACF,CAAC,CAAC;MACH,OAAO,OAAO,CAAC;EACjB;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-group - v1.1
|
|
3
|
-
* Copyright (c) 2018-
|
|
4
|
-
*
|
|
2
|
+
* @esri/solution-group - v1.3.1 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
+
* Thu Feb 17 2022 10:42:08 GMT-0800 (Pacific Standard Time)
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-common")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common"],t):t((e=e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution)}(this,(function(e,t){"use strict";e.
|
|
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
19
|
//# sourceMappingURL=group.umd.min.js.map
|
|
@@ -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 authentication Credentials for working with AGO\r\n * @return 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 authentication: 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, authentication).then(\r\n groupContents => {\r\n itemTemplate.type = \"Group\";\r\n itemTemplate.dependencies = groupContents;\r\n common.getGroupBase(itemInfo.id, authentication).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 description: newItemTemplate.item.description,\r\n thumbnail: newItemTemplate.item.thumbnail,\r\n snippet: newItemTemplate.item.snippet\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: false\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: false\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"],"names":["solutionItemId","itemInfo","authentication","Promise","resolve","itemTemplate","common.createInitializedGroupTemplate","item","id","common.templatizeTerm","common.getGroupContents","then","groupContents","type","dependencies","common.getGroupBase","groupResponse","template","templateDictionary","destinationAuthentication","itemProgressCallback","itemId","common.EItemProgressStatus","Started","Ignored","common.generateEmptyCreationResponse","newItemTemplate","common.cloneObject","common.replaceInTemplate","thumbnail","newGroup","title","access","owner","tags","description","snippet","common\r\n .createUniqueGroup","common.isTrackingViewGroup","locationTracking","undefined","createResponse","success","Created","estimatedDeploymentCostFactor","group","Finished","common.reassignGroup","assignResults","common.removeUsers","username","removeResults","Array","isArray","notRemoved","length","postProcess","Cancelled","common\r\n .removeGroup","Failed","common\r\n .removeGroup","common\r\n .removeGroup","common\r\n .removeGroup"],"mappings":";;;;;;;;;;;;;;;;;2UAmCEA,EACAC,EACAC,GAEA,OAAO,IAAIC,SAA8BC,IAEvC,MAAMC,EAAqCC,iCACzCL,GAIFI,EAAaE,KAAKC,GAAKC,iBACrBJ,EAAaE,KAAKC,GAClBH,EAAaE,KAAKC,GAClB,WAIFE,mBAAwBT,EAASO,GAAIN,GAAgBS,MACnDC,IACEP,EAAaQ,KAAO,QACpBR,EAAaS,aAAeF,EAC5BG,eAAoBd,EAASO,GAAIN,GAAgBS,MAC/CK,IACEA,EAAcR,GAAKH,EAAaE,KAAKC,GACrCH,EAAaE,KAAO,IACfS,EACHH,KAAM,SAERT,EAAQC,MAEV,IAAMD,EAAQC,QAGlB,IAAMD,EAAQC,2CAMlBY,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIjB,SAAgDC,IAEzD,IACGgB,EACCH,EAASI,OACTC,sBAA2BC,QAC3B,GASF,OANAH,EACEH,EAASI,OACTC,sBAA2BE,QAC3B,QAEFpB,EAAQqB,gCAAqCR,EAASJ,OAKxD,IAAIa,EAA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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 * @return 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,MAEV,IAAMD,EAAQC,QAGlB,IAAMD,EAAQC,2CAMlBa,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIlB,SAAgDC,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NlB,GAAIqC,EAAeI,MAAMzC,GACzBK,KAAMa,EAAgBb,KACtB+C,YAAavD,EAAOwD,uBAClBnC,UA1HNN,EACEH,EAASI,OACThB,EAAOiB,oBAAoBwC,UAC3B,GAGFzD,EACG0D,YACClB,EAAeI,MAAMzC,GACrBW,GAEDR,MACC,IACER,EACEE,EAAOoB,8BAA8BR,EAASJ,SAElD,IACEV,EACEE,EAAOoB,8BAA8BR,EAASJ,cA3DxDO,EACEH,EAASI,OACThB,EAAOiB,oBAAoBwC,UAC3B,GAGFzD,EACG0D,YAAYlB,EAAeI,MAAMzC,GAAIW,GACrCR,MACC,IACER,EACEE,EAAOoB,8BAA8BR,EAASJ,SAElD,IACEV,EAAQE,EAAOoB,8BAA8BR,EAASJ,cA4J9DO,EACEH,EAASI,OACThB,EAAOiB,oBAAoB0C,OAC3B,GAEF7D,EAAQE,EAAOoB,8BAA8BR,EAASJ,UAG1D,KACEO,EACEH,EAASI,OACThB,EAAOiB,oBAAoB0C,OAC3B,GAEF7D,EAAQE,EAAOoB,8BAA8BR,EAASJ,qCAmB9DL,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/solution-group",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.3.1",
|
|
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",
|
|
@@ -13,32 +13,31 @@
|
|
|
13
13
|
"dist/**"
|
|
14
14
|
],
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@esri/arcgis-rest-auth": "3.4.
|
|
17
|
-
"@esri/arcgis-rest-feature-layer": "3.4.
|
|
18
|
-
"@esri/arcgis-rest-portal": "3.4.
|
|
19
|
-
"@esri/arcgis-rest-request": "3.4.
|
|
20
|
-
"@esri/arcgis-rest-service-admin": "3.4.
|
|
21
|
-
"@esri/hub-common": "9.
|
|
22
|
-
"@esri/hub-initiatives": "9.
|
|
23
|
-
"@esri/hub-sites": "9.
|
|
24
|
-
"@esri/hub-teams": "9.
|
|
25
|
-
"rollup": "^
|
|
26
|
-
"typescript": "^4.3.4"
|
|
16
|
+
"@esri/arcgis-rest-auth": "3.4.3",
|
|
17
|
+
"@esri/arcgis-rest-feature-layer": "3.4.3",
|
|
18
|
+
"@esri/arcgis-rest-portal": "3.4.3",
|
|
19
|
+
"@esri/arcgis-rest-request": "3.4.3",
|
|
20
|
+
"@esri/arcgis-rest-service-admin": "3.4.3",
|
|
21
|
+
"@esri/hub-common": "9.15.0",
|
|
22
|
+
"@esri/hub-initiatives": "9.15.0",
|
|
23
|
+
"@esri/hub-sites": "9.15.0",
|
|
24
|
+
"@esri/hub-teams": "9.15.0",
|
|
25
|
+
"rollup": "^2.60.0"
|
|
27
26
|
},
|
|
28
27
|
"peerDependencies": {
|
|
29
|
-
"@esri/arcgis-rest-auth": "3.4.
|
|
30
|
-
"@esri/arcgis-rest-feature-layer": "3.4.
|
|
31
|
-
"@esri/arcgis-rest-portal": "3.4.
|
|
32
|
-
"@esri/arcgis-rest-request": "3.4.
|
|
33
|
-
"@esri/arcgis-rest-service-admin": "3.4.
|
|
34
|
-
"@esri/hub-common": "9.
|
|
35
|
-
"@esri/hub-initiatives": "9.
|
|
36
|
-
"@esri/hub-sites": "9.
|
|
37
|
-
"@esri/hub-teams": "9.
|
|
28
|
+
"@esri/arcgis-rest-auth": "3.4.3",
|
|
29
|
+
"@esri/arcgis-rest-feature-layer": "3.4.3",
|
|
30
|
+
"@esri/arcgis-rest-portal": "3.4.3",
|
|
31
|
+
"@esri/arcgis-rest-request": "3.4.3",
|
|
32
|
+
"@esri/arcgis-rest-service-admin": "3.4.3",
|
|
33
|
+
"@esri/hub-common": "9.15.0",
|
|
34
|
+
"@esri/hub-initiatives": "9.15.0",
|
|
35
|
+
"@esri/hub-sites": "9.15.0",
|
|
36
|
+
"@esri/hub-teams": "9.15.0"
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
|
-
"@esri/solution-common": "^1.1
|
|
41
|
-
"tslib": "
|
|
39
|
+
"@esri/solution-common": "^1.3.1",
|
|
40
|
+
"tslib": "1.13.0"
|
|
42
41
|
},
|
|
43
42
|
"scripts": {
|
|
44
43
|
"prepare": "npm run build",
|
|
@@ -90,5 +89,5 @@
|
|
|
90
89
|
"esri",
|
|
91
90
|
"ES6"
|
|
92
91
|
],
|
|
93
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "70c45e0eb9c745f7dbc0f8b6ce3654921cca11a0"
|
|
94
93
|
}
|