@esri/solution-hub-types 6.1.0-alpha.0 → 6.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/cjs/helpers/_post-process-page.d.ts +17 -0
  2. package/dist/cjs/helpers/_post-process-page.js +33 -0
  3. package/dist/cjs/helpers/_post-process-page.js.map +1 -0
  4. package/dist/cjs/helpers/_post-process-site.d.ts +29 -0
  5. package/dist/cjs/helpers/_post-process-site.js +53 -0
  6. package/dist/cjs/helpers/_post-process-site.js.map +1 -0
  7. package/dist/cjs/helpers/_update-site-pages.d.ts +24 -0
  8. package/dist/cjs/helpers/_update-site-pages.js +43 -0
  9. package/dist/cjs/helpers/_update-site-pages.js.map +1 -0
  10. package/dist/cjs/helpers/move-model-to-folder.d.ts +26 -0
  11. package/dist/cjs/helpers/move-model-to-folder.js +50 -0
  12. package/dist/cjs/helpers/move-model-to-folder.js.map +1 -0
  13. package/dist/cjs/helpers/replace-item-ids.d.ts +17 -0
  14. package/dist/cjs/helpers/replace-item-ids.js +37 -0
  15. package/dist/cjs/helpers/replace-item-ids.js.map +1 -0
  16. package/dist/cjs/hub-page-processor.d.ts +62 -0
  17. package/dist/cjs/hub-page-processor.js +225 -0
  18. package/dist/cjs/hub-page-processor.js.map +1 -0
  19. package/dist/cjs/hub-site-processor.d.ts +64 -0
  20. package/dist/cjs/hub-site-processor.js +235 -0
  21. package/dist/cjs/hub-site-processor.js.map +1 -0
  22. package/dist/cjs/index.d.ts +23 -0
  23. package/dist/cjs/index.js +29 -0
  24. package/dist/cjs/index.js.map +1 -0
  25. package/dist/esm/helpers/_post-process-page.d.ts +17 -0
  26. package/dist/esm/helpers/_post-process-page.js +29 -0
  27. package/dist/esm/helpers/_post-process-page.js.map +1 -0
  28. package/dist/esm/helpers/_post-process-site.d.ts +29 -0
  29. package/dist/esm/helpers/_post-process-site.js +49 -0
  30. package/dist/esm/helpers/_post-process-site.js.map +1 -0
  31. package/dist/esm/helpers/_update-site-pages.d.ts +24 -0
  32. package/dist/esm/helpers/_update-site-pages.js +39 -0
  33. package/dist/esm/helpers/_update-site-pages.js.map +1 -0
  34. package/dist/esm/helpers/move-model-to-folder.d.ts +26 -0
  35. package/dist/esm/helpers/move-model-to-folder.js +46 -0
  36. package/dist/esm/helpers/move-model-to-folder.js.map +1 -0
  37. package/dist/esm/helpers/replace-item-ids.d.ts +17 -0
  38. package/dist/esm/helpers/replace-item-ids.js +33 -0
  39. package/dist/esm/helpers/replace-item-ids.js.map +1 -0
  40. package/dist/esm/hub-page-processor.d.ts +62 -0
  41. package/dist/esm/hub-page-processor.js +218 -0
  42. package/dist/esm/hub-page-processor.js.map +1 -0
  43. package/dist/esm/hub-site-processor.d.ts +64 -0
  44. package/dist/esm/hub-site-processor.js +228 -0
  45. package/dist/esm/hub-site-processor.js.map +1 -0
  46. package/dist/esm/index.d.ts +23 -0
  47. package/dist/esm/index.js +25 -0
  48. package/dist/esm/index.js.map +1 -0
  49. package/package.json +3 -3
