@esri/solution-hub-types 1.1.3 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/hub-page-processor.d.ts +3 -2
- package/dist/esm/hub-page-processor.js +13 -4
- package/dist/esm/hub-page-processor.js.map +1 -1
- package/dist/esm/hub-site-processor.d.ts +10 -9
- package/dist/esm/hub-site-processor.js +45 -36
- package/dist/esm/hub-site-processor.js.map +1 -1
- package/dist/node/hub-page-processor.d.ts +3 -2
- package/dist/node/hub-page-processor.js +13 -4
- package/dist/node/hub-page-processor.js.map +1 -1
- package/dist/node/hub-site-processor.d.ts +10 -9
- package/dist/node/hub-site-processor.js +47 -38
- package/dist/node/hub-site-processor.js.map +1 -1
- package/dist/node/index.js +3 -2
- package/dist/node/index.js.map +1 -1
- package/dist/umd/hub-page-processor.d.ts +3 -2
- package/dist/umd/hub-site-processor.d.ts +10 -9
- package/dist/umd/hub-types.umd.js +74 -56
- package/dist/umd/hub-types.umd.js.map +1 -1
- package/dist/umd/hub-types.umd.min.js +4 -4
- package/dist/umd/hub-types.umd.min.js.map +1 -1
- package/package.json +24 -25
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-hub-types - v1.
|
|
3
|
-
* Copyright (c) 2018-
|
|
4
|
-
*
|
|
2
|
+
* @esri/solution-hub-types - v1.3.0 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
+
* Thu Feb 17 2022 09:43:27 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,8 @@
|
|
|
18
18
|
(function (global, factory) {
|
|
19
19
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common'), require('@esri/arcgis-rest-portal'), require('@esri/hub-common'), require('@esri/hub-sites')) :
|
|
20
20
|
typeof define === 'function' && define.amd ? define(['exports', '@esri/solution-common', '@esri/arcgis-rest-portal', '@esri/hub-common', '@esri/hub-sites'], factory) :
|
|
21
|
-
(global = global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution, global.arcgisRest, global.arcgisHub, global.arcgisHub));
|
|
22
|
-
}(this, (function (exports, solutionCommon, arcgisRestPortal, hubCommon, hubSites) { 'use strict';
|
|
21
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution, global.arcgisRest, global.arcgisHub, global.arcgisHub));
|
|
22
|
+
})(this, (function (exports, solutionCommon, arcgisRestPortal, hubCommon, hubSites) { 'use strict';
|
|
23
23
|
|
|
24
24
|
/** @license
|
|
25
25
|
* Copyright 2020 Esri
|
|
@@ -143,20 +143,29 @@
|
|
|
143
143
|
*
|
|
144
144
|
* @param solutionItemId The solution to contain the template
|
|
145
145
|
* @param itemInfo Info about the item
|
|
146
|
-
* @param
|
|
146
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
147
|
+
* @param srcAuthentication Credentials for requests to source items (placeholder--not used)
|
|
147
148
|
* @return A promise that will resolve when the template has been created
|
|
148
149
|
*/
|
|
149
|
-
function convertItemToTemplate(solutionItemId, itemInfo,
|
|
150
|
+
function convertItemToTemplate$1(solutionItemId, itemInfo, destAuthentication, srcAuthentication = null // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
151
|
+
) {
|
|
152
|
+
let created = 0;
|
|
153
|
+
let modified = 0;
|
|
150
154
|
// get the page model and hubRequestOptions
|
|
151
155
|
return Promise.all([
|
|
152
|
-
hubCommon.getModel(itemInfo.id, { authentication }),
|
|
153
|
-
solutionCommon.createHubRequestOptions(
|
|
156
|
+
hubCommon.getModel(itemInfo.id, { authentication: destAuthentication }),
|
|
157
|
+
solutionCommon.createHubRequestOptions(destAuthentication)
|
|
154
158
|
])
|
|
155
159
|
.then(([pageModel, ro]) => {
|
|
160
|
+
// We need to save these properties in order to restore them after hub.js deletes them
|
|
161
|
+
created = pageModel.item.created;
|
|
162
|
+
modified = pageModel.item.modified;
|
|
156
163
|
return hubSites.convertPageToTemplate(pageModel, ro);
|
|
157
164
|
})
|
|
158
165
|
.then(tmpl => {
|
|
159
166
|
// add in some stuff Hub.js does not yet add
|
|
167
|
+
tmpl.item.created = created;
|
|
168
|
+
tmpl.item.modified = modified;
|
|
160
169
|
tmpl.item.typeKeywords = hubCommon.without(tmpl.item.typeKeywords, "doNotDelete");
|
|
161
170
|
tmpl.groups = [];
|
|
162
171
|
tmpl.estimatedDeploymentCostFactor = 2;
|
|
@@ -181,7 +190,7 @@
|
|
|
181
190
|
* @param {IItemProgressCallback} itemProgressCallback
|
|
182
191
|
* @returns {Promise<ICreateItemFromTemplateResponse>}
|
|
183
192
|
*/
|
|
184
|
-
function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
193
|
+
function createItemFromTemplate$1(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
185
194
|
// let the progress system know we've started...
|
|
186
195
|
const startStatus = itemProgressCallback(template.itemId, solutionCommon.EItemProgressStatus.Started, 0);
|
|
187
196
|
// and if it returned false, just resolve out
|
|
@@ -293,7 +302,7 @@
|
|
|
293
302
|
* @param templateDictionary
|
|
294
303
|
* @param authentication
|
|
295
304
|
*/
|
|
296
|
-
function postProcess(id, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
305
|
+
function postProcess$1(id, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
297
306
|
// create the requestOptions
|
|
298
307
|
let hubRo;
|
|
299
308
|
// get hubRequestOptions
|
|
@@ -325,9 +334,9 @@
|
|
|
325
334
|
|
|
326
335
|
var hubPageProcessor = /*#__PURE__*/Object.freeze({
|
|
327
336
|
__proto__: null,
|
|
328
|
-
convertItemToTemplate: convertItemToTemplate,
|
|
329
|
-
createItemFromTemplate: createItemFromTemplate,
|
|
330
|
-
postProcess: postProcess,
|
|
337
|
+
convertItemToTemplate: convertItemToTemplate$1,
|
|
338
|
+
createItemFromTemplate: createItemFromTemplate$1,
|
|
339
|
+
postProcess: postProcess$1,
|
|
331
340
|
isAPage: isAPage
|
|
332
341
|
});
|
|
333
342
|
|
|
@@ -426,6 +435,51 @@
|
|
|
426
435
|
* See the License for the specific language governing permissions and
|
|
427
436
|
* limitations under the License.
|
|
428
437
|
*/
|
|
438
|
+
/**
|
|
439
|
+
* Converts a Site item into a template.
|
|
440
|
+
*
|
|
441
|
+
* @param solutionItemId The solution to contain the template
|
|
442
|
+
* @param itemInfo Info about the item
|
|
443
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
444
|
+
* @param srcAuthentication Credentials for requests to source items (placeholder--not used)
|
|
445
|
+
* @return A promise that will resolve when the template has been created
|
|
446
|
+
*/
|
|
447
|
+
function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication = null // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
448
|
+
) {
|
|
449
|
+
let created = 0;
|
|
450
|
+
let modified = 0;
|
|
451
|
+
let hubRo;
|
|
452
|
+
// get hubRequestOptions
|
|
453
|
+
return solutionCommon.createHubRequestOptions(destAuthentication)
|
|
454
|
+
.then(ro => {
|
|
455
|
+
hubRo = ro;
|
|
456
|
+
return hubSites.getSiteById(itemInfo.id, hubRo);
|
|
457
|
+
})
|
|
458
|
+
.then(siteModel => {
|
|
459
|
+
// We need to save these properties in order to restore them after hub.js deletes them
|
|
460
|
+
created = siteModel.item.created;
|
|
461
|
+
modified = siteModel.item.modified;
|
|
462
|
+
return hubSites.convertSiteToTemplate(siteModel, hubRo);
|
|
463
|
+
})
|
|
464
|
+
.then(tmpl => {
|
|
465
|
+
// add in some stuff Hub.js does not yet add
|
|
466
|
+
tmpl.item.created = created;
|
|
467
|
+
tmpl.item.modified = modified;
|
|
468
|
+
tmpl.item.typeKeywords = hubCommon.without(tmpl.item.typeKeywords, "doNotDelete");
|
|
469
|
+
tmpl.groups = [];
|
|
470
|
+
tmpl.estimatedDeploymentCostFactor = 2;
|
|
471
|
+
tmpl.resources = [];
|
|
472
|
+
if (!solutionCommon.getProp(tmpl, "properties")) {
|
|
473
|
+
tmpl.properties = {};
|
|
474
|
+
}
|
|
475
|
+
// swap out dependency id's to {{<depid>.itemId}}
|
|
476
|
+
// so it will be re-interpolated
|
|
477
|
+
tmpl.dependencies = solutionCommon.dedupe(tmpl.dependencies);
|
|
478
|
+
tmpl = replaceItemIds(tmpl);
|
|
479
|
+
// and return it
|
|
480
|
+
return tmpl;
|
|
481
|
+
});
|
|
482
|
+
}
|
|
429
483
|
/**
|
|
430
484
|
* Handle deployment of Site item templates
|
|
431
485
|
*
|
|
@@ -436,7 +490,7 @@
|
|
|
436
490
|
* @param {IItemProgressCallback} itemProgressCallback
|
|
437
491
|
* @returns {Promise<ICreateItemFromTemplateResponse>}
|
|
438
492
|
*/
|
|
439
|
-
function createItemFromTemplate
|
|
493
|
+
function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
440
494
|
// let the progress system know we've started...
|
|
441
495
|
const startStatus = itemProgressCallback(template.itemId, solutionCommon.EItemProgressStatus.Started, 0);
|
|
442
496
|
// if it returned false, just resolve out
|
|
@@ -533,42 +587,6 @@
|
|
|
533
587
|
throw ex;
|
|
534
588
|
});
|
|
535
589
|
}
|
|
536
|
-
/**
|
|
537
|
-
* Converts a Site item into a template.
|
|
538
|
-
*
|
|
539
|
-
* @param solutionItemId The solution to contain the template
|
|
540
|
-
* @param itemInfo Info about the item
|
|
541
|
-
* @param authentication Credentials for working with AGO
|
|
542
|
-
* @return A promise that will resolve when the template has been created
|
|
543
|
-
*/
|
|
544
|
-
function convertItemToTemplate$1(solutionItemId, itemInfo, authentication) {
|
|
545
|
-
let hubRo;
|
|
546
|
-
// get hubRequestOptions
|
|
547
|
-
return solutionCommon.createHubRequestOptions(authentication)
|
|
548
|
-
.then(ro => {
|
|
549
|
-
hubRo = ro;
|
|
550
|
-
return hubSites.getSiteById(itemInfo.id, hubRo);
|
|
551
|
-
})
|
|
552
|
-
.then(siteModel => {
|
|
553
|
-
return hubSites.convertSiteToTemplate(siteModel, hubRo);
|
|
554
|
-
})
|
|
555
|
-
.then(tmpl => {
|
|
556
|
-
// add in some stuff Hub.js does not yet add
|
|
557
|
-
tmpl.item.typeKeywords = hubCommon.without(tmpl.item.typeKeywords, "doNotDelete");
|
|
558
|
-
tmpl.groups = [];
|
|
559
|
-
tmpl.estimatedDeploymentCostFactor = 2;
|
|
560
|
-
tmpl.resources = [];
|
|
561
|
-
if (!solutionCommon.getProp(tmpl, "properties")) {
|
|
562
|
-
tmpl.properties = {};
|
|
563
|
-
}
|
|
564
|
-
// swap out dependency id's to {{<depid>.itemId}}
|
|
565
|
-
// so it will be re-interpolated
|
|
566
|
-
tmpl.dependencies = solutionCommon.dedupe(tmpl.dependencies);
|
|
567
|
-
tmpl = replaceItemIds(tmpl);
|
|
568
|
-
// and return it
|
|
569
|
-
return tmpl;
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
590
|
/**
|
|
573
591
|
* Deployer life-cycle hook allowing the Site Processor
|
|
574
592
|
* a chance to apply final processes to all the items that
|
|
@@ -583,7 +601,7 @@
|
|
|
583
601
|
* @param authentication
|
|
584
602
|
* @param templateDictionary
|
|
585
603
|
*/
|
|
586
|
-
function postProcess
|
|
604
|
+
function postProcess(id, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
587
605
|
let hubRo;
|
|
588
606
|
return solutionCommon.createHubRequestOptions(authentication, templateDictionary)
|
|
589
607
|
.then(ro => {
|
|
@@ -617,9 +635,9 @@
|
|
|
617
635
|
|
|
618
636
|
var hubSiteProcessor = /*#__PURE__*/Object.freeze({
|
|
619
637
|
__proto__: null,
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
postProcess: postProcess
|
|
638
|
+
convertItemToTemplate: convertItemToTemplate,
|
|
639
|
+
createItemFromTemplate: createItemFromTemplate,
|
|
640
|
+
postProcess: postProcess,
|
|
623
641
|
isASite: isASite
|
|
624
642
|
});
|
|
625
643
|
|
|
@@ -628,5 +646,5 @@
|
|
|
628
646
|
|
|
629
647
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
630
648
|
|
|
631
|
-
}))
|
|
649
|
+
}));
|
|
632
650
|
//# sourceMappingURL=hub-types.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hub-types.umd.js","sources":["../../src/helpers/_post-process-page.ts","../../src/helpers/replace-item-ids.ts","../../src/helpers/move-model-to-folder.ts","../../src/hub-page-processor.ts","../../src/helpers/_update-site-pages.ts","../../src/helpers/_post-process-site.ts","../../src/hub-site-processor.ts"],"sourcesContent":["/** @license\r\n * Copyright 2020 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\nimport { IModel, IHubUserRequestOptions, interpolate } from \"@esri/hub-common\";\r\nimport { updatePage } from \"@esri/hub-sites\";\r\n\r\nexport function _postProcessPage(\r\n pageModel: IModel,\r\n itemInfos: any[],\r\n templateDictionary: any,\r\n hubRequestOptions: IHubUserRequestOptions\r\n): Promise<boolean> {\r\n // re-interpolate the siteModel using the itemInfos; no patches supplied\r\n pageModel = interpolate(pageModel, templateDictionary, {});\r\n return updatePage(pageModel, {\r\n ...hubRequestOptions,\r\n allowList: []\r\n }).then(() => {\r\n return true;\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2020 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\nimport {\r\n IModelTemplate,\r\n cloneObject,\r\n deepStringReplace\r\n} from \"@esri/hub-common\";\r\n\r\nexport function replaceItemIds(template: IModelTemplate): IModelTemplate {\r\n const clone = cloneObject(template);\r\n const deps = template.dependencies || [];\r\n // iterate the dependencies\r\n deps.forEach(depId => {\r\n const re = new RegExp(depId, \"g\");\r\n const replacement = `{{${depId}.itemId}}`;\r\n // we have to do this property-by-property or we would replace the `itemId` prop itself\r\n clone.item = deepStringReplace(clone.item, re, replacement);\r\n clone.data = deepStringReplace(clone.data, re, replacement);\r\n if (template.properties) {\r\n clone.properties = deepStringReplace(clone.properties, re, replacement);\r\n }\r\n });\r\n return clone;\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { IModel, getProp, failSafe } from \"@esri/hub-common\";\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { moveItem } from \"@esri/arcgis-rest-portal\";\r\n\r\n/**\r\n * Move the created site item, and optionally the Initiative, into\r\n * the solution folder\r\n *\r\n * @param siteModel\r\n * @param folderId\r\n * @param authentication\r\n */\r\nexport function moveModelToFolder(\r\n siteModel: IModel,\r\n folderId: string,\r\n authentication: UserSession\r\n): Promise<any> {\r\n // Fail-Safe the move call as it's not critical if it fails\r\n const failSafeMove = failSafe(moveItem, { success: true });\r\n\r\n const movePromises = [\r\n failSafeMove({\r\n itemId: siteModel.item.id,\r\n folderId,\r\n authentication\r\n })\r\n ];\r\n // if an initiative was created...\r\n if (getProp(siteModel, \"item.properties.parentInitiativeId\")) {\r\n movePromises.push(\r\n failSafeMove({\r\n itemId: siteModel.item.properties.parentInitiativeId,\r\n folderId,\r\n authentication\r\n })\r\n );\r\n }\r\n\r\n return Promise.all(movePromises);\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of Hub Page item types.\r\n *\r\n * @module hub-page-processor\r\n */\r\n\r\nimport {\r\n IItemTemplate,\r\n IItemProgressCallback,\r\n ICreateItemFromTemplateResponse,\r\n EItemProgressStatus,\r\n UserSession,\r\n createHubRequestOptions,\r\n generateEmptyCreationResponse\r\n} from \"@esri/solution-common\";\r\nimport { IUpdateItemOptions, updateItem } from \"@esri/arcgis-rest-portal\";\r\nimport {\r\n IModel,\r\n IModelTemplate,\r\n failSafe,\r\n getModel,\r\n IHubUserRequestOptions,\r\n getProp,\r\n without\r\n} from \"@esri/hub-common\";\r\nimport {\r\n createPageModelFromTemplate,\r\n createPage,\r\n removePage,\r\n convertPageToTemplate\r\n} from \"@esri/hub-sites\";\r\n\r\nimport { _postProcessPage } from \"./helpers/_post-process-page\";\r\nimport { replaceItemIds } from \"./helpers/replace-item-ids\";\r\nimport { moveModelToFolder } from \"./helpers/move-model-to-folder\";\r\n\r\n/**\r\n * Converts a Hub Page 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: UserSession\r\n): Promise<IItemTemplate> {\r\n // get the page model and hubRequestOptions\r\n return Promise.all([\r\n getModel(itemInfo.id, { authentication }),\r\n createHubRequestOptions(authentication)\r\n ])\r\n .then(([pageModel, ro]) => {\r\n return convertPageToTemplate(pageModel, ro);\r\n })\r\n .then(tmpl => {\r\n // add in some stuff Hub.js does not yet add\r\n tmpl.item.typeKeywords = without(tmpl.item.typeKeywords, \"doNotDelete\");\r\n tmpl.groups = [];\r\n tmpl.estimatedDeploymentCostFactor = 2;\r\n tmpl.resources = [];\r\n if (!getProp(tmpl, \"properties\")) {\r\n tmpl.properties = {};\r\n }\r\n // swap out dependency id's to {{<depid>.itemId}}\r\n // so it will be re-interpolated\r\n tmpl = replaceItemIds(tmpl);\r\n // and return it\r\n return tmpl as IItemTemplate;\r\n });\r\n}\r\n/**\r\n * Handle deployment of Page item templates\r\n *\r\n * @export\r\n * @param {IItemTemplate} template\r\n * @param {*} templateDictionary\r\n * @param {UserSession} destinationAuthentication\r\n * @param {IItemProgressCallback} itemProgressCallback\r\n * @returns {Promise<ICreateItemFromTemplateResponse>}\r\n */\r\nexport function createItemFromTemplate(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession,\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ICreateItemFromTemplateResponse> {\r\n // let the progress system know we've started...\r\n const startStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Started,\r\n 0\r\n );\r\n\r\n // and if it returned false, just resolve out\r\n if (!startStatus) {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n }\r\n\r\n // TODO: Reassess with resource unification\r\n if (template.assets && template.resources) {\r\n delete template.assets;\r\n }\r\n\r\n // solutionItemExtent is in geographic, but it's a string, and we want/need a bbox\r\n // and Hub templates expect it in organization.defaultExtentBBox\r\n if (templateDictionary.solutionItemExtent) {\r\n const parts = templateDictionary.solutionItemExtent.split(\",\");\r\n templateDictionary.organization.defaultExtentBBox = [\r\n [parts[0], parts[1]],\r\n [parts[2], parts[3]]\r\n ];\r\n }\r\n\r\n // TODO: Determine if we need any transforms in this new env\r\n const transforms = {};\r\n\r\n // create an object to hold the created site through\r\n // subsequent promise calls\r\n let pageModel: IModel;\r\n\r\n let hubRo: IHubUserRequestOptions;\r\n const thumbnail: File = template.item.thumbnail; // createPageModelFromTemplate trashes thumbnail\r\n return createHubRequestOptions(destinationAuthentication, templateDictionary)\r\n .then(ro => {\r\n hubRo = ro;\r\n return createPageModelFromTemplate(\r\n template,\r\n templateDictionary,\r\n transforms,\r\n hubRo\r\n );\r\n })\r\n .then((interpolated: unknown) => {\r\n // --------------------------------------------\r\n // TODO: Update hub.js to take an IModel in createPage\r\n // then remove this silliness\r\n const modelTmpl = interpolated as IModelTemplate;\r\n const options = {\r\n assets: modelTmpl.assets || []\r\n } as unknown;\r\n // --------------------------------------------\r\n return createPage(modelTmpl, options, hubRo);\r\n })\r\n .then(page => {\r\n pageModel = page;\r\n // Move the site and initiative to the solution folder\r\n // this is essentially fire and forget. We fail-safe the actual moveItem\r\n // call since it's not critical to the outcome\r\n return moveModelToFolder(\r\n page,\r\n templateDictionary.folderId,\r\n destinationAuthentication\r\n );\r\n })\r\n .then(() => {\r\n // Fix the thumbnail\r\n const updateOptions: IUpdateItemOptions = {\r\n item: {\r\n id: pageModel.item.id\r\n },\r\n params: {\r\n // Pass thumbnail in via params because item property is serialized, which discards a blob\r\n thumbnail\r\n },\r\n authentication: destinationAuthentication\r\n };\r\n return updateItem(updateOptions);\r\n })\r\n .then(() => {\r\n // Update the template dictionary\r\n // TODO: This should be done in whatever recieves\r\n // the outcome of this promise chain\r\n templateDictionary[template.itemId] = {\r\n itemId: pageModel.item.id\r\n };\r\n // call the progress callback, which also mutates templateDictionary\r\n const finalStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor || 2,\r\n pageModel.item.id\r\n );\r\n if (!finalStatus) {\r\n // clean up the site we just created\r\n const failSafeRemove = failSafe(removePage, { success: true });\r\n return failSafeRemove(pageModel, hubRo).then(() => {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n });\r\n } else {\r\n // finally, return ICreateItemFromTemplateResponse\r\n const response: ICreateItemFromTemplateResponse = {\r\n item: {\r\n ...template,\r\n ...pageModel\r\n },\r\n id: pageModel.item.id,\r\n type: template.type,\r\n postProcess: true\r\n };\r\n response.item.itemId = pageModel.item.id;\r\n return response;\r\n }\r\n })\r\n .catch(ex => {\r\n itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);\r\n throw ex;\r\n });\r\n}\r\n\r\n/**\r\n * Post-Process a Page\r\n * Re-interpolate the page item + data w/ the full template dictionary hash\r\n *\r\n * @param id\r\n * @param type\r\n * @param itemInfos\r\n * @param template\r\n * @param templates\r\n * @param templateDictionary\r\n * @param authentication\r\n */\r\nexport function postProcess(\r\n id: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: any,\r\n templates: IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: UserSession\r\n): Promise<boolean> {\r\n // create the requestOptions\r\n let hubRo: IHubUserRequestOptions;\r\n // get hubRequestOptions\r\n return createHubRequestOptions(authentication)\r\n .then(ro => {\r\n hubRo = ro;\r\n // get the site model\r\n return getModel(id, { authentication });\r\n })\r\n .then(pageModel => {\r\n // post process the page\r\n return _postProcessPage(pageModel, itemInfos, templateDictionary, hubRo);\r\n });\r\n}\r\n\r\n/**\r\n * Check of an item type is a Page\r\n * Hub Page is for ArcGIS Online\r\n * Site Page is for ArcGIS Enterprise\r\n *\r\n * @param itemType\r\n */\r\nexport function isAPage(itemType: string): boolean {\r\n let result = false;\r\n\r\n if (itemType === \"Hub Page\" || itemType === \"Site Page\") {\r\n result = true;\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2020 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\nimport { IModel, IHubUserRequestOptions, getModel } from \"@esri/hub-common\";\r\nimport { _updatePages } from \"@esri/hub-sites\";\r\n/**\r\n *\r\n * @param siteModel\r\n * @param itemInfos\r\n * @param hubRequestOptions\r\n */\r\nexport function _updateSitePages(\r\n siteModel: IModel,\r\n itemInfos: any[],\r\n hubRequestOptions: IHubUserRequestOptions\r\n): Promise<any> {\r\n const pageIds = itemInfos\r\n .filter(e => {\r\n return e.type.indexOf(\"Page\") > -1;\r\n })\r\n .map(e => e.id);\r\n\r\n // now get all those models\r\n return Promise.all(\r\n pageIds.map(id => {\r\n return getModel(id, hubRequestOptions);\r\n })\r\n ).then((pageModels: any) => {\r\n // now delegate back to hub.js internal _updatePages fn\r\n return _updatePages(siteModel, pageModels, hubRequestOptions);\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2020 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\nimport { IModel, IHubUserRequestOptions } from \"@esri/hub-common\";\r\n\r\nimport { _shareItemsToSiteGroups, updateSite, interpolateSite } from \"@esri/hub-sites\";\r\n\r\nimport { _updateSitePages } from \"./_update-site-pages\";\r\n\r\n/**\r\n * Post Process a Site\r\n * - share all items to the Hub teams created as part of the site\r\n * - link any created page to the site item\r\n * - re-interpolate any remaining item ids that were not direct deps of the site\r\n *\r\n * @param siteModel\r\n * @param itemInfos\r\n * @param templateDictionary\r\n * @param hubRequestOptions\r\n */\r\nexport function _postProcessSite(\r\n siteModel: IModel,\r\n itemInfos: any[],\r\n templateDictionary: any,\r\n hubRequestOptions: IHubUserRequestOptions\r\n): Promise<boolean> {\r\n const infosWithoutSite = itemInfos.filter(\r\n info => info.id !== siteModel.item.id\r\n );\r\n\r\n // convert the itemInfo's into things that look enough like a model\r\n // that we can call _shareItemsToSiteGroups\r\n const pseudoModels = infosWithoutSite.map(e => {\r\n return {\r\n item: {\r\n id: e.id,\r\n type: e.type\r\n }\r\n };\r\n });\r\n\r\n let secondPassPromises: Array<Promise<any>> = [];\r\n\r\n secondPassPromises = secondPassPromises.concat(\r\n _shareItemsToSiteGroups(\r\n siteModel,\r\n (pseudoModels as unknown) as IModel[],\r\n hubRequestOptions\r\n )\r\n );\r\n\r\n // we can't use that same trick w/ the page sharing\r\n // because we really need the models themselves\r\n // so we delegate to a local function\r\n secondPassPromises = secondPassPromises.concat(\r\n _updateSitePages(siteModel, infosWithoutSite, hubRequestOptions)\r\n );\r\n // need to get all the child items and add into site.item.properties.children\r\n const childItemIds = infosWithoutSite.map(i => i.id);\r\n\r\n siteModel.item.properties.children = childItemIds;\r\n\r\n // re-interpolate the siteModel using the itemInfos\r\n siteModel = interpolateSite(siteModel, templateDictionary, {});\r\n // and update the model\r\n secondPassPromises.push(\r\n updateSite(siteModel, {\r\n ...hubRequestOptions,\r\n allowList: null\r\n })\r\n );\r\n\r\n return Promise.all(secondPassPromises).then(() => {\r\n return true;\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2020 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 Hub Site item types.\r\n *\r\n * @module hub-site-processor\r\n */\r\n\r\nimport {\r\n IItemTemplate,\r\n IItemProgressCallback,\r\n ICreateItemFromTemplateResponse,\r\n EItemProgressStatus,\r\n UserSession,\r\n createHubRequestOptions,\r\n dedupe,\r\n generateEmptyCreationResponse,\r\n getProp\r\n} from \"@esri/solution-common\";\r\nimport { IUpdateItemOptions, updateItem } from \"@esri/arcgis-rest-portal\";\r\nimport {\r\n createSiteModelFromTemplate,\r\n createSite,\r\n getSiteById,\r\n removeSite,\r\n convertSiteToTemplate\r\n} from \"@esri/hub-sites\";\r\n\r\nimport {\r\n IModel,\r\n failSafe,\r\n IHubUserRequestOptions,\r\n without\r\n} from \"@esri/hub-common\";\r\n\r\nimport { moveModelToFolder } from \"./helpers/move-model-to-folder\";\r\nimport { _postProcessSite } from \"./helpers/_post-process-site\";\r\nimport { replaceItemIds } from \"./helpers/replace-item-ids\";\r\n/**\r\n * Handle deployment of Site item templates\r\n *\r\n * @export\r\n * @param {IItemTemplate} template\r\n * @param {*} templateDictionary\r\n * @param {UserSession} destinationAuthentication\r\n * @param {IItemProgressCallback} itemProgressCallback\r\n * @returns {Promise<ICreateItemFromTemplateResponse>}\r\n */\r\nexport function createItemFromTemplate(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession,\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ICreateItemFromTemplateResponse> {\r\n // let the progress system know we've started...\r\n const startStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Started,\r\n 0\r\n );\r\n // if it returned false, just resolve out\r\n if (!startStatus) {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n }\r\n\r\n // TODO: Reassess with resource unification\r\n if (template.assets && template.resources) {\r\n delete template.assets;\r\n }\r\n\r\n // ensure we have a solution object in the templateDictionary hash\r\n if (!templateDictionary.solution) {\r\n templateDictionary.solution = {};\r\n }\r\n // .title should always be set on the templateDictionary\r\n templateDictionary.solution.title = templateDictionary.title;\r\n\r\n // TODO: Determine if we need any transforms in this new env\r\n const transforms = {};\r\n\r\n // create an object to hold the created site through\r\n // subsequent promise calls\r\n let siteModel: IModel;\r\n\r\n // Create the \"siteModel\" from the template. Does not save the site item yet\r\n // Note: depending on licensing and user privs, will also create the team groups\r\n // and initiative item.\r\n let hubRo: IHubUserRequestOptions;\r\n const thumbnail: File = template.item.thumbnail; // createSiteModelFromTemplate trashes thumbnail\r\n return createHubRequestOptions(destinationAuthentication, templateDictionary)\r\n .then(ro => {\r\n hubRo = ro;\r\n return createSiteModelFromTemplate(\r\n template,\r\n templateDictionary,\r\n transforms,\r\n hubRo\r\n );\r\n })\r\n .then(interpolated => {\r\n const options = {\r\n assets: interpolated.assets || []\r\n };\r\n // Now create the item, register for oAuth, register domain etc\r\n return createSite(interpolated, options, hubRo);\r\n })\r\n .then(site => {\r\n // hold onto the site\r\n siteModel = site;\r\n // Move the site and initiative to the solution folder\r\n // this is essentially fire and forget. We fail-safe the actual moveItem\r\n // call since it's not critical to the outcome\r\n return moveModelToFolder(\r\n site,\r\n templateDictionary.folderId,\r\n destinationAuthentication\r\n );\r\n })\r\n .then(() => {\r\n // Fix the thumbnail\r\n const updateOptions: IUpdateItemOptions = {\r\n item: {\r\n id: siteModel.item.id\r\n },\r\n params: {\r\n // Pass thumbnail in via params because item property is serialized, which discards a blob\r\n thumbnail\r\n },\r\n authentication: destinationAuthentication\r\n };\r\n return updateItem(updateOptions);\r\n })\r\n .then(() => {\r\n // Update the template dictionary\r\n // TODO: This should be done in whatever recieves\r\n // the outcome of this promise chain\r\n templateDictionary[template.itemId] = {\r\n itemId: siteModel.item.id\r\n };\r\n // call the progress callback, which also mutates templateDictionary\r\n const finalStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor || 2,\r\n siteModel.item.id\r\n );\r\n if (!finalStatus) {\r\n // clean up the site we just created\r\n const failSafeRemove = failSafe(removeSite, { success: true });\r\n return failSafeRemove(siteModel, hubRo).then(() => {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n });\r\n } else {\r\n // finally, return ICreateItemFromTemplateResponse\r\n const response: ICreateItemFromTemplateResponse = {\r\n item: {\r\n ...template,\r\n ...siteModel\r\n },\r\n id: siteModel.item.id,\r\n type: template.type,\r\n postProcess: true\r\n };\r\n response.item.itemId = siteModel.item.id;\r\n return response;\r\n }\r\n })\r\n .catch(ex => {\r\n itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);\r\n throw ex;\r\n });\r\n}\r\n\r\n/**\r\n * Converts a Site 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: UserSession\r\n): Promise<IItemTemplate> {\r\n let hubRo: IHubUserRequestOptions;\r\n // get hubRequestOptions\r\n return createHubRequestOptions(authentication)\r\n .then(ro => {\r\n hubRo = ro;\r\n return getSiteById(itemInfo.id, hubRo);\r\n })\r\n .then(siteModel => {\r\n return convertSiteToTemplate(siteModel, hubRo);\r\n })\r\n .then(tmpl => {\r\n // add in some stuff Hub.js does not yet add\r\n tmpl.item.typeKeywords = without(tmpl.item.typeKeywords, \"doNotDelete\");\r\n tmpl.groups = [];\r\n tmpl.estimatedDeploymentCostFactor = 2;\r\n tmpl.resources = [];\r\n if (!getProp(tmpl, \"properties\")) {\r\n tmpl.properties = {};\r\n }\r\n // swap out dependency id's to {{<depid>.itemId}}\r\n // so it will be re-interpolated\r\n tmpl.dependencies = dedupe(tmpl.dependencies);\r\n tmpl = replaceItemIds(tmpl);\r\n\r\n // and return it\r\n return tmpl as IItemTemplate;\r\n });\r\n}\r\n\r\n/**\r\n * Deployer life-cycle hook allowing the Site Processor\r\n * a chance to apply final processes to all the items that\r\n * were created as part of the solution.\r\n * Specifically this will:\r\n * - share all items to the content team, and (if created)\r\n * the core team (depends on user privs)\r\n * - link all Page items that were created, to the Site\r\n *\r\n * @param model\r\n * @param items\r\n * @param authentication\r\n * @param templateDictionary\r\n */\r\nexport function postProcess(\r\n id: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: any,\r\n templates: IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: UserSession\r\n): Promise<boolean> {\r\n let hubRo: IHubUserRequestOptions;\r\n return createHubRequestOptions(authentication, templateDictionary)\r\n .then(ro => {\r\n hubRo = ro;\r\n // get the site model\r\n return getSiteById(id, hubRo);\r\n })\r\n .then(siteModel => {\r\n // Hub.js does not expect the same structures, so we delegat to a local fn\r\n return _postProcessSite(siteModel, itemInfos, templateDictionary, hubRo);\r\n })\r\n .then(() => {\r\n // resolve w/ a boolean\r\n return Promise.resolve(true);\r\n });\r\n}\r\n\r\n/**\r\n * Check of an item type is a Site\r\n * Hub Site Application is for ArcGIS Online\r\n * Site Application is for ArcGIS Enterprise\r\n *\r\n * @param itemType\r\n */\r\nexport function isASite(itemType: string): boolean {\r\n let result = false;\r\n if (itemType === \"Hub Site Application\" || itemType === \"Site Application\") {\r\n result = true;\r\n }\r\n return result;\r\n}\r\n"],"names":["interpolate","updatePage","cloneObject","deepStringReplace","failSafe","moveItem","getProp","getModel","createHubRequestOptions","convertPageToTemplate","without","EItemProgressStatus","generateEmptyCreationResponse","createPageModelFromTemplate","createPage","updateItem","removePage","_updatePages","_shareItemsToSiteGroups","interpolateSite","updateSite","createItemFromTemplate","createSiteModelFromTemplate","createSite","removeSite","convertItemToTemplate","getSiteById","convertSiteToTemplate","dedupe","postProcess"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;WAkBgB,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,kBAAuB,EACvB,iBAAyC;;MAGzC,SAAS,GAAGA,qBAAW,CAAC,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;MAC3D,OAAOC,mBAAU,CAAC,SAAS,EAAE;UAC3B,GAAG,iBAAiB;UACpB,SAAS,EAAE,EAAE;OACd,CAAC,CAAC,IAAI,CAAC;UACN,OAAO,IAAI,CAAC;OACb,CAAC,CAAC;EACL;;EChCA;;;;;;;;;;;;;;;AAgBA,WAMgB,cAAc,CAAC,QAAwB;MACrD,MAAM,KAAK,GAAGC,qBAAW,CAAC,QAAQ,CAAC,CAAC;MACpC,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC;;MAEzC,IAAI,CAAC,OAAO,CAAC,KAAK;UAChB,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;UAClC,MAAM,WAAW,GAAG,KAAK,KAAK,WAAW,CAAC;;UAE1C,KAAK,CAAC,IAAI,GAAGC,2BAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;UAC5D,KAAK,CAAC,IAAI,GAAGA,2BAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;UAC5D,IAAI,QAAQ,CAAC,UAAU,EAAE;cACvB,KAAK,CAAC,UAAU,GAAGA,2BAAiB,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;WACzE;OACF,CAAC,CAAC;MACH,OAAO,KAAK,CAAC;EACf,CAAC;;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;AAOA,WAAgB,OAAO,CAAC,QAAgB;MACtC,IAAI,MAAM,GAAG,KAAK,CAAC;MACnB,IAAI,QAAQ,KAAK,sBAAsB,IAAI,QAAQ,KAAK,kBAAkB,EAAE;UAC1E,MAAM,GAAG,IAAI,CAAC;OACf;MACD,OAAO,MAAM,CAAC;EAChB,CAAC;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"hub-types.umd.js","sources":["../../src/helpers/_post-process-page.ts","../../src/helpers/replace-item-ids.ts","../../src/helpers/move-model-to-folder.ts","../../src/hub-page-processor.ts","../../src/helpers/_update-site-pages.ts","../../src/helpers/_post-process-site.ts","../../src/hub-site-processor.ts"],"sourcesContent":["/** @license\r\n * Copyright 2020 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\nimport { IModel, IHubUserRequestOptions, interpolate } from \"@esri/hub-common\";\r\nimport { updatePage } from \"@esri/hub-sites\";\r\n\r\nexport function _postProcessPage(\r\n pageModel: IModel,\r\n itemInfos: any[],\r\n templateDictionary: any,\r\n hubRequestOptions: IHubUserRequestOptions\r\n): Promise<boolean> {\r\n // re-interpolate the siteModel using the itemInfos; no patches supplied\r\n pageModel = interpolate(pageModel, templateDictionary, {});\r\n return updatePage(pageModel, {\r\n ...hubRequestOptions,\r\n allowList: []\r\n }).then(() => {\r\n return true;\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2020 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\nimport {\r\n IModelTemplate,\r\n cloneObject,\r\n deepStringReplace\r\n} from \"@esri/hub-common\";\r\n\r\nexport function replaceItemIds(template: IModelTemplate): IModelTemplate {\r\n const clone = cloneObject(template);\r\n const deps = template.dependencies || [];\r\n // iterate the dependencies\r\n deps.forEach(depId => {\r\n const re = new RegExp(depId, \"g\");\r\n const replacement = `{{${depId}.itemId}}`;\r\n // we have to do this property-by-property or we would replace the `itemId` prop itself\r\n clone.item = deepStringReplace(clone.item, re, replacement);\r\n clone.data = deepStringReplace(clone.data, re, replacement);\r\n if (template.properties) {\r\n clone.properties = deepStringReplace(clone.properties, re, replacement);\r\n }\r\n });\r\n return clone;\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { IModel, getProp, failSafe } from \"@esri/hub-common\";\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { moveItem } from \"@esri/arcgis-rest-portal\";\r\n\r\n/**\r\n * Move the created site item, and optionally the Initiative, into\r\n * the solution folder\r\n *\r\n * @param siteModel\r\n * @param folderId\r\n * @param authentication\r\n */\r\nexport function moveModelToFolder(\r\n siteModel: IModel,\r\n folderId: string,\r\n authentication: UserSession\r\n): Promise<any> {\r\n // Fail-Safe the move call as it's not critical if it fails\r\n const failSafeMove = failSafe(moveItem, { success: true });\r\n\r\n const movePromises = [\r\n failSafeMove({\r\n itemId: siteModel.item.id,\r\n folderId,\r\n authentication\r\n })\r\n ];\r\n // if an initiative was created...\r\n if (getProp(siteModel, \"item.properties.parentInitiativeId\")) {\r\n movePromises.push(\r\n failSafeMove({\r\n itemId: siteModel.item.properties.parentInitiativeId,\r\n folderId,\r\n authentication\r\n })\r\n );\r\n }\r\n\r\n return Promise.all(movePromises);\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of Hub Page item types.\r\n *\r\n * @module hub-page-processor\r\n */\r\n\r\nimport {\r\n IItemTemplate,\r\n IItemProgressCallback,\r\n ICreateItemFromTemplateResponse,\r\n EItemProgressStatus,\r\n UserSession,\r\n createHubRequestOptions,\r\n generateEmptyCreationResponse\r\n} from \"@esri/solution-common\";\r\nimport { IUpdateItemOptions, updateItem } from \"@esri/arcgis-rest-portal\";\r\nimport {\r\n IModel,\r\n IModelTemplate,\r\n failSafe,\r\n getModel,\r\n IHubUserRequestOptions,\r\n getProp,\r\n without\r\n} from \"@esri/hub-common\";\r\nimport {\r\n createPageModelFromTemplate,\r\n createPage,\r\n removePage,\r\n convertPageToTemplate\r\n} from \"@esri/hub-sites\";\r\n\r\nimport { _postProcessPage } from \"./helpers/_post-process-page\";\r\nimport { replaceItemIds } from \"./helpers/replace-item-ids\";\r\nimport { moveModelToFolder } from \"./helpers/move-model-to-folder\";\r\n\r\n/**\r\n * Converts a Hub Page 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 (placeholder--not used)\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: UserSession,\r\n srcAuthentication: UserSession = null // eslint-disable-line @typescript-eslint/no-unused-vars\r\n): Promise<IItemTemplate> {\r\n let created: number = 0;\r\n let modified: number = 0;\r\n\r\n // get the page model and hubRequestOptions\r\n return Promise.all([\r\n getModel(itemInfo.id, { authentication: destAuthentication }),\r\n createHubRequestOptions(destAuthentication)\r\n ])\r\n .then(([pageModel, ro]) => {\r\n // We need to save these properties in order to restore them after hub.js deletes them\r\n created = pageModel.item.created;\r\n modified = pageModel.item.modified;\r\n return convertPageToTemplate(pageModel, ro);\r\n })\r\n .then(tmpl => {\r\n // add in some stuff Hub.js does not yet add\r\n tmpl.item.created = created;\r\n tmpl.item.modified = modified;\r\n tmpl.item.typeKeywords = without(tmpl.item.typeKeywords, \"doNotDelete\");\r\n tmpl.groups = [];\r\n tmpl.estimatedDeploymentCostFactor = 2;\r\n tmpl.resources = [];\r\n if (!getProp(tmpl, \"properties\")) {\r\n tmpl.properties = {};\r\n }\r\n // swap out dependency id's to {{<depid>.itemId}}\r\n // so it will be re-interpolated\r\n tmpl = replaceItemIds(tmpl);\r\n // and return it\r\n return tmpl as IItemTemplate;\r\n });\r\n}\r\n/**\r\n * Handle deployment of Page item templates\r\n *\r\n * @export\r\n * @param {IItemTemplate} template\r\n * @param {*} templateDictionary\r\n * @param {UserSession} destinationAuthentication\r\n * @param {IItemProgressCallback} itemProgressCallback\r\n * @returns {Promise<ICreateItemFromTemplateResponse>}\r\n */\r\nexport function createItemFromTemplate(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession,\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ICreateItemFromTemplateResponse> {\r\n // let the progress system know we've started...\r\n const startStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Started,\r\n 0\r\n );\r\n\r\n // and if it returned false, just resolve out\r\n if (!startStatus) {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n }\r\n\r\n // TODO: Reassess with resource unification\r\n if (template.assets && template.resources) {\r\n delete template.assets;\r\n }\r\n\r\n // solutionItemExtent is in geographic, but it's a string, and we want/need a bbox\r\n // and Hub templates expect it in organization.defaultExtentBBox\r\n if (templateDictionary.solutionItemExtent) {\r\n const parts = templateDictionary.solutionItemExtent.split(\",\");\r\n templateDictionary.organization.defaultExtentBBox = [\r\n [parts[0], parts[1]],\r\n [parts[2], parts[3]]\r\n ];\r\n }\r\n\r\n // TODO: Determine if we need any transforms in this new env\r\n const transforms = {};\r\n\r\n // create an object to hold the created site through\r\n // subsequent promise calls\r\n let pageModel: IModel;\r\n\r\n let hubRo: IHubUserRequestOptions;\r\n const thumbnail: File = template.item.thumbnail; // createPageModelFromTemplate trashes thumbnail\r\n return createHubRequestOptions(destinationAuthentication, templateDictionary)\r\n .then(ro => {\r\n hubRo = ro;\r\n return createPageModelFromTemplate(\r\n template,\r\n templateDictionary,\r\n transforms,\r\n hubRo\r\n );\r\n })\r\n .then((interpolated: unknown) => {\r\n // --------------------------------------------\r\n // TODO: Update hub.js to take an IModel in createPage\r\n // then remove this silliness\r\n const modelTmpl = interpolated as IModelTemplate;\r\n const options = {\r\n assets: modelTmpl.assets || []\r\n } as unknown;\r\n // --------------------------------------------\r\n return createPage(modelTmpl, options, hubRo);\r\n })\r\n .then(page => {\r\n pageModel = page;\r\n // Move the site and initiative to the solution folder\r\n // this is essentially fire and forget. We fail-safe the actual moveItem\r\n // call since it's not critical to the outcome\r\n return moveModelToFolder(\r\n page,\r\n templateDictionary.folderId,\r\n destinationAuthentication\r\n );\r\n })\r\n .then(() => {\r\n // Fix the thumbnail\r\n const updateOptions: IUpdateItemOptions = {\r\n item: {\r\n id: pageModel.item.id\r\n },\r\n params: {\r\n // Pass thumbnail in via params because item property is serialized, which discards a blob\r\n thumbnail\r\n },\r\n authentication: destinationAuthentication\r\n };\r\n return updateItem(updateOptions);\r\n })\r\n .then(() => {\r\n // Update the template dictionary\r\n // TODO: This should be done in whatever recieves\r\n // the outcome of this promise chain\r\n templateDictionary[template.itemId] = {\r\n itemId: pageModel.item.id\r\n };\r\n // call the progress callback, which also mutates templateDictionary\r\n const finalStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor || 2,\r\n pageModel.item.id\r\n );\r\n if (!finalStatus) {\r\n // clean up the site we just created\r\n const failSafeRemove = failSafe(removePage, { success: true });\r\n return failSafeRemove(pageModel, hubRo).then(() => {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n });\r\n } else {\r\n // finally, return ICreateItemFromTemplateResponse\r\n const response: ICreateItemFromTemplateResponse = {\r\n item: {\r\n ...template,\r\n ...pageModel\r\n },\r\n id: pageModel.item.id,\r\n type: template.type,\r\n postProcess: true\r\n };\r\n response.item.itemId = pageModel.item.id;\r\n return response;\r\n }\r\n })\r\n .catch(ex => {\r\n itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);\r\n throw ex;\r\n });\r\n}\r\n\r\n/**\r\n * Post-Process a Page\r\n * Re-interpolate the page item + data w/ the full template dictionary hash\r\n *\r\n * @param id\r\n * @param type\r\n * @param itemInfos\r\n * @param template\r\n * @param templates\r\n * @param templateDictionary\r\n * @param authentication\r\n */\r\nexport function postProcess(\r\n id: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: any,\r\n templates: IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: UserSession\r\n): Promise<boolean> {\r\n // create the requestOptions\r\n let hubRo: IHubUserRequestOptions;\r\n // get hubRequestOptions\r\n return createHubRequestOptions(authentication)\r\n .then(ro => {\r\n hubRo = ro;\r\n // get the site model\r\n return getModel(id, { authentication });\r\n })\r\n .then(pageModel => {\r\n // post process the page\r\n return _postProcessPage(pageModel, itemInfos, templateDictionary, hubRo);\r\n });\r\n}\r\n\r\n/**\r\n * Check of an item type is a Page\r\n * Hub Page is for ArcGIS Online\r\n * Site Page is for ArcGIS Enterprise\r\n *\r\n * @param itemType\r\n */\r\nexport function isAPage(itemType: string): boolean {\r\n let result = false;\r\n\r\n if (itemType === \"Hub Page\" || itemType === \"Site Page\") {\r\n result = true;\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2020 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\nimport { IModel, IHubUserRequestOptions, getModel } from \"@esri/hub-common\";\r\nimport { _updatePages } from \"@esri/hub-sites\";\r\n/**\r\n *\r\n * @param siteModel\r\n * @param itemInfos\r\n * @param hubRequestOptions\r\n */\r\nexport function _updateSitePages(\r\n siteModel: IModel,\r\n itemInfos: any[],\r\n hubRequestOptions: IHubUserRequestOptions\r\n): Promise<any> {\r\n const pageIds = itemInfos\r\n .filter(e => {\r\n return e.type.indexOf(\"Page\") > -1;\r\n })\r\n .map(e => e.id);\r\n\r\n // now get all those models\r\n return Promise.all(\r\n pageIds.map(id => {\r\n return getModel(id, hubRequestOptions);\r\n })\r\n ).then((pageModels: any) => {\r\n // now delegate back to hub.js internal _updatePages fn\r\n return _updatePages(siteModel, pageModels, hubRequestOptions);\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2020 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\nimport { IModel, IHubUserRequestOptions } from \"@esri/hub-common\";\r\n\r\nimport { _shareItemsToSiteGroups, updateSite, interpolateSite } from \"@esri/hub-sites\";\r\n\r\nimport { _updateSitePages } from \"./_update-site-pages\";\r\n\r\n/**\r\n * Post Process a Site\r\n * - share all items to the Hub teams created as part of the site\r\n * - link any created page to the site item\r\n * - re-interpolate any remaining item ids that were not direct deps of the site\r\n *\r\n * @param siteModel\r\n * @param itemInfos\r\n * @param templateDictionary\r\n * @param hubRequestOptions\r\n */\r\nexport function _postProcessSite(\r\n siteModel: IModel,\r\n itemInfos: any[],\r\n templateDictionary: any,\r\n hubRequestOptions: IHubUserRequestOptions\r\n): Promise<boolean> {\r\n const infosWithoutSite = itemInfos.filter(\r\n info => info.id !== siteModel.item.id\r\n );\r\n\r\n // convert the itemInfo's into things that look enough like a model\r\n // that we can call _shareItemsToSiteGroups\r\n const pseudoModels = infosWithoutSite.map(e => {\r\n return {\r\n item: {\r\n id: e.id,\r\n type: e.type\r\n }\r\n };\r\n });\r\n\r\n let secondPassPromises: Array<Promise<any>> = [];\r\n\r\n secondPassPromises = secondPassPromises.concat(\r\n _shareItemsToSiteGroups(\r\n siteModel,\r\n (pseudoModels as unknown) as IModel[],\r\n hubRequestOptions\r\n )\r\n );\r\n\r\n // we can't use that same trick w/ the page sharing\r\n // because we really need the models themselves\r\n // so we delegate to a local function\r\n secondPassPromises = secondPassPromises.concat(\r\n _updateSitePages(siteModel, infosWithoutSite, hubRequestOptions)\r\n );\r\n // need to get all the child items and add into site.item.properties.children\r\n const childItemIds = infosWithoutSite.map(i => i.id);\r\n\r\n siteModel.item.properties.children = childItemIds;\r\n\r\n // re-interpolate the siteModel using the itemInfos\r\n siteModel = interpolateSite(siteModel, templateDictionary, {});\r\n // and update the model\r\n secondPassPromises.push(\r\n updateSite(siteModel, {\r\n ...hubRequestOptions,\r\n allowList: null\r\n })\r\n );\r\n\r\n return Promise.all(secondPassPromises).then(() => {\r\n return true;\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2020 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 Hub Site item types.\r\n *\r\n * @module hub-site-processor\r\n */\r\n\r\nimport {\r\n IItemTemplate,\r\n IItemProgressCallback,\r\n ICreateItemFromTemplateResponse,\r\n EItemProgressStatus,\r\n UserSession,\r\n createHubRequestOptions,\r\n dedupe,\r\n generateEmptyCreationResponse,\r\n getProp\r\n} from \"@esri/solution-common\";\r\nimport { IUpdateItemOptions, updateItem } from \"@esri/arcgis-rest-portal\";\r\nimport {\r\n createSiteModelFromTemplate,\r\n createSite,\r\n getSiteById,\r\n removeSite,\r\n convertSiteToTemplate\r\n} from \"@esri/hub-sites\";\r\n\r\nimport {\r\n IModel,\r\n failSafe,\r\n IHubUserRequestOptions,\r\n without\r\n} from \"@esri/hub-common\";\r\n\r\nimport { moveModelToFolder } from \"./helpers/move-model-to-folder\";\r\nimport { _postProcessSite } from \"./helpers/_post-process-site\";\r\nimport { replaceItemIds } from \"./helpers/replace-item-ids\";\r\n\r\n/**\r\n * Converts a Site 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 (placeholder--not used)\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: UserSession,\r\n srcAuthentication: UserSession = null // eslint-disable-line @typescript-eslint/no-unused-vars\r\n): Promise<IItemTemplate> {\r\n let created: number = 0;\r\n let modified: number = 0;\r\n\r\n let hubRo: IHubUserRequestOptions;\r\n // get hubRequestOptions\r\n return createHubRequestOptions(destAuthentication)\r\n .then(ro => {\r\n hubRo = ro;\r\n return getSiteById(itemInfo.id, hubRo);\r\n })\r\n .then(siteModel => {\r\n // We need to save these properties in order to restore them after hub.js deletes them\r\n created = siteModel.item.created;\r\n modified = siteModel.item.modified;\r\n return convertSiteToTemplate(siteModel, hubRo);\r\n })\r\n .then(tmpl => {\r\n // add in some stuff Hub.js does not yet add\r\n tmpl.item.created = created;\r\n tmpl.item.modified = modified;\r\n tmpl.item.typeKeywords = without(tmpl.item.typeKeywords, \"doNotDelete\");\r\n tmpl.groups = [];\r\n tmpl.estimatedDeploymentCostFactor = 2;\r\n tmpl.resources = [];\r\n if (!getProp(tmpl, \"properties\")) {\r\n tmpl.properties = {};\r\n }\r\n // swap out dependency id's to {{<depid>.itemId}}\r\n // so it will be re-interpolated\r\n tmpl.dependencies = dedupe(tmpl.dependencies);\r\n tmpl = replaceItemIds(tmpl);\r\n\r\n // and return it\r\n return tmpl as IItemTemplate;\r\n });\r\n}\r\n\r\n/**\r\n * Handle deployment of Site item templates\r\n *\r\n * @export\r\n * @param {IItemTemplate} template\r\n * @param {*} templateDictionary\r\n * @param {UserSession} destinationAuthentication\r\n * @param {IItemProgressCallback} itemProgressCallback\r\n * @returns {Promise<ICreateItemFromTemplateResponse>}\r\n */\r\nexport function createItemFromTemplate(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession,\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ICreateItemFromTemplateResponse> {\r\n // let the progress system know we've started...\r\n const startStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Started,\r\n 0\r\n );\r\n // if it returned false, just resolve out\r\n if (!startStatus) {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n }\r\n\r\n // TODO: Reassess with resource unification\r\n if (template.assets && template.resources) {\r\n delete template.assets;\r\n }\r\n\r\n // ensure we have a solution object in the templateDictionary hash\r\n if (!templateDictionary.solution) {\r\n templateDictionary.solution = {};\r\n }\r\n // .title should always be set on the templateDictionary\r\n templateDictionary.solution.title = templateDictionary.title;\r\n\r\n // TODO: Determine if we need any transforms in this new env\r\n const transforms = {};\r\n\r\n // create an object to hold the created site through\r\n // subsequent promise calls\r\n let siteModel: IModel;\r\n\r\n // Create the \"siteModel\" from the template. Does not save the site item yet\r\n // Note: depending on licensing and user privs, will also create the team groups\r\n // and initiative item.\r\n let hubRo: IHubUserRequestOptions;\r\n const thumbnail: File = template.item.thumbnail; // createSiteModelFromTemplate trashes thumbnail\r\n return createHubRequestOptions(destinationAuthentication, templateDictionary)\r\n .then(ro => {\r\n hubRo = ro;\r\n return createSiteModelFromTemplate(\r\n template,\r\n templateDictionary,\r\n transforms,\r\n hubRo\r\n );\r\n })\r\n .then(interpolated => {\r\n const options = {\r\n assets: interpolated.assets || []\r\n };\r\n // Now create the item, register for oAuth, register domain etc\r\n return createSite(interpolated, options, hubRo);\r\n })\r\n .then(site => {\r\n // hold onto the site\r\n siteModel = site;\r\n // Move the site and initiative to the solution folder\r\n // this is essentially fire and forget. We fail-safe the actual moveItem\r\n // call since it's not critical to the outcome\r\n return moveModelToFolder(\r\n site,\r\n templateDictionary.folderId,\r\n destinationAuthentication\r\n );\r\n })\r\n .then(() => {\r\n // Fix the thumbnail\r\n const updateOptions: IUpdateItemOptions = {\r\n item: {\r\n id: siteModel.item.id\r\n },\r\n params: {\r\n // Pass thumbnail in via params because item property is serialized, which discards a blob\r\n thumbnail\r\n },\r\n authentication: destinationAuthentication\r\n };\r\n return updateItem(updateOptions);\r\n })\r\n .then(() => {\r\n // Update the template dictionary\r\n // TODO: This should be done in whatever recieves\r\n // the outcome of this promise chain\r\n templateDictionary[template.itemId] = {\r\n itemId: siteModel.item.id\r\n };\r\n // call the progress callback, which also mutates templateDictionary\r\n const finalStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor || 2,\r\n siteModel.item.id\r\n );\r\n if (!finalStatus) {\r\n // clean up the site we just created\r\n const failSafeRemove = failSafe(removeSite, { success: true });\r\n return failSafeRemove(siteModel, hubRo).then(() => {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n });\r\n } else {\r\n // finally, return ICreateItemFromTemplateResponse\r\n const response: ICreateItemFromTemplateResponse = {\r\n item: {\r\n ...template,\r\n ...siteModel\r\n },\r\n id: siteModel.item.id,\r\n type: template.type,\r\n postProcess: true\r\n };\r\n response.item.itemId = siteModel.item.id;\r\n return response;\r\n }\r\n })\r\n .catch(ex => {\r\n itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);\r\n throw ex;\r\n });\r\n}\r\n\r\n/**\r\n * Deployer life-cycle hook allowing the Site Processor\r\n * a chance to apply final processes to all the items that\r\n * were created as part of the solution.\r\n * Specifically this will:\r\n * - share all items to the content team, and (if created)\r\n * the core team (depends on user privs)\r\n * - link all Page items that were created, to the Site\r\n *\r\n * @param model\r\n * @param items\r\n * @param authentication\r\n * @param templateDictionary\r\n */\r\nexport function postProcess(\r\n id: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: any,\r\n templates: IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: UserSession\r\n): Promise<boolean> {\r\n let hubRo: IHubUserRequestOptions;\r\n return createHubRequestOptions(authentication, templateDictionary)\r\n .then(ro => {\r\n hubRo = ro;\r\n // get the site model\r\n return getSiteById(id, hubRo);\r\n })\r\n .then(siteModel => {\r\n // Hub.js does not expect the same structures, so we delegat to a local fn\r\n return _postProcessSite(siteModel, itemInfos, templateDictionary, hubRo);\r\n })\r\n .then(() => {\r\n // resolve w/ a boolean\r\n return Promise.resolve(true);\r\n });\r\n}\r\n\r\n/**\r\n * Check of an item type is a Site\r\n * Hub Site Application is for ArcGIS Online\r\n * Site Application is for ArcGIS Enterprise\r\n *\r\n * @param itemType\r\n */\r\nexport function isASite(itemType: string): boolean {\r\n let result = false;\r\n if (itemType === \"Hub Site Application\" || itemType === \"Site Application\") {\r\n result = true;\r\n }\r\n return result;\r\n}\r\n"],"names":["interpolate","updatePage","cloneObject","deepStringReplace","failSafe","moveItem","getProp","convertItemToTemplate","getModel","createHubRequestOptions","convertPageToTemplate","without","createItemFromTemplate","EItemProgressStatus","generateEmptyCreationResponse","createPageModelFromTemplate","createPage","updateItem","removePage","postProcess","_updatePages","_shareItemsToSiteGroups","interpolateSite","updateSite","getSiteById","convertSiteToTemplate","dedupe","createSiteModelFromTemplate","createSite","removeSite"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;WAkBgB,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,kBAAuB,EACvB,iBAAyC;;MAGzC,SAAS,GAAGA,qBAAW,CAAC,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;MAC3D,OAAOC,mBAAU,CAAC,SAAS,EAAE;UAC3B,GAAG,iBAAiB;UACpB,SAAS,EAAE,EAAE;OACd,CAAC,CAAC,IAAI,CAAC;UACN,OAAO,IAAI,CAAC;OACb,CAAC,CAAC;EACL;;EChCA;;;;;;;;;;;;;;;WAsBgB,cAAc,CAAC,QAAwB;MACrD,MAAM,KAAK,GAAGC,qBAAW,CAAC,QAAQ,CAAC,CAAC;MACpC,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC;;MAEzC,IAAI,CAAC,OAAO,CAAC,KAAK;UAChB,MAAM,EAAE,GAAG,IAAI,MAAM,C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;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-hub-types - v1.
|
|
3
|
-
* Copyright (c) 2018-
|
|
4
|
-
*
|
|
2
|
+
* @esri/solution-hub-types - v1.3.0 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
+
* Thu Feb 17 2022 09:43:35 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"),require("@esri/arcgis-rest-portal"),require("@esri/hub-common"),require("@esri/hub-sites")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common","@esri/arcgis-rest-portal","@esri/hub-common","@esri/hub-sites"],t):t((e=e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution,e.arcgisRest,e.arcgisHub,e.arcgisHub)}(this,(function(e,t,i,r,o){"use strict";function s(e){const t=r.cloneObject(e);return(e.dependencies||[]).forEach((i=>{const o=new RegExp(i,"g"),s=`{{${i}.itemId}}`;t.item=r.deepStringReplace(t.item,o,s),t.data=r.deepStringReplace(t.data,o,s),e.properties&&(t.properties=r.deepStringReplace(t.properties,o,s))})),t}function n(e,t,o){const s=r.failSafe(i.moveItem,{success:!0}),n=[s({itemId:e.item.id,folderId:t,authentication:o})];return r.getProp(e,"item.properties.parentInitiativeId")&&n.push(s({itemId:e.item.properties.parentInitiativeId,folderId:t,authentication:o})),Promise.all(n)}var a=Object.freeze({__proto__:null,convertItemToTemplate:function(e,i,n){return Promise.all([r.getModel(i.id,{authentication:n}),t.createHubRequestOptions(n)]).then((([e,t])=>o.convertPageToTemplate(e,t))).then((e=>(e.item.typeKeywords=r.without(e.item.typeKeywords,"doNotDelete"),e.groups=[],e.estimatedDeploymentCostFactor=2,e.resources=[],r.getProp(e,"properties")||(e.properties={}),e=s(e))))},createItemFromTemplate:function(e,s,a,
|
|
18
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-common"),require("@esri/arcgis-rest-portal"),require("@esri/hub-common"),require("@esri/hub-sites")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common","@esri/arcgis-rest-portal","@esri/hub-common","@esri/hub-sites"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution,e.arcgisRest,e.arcgisHub,e.arcgisHub)}(this,(function(e,t,i,r,o){"use strict";function s(e){const t=r.cloneObject(e);return(e.dependencies||[]).forEach((i=>{const o=new RegExp(i,"g"),s=`{{${i}.itemId}}`;t.item=r.deepStringReplace(t.item,o,s),t.data=r.deepStringReplace(t.data,o,s),e.properties&&(t.properties=r.deepStringReplace(t.properties,o,s))})),t}function n(e,t,o){const s=r.failSafe(i.moveItem,{success:!0}),n=[s({itemId:e.item.id,folderId:t,authentication:o})];return r.getProp(e,"item.properties.parentInitiativeId")&&n.push(s({itemId:e.item.properties.parentInitiativeId,folderId:t,authentication:o})),Promise.all(n)}var a=Object.freeze({__proto__:null,convertItemToTemplate:function(e,i,n,a=null){let m=0,u=0;return Promise.all([r.getModel(i.id,{authentication:n}),t.createHubRequestOptions(n)]).then((([e,t])=>(m=e.item.created,u=e.item.modified,o.convertPageToTemplate(e,t)))).then((e=>(e.item.created=m,e.item.modified=u,e.item.typeKeywords=r.without(e.item.typeKeywords,"doNotDelete"),e.groups=[],e.estimatedDeploymentCostFactor=2,e.resources=[],r.getProp(e,"properties")||(e.properties={}),e=s(e))))},createItemFromTemplate:function(e,s,a,m){if(!m(e.itemId,t.EItemProgressStatus.Started,0))return Promise.resolve(t.generateEmptyCreationResponse(e.type));if(e.assets&&e.resources&&delete e.assets,s.solutionItemExtent){const e=s.solutionItemExtent.split(",");s.organization.defaultExtentBBox=[[e[0],e[1]],[e[2],e[3]]]}const u={};let d,c;const p=e.item.thumbnail;return t.createHubRequestOptions(a,s).then((t=>(c=t,o.createPageModelFromTemplate(e,s,u,c)))).then((e=>{const t=e,i={assets:t.assets||[]};return o.createPage(t,i,c)})).then((e=>(d=e,n(e,s.folderId,a)))).then((()=>{const e={item:{id:d.item.id},params:{thumbnail:p},authentication:a};return i.updateItem(e)})).then((()=>{s[e.itemId]={itemId:d.item.id};if(m(e.itemId,t.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor||2,d.item.id)){const t={item:{...e,...d},id:d.item.id,type:e.type,postProcess:!0};return t.item.itemId=d.item.id,t}return r.failSafe(o.removePage,{success:!0})(d,c).then((()=>Promise.resolve(t.generateEmptyCreationResponse(e.type))))})).catch((i=>{throw m(e.itemId,t.EItemProgressStatus.Failed,0),i}))},postProcess:function(e,i,s,n,a,m,u){let d;return t.createHubRequestOptions(u).then((t=>(d=t,r.getModel(e,{authentication:u})))).then((e=>function(e,t,i,s){return e=r.interpolate(e,i,{}),o.updatePage(e,{...s,allowList:[]}).then((()=>!0))}(e,0,m,d)))},isAPage:function(e){let t=!1;return"Hub Page"!==e&&"Site Page"!==e||(t=!0),t}});function m(e,t,i,s){const n=t.filter((t=>t.id!==e.item.id)),a=n.map((e=>({item:{id:e.id,type:e.type}})));let m=[];m=m.concat(o._shareItemsToSiteGroups(e,a,s)),m=m.concat(function(e,t,i){const s=t.filter((e=>e.type.indexOf("Page")>-1)).map((e=>e.id));return Promise.all(s.map((e=>r.getModel(e,i)))).then((t=>o._updatePages(e,t,i)))}(e,n,s));const u=n.map((e=>e.id));return e.item.properties.children=u,e=o.interpolateSite(e,i,{}),m.push(o.updateSite(e,{...s,allowList:null})),Promise.all(m).then((()=>!0))}var u=Object.freeze({__proto__:null,convertItemToTemplate:function(e,i,n,a=null){let m,u=0,d=0;return t.createHubRequestOptions(n).then((e=>(m=e,o.getSiteById(i.id,m)))).then((e=>(u=e.item.created,d=e.item.modified,o.convertSiteToTemplate(e,m)))).then((e=>(e.item.created=u,e.item.modified=d,e.item.typeKeywords=r.without(e.item.typeKeywords,"doNotDelete"),e.groups=[],e.estimatedDeploymentCostFactor=2,e.resources=[],t.getProp(e,"properties")||(e.properties={}),e.dependencies=t.dedupe(e.dependencies),e=s(e))))},createItemFromTemplate:function(e,s,a,m){if(!m(e.itemId,t.EItemProgressStatus.Started,0))return Promise.resolve(t.generateEmptyCreationResponse(e.type));e.assets&&e.resources&&delete e.assets,s.solution||(s.solution={}),s.solution.title=s.title;const u={};let d,c;const p=e.item.thumbnail;return t.createHubRequestOptions(a,s).then((t=>(c=t,o.createSiteModelFromTemplate(e,s,u,c)))).then((e=>{const t={assets:e.assets||[]};return o.createSite(e,t,c)})).then((e=>(d=e,n(e,s.folderId,a)))).then((()=>{const e={item:{id:d.item.id},params:{thumbnail:p},authentication:a};return i.updateItem(e)})).then((()=>{s[e.itemId]={itemId:d.item.id};if(m(e.itemId,t.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor||2,d.item.id)){const t={item:{...e,...d},id:d.item.id,type:e.type,postProcess:!0};return t.item.itemId=d.item.id,t}return r.failSafe(o.removeSite,{success:!0})(d,c).then((()=>Promise.resolve(t.generateEmptyCreationResponse(e.type))))})).catch((i=>{throw m(e.itemId,t.EItemProgressStatus.Failed,0),i}))},postProcess:function(e,i,r,s,n,a,u){let d;return t.createHubRequestOptions(u,a).then((t=>(d=t,o.getSiteById(e,d)))).then((e=>m(e,r,a,d))).then((()=>Promise.resolve(!0)))},isASite:function(e){let t=!1;return"Hub Site Application"!==e&&"Site Application"!==e||(t=!0),t}});e.HubPageProcessor=a,e.HubSiteProcessor=u,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
19
19
|
//# sourceMappingURL=hub-types.umd.min.js.map
|