@esri/solution-hub-types 1.3.9 → 1.3.12

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.
Files changed (33) hide show
  1. package/dist/esm/helpers/_post-process-page.js +1 -0
  2. package/dist/esm/helpers/_post-process-page.js.map +1 -1
  3. package/dist/esm/helpers/_post-process-site.d.ts +1 -0
  4. package/dist/esm/helpers/_post-process-site.js +1 -0
  5. package/dist/esm/helpers/_post-process-site.js.map +1 -1
  6. package/dist/esm/helpers/_update-site-pages.d.ts +1 -0
  7. package/dist/esm/helpers/_update-site-pages.js +1 -0
  8. package/dist/esm/helpers/_update-site-pages.js.map +1 -1
  9. package/dist/esm/hub-page-processor.d.ts +1 -1
  10. package/dist/esm/hub-page-processor.js +1 -1
  11. package/dist/esm/hub-site-processor.d.ts +1 -1
  12. package/dist/esm/hub-site-processor.js +1 -1
  13. package/dist/node/helpers/_post-process-page.js +1 -0
  14. package/dist/node/helpers/_post-process-page.js.map +1 -1
  15. package/dist/node/helpers/_post-process-site.d.ts +1 -0
  16. package/dist/node/helpers/_post-process-site.js +1 -0
  17. package/dist/node/helpers/_post-process-site.js.map +1 -1
  18. package/dist/node/helpers/_update-site-pages.d.ts +1 -0
  19. package/dist/node/helpers/_update-site-pages.js +1 -0
  20. package/dist/node/helpers/_update-site-pages.js.map +1 -1
  21. package/dist/node/hub-page-processor.d.ts +1 -1
  22. package/dist/node/hub-page-processor.js +1 -1
  23. package/dist/node/hub-site-processor.d.ts +1 -1
  24. package/dist/node/hub-site-processor.js +1 -1
  25. package/dist/umd/helpers/_post-process-site.d.ts +1 -0
  26. package/dist/umd/helpers/_update-site-pages.d.ts +1 -0
  27. package/dist/umd/hub-page-processor.d.ts +1 -1
  28. package/dist/umd/hub-site-processor.d.ts +1 -1
  29. package/dist/umd/hub-types.umd.js +7 -4
  30. package/dist/umd/hub-types.umd.js.map +1 -1
  31. package/dist/umd/hub-types.umd.min.js +2 -2
  32. package/dist/umd/hub-types.umd.min.js.map +1 -1
  33. package/package.json +14 -13
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { interpolate } from "@esri/hub-common";
17
17
  import { updatePage } from "@esri/hub-sites";