@@ -0,0 +1,17 @@
1
+ /** @license
2
+ * Copyright 2020 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { IModelTemplate } from "@esri/hub-common";
17
+ export declare function replaceItemIds(template: IModelTemplate): IModelTemplate;
@@ -0,0 +1,33 @@
1
+ /** @license
2
+ * Copyright 2020 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { cloneObject, deepStringReplace } from "@esri/hub-common";
17
+ export function replaceItemIds(template) {
18
+ const clone = cloneObject(template);
19
+ const deps = template.dependencies || [];
20
+ // iterate the dependencies
21
+ deps.forEach((depId) => {
22
+ const re = new RegExp(depId, "g");
23
+ const replacement = `{{${depId}.itemId}}`;
24
+ // we have to do this property-by-property or we would replace the `itemId` prop itself
25
+ clone.item = deepStringReplace(clone.item, re, replacement);
26
+ clone.data = deepStringReplace(clone.data, re, replacement);
27
+ if (template.properties) {
28
+ clone.properties = deepStringReplace(clone.properties, re, replacement);
29
+ }
30
+ });
31
+ return clone;
32
+ }
33
+ //# sourceMappingURL=replace-item-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace-item-ids.js","sourceRoot":"","sources":["../../../src/helpers/replace-item-ids.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAkB,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAElF,MAAM,UAAU,cAAc,CAAC,QAAwB;IACrD,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC;IACzC,2BAA2B;IAC3B,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClC,MAAM,WAAW,GAAG,KAAK,KAAK,WAAW,CAAC;QAC1C,uFAAuF;QACvF,KAAK,CAAC,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;QAC5D,KAAK,CAAC,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;QAC5D,IAAI,QAAQ,CAAC,UAAU,EAAE;YACvB,KAAK,CAAC,UAAU,GAAG,iBAAiB,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;SACzE;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,62 @@
1
+ /** @license
2
+ * Copyright 2018 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Manages the creation and deployment of Hub Page item types.
18
+ *
19
+ * @module hub-page-processor
20
+ */
21
+ import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse, UserSession } from "@esri/solution-common";
22
+ /**
23
+ * Converts a Hub Page item into a template.
24
+ *
25
+ * @param itemInfo Info about the item
26
+ * @param destAuthentication Credentials for requests to the destination organization
27
+ * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
28
+ * @returns A promise that will resolve when the template has been created
29
+ */
30
+ export declare function convertItemToTemplate(itemInfo: any, destAuthentication: UserSession, srcAuthentication?: UserSession): Promise<IItemTemplate>;
31
+ /**
32
+ * Handle deployment of Page item templates
33
+ *
34
+ * @export
35
+ * @param {IItemTemplate} template
36
+ * @param {*} templateDictionary
37
+ * @param {UserSession} destinationAuthentication
38
+ * @param {IItemProgressCallback} itemProgressCallback
39
+ * @returns {Promise<ICreateItemFromTemplateResponse>}
40
+ */
41
+ export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
42
+ /**
43
+ * Post-Process a Page
44
+ * Re-interpolate the page item + data w/ the full template dictionary hash
45
+ *
46
+ * @param id
47
+ * @param type
48
+ * @param itemInfos
49
+ * @param template
50
+ * @param templates
51
+ * @param templateDictionary
52
+ * @param authentication
53
+ */
54
+ export declare function postProcess(id: string, type: string, itemInfos: any[], template: any, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<boolean>;
55
+ /**
56
+ * Check of an item type is a Page
57
+ * Hub Page is for ArcGIS Online
58
+ * Site Page is for ArcGIS Enterprise
59
+ *
60
+ * @param itemType
61
+ */
62
+ export declare function isAPage(itemType: string): boolean;
@@ -0,0 +1,218 @@
1
+ /** @license
2
+ * Copyright 2018 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Manages the creation and deployment of Hub Page item types.
18
+ *
19
+ * @module hub-page-processor
20
+ */
21
+ import { EItemProgressStatus, convertIModel, createHubRequestOptions, generateEmptyCreationResponse, restUpdateItem, } from "@esri/solution-common";
22
+ import { failSafe, getModel, getProp, without } from "@esri/hub-common";
23
+ import { createPageModelFromTemplate, createPage, removePage, convertPageToTemplate } from "@esri/hub-sites";
24
+ import { _postProcessPage } from "./helpers/_post-process-page";
25
+ import { replaceItemIds } from "./helpers/replace-item-ids";
26
+ import { moveModelToFolder } from "./helpers/move-model-to-folder";
27
+ /**
28
+ * Converts a Hub Page item into a template.
29
+ *
30
+ * @param itemInfo Info about the item
31
+ * @param destAuthentication Credentials for requests to the destination organization
32
+ * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
33
+ * @returns A promise that will resolve when the template has been created
34
+ */
35
+ export function convertItemToTemplate(itemInfo, destAuthentication, srcAuthentication = null) {
36
+ let created = 0;
37
+ let modified = 0;
38
+ // get the page model and hubRequestOptions
39
+ return Promise.all([
40
+ getModel(itemInfo.id, { authentication: destAuthentication }),
41
+ createHubRequestOptions(destAuthentication),
42
+ ])
43
+ .then(([pageModel, ro]) => {
44
+ // We need to save these properties in order to restore them after hub.js deletes them
45
+ created = pageModel.item.created;
46
+ modified = pageModel.item.modified;
47
+ return convertPageToTemplate(pageModel, ro);
48
+ })
49
+ .then((tmpl) => {
50
+ // add in some stuff Hub.js does not yet add
51
+ tmpl.item.created = created;
52
+ tmpl.item.modified = modified;
53
+ tmpl.item.typeKeywords = without(tmpl.item.typeKeywords, "doNotDelete");
54
+ tmpl.groups = [];
55
+ tmpl.estimatedDeploymentCostFactor = 2;
56
+ tmpl.resources = [];
57
+ if (!getProp(tmpl, "properties")) {
58
+ tmpl.properties = {};
59
+ }
60
+ // swap out dependency id's to {{<depid>.itemId}}
61
+ // so it will be re-interpolated
62
+ tmpl = replaceItemIds(tmpl);
63
+ // and return it
64
+ return tmpl;
65
+ });
66
+ }
67
+ /**
68
+ * Handle deployment of Page item templates
69
+ *
70
+ * @export
71
+ * @param {IItemTemplate} template
72
+ * @param {*} templateDictionary
73
+ * @param {UserSession} destinationAuthentication
74
+ * @param {IItemProgressCallback} itemProgressCallback
75
+ * @returns {Promise<ICreateItemFromTemplateResponse>}
76
+ */
77
+ export function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
78
+ // let the progress system know we've started...
79
+ const startStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Started, 0);
80
+ // and if it returned false, just resolve out
81
+ if (!startStatus) {
82
+ return Promise.resolve(generateEmptyCreationResponse(template.type));
83
+ }
84
+ // TODO: Reassess with resource unification
85
+ if (template.assets && template.resources) {
86
+ delete template.assets;
87
+ }
88
+ // solutionItemExtent is in geographic, but it's a string, and we want/need a bbox
89
+ // and Hub templates expect it in organization.defaultExtentBBox
90
+ if (templateDictionary.solutionItemExtent) {
91
+ const parts = templateDictionary.solutionItemExtent.split(",");
92
+ templateDictionary.organization.defaultExtentBBox = [
93
+ [parts[0], parts[1]],
94
+ [parts[2], parts[3]],
95
+ ];
96
+ }
97
+ // TODO: Determine if we need any transforms in this new env
98
+ const transforms = {};
99
+ // create an object to hold the created site through
100
+ // subsequent promise calls
101
+ let pageModel;
102
+ let hubRo;
103
+ const thumbnail = template.item.thumbnail; // createPageModelFromTemplate trashes thumbnail
104
+ return createHubRequestOptions(destinationAuthentication, templateDictionary)
105
+ .then((ro) => {
106
+ hubRo = ro;
107
+ return createPageModelFromTemplate(template, templateDictionary, transforms, hubRo);
108
+ })
109
+ .then((interpolated) => {
110
+ // --------------------------------------------
111
+ // TODO: Update hub.js to take an IModel in createPage
112
+ // then remove this silliness
113
+ const modelTmpl = interpolated;
114
+ const options = {
115
+ assets: modelTmpl.assets || [],
116
+ };
117
+ // --------------------------------------------
118
+ return createPage(modelTmpl, options, hubRo);
119
+ })
120
+ .then((page) => {
121
+ pageModel = page;
122
+ // Move the site and initiative to the solution folder
123
+ // this is essentially fire and forget. We fail-safe the actual moveItem
124
+ // call since it's not critical to the outcome
125
+ return moveModelToFolder(page, templateDictionary.folderId, destinationAuthentication);
126
+ })
127
+ .then(() => {
128
+ // Fix the thumbnail
129
+ const updateOptions = {
130
+ item: {
131
+ id: pageModel.item.id,
132
+ },
133
+ params: {
134
+ // Pass thumbnail in via params because item property is serialized, which discards a blob
135
+ thumbnail,
136
+ },
137
+ authentication: destinationAuthentication,
138
+ };
139
+ return restUpdateItem(updateOptions);
140
+ })
141
+ .then(() => {
142
+ // Update the template dictionary
143
+ // TODO: This should be done in whatever recieves
144
+ // the outcome of this promise chain
145
+ templateDictionary[template.itemId] = {
146
+ itemId: pageModel.item.id,
147
+ };
148
+ // call the progress callback, which also mutates templateDictionary
149
+ const finalStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, pageModel.item.id);
150
+ if (!finalStatus) {
151
+ // clean up the site we just created
152
+ const failSafeRemove = failSafe(removePage, { success: true });
153
+ return failSafeRemove(pageModel, hubRo).then(() => {
154
+ return Promise.resolve(generateEmptyCreationResponse(template.type));
155
+ });
156
+ }
157
+ else {
158
+ // finally, return ICreateItemFromTemplateResponse
159
+ const response = {
160
+ item: {
161
+ ...template,
162
+ ...convertIModel(pageModel),
163
+ },
164
+ id: pageModel.item.id,
165
+ type: template.type,
166
+ postProcess: true,
167
+ };
168
+ response.item.itemId = pageModel.item.id;
169
+ return response;
170
+ }
171
+ })
172
+ .catch((ex) => {
173
+ itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);
174
+ throw ex;
175
+ });
176
+ }
177
+ /**
178
+ * Post-Process a Page
179
+ * Re-interpolate the page item + data w/ the full template dictionary hash
180
+ *
181
+ * @param id
182
+ * @param type
183
+ * @param itemInfos
184
+ * @param template
185
+ * @param templates
186
+ * @param templateDictionary
187
+ * @param authentication
188
+ */
189
+ export function postProcess(id, type, itemInfos, template, templates, templateDictionary, authentication) {
190
+ // create the requestOptions
191
+ let hubRo;
192
+ // get hubRequestOptions
193
+ return createHubRequestOptions(authentication)
194
+ .then((ro) => {
195
+ hubRo = ro;
196
+ // get the site model
197
+ return getModel(id, { authentication });
198
+ })
199
+ .then((pageModel) => {
200
+ // post process the page
201
+ return _postProcessPage(pageModel, itemInfos, templateDictionary, hubRo);
202
+ });
203
+ }
204
+ /**
205
+ * Check of an item type is a Page
206
+ * Hub Page is for ArcGIS Online
207
+ * Site Page is for ArcGIS Enterprise
208
+ *
209
+ * @param itemType
210
+ */
211
+ export function isAPage(itemType) {
212
+ let result = false;
213
+ if (itemType === "Hub Page" || itemType === "Site Page") {
214
+ result = true;
215
+ }
216
+ return result;
217
+ }
218
+ //# sourceMappingURL=hub-page-processor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub-page-processor.js","sourceRoot":"","sources":["../../src/hub-page-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,EAKL,mBAAmB,EAEnB,aAAa,EACb,uBAAuB,EACvB,6BAA6B,EAC7B,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAA0B,QAAQ,EAAE,QAAQ,EAA0B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACxH,OAAO,EAAE,2BAA2B,EAAE,UAAU,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAa,EACb,kBAA+B,EAC/B,oBAAiC,IAAI;IAErC,IAAI,OAAO,GAAW,CAAC,CAAC;IACxB,IAAI,QAAQ,GAAW,CAAC,CAAC;IAEzB,2CAA2C;IAC3C,OAAO,OAAO,CAAC,GAAG,CAAC;QACjB,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC;QAC7D,uBAAuB,CAAC,kBAAkB,CAAC;KAC5C,CAAC;SACC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE;QACxB,sFAAsF;QACtF,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC;QACjC,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;QACn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,64 @@
1
+ /** @license
2
+ * Copyright 2020 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Manages the creation and deployment of Hub Site item types.
18
+ *
19
+ * @module hub-site-processor
20
+ */
21
+ import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse, UserSession } from "@esri/solution-common";
22
+ /**
23
+ * Converts a Site item into a template.
24
+ *
25
+ * @param itemInfo Info about the item
26
+ * @param destAuthentication Credentials for requests to the destination organization
27
+ * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
28
+ * @returns A promise that will resolve when the template has been created
29
+ */
30
+ export declare function convertItemToTemplate(itemInfo: any, destAuthentication: UserSession, srcAuthentication?: UserSession): Promise<IItemTemplate>;
31
+ /**
32
+ * Handle deployment of Site item templates
33
+ *
34
+ * @export
35
+ * @param {IItemTemplate} template
36
+ * @param {*} templateDictionary
37
+ * @param {UserSession} destinationAuthentication
38
+ * @param {IItemProgressCallback} itemProgressCallback
39
+ * @returns {Promise<ICreateItemFromTemplateResponse>}
40
+ */
41
+ export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
42
+ /**
43
+ * Deployer life-cycle hook allowing the Site Processor
44
+ * a chance to apply final processes to all the items that
45
+ * were created as part of the solution.
46
+ * Specifically this will:
47
+ * - share all items to the content team, and (if created)
48
+ * the core team (depends on user privs)
49
+ * - link all Page items that were created, to the Site
50
+ *
51
+ * @param model
52
+ * @param items
53
+ * @param authentication
54
+ * @param templateDictionary
55
+ */
56
+ export declare function postProcess(id: string, type: string, itemInfos: any[], template: any, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<boolean>;
57
+ /**
58
+ * Check of an item type is a Site
59
+ * Hub Site Application is for ArcGIS Online
60
+ * Site Application is for ArcGIS Enterprise
61
+ *
62
+ * @param itemType
63
+ */
64
+ export declare function isASite(itemType: string): boolean;
@@ -0,0 +1,228 @@
1
+ /** @license
2
+ * Copyright 2020 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Manages the creation and deployment of Hub Site item types.
18
+ *
19
+ * @module hub-site-processor
20
+ */
21
+ import { EItemProgressStatus, convertIModel, createHubRequestOptions, dedupe, generateEmptyCreationResponse, getProp, restUpdateItem, } from "@esri/solution-common";
22
+ import { createSiteModelFromTemplate, createSite, getSiteById, removeSite, convertSiteToTemplate, } from "@esri/hub-sites";
23
+ import { failSafe, without } from "@esri/hub-common";
24
+ import { moveModelToFolder } from "./helpers/move-model-to-folder";
25
+ import { _postProcessSite } from "./helpers/_post-process-site";
26
+ import { replaceItemIds } from "./helpers/replace-item-ids";
27
+ /**
28
+ * Converts a Site item into a template.
29
+ *
30
+ * @param itemInfo Info about the item
31
+ * @param destAuthentication Credentials for requests to the destination organization
32
+ * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
33
+ * @returns A promise that will resolve when the template has been created
34
+ */
35
+ export function convertItemToTemplate(itemInfo, destAuthentication, srcAuthentication = null) {
36
+ let created = 0;
37
+ let modified = 0;
38
+ let itemTitle;
39
+ let dataTitle;
40
+ let hubRo;
41
+ // get hubRequestOptions
42
+ return createHubRequestOptions(destAuthentication)
43
+ .then((ro) => {
44
+ hubRo = ro;
45
+ return getSiteById(itemInfo.id, hubRo);
46
+ })
47
+ .then((siteModel) => {
48
+ // We need to save these properties in order to restore them after hub.js deletes them
49
+ created = siteModel.item.created;
50
+ modified = siteModel.item.modified;
51
+ itemTitle = siteModel.item.title;
52
+ dataTitle = siteModel.data.values.title;
53
+ return convertSiteToTemplate(siteModel, hubRo);
54
+ })
55
+ .then((tmpl) => {
56
+ // add in some stuff Hub.js does not yet add
57
+ tmpl.item.created = created;
58
+ tmpl.item.modified = modified;
59
+ tmpl.item.title = itemTitle;
60
+ tmpl.item.typeKeywords = without(tmpl.item.typeKeywords, "doNotDelete");
61
+ tmpl.data.values.title = dataTitle;
62
+ tmpl.groups = [];
63
+ tmpl.estimatedDeploymentCostFactor = 2;
64
+ tmpl.resources = [];
65
+ if (!getProp(tmpl, "properties")) {
66
+ tmpl.properties = {};
67
+ }
68
+ // swap out dependency id's to {{<depid>.itemId}}
69
+ // so it will be re-interpolated
70
+ tmpl.dependencies = dedupe(tmpl.dependencies);
71
+ tmpl = replaceItemIds(tmpl);
72
+ // and return it
73
+ return tmpl;
74
+ });
75
+ }
76
+ /**
77
+ * Handle deployment of Site item templates
78
+ *
79
+ * @export
80
+ * @param {IItemTemplate} template
81
+ * @param {*} templateDictionary
82
+ * @param {UserSession} destinationAuthentication
83
+ * @param {IItemProgressCallback} itemProgressCallback
84
+ * @returns {Promise<ICreateItemFromTemplateResponse>}
85
+ */
86
+ export function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
87
+ // let the progress system know we've started...
88
+ const startStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Started, 0);
89
+ // if it returned false, just resolve out
90
+ if (!startStatus) {
91
+ return Promise.resolve(generateEmptyCreationResponse(template.type));
92
+ }
93
+ // TODO: Reassess with resource unification
94
+ if (template.assets && template.resources) {
95
+ delete template.assets;
96
+ }
97
+ // ensure we have a solution object in the templateDictionary hash
98
+ if (!templateDictionary.solution) {
99
+ templateDictionary.solution = {};
100
+ }
101
+ // .title should always be set on the templateDictionary
102
+ templateDictionary.solution.title = templateDictionary.title;
103
+ // TODO: Determine if we need any transforms in this new env
104
+ const transforms = {};
105
+ // create an object to hold the created site through
106
+ // subsequent promise calls
107
+ let siteModel;
108
+ // Create the "siteModel" from the template. Does not save the site item yet
109
+ // Note: depending on licensing and user privs, will also create the team groups
110
+ // and initiative item.
111
+ let hubRo;
112
+ const thumbnail = template.item.thumbnail; // createSiteModelFromTemplate trashes thumbnail
113
+ return createHubRequestOptions(destinationAuthentication, templateDictionary)
114
+ .then((ro) => {
115
+ hubRo = ro;
116
+ return createSiteModelFromTemplate(template, templateDictionary, transforms, hubRo);
117
+ })
118
+ .then((interpolated) => {
119
+ const options = {
120
+ assets: interpolated.assets || [],
121
+ };
122
+ // Now create the item, register for oAuth, register domain etc
123
+ return createSite(interpolated, options, hubRo);
124
+ })
125
+ .then((site) => {
126
+ // hold onto the site
127
+ siteModel = site;
128
+ // Move the site and initiative to the solution folder
129
+ // this is essentially fire and forget. We fail-safe the actual moveItem
130
+ // call since it's not critical to the outcome
131
+ return moveModelToFolder(site, templateDictionary.folderId, destinationAuthentication);
132
+ })
133
+ .then(() => {
134
+ // Fix the thumbnail
135
+ const updateOptions = {
136
+ item: {
137
+ id: siteModel.item.id,
138
+ },
139
+ params: {
140
+ // Pass thumbnail in via params because item property is serialized, which discards a blob
141
+ thumbnail,
142
+ },
143
+ authentication: destinationAuthentication,
144
+ };
145
+ return restUpdateItem(updateOptions);
146
+ })
147
+ .then(() => {
148
+ // Update the template dictionary
149
+ // TODO: This should be done in whatever recieves
150
+ // the outcome of this promise chain
151
+ templateDictionary[template.itemId] = {
152
+ itemId: siteModel.item.id,
153
+ };
154
+ // call the progress callback, which also mutates templateDictionary
155
+ const finalStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, siteModel.item.id);
156
+ if (!finalStatus) {
157
+ // clean up the site we just created
158
+ const failSafeRemove = failSafe(removeSite, { success: true });
159
+ return failSafeRemove(siteModel, hubRo).then(() => {
160
+ return Promise.resolve(generateEmptyCreationResponse(template.type));
161
+ });
162
+ }
163
+ else {
164
+ // finally, return ICreateItemFromTemplateResponse
165
+ const response = {
166
+ item: {
167
+ ...template,
168
+ ...convertIModel(siteModel),
169
+ },
170
+ id: siteModel.item.id,
171
+ type: template.type,
172
+ postProcess: true,
173
+ };
174
+ response.item.itemId = siteModel.item.id;
175
+ return response;
176
+ }
177
+ })
178
+ .catch((ex) => {
179
+ itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);
180
+ throw ex;
181
+ });
182
+ }
183
+ /**
184
+ * Deployer life-cycle hook allowing the Site Processor
185
+ * a chance to apply final processes to all the items that
186
+ * were created as part of the solution.
187
+ * Specifically this will:
188
+ * - share all items to the content team, and (if created)
189
+ * the core team (depends on user privs)
190
+ * - link all Page items that were created, to the Site
191
+ *
192
+ * @param model
193
+ * @param items
194
+ * @param authentication
195
+ * @param templateDictionary
196
+ */
197
+ export function postProcess(id, type, itemInfos, template, templates, templateDictionary, authentication) {
198
+ let hubRo;
199
+ return createHubRequestOptions(authentication, templateDictionary)
200
+ .then((ro) => {
201
+ hubRo = ro;
202
+ // get the site model
203
+ return getSiteById(id, hubRo);
204
+ })
205
+ .then((siteModel) => {
206
+ // Hub.js does not expect the same structures, so we delegat to a local fn
207
+ return _postProcessSite(siteModel, itemInfos, templateDictionary, hubRo);
208
+ })
209
+ .then(() => {
210
+ // resolve w/ a boolean
211
+ return Promise.resolve(true);
212
+ });
213
+ }
214
+ /**
215
+ * Check of an item type is a Site
216
+ * Hub Site Application is for ArcGIS Online
217
+ * Site Application is for ArcGIS Enterprise
218
+ *
219
+ * @param itemType
220
+ */
221
+ export function isASite(itemType) {
222
+ let result = false;
223
+ if (itemType === "Hub Site Application" || itemType === "Site Application") {
224
+ result = true;
225
+ }
226
+ return result;
227
+ }
228
+ //# sourceMappingURL=hub-site-processor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub-site-processor.js","sourceRoot":"","sources":["../../src/hub-site-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,EAKL,mBAAmB,EAEnB,aAAa,EACb,uBAAuB,EACvB,MAAM,EACN,6BAA6B,EAC7B,OAAO,EACP,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,2BAA2B,EAC3B,UAAU,EACV,WAAW,EACX,UAAU,EACV,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAU,QAAQ,EAA0B,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAErF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAa,EACb,kBAA+B,EAC/B,oBAAiC,IAAI;IAErC,IAAI,OAAO,GAAW,CAAC,CAAC;IACxB,IAAI,QAAQ,GAAW,CAAC,CAAC;IACzB,IAAI,SAAiB,CAAC;IACtB,IAAI,SAAiB,CAAC;IAEtB,IAAI,KAA6B,CAAC;IAClC,wBAAwB;IACxB,OAAO,uBAAuB,CAAC,kBAAkB,CAAC;SAC/C,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;QACX,KAAK,GAAG,EAAE,CAAC;QACX,OAAO,WAAW,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;QAClB,sFAAsF;QACtF,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC;QACjC,QA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