18
+ //???
18
19
  export function _postProcessPage(pageModel, itemInfos, templateDictionary, hubRequestOptions) {
19
20
  // re-interpolate the siteModel using the itemInfos; no patches supplied
20
21
  pageModel = interpolate(pageModel, templateDictionary, {});
@@ -1 +1 @@
1
- {"version":3,"file":"_post-process-page.js","sourceRoot":"","sources":["../../../src/helpers/_post-process-page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAkC,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,kBAAuB,EACvB,iBAAyC;IAEzC,wEAAwE;IACxE,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAC3D,OAAO,UAAU,CAAC,SAAS,EAAE;QAC3B,GAAG,iBAAiB;QACpB,SAAS,EAAE,EAAE;KACd,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACX,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"_post-process-page.js","sourceRoot":"","sources":["../../../src/helpers/_post-process-page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAkC,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,KAAK;AACL,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,kBAAuB,EACvB,iBAAyC;IAEzC,wEAAwE;IACxE,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAC3D,OAAO,UAAU,CAAC,SAAS,EAAE;QAC3B,GAAG,iBAAiB;QACpB,SAAS,EAAE,EAAE;KACd,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACX,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -24,5 +24,6 @@ import { IModel, IHubUserRequestOptions } from "@esri/hub-common";
24
24
  * @param itemInfos
25
25
  * @param templateDictionary
26
26
  * @param hubRequestOptions
27
+ * @private
27
28
  */
28
29
  export declare function _postProcessSite(siteModel: IModel, itemInfos: any[], templateDictionary: any, hubRequestOptions: IHubUserRequestOptions): Promise<boolean>;
@@ -10,6 +10,7 @@ import { _updateSitePages } from "./_update-site-pages";
10
10
  * @param itemInfos
11
11
  * @param templateDictionary
12
12
  * @param hubRequestOptions
13
+ * @private
13
14
  */
14
15
  export function _postProcessSite(siteModel, itemInfos, templateDictionary, hubRequestOptions) {
15
16
  const infosWithoutSite = itemInfos.filter(info => info.id !== siteModel.item.id);
@@ -1 +1 @@
1
- {"version":3,"file":"_post-process-site.js","sourceRoot":"","sources":["../../../src/helpers/_post-process-site.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,kBAAuB,EACvB,iBAAyC;IAEzC,MAAM,gBAAgB,GAAG,SAAS,CAAC,MAAM,CACvC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,CAAC,IAAI,CAAC,EAAE,CACtC,CAAC;IAEF,mEAAmE;IACnE,2CAA2C;IAC3C,MAAM,YAAY,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QAC5C,OAAO;YACL,IAAI,EAAE;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CAAC,IAAI,CAAC,GAAG,EAAE;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -19,5 +19,6 @@ import { IModel, IHubUserRequestOptions } from "@esri/hub-common";
19
19
  * @param siteModel
20
20
  * @param itemInfos
21
21
  * @param hubRequestOptions
22
+ * @private
22
23
  */
23
24
  export declare function _updateSitePages(siteModel: IModel, itemInfos: any[], hubRequestOptions: IHubUserRequestOptions): Promise<any>;
@@ -20,6 +20,7 @@ import { _updatePages } from "@esri/hub-sites";
20
20
  * @param siteModel
21
21
  * @param itemInfos
22
22
  * @param hubRequestOptions
23
+ * @private
23
24
  */
24
25
  export function _updateSitePages(siteModel, itemInfos, hubRequestOptions) {
25
26
  const pageIds = itemInfos
@@ -1 +1 @@
1
- {"version":3,"file":"_update-site-pages.js","sourceRoot":"","sources":["../../../src/helpers/_update-site-pages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAkC,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,iBAAyC;IAEzC,MAAM,OAAO,GAAG,SAAS;SACtB,MAAM,CAAC,CAAC,CAAC,EAAE;QACV,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAElB,2BAA2B;IAC3B,OAAO,OAAO,CAAC,GAAG,CAChB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QACf,OAAO,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;IACzC,CAAC,CAAC,CACH,CAAC,IAAI,CAAC,CAAC,UAAe,EAAE,EAAE;QACzB,uDAAuD;QACvD,OAAO,YAAY,CAAC,SAAS,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"_update-site-pages.js","sourceRoot":"","sources":["../../../src/helpers/_update-site-pages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAkC,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,iBAAyC;IAEzC,MAAM,OAAO,GAAG,SAAS;SACtB,MAAM,CAAC,CAAC,CAAC,EAAE;QACV,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAElB,2BAA2B;IAC3B,OAAO,OAAO,CAAC,GAAG,CAChB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QACf,OAAO,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;IACzC,CAAC,CAAC,CACH,CAAC,IAAI,CAAC,CAAC,UAAe,EAAE,EAAE;QACzB,uDAAuD;QACvD,OAAO,YAAY,CAAC,SAAS,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -26,7 +26,7 @@ import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse,
26
26
  * @param itemInfo Info about the item
27
27
  * @param destAuthentication Credentials for requests to the destination organization
28
28
  * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
29
- * @return A promise that will resolve when the template has been created
29
+ * @returns A promise that will resolve when the template has been created
30
30
  */
31
31
  export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication?: UserSession): Promise<IItemTemplate>;
32
32
  /**
@@ -32,7 +32,7 @@ import { moveModelToFolder } from "./helpers/move-model-to-folder";
32
32
  * @param itemInfo Info about the item
33
33
  * @param destAuthentication Credentials for requests to the destination organization
34
34
  * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
35
- * @return A promise that will resolve when the template has been created
35
+ * @returns A promise that will resolve when the template has been created
36
36
  */
37
37
  export function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication = null // eslint-disable-line @typescript-eslint/no-unused-vars
38
38
  ) {
@@ -26,7 +26,7 @@ import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse,
26
26
  * @param itemInfo Info about the item
27
27
  * @param destAuthentication Credentials for requests to the destination organization
28
28
  * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
29
- * @return A promise that will resolve when the template has been created
29
+ * @returns A promise that will resolve when the template has been created
30
30
  */
31
31
  export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication?: UserSession): Promise<IItemTemplate>;
32
32
  /**
@@ -32,7 +32,7 @@ import { replaceItemIds } from "./helpers/replace-item-ids";
32
32
  * @param itemInfo Info about the item
33
33
  * @param destAuthentication Credentials for requests to the destination organization
34
34
  * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
35
- * @return A promise that will resolve when the template has been created
35
+ * @returns A promise that will resolve when the template has been created
36
36
  */
37
37
  export function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication = null // eslint-disable-line @typescript-eslint/no-unused-vars
38
38
  ) {
@@ -18,6 +18,7 @@ exports._postProcessPage = void 0;
18
18
  */
19
19
  const hub_common_1 = require("@esri/hub-common");
20
20
  const hub_sites_1 = require("@esri/hub-sites");
21
+ //???
21
22
  function _postProcessPage(pageModel, itemInfos, templateDictionary, hubRequestOptions) {
22
23
  // re-interpolate the siteModel using the itemInfos; no patches supplied
23
24
  pageModel = (0, hub_common_1.interpolate)(pageModel, templateDictionary, {});
@@ -1 +1 @@
1
- {"version":3,"file":"_post-process-page.js","sourceRoot":"","sources":["../../../src/helpers/_post-process-page.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,iDAA+E;AAC/E,+CAA6C;AAE7C,SAAgB,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,kBAAuB,EACvB,iBAAyC;IAEzC,wEAAwE;IACxE,SAAS,GAAG,IAAA,wBAAW,EAAC,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAC3D,OAAO,IAAA,sBAAU,EAAC,SAAS,EAAE;QAC3B,GAAG,iBAAiB;QACpB,SAAS,EAAE,EAAE;KACd,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACX,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAdD,4CAcC"}
1
+ {"version":3,"file":"_post-process-page.js","sourceRoot":"","sources":["../../../src/helpers/_post-process-page.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,iDAA+E;AAC/E,+CAA6C;AAE7C,KAAK;AACL,SAAgB,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,kBAAuB,EACvB,iBAAyC;IAEzC,wEAAwE;IACxE,SAAS,GAAG,IAAA,wBAAW,EAAC,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAC3D,OAAO,IAAA,sBAAU,EAAC,SAAS,EAAE;QAC3B,GAAG,iBAAiB;QACpB,SAAS,EAAE,EAAE;KACd,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACX,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAdD,4CAcC"}
@@ -24,5 +24,6 @@ import { IModel, IHubUserRequestOptions } from "@esri/hub-common";
24
24
  * @param itemInfos
25
25
  * @param templateDictionary
26
26
  * @param hubRequestOptions
27
+ * @private
27
28
  */
28
29
  export declare function _postProcessSite(siteModel: IModel, itemInfos: any[], templateDictionary: any, hubRequestOptions: IHubUserRequestOptions): Promise<boolean>;
@@ -13,6 +13,7 @@ const _update_site_pages_1 = require("./_update-site-pages");
13
13
  * @param itemInfos
14
14
  * @param templateDictionary
15
15
  * @param hubRequestOptions
16
+ * @private
16
17
  */
17
18
  function _postProcessSite(siteModel, itemInfos, templateDictionary, hubRequestOptions) {
18
19
  const infosWithoutSite = itemInfos.filter(info => info.id !== siteModel.item.id);
@@ -1 +1 @@
1
- {"version":3,"file":"_post-process-site.js","sourceRoot":"","sources":["../../../src/helpers/_post-process-site.ts"],"names":[],"mappings":";;;AAiBA,+CAAuF;AAEvF,6DAAwD;AAExD;;;;;;;;;;GAUG;AACH,SAAgB,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,kBAAuB,EACvB,iBAAyC;IAEzC,MAAM,gBAAgB,GAAG,SAAS,CAAC,MAAM,CACvC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,CAAC,IAAI,CAAC,EAAE,CACtC,CAAC;IAEF,mEAAmE;IACnE,2CAA2C;IAC3C,MAAM,YAAY,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QAC5C,OAAO;YACL,IAAI,EAAE;gBACJ,EAAE,EAAE,CAAC,CAAC,EAAE;gBACR,IAAI,EAAE,CAAC,CAAC,IAAI;aACb;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,kBAAkB,GAAwB,EAAE,CAAC;IAEjD,kBAAkB,GAAG,kBAAkB,CAAC,MAAM,CAC5C,IAAA,mCAAuB,EACrB,SAAS,EACR,YAAoC,EACrC,iBAAiB,CAClB,CACF,CAAC;IAEF,mDAAmD;IACnD,+CAA+C;IAC/C,qCAAqC;IACrC,kBAAkB,GAAG,kBAAkB,CAAC,MAAM,CAC5C,IAAA,qCAAgB,EAAC,SAAS,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;IAEH,IAAI,kBAAkB,GAAwB,EAAE,CAAC;IAEjD,kBAAkB,GAAG,kBAAkB,CAAC,MAAM,CAC5C,IAAA,mCAAuB,EACrB,SAAS,EACR,YAAoC,EACrC,iBAAiB,CAClB,CACF,CAAC;IAEF,mDAAmD;IACnD,+CAA+C;IAC/C,qCAAqC;IACrC,kBAAkB,GAAG,kBAAkB,CAAC,MAAM,CAC5C,IAAA,qCAAgB,EAAC,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CACjE,CAAC;IACF,6EAA6E;IAC7E,MAAM,YAAY,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAErD,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,YAAY,CAAC;IAElD,mDAAmD;IACnD,SAAS,GAAG,IAAA,2BAAe,EAAC,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAC/D,uBAAuB;IACvB,kBAAkB,CAAC,IAAI,CACrB,IAAA,sBAAU,EAAC,SAAS,EAAE;QACpB,GAAG,iBAAiB;QACpB,SAAS,EAAE,IAAI;KAChB,CAAC,CACH,CAAC;IAEF,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAvDD,4CAuDC"}
@@ -19,5 +19,6 @@ import { IModel, IHubUserRequestOptions } from "@esri/hub-common";
19
19
  * @param siteModel
20
20
  * @param itemInfos
21
21
  * @param hubRequestOptions
22
+ * @private
22
23
  */
23
24
  export declare function _updateSitePages(siteModel: IModel, itemInfos: any[], hubRequestOptions: IHubUserRequestOptions): Promise<any>;
@@ -23,6 +23,7 @@ const hub_sites_1 = require("@esri/hub-sites");
23
23
  * @param siteModel
24
24
  * @param itemInfos
25
25
  * @param hubRequestOptions
26
+ * @private
26
27
  */
27
28
  function _updateSitePages(siteModel, itemInfos, hubRequestOptions) {
28
29
  const pageIds = itemInfos
@@ -1 +1 @@
1
- {"version":3,"file":"_update-site-pages.js","sourceRoot":"","sources":["../../../src/helpers/_update-site-pages.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,iDAA4E;AAC5E,+CAA+C;AAC/C;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,iBAAyC;IAEzC,MAAM,OAAO,GAAG,SAAS;SACtB,MAAM,CAAC,CAAC,CAAC,EAAE;QACV,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAElB,2BAA2B;IAC3B,OAAO,OAAO,CAAC,GAAG,CAChB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QACf,OAAO,IAAA,qBAAQ,EAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;IACzC,CAAC,CAAC,CACH,CAAC,IAAI,CAAC,CAAC,UAAe,EAAE,EAAE;QACzB,uDAAuD;QACvD,OAAO,IAAA,wBAAY,EAAC,SAAS,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC;AApBD,4CAoBC"}
1
+ {"version":3,"file":"_update-site-pages.js","sourceRoot":"","sources":["../../../src/helpers/_update-site-pages.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,iDAA4E;AAC5E,+CAA+C;AAC/C;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,iBAAyC;IAEzC,MAAM,OAAO,GAAG,SAAS;SACtB,MAAM,CAAC,CAAC,CAAC,EAAE;QACV,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAElB,2BAA2B;IAC3B,OAAO,OAAO,CAAC,GAAG,CAChB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QACf,OAAO,IAAA,qBAAQ,EAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;IACzC,CAAC,CAAC,CACH,CAAC,IAAI,CAAC,CAAC,UAAe,EAAE,EAAE;QACzB,uDAAuD;QACvD,OAAO,IAAA,wBAAY,EAAC,SAAS,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC;AApBD,4CAoBC"}
@@ -26,7 +26,7 @@ import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse,
26
26
  * @param itemInfo Info about the item
27
27
  * @param destAuthentication Credentials for requests to the destination organization
28
28
  * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
29
- * @return A promise that will resolve when the template has been created
29
+ * @returns A promise that will resolve when the template has been created
30
30
  */
31
31
  export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication?: UserSession): Promise<IItemTemplate>;
32
32
  /**
@@ -35,7 +35,7 @@ const move_model_to_folder_1 = require("./helpers/move-model-to-folder");
35
35
  * @param itemInfo Info about the item
36
36
  * @param destAuthentication Credentials for requests to the destination organization
37
37
  * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
38
- * @return A promise that will resolve when the template has been created
38
+ * @returns A promise that will resolve when the template has been created
39
39
  */
40
40
  function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication = null // eslint-disable-line @typescript-eslint/no-unused-vars
41
41
  ) {
@@ -26,7 +26,7 @@ import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse,
26
26
  * @param itemInfo Info about the item
27
27
  * @param destAuthentication Credentials for requests to the destination organization
28
28
  * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
29
- * @return A promise that will resolve when the template has been created
29
+ * @returns A promise that will resolve when the template has been created
30
30
  */
31
31
  export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication?: UserSession): Promise<IItemTemplate>;
32
32
  /**
@@ -35,7 +35,7 @@ const replace_item_ids_1 = require("./helpers/replace-item-ids");
35
35
  * @param itemInfo Info about the item
36
36
  * @param destAuthentication Credentials for requests to the destination organization
37
37
  * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
38
- * @return A promise that will resolve when the template has been created
38
+ * @returns A promise that will resolve when the template has been created
39
39
  */
40
40
  function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication = null // eslint-disable-line @typescript-eslint/no-unused-vars
41
41
  ) {
@@ -24,5 +24,6 @@ import { IModel, IHubUserRequestOptions } from "@esri/hub-common";
24
24
  * @param itemInfos
25
25
  * @param templateDictionary
26
26
  * @param hubRequestOptions
27
+ * @private
27
28
  */
28
29
  export declare function _postProcessSite(siteModel: IModel, itemInfos: any[], templateDictionary: any, hubRequestOptions: IHubUserRequestOptions): Promise<boolean>;
@@ -19,5 +19,6 @@ import { IModel, IHubUserRequestOptions } from "@esri/hub-common";
19
19
  * @param siteModel
20
20
  * @param itemInfos
21
21
  * @param hubRequestOptions
22
+ * @private
22
23
  */
23
24
  export declare function _updateSitePages(siteModel: IModel, itemInfos: any[], hubRequestOptions: IHubUserRequestOptions): Promise<any>;
@@ -26,7 +26,7 @@ import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse,
26
26
  * @param itemInfo Info about the item
27
27
  * @param destAuthentication Credentials for requests to the destination organization
28
28
  * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
29
- * @return A promise that will resolve when the template has been created
29
+ * @returns A promise that will resolve when the template has been created
30
30
  */
31
31
  export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication?: UserSession): Promise<IItemTemplate>;
32
32
  /**
@@ -26,7 +26,7 @@ import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse,
26
26
  * @param itemInfo Info about the item
27
27
  * @param destAuthentication Credentials for requests to the destination organization
28
28
  * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
29
- * @return A promise that will resolve when the template has been created
29
+ * @returns A promise that will resolve when the template has been created
30
30
  */
31
31
  export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication?: UserSession): Promise<IItemTemplate>;
32
32
  /**
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-hub-types - v1.3.9 - Apache-2.0
2
+ * @esri/solution-hub-types - v1.3.12 - Apache-2.0
3
3
  * Copyright (c) 2018-2022 Esri, Inc.
4
- * Fri Mar 25 2022 15:23:14 GMT-0700 (Pacific Daylight Time)
4
+ * Tue Apr 26 2022 14:45:18 GMT-0700 (Pacific Daylight Time)
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@
36
36
  * See the License for the specific language governing permissions and
37
37
  * limitations under the License.
38
38
  */
39
+ //???
39
40
  function _postProcessPage(pageModel, itemInfos, templateDictionary, hubRequestOptions) {
40
41
  // re-interpolate the siteModel using the itemInfos; no patches supplied
41
42
  pageModel = hubCommon.interpolate(pageModel, templateDictionary, {});
@@ -145,7 +146,7 @@
145
146
  * @param itemInfo Info about the item
146
147
  * @param destAuthentication Credentials for requests to the destination organization
147
148
  * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
148
- * @return A promise that will resolve when the template has been created
149
+ * @returns A promise that will resolve when the template has been created
149
150
  */
150
151
  function convertItemToTemplate$1(solutionItemId, itemInfo, destAuthentication, srcAuthentication = null // eslint-disable-line @typescript-eslint/no-unused-vars
151
152
  ) {
@@ -360,6 +361,7 @@
360
361
  * @param siteModel
361
362
  * @param itemInfos
362
363
  * @param hubRequestOptions
364
+ * @private
363
365
  */
364
366
  function _updateSitePages(siteModel, itemInfos, hubRequestOptions) {
365
367
  const pageIds = itemInfos
@@ -386,6 +388,7 @@
386
388
  * @param itemInfos
387
389
  * @param templateDictionary
388
390
  * @param hubRequestOptions
391
+ * @private
389
392
  */
390
393
  function _postProcessSite(siteModel, itemInfos, templateDictionary, hubRequestOptions) {
391
394
  const infosWithoutSite = itemInfos.filter(info => info.id !== siteModel.item.id);
@@ -442,7 +445,7 @@
442
445
  * @param itemInfo Info about the item
443
446
  * @param destAuthentication Credentials for requests to the destination organization
444
447
  * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
445
- * @return A promise that will resolve when the template has been created
448
+ * @returns A promise that will resolve when the template has been created
446
449
  */
447
450
  function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication = null // eslint-disable-line @typescript-eslint/no-unused-vars
448
451
  ) {
@@ -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 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,i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AAK,CAAC,CAAC;OAC1E,CAAC;WACD,IAAI,CAAC;;UAEJ,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;OAC9B,CAAC,CAAC;EACP,CAAC;EAED;;;;;;;WAOgB,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;;;;;;;;;;;;;;;;;;;"}
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\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 * @returns A promise that will resolve when the template has been created\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: 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 * @private\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 * @private\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 * @returns A promise that will resolve when the template has been created\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: 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;;;;;;;;;;;;;;EAcG;EAIH;EACM,SAAU,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,kBAAuB,EACvB,iBAAyC,EAAA;;MAGzC,SAAS,GAAGA,qBAAW,CAAC,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;MAC3D,OAAOC,mBAAU,CAAC,SAAS,EAAE;EAC3B,QAAA,GAAG,iBAAiB;EACpB,QAAA,SAAS,EAAE,EAAE;EACd,KAAA,CAAC,CAAC,IAAI,CAAC,MAAK;EACX,QAAA,OAAO,IAAI,CAAC;EACd,KAAC,CAAC,CAAC;EACL;;ECjCA;;;;;;;;;;;;;;EAcG;EAQG,SAAU,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AAI,CAAC,MAAK;;EAET,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;EAC/B,KAAC,CAAC,CAAC;EACP,CAAC;EAED;;;;;;EAMG;EACG,SAAU,OAAO,CAAC,QAAgB,EAAA;MACtC,IAAI,MAAM,GAAG,KAAK,CAAC;EACnB,IAAA,IAAI,QAAQ,KAAK,sBAAsB,IAAI,QAAQ,KAAK,kBAAkB,EAAE;UAC1E,MAAM,GAAG,IAAI,CAAC;EACf,KAAA;EACD,IAAA,OAAO,MAAM,CAAC;EAChB;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-hub-types - v1.3.9 - Apache-2.0
2
+ * @esri/solution-hub-types - v1.3.12 - Apache-2.0
3
3
  * Copyright (c) 2018-2022 Esri, Inc.
4
- * Fri Mar 25 2022 15:23:17 GMT-0700 (Pacific Daylight Time)
4
+ * Tue Apr 26 2022 14:45:28 GMT-0700 (Pacific Daylight Time)
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1 +1 @@
1
- {"version":3,"file":"hub-types.umd.min.js","sources":["../../src/helpers/replace-item-ids.ts","../../src/helpers/move-model-to-folder.ts","../../src/hub-page-processor.ts","../../src/helpers/_post-process-page.ts","../../src/helpers/_post-process-site.ts","../../src/helpers/_update-site-pages.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\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, 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\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\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\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":["replaceItemIds","template","clone","cloneObject","dependencies","forEach","depId","re","RegExp","replacement","item","deepStringReplace","data","properties","moveModelToFolder","siteModel","folderId","authentication","failSafeMove","failSafe","moveItem","success","movePromises","itemId","id","getProp","push","parentInitiativeId","Promise","all","solutionItemId","itemInfo","destAuthentication","srcAuthentication","created","modified","getModel","createHubRequestOptions","then","pageModel","ro","convertPageToTemplate","tmpl","typeKeywords","without","groups","estimatedDeploymentCostFactor","resources","templateDictionary","destinationAuthentication","itemProgressCallback","EItemProgressStatus","Started","resolve","generateEmptyCreationResponse","type","assets","solutionItemExtent","parts","split","organization","defaultExtentBBox","transforms","hubRo","thumbnail","createPageModelFromTemplate","interpolated","modelTmpl","options","createPage","page","updateOptions","params","updateItem","Finished","response","postProcess","removePage","failSafeRemove","catch","ex","Failed","itemInfos","templates","hubRequestOptions","interpolate","updatePage","allowList","_postProcessPage","itemType","result","_postProcessSite","infosWithoutSite","filter","info","pseudoModels","map","e","secondPassPromises","concat","_shareItemsToSiteGroups","pageIds","indexOf","pageModels","_updatePages","_updateSitePages","childItemIds","i","children","interpolateSite","updateSite","getSiteById","convertSiteToTemplate","dedupe","solution","title","createSiteModelFromTemplate","createSite","site","removeSite"],"mappings":";;;;;;;;;;;;;;;;;miBAsBgBA,EAAeC,GAC7B,MAAMC,EAAQC,cAAYF,GAa1B,OAZaA,EAASG,cAAgB,IAEjCC,SAAQC,IACX,MAAMC,EAAK,IAAIC,OAAOF,EAAO,KACvBG,EAAc,KAAKH,aAEzBJ,EAAMQ,KAAOC,oBAAkBT,EAAMQ,KAAMH,EAAIE,GAC/CP,EAAMU,KAAOD,oBAAkBT,EAAMU,KAAML,EAAIE,GAC3CR,EAASY,aACXX,EAAMW,WAAaF,oBAAkBT,EAAMW,WAAYN,EAAIE,OAGxDP,WCROY,EACdC,EACAC,EACAC,GAGA,MAAMC,EAAeC,WAASC,WAAU,CAAEC,SAAS,IAE7CC,EAAe,CACnBJ,EAAa,CACXK,OAAQR,EAAUL,KAAKc,GACvBR,SAAAA,EACAC,eAAAA,KAcJ,OAVIQ,UAAQV,EAAW,uCACrBO,EAAaI,KACXR,EAAa,CACXK,OAAQR,EAAUL,KAAKG,WAAWc,mBAClCX,SAAAA,EACAC,eAAAA,KAKCW,QAAQC,IAAIP,sECQnBQ,EACAC,EACAC,EACAC,EAAiC,MAEjC,IAAIC,EAAkB,EAClBC,EAAmB,EAGvB,OAAOP,QAAQC,IAAI,CACjBO,WAASL,EAASP,GAAI,CAAEP,eAAgBe,IACxCK,0BAAwBL,KAEvBM,MAAK,EAAEC,EAAWC,MAEjBN,EAAUK,EAAU7B,KAAKwB,QACzBC,EAAWI,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AC5DD,2BAmBVxD,EACA+B,EACA2B,EACAjF,EACAkF,EACAnC,EACA/B,GAEA,IAAI8C,EACJ,OAAO1B,0BAAwBpB,EAAgB+B,GAC5CV,MAAKE,IACJuB,EAAQvB,EAEDuE,cAAYvF,EAAIuC,MAExBzB,MAAKvB,GAEG4E,EAAiB5E,EAAWmE,EAAWlC,EAAoBe,KAEnEzB,MAAK,IAEGV,QAAQyB,SAAQ,uBAWLoC,GACtB,IAAIC,GAAS,EAIb,MAHiB,yBAAbD,GAAoD,qBAAbA,IACzCC,GAAS,GAEJA"}
1
+ {"version":3,"file":"hub-types.umd.min.js","sources":["../../src/helpers/replace-item-ids.ts","../../src/helpers/move-model-to-folder.ts","../../src/hub-page-processor.ts","../../src/helpers/_post-process-page.ts","../../src/helpers/_post-process-site.ts","../../src/helpers/_update-site-pages.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\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 * @returns A promise that will resolve when the template has been created\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: 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, interpolate } from \"@esri/hub-common\";\r\nimport { updatePage } from \"@esri/hub-sites\";\r\n\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\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 * @private\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\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 * @private\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\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 * @returns A promise that will resolve when the template has been created\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: 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":["replaceItemIds","template","clone","cloneObject","dependencies","forEach","depId","re","RegExp","replacement","item","deepStringReplace","data","properties","moveModelToFolder","siteModel","folderId","authentication","failSafeMove","failSafe","moveItem","success","movePromises","itemId","id","getProp","push","parentInitiativeId","Promise","all","solutionItemId","itemInfo","destAuthentication","srcAuthentication","created","modified","getModel","createHubRequestOptions","then","pageModel","ro","convertPageToTemplate","tmpl","typeKeywords","without","groups","estimatedDeploymentCostFactor","resources","templateDictionary","destinationAuthentication","itemProgressCallback","EItemProgressStatus","Started","resolve","generateEmptyCreationResponse","type","assets","solutionItemExtent","parts","split","organization","defaultExtentBBox","transforms","hubRo","thumbnail","createPageModelFromTemplate","interpolated","modelTmpl","options","createPage","page","updateOptions","params","updateItem","Finished","response","postProcess","removePage","failSafeRemove","catch","ex","Failed","itemInfos","templates","hubRequestOptions","interpolate","updatePage","allowList","_postProcessPage","itemType","result","_postProcessSite","infosWithoutSite","filter","info","pseudoModels","map","e","secondPassPromises","concat","_shareItemsToSiteGroups","pageIds","indexOf","pageModels","_updatePages","_updateSitePages","childItemIds","i","children","interpolateSite","updateSite","getSiteById","convertSiteToTemplate","dedupe","solution","title","createSiteModelFromTemplate","create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ACdxD,EACA+B,EACA2B,EACAjF,EACAkF,EACAnC,EACA/B,GAEA,IAAI8C,EACJ,OAAO1B,EAAuBA,wBAACpB,EAAgB+B,GAC5CV,MAAKE,IACJuB,EAAQvB,EAEDuE,EAAWA,YAACvF,EAAIuC,MAExBzB,MAAKvB,GAEG4E,EAAiB5E,EAAWmE,EAAWlC,EAAoBe,KAEnEzB,MAAK,IAEGV,QAAQyB,SAAQ,cAWvB,SAAkBoC,GACtB,IAAIC,GAAS,EAIb,MAHiB,yBAAbD,GAAoD,qBAAbA,IACzCC,GAAS,GAEJA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-hub-types",
3
- "version": "1.3.9",
3
+ "version": "1.3.12",
4
4
  "description": "Manages the creation and deployment of Hub Site and Hub Page item types for @esri/solution.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "unpkg": "dist/umd/hub-types.umd.min.js",
@@ -18,11 +18,11 @@
18
18
  "@esri/arcgis-rest-portal": "3.4.3",
19
19
  "@esri/arcgis-rest-request": "3.4.3",
20
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"
21
+ "@esri/hub-common": "9.29.0",
22
+ "@esri/hub-initiatives": "9.29.0",
23
+ "@esri/hub-sites": "9.29.0",
24
+ "@esri/hub-teams": "9.29.0",
25
+ "rollup": "2.70.2"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@esri/arcgis-rest-auth": "3.4.3",
@@ -30,14 +30,14 @@
30
30
  "@esri/arcgis-rest-portal": "3.4.3",
31
31
  "@esri/arcgis-rest-request": "3.4.3",
32
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"
33
+ "@esri/hub-common": "9.29.0",
34
+ "@esri/hub-initiatives": "9.29.0",
35
+ "@esri/hub-sites": "9.29.0",
36
+ "@esri/hub-teams": "9.29.0"
37
37
  },
38
38
  "dependencies": {
39
- "@esri/solution-common": "^1.3.9",
40
- "tslib": "1.13.0"
39
+ "@esri/solution-common": "^1.3.12",
40
+ "tslib": "1.14.1"
41
41
  },
42
42
  "scripts": {
43
43
  "prepare": "npm run build",
@@ -48,6 +48,7 @@
48
48
  "dev:esm": "tsc -w --module esnext --outDir ./dist/esm --declaration",
49
49
  "dev:umd": "rollup -w -c ../../umd-base-profile.js",
50
50
  "dev:node": "tsc -w --module commonjs --outDir ./dist/node",
51
+ "getupdates": "npm-check-updates --upgrade",
51
52
  "test:chrome": "karma start --single-run --browsers=Chrome",
52
53
  "test:node": "jasmine --config=../../jasmine.json",
53
54
  "y:link:hub": "yalc link @esri/hub-common && yalc link @esri/hub-sites",
@@ -93,5 +94,5 @@
93
94
  "esri",
94
95
  "ES6"
95
96
  ],
96
- "gitHead": "b6373fcbf48472b35e833564440ecec8665cd734"
97
+ "gitHead": "5cb0515da75cf8faaba2a626808d50925d290b55"
97
98
  }