@esri/solution-hub-types 4.1.2-alpha.0 → 5.0.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 (35) hide show
  1. package/dist/cjs/helpers/_post-process-page.d.ts +17 -17
  2. package/dist/cjs/helpers/_post-process-page.js +32 -32
  3. package/dist/cjs/helpers/_post-process-page.js.map +1 -1
  4. package/dist/cjs/helpers/_post-process-site.d.ts +29 -29
  5. package/dist/cjs/helpers/_post-process-site.js +50 -50
  6. package/dist/cjs/helpers/_update-site-pages.d.ts +24 -24
  7. package/dist/cjs/helpers/_update-site-pages.js +42 -42
  8. package/dist/cjs/helpers/move-model-to-folder.d.ts +26 -26
  9. package/dist/cjs/helpers/move-model-to-folder.js +49 -49
  10. package/dist/cjs/helpers/replace-item-ids.d.ts +17 -17
  11. package/dist/cjs/helpers/replace-item-ids.js +36 -36
  12. package/dist/cjs/hub-page-processor.d.ts +63 -63
  13. package/dist/cjs/hub-page-processor.js +227 -227
  14. package/dist/cjs/hub-site-processor.d.ts +65 -65
  15. package/dist/cjs/hub-site-processor.js +231 -231
  16. package/dist/cjs/index.d.ts +23 -23
  17. package/dist/cjs/index.js +28 -28
  18. package/dist/esm/helpers/_post-process-page.d.ts +17 -17
  19. package/dist/esm/helpers/_post-process-page.js +28 -28
  20. package/dist/esm/helpers/_post-process-page.js.map +1 -1
  21. package/dist/esm/helpers/_post-process-site.d.ts +29 -29
  22. package/dist/esm/helpers/_post-process-site.js +46 -46
  23. package/dist/esm/helpers/_update-site-pages.d.ts +24 -24
  24. package/dist/esm/helpers/_update-site-pages.js +38 -38
  25. package/dist/esm/helpers/move-model-to-folder.d.ts +26 -26
  26. package/dist/esm/helpers/move-model-to-folder.js +45 -45
  27. package/dist/esm/helpers/replace-item-ids.d.ts +17 -17
  28. package/dist/esm/helpers/replace-item-ids.js +32 -32
  29. package/dist/esm/hub-page-processor.d.ts +63 -63
  30. package/dist/esm/hub-page-processor.js +220 -220
  31. package/dist/esm/hub-site-processor.d.ts +65 -65
  32. package/dist/esm/hub-site-processor.js +224 -224
  33. package/dist/esm/index.d.ts +23 -23
  34. package/dist/esm/index.js +24 -24
  35. package/package.json +3 -3
@@ -1,65 +1,65 @@
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 solutionItemId The solution to contain the template
26
- * @param itemInfo Info about the item
27
- * @param destAuthentication Credentials for requests to the destination organization
28
- * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
29
- * @returns A promise that will resolve when the template has been created
30
- */
31
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication?: UserSession): Promise<IItemTemplate>;
32
- /**
33
- * Handle deployment of Site item templates
34
- *
35
- * @export
36
- * @param {IItemTemplate} template
37
- * @param {*} templateDictionary
38
- * @param {UserSession} destinationAuthentication
39
- * @param {IItemProgressCallback} itemProgressCallback
40
- * @returns {Promise<ICreateItemFromTemplateResponse>}
41
- */
42
- export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
43
- /**
44
- * Deployer life-cycle hook allowing the Site Processor
45
- * a chance to apply final processes to all the items that
46
- * were created as part of the solution.
47
- * Specifically this will:
48
- * - share all items to the content team, and (if created)
49
- * the core team (depends on user privs)
50
- * - link all Page items that were created, to the Site
51
- *
52
- * @param model
53
- * @param items
54
- * @param authentication
55
- * @param templateDictionary
56
- */
57
- export declare function postProcess(id: string, type: string, itemInfos: any[], template: any, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<boolean>;
58
- /**
59
- * Check of an item type is a Site
60
- * Hub Site Application is for ArcGIS Online
61
- * Site Application is for ArcGIS Enterprise
62
- *
63
- * @param itemType
64
- */
65
- export declare function isASite(itemType: string): boolean;
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 solutionItemId The solution to contain the template
26
+ * @param itemInfo Info about the item
27
+ * @param destAuthentication Credentials for requests to the destination organization
28
+ * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
29
+ * @returns A promise that will resolve when the template has been created
30
+ */
31
+ export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication?: UserSession): Promise<IItemTemplate>;
32
+ /**
33
+ * Handle deployment of Site item templates
34
+ *
35
+ * @export
36
+ * @param {IItemTemplate} template
37
+ * @param {*} templateDictionary
38
+ * @param {UserSession} destinationAuthentication
39
+ * @param {IItemProgressCallback} itemProgressCallback
40
+ * @returns {Promise<ICreateItemFromTemplateResponse>}
41
+ */
42
+ export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
43
+ /**
44
+ * Deployer life-cycle hook allowing the Site Processor
45
+ * a chance to apply final processes to all the items that
46
+ * were created as part of the solution.
47
+ * Specifically this will:
48
+ * - share all items to the content team, and (if created)
49
+ * the core team (depends on user privs)
50
+ * - link all Page items that were created, to the Site
51
+ *
52
+ * @param model
53
+ * @param items
54
+ * @param authentication
55
+ * @param templateDictionary
56
+ */
57
+ export declare function postProcess(id: string, type: string, itemInfos: any[], template: any, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<boolean>;
58
+ /**
59
+ * Check of an item type is a Site
60
+ * Hub Site Application is for ArcGIS Online
61
+ * Site Application is for ArcGIS Enterprise
62
+ *
63
+ * @param itemType
64
+ */
65
+ export declare function isASite(itemType: string): boolean;
@@ -1,225 +1,225 @@
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 } from "@esri/solution-common";
22
- import { updateItem } from "@esri/arcgis-rest-portal";
23
- import { createSiteModelFromTemplate, createSite, getSiteById, removeSite, convertSiteToTemplate } from "@esri/hub-sites";
24
- import { failSafe, without } from "@esri/hub-common";
25
- import { moveModelToFolder } from "./helpers/move-model-to-folder";
26
- import { _postProcessSite } from "./helpers/_post-process-site";
27
- import { replaceItemIds } from "./helpers/replace-item-ids";
28
- /**
29
- * Converts a Site item into a template.
30
- *
31
- * @param solutionItemId The solution to contain the template
32
- * @param itemInfo Info about the item
33
- * @param destAuthentication Credentials for requests to the destination organization
34
- * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
35
- * @returns A promise that will resolve when the template has been created
36
- */
37
- export function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication = null // eslint-disable-line @typescript-eslint/no-unused-vars
38
- ) {
39
- let created = 0;
40
- let modified = 0;
41
- let hubRo;
42
- // get hubRequestOptions
43
- return createHubRequestOptions(destAuthentication)
44
- .then(ro => {
45
- hubRo = ro;
46
- return getSiteById(itemInfo.id, hubRo);
47
- })
48
- .then(siteModel => {
49
- // We need to save these properties in order to restore them after hub.js deletes them
50
- created = siteModel.item.created;
51
- modified = siteModel.item.modified;
52
- return convertSiteToTemplate(siteModel, hubRo);
53
- })
54
- .then(tmpl => {
55
- // add in some stuff Hub.js does not yet add
56
- tmpl.item.created = created;
57
- tmpl.item.modified = modified;
58
- tmpl.item.typeKeywords = without(tmpl.item.typeKeywords, "doNotDelete");
59
- tmpl.groups = [];
60
- tmpl.estimatedDeploymentCostFactor = 2;
61
- tmpl.resources = [];
62
- if (!getProp(tmpl, "properties")) {
63
- tmpl.properties = {};
64
- }
65
- // swap out dependency id's to {{<depid>.itemId}}
66
- // so it will be re-interpolated
67
- tmpl.dependencies = dedupe(tmpl.dependencies);
68
- tmpl = replaceItemIds(tmpl);
69
- // and return it
70
- return tmpl;
71
- });
72
- }
73
- /**
74
- * Handle deployment of Site item templates
75
- *
76
- * @export
77
- * @param {IItemTemplate} template
78
- * @param {*} templateDictionary
79
- * @param {UserSession} destinationAuthentication
80
- * @param {IItemProgressCallback} itemProgressCallback
81
- * @returns {Promise<ICreateItemFromTemplateResponse>}
82
- */
83
- export function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
84
- // let the progress system know we've started...
85
- const startStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Started, 0);
86
- // if it returned false, just resolve out
87
- if (!startStatus) {
88
- return Promise.resolve(generateEmptyCreationResponse(template.type));
89
- }
90
- // TODO: Reassess with resource unification
91
- if (template.assets && template.resources) {
92
- delete template.assets;
93
- }
94
- // ensure we have a solution object in the templateDictionary hash
95
- if (!templateDictionary.solution) {
96
- templateDictionary.solution = {};
97
- }
98
- // .title should always be set on the templateDictionary
99
- templateDictionary.solution.title = templateDictionary.title;
100
- // TODO: Determine if we need any transforms in this new env
101
- const transforms = {};
102
- // create an object to hold the created site through
103
- // subsequent promise calls
104
- let siteModel;
105
- // Create the "siteModel" from the template. Does not save the site item yet
106
- // Note: depending on licensing and user privs, will also create the team groups
107
- // and initiative item.
108
- let hubRo;
109
- const thumbnail = template.item.thumbnail; // createSiteModelFromTemplate trashes thumbnail
110
- return createHubRequestOptions(destinationAuthentication, templateDictionary)
111
- .then(ro => {
112
- hubRo = ro;
113
- return createSiteModelFromTemplate(template, templateDictionary, transforms, hubRo);
114
- })
115
- .then(interpolated => {
116
- const options = {
117
- assets: interpolated.assets || []
118
- };
119
- // Now create the item, register for oAuth, register domain etc
120
- return createSite(interpolated, options, hubRo);
121
- })
122
- .then(site => {
123
- // hold onto the site
124
- siteModel = site;
125
- // Move the site and initiative to the solution folder
126
- // this is essentially fire and forget. We fail-safe the actual moveItem
127
- // call since it's not critical to the outcome
128
- return moveModelToFolder(site, templateDictionary.folderId, destinationAuthentication);
129
- })
130
- .then(() => {
131
- // Fix the thumbnail
132
- const updateOptions = {
133
- item: {
134
- id: siteModel.item.id
135
- },
136
- params: {
137
- // Pass thumbnail in via params because item property is serialized, which discards a blob
138
- thumbnail
139
- },
140
- authentication: destinationAuthentication
141
- };
142
- return updateItem(updateOptions);
143
- })
144
- .then(() => {
145
- // Update the template dictionary
146
- // TODO: This should be done in whatever recieves
147
- // the outcome of this promise chain
148
- templateDictionary[template.itemId] = {
149
- itemId: siteModel.item.id
150
- };
151
- // call the progress callback, which also mutates templateDictionary
152
- const finalStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, siteModel.item.id);
153
- if (!finalStatus) {
154
- // clean up the site we just created
155
- const failSafeRemove = failSafe(removeSite, { success: true });
156
- return failSafeRemove(siteModel, hubRo).then(() => {
157
- return Promise.resolve(generateEmptyCreationResponse(template.type));
158
- });
159
- }
160
- else {
161
- // finally, return ICreateItemFromTemplateResponse
162
- const response = {
163
- item: {
164
- ...template,
165
- ...convertIModel(siteModel)
166
- },
167
- id: siteModel.item.id,
168
- type: template.type,
169
- postProcess: true
170
- };
171
- response.item.itemId = siteModel.item.id;
172
- return response;
173
- }
174
- })
175
- .catch(ex => {
176
- itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);
177
- throw ex;
178
- });
179
- }
180
- /**
181
- * Deployer life-cycle hook allowing the Site Processor
182
- * a chance to apply final processes to all the items that
183
- * were created as part of the solution.
184
- * Specifically this will:
185
- * - share all items to the content team, and (if created)
186
- * the core team (depends on user privs)
187
- * - link all Page items that were created, to the Site
188
- *
189
- * @param model
190
- * @param items
191
- * @param authentication
192
- * @param templateDictionary
193
- */
194
- export function postProcess(id, type, itemInfos, template, templates, templateDictionary, authentication) {
195
- let hubRo;
196
- return createHubRequestOptions(authentication, templateDictionary)
197
- .then(ro => {
198
- hubRo = ro;
199
- // get the site model
200
- return getSiteById(id, hubRo);
201
- })
202
- .then(siteModel => {
203
- // Hub.js does not expect the same structures, so we delegat to a local fn
204
- return _postProcessSite(siteModel, itemInfos, templateDictionary, hubRo);
205
- })
206
- .then(() => {
207
- // resolve w/ a boolean
208
- return Promise.resolve(true);
209
- });
210
- }
211
- /**
212
- * Check of an item type is a Site
213
- * Hub Site Application is for ArcGIS Online
214
- * Site Application is for ArcGIS Enterprise
215
- *
216
- * @param itemType
217
- */
218
- export function isASite(itemType) {
219
- let result = false;
220
- if (itemType === "Hub Site Application" || itemType === "Site Application") {
221
- result = true;
222
- }
223
- return result;
224
- }
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 } from "@esri/solution-common";
22
+ import { updateItem } from "@esri/arcgis-rest-portal";
23
+ import { createSiteModelFromTemplate, createSite, getSiteById, removeSite, convertSiteToTemplate } from "@esri/hub-sites";
24
+ import { failSafe, without } from "@esri/hub-common";
25
+ import { moveModelToFolder } from "./helpers/move-model-to-folder";
26
+ import { _postProcessSite } from "./helpers/_post-process-site";
27
+ import { replaceItemIds } from "./helpers/replace-item-ids";
28
+ /**
29
+ * Converts a Site item into a template.
30
+ *
31
+ * @param solutionItemId The solution to contain the template
32
+ * @param itemInfo Info about the item
33
+ * @param destAuthentication Credentials for requests to the destination organization
34
+ * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
35
+ * @returns A promise that will resolve when the template has been created
36
+ */
37
+ export function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication = null // eslint-disable-line @typescript-eslint/no-unused-vars
38
+ ) {
39
+ let created = 0;
40
+ let modified = 0;
41
+ let hubRo;
42
+ // get hubRequestOptions
43
+ return createHubRequestOptions(destAuthentication)
44
+ .then(ro => {
45
+ hubRo = ro;
46
+ return getSiteById(itemInfo.id, hubRo);
47
+ })
48
+ .then(siteModel => {
49
+ // We need to save these properties in order to restore them after hub.js deletes them
50
+ created = siteModel.item.created;
51
+ modified = siteModel.item.modified;
52
+ return convertSiteToTemplate(siteModel, hubRo);
53
+ })
54
+ .then(tmpl => {
55
+ // add in some stuff Hub.js does not yet add
56
+ tmpl.item.created = created;
57
+ tmpl.item.modified = modified;
58
+ tmpl.item.typeKeywords = without(tmpl.item.typeKeywords, "doNotDelete");
59
+ tmpl.groups = [];
60
+ tmpl.estimatedDeploymentCostFactor = 2;
61
+ tmpl.resources = [];
62
+ if (!getProp(tmpl, "properties")) {
63
+ tmpl.properties = {};
64
+ }
65
+ // swap out dependency id's to {{<depid>.itemId}}
66
+ // so it will be re-interpolated
67
+ tmpl.dependencies = dedupe(tmpl.dependencies);
68
+ tmpl = replaceItemIds(tmpl);
69
+ // and return it
70
+ return tmpl;
71
+ });
72
+ }
73
+ /**
74
+ * Handle deployment of Site item templates
75
+ *
76
+ * @export
77
+ * @param {IItemTemplate} template
78
+ * @param {*} templateDictionary
79
+ * @param {UserSession} destinationAuthentication
80
+ * @param {IItemProgressCallback} itemProgressCallback
81
+ * @returns {Promise<ICreateItemFromTemplateResponse>}
82
+ */
83
+ export function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
84
+ // let the progress system know we've started...
85
+ const startStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Started, 0);
86
+ // if it returned false, just resolve out
87
+ if (!startStatus) {
88
+ return Promise.resolve(generateEmptyCreationResponse(template.type));
89
+ }
90
+ // TODO: Reassess with resource unification
91
+ if (template.assets && template.resources) {
92
+ delete template.assets;
93
+ }
94
+ // ensure we have a solution object in the templateDictionary hash
95
+ if (!templateDictionary.solution) {
96
+ templateDictionary.solution = {};
97
+ }
98
+ // .title should always be set on the templateDictionary
99
+ templateDictionary.solution.title = templateDictionary.title;
100
+ // TODO: Determine if we need any transforms in this new env
101
+ const transforms = {};
102
+ // create an object to hold the created site through
103
+ // subsequent promise calls
104
+ let siteModel;
105
+ // Create the "siteModel" from the template. Does not save the site item yet
106
+ // Note: depending on licensing and user privs, will also create the team groups
107
+ // and initiative item.
108
+ let hubRo;
109
+ const thumbnail = template.item.thumbnail; // createSiteModelFromTemplate trashes thumbnail
110
+ return createHubRequestOptions(destinationAuthentication, templateDictionary)
111
+ .then(ro => {
112
+ hubRo = ro;
113
+ return createSiteModelFromTemplate(template, templateDictionary, transforms, hubRo);
114
+ })
115
+ .then(interpolated => {
116
+ const options = {
117
+ assets: interpolated.assets || []
118
+ };
119
+ // Now create the item, register for oAuth, register domain etc
120
+ return createSite(interpolated, options, hubRo);
121
+ })
122
+ .then(site => {
123
+ // hold onto the site
124
+ siteModel = site;
125
+ // Move the site and initiative to the solution folder
126
+ // this is essentially fire and forget. We fail-safe the actual moveItem
127
+ // call since it's not critical to the outcome
128
+ return moveModelToFolder(site, templateDictionary.folderId, destinationAuthentication);
129
+ })
130
+ .then(() => {
131
+ // Fix the thumbnail
132
+ const updateOptions = {
133
+ item: {
134
+ id: siteModel.item.id
135
+ },
136
+ params: {
137
+ // Pass thumbnail in via params because item property is serialized, which discards a blob
138
+ thumbnail
139
+ },
140
+ authentication: destinationAuthentication
141
+ };
142
+ return updateItem(updateOptions);
143
+ })
144
+ .then(() => {
145
+ // Update the template dictionary
146
+ // TODO: This should be done in whatever recieves
147
+ // the outcome of this promise chain
148
+ templateDictionary[template.itemId] = {
149
+ itemId: siteModel.item.id
150
+ };
151
+ // call the progress callback, which also mutates templateDictionary
152
+ const finalStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, siteModel.item.id);
153
+ if (!finalStatus) {
154
+ // clean up the site we just created
155
+ const failSafeRemove = failSafe(removeSite, { success: true });
156
+ return failSafeRemove(siteModel, hubRo).then(() => {
157
+ return Promise.resolve(generateEmptyCreationResponse(template.type));
158
+ });
159
+ }
160
+ else {
161
+ // finally, return ICreateItemFromTemplateResponse
162
+ const response = {
163
+ item: {
164
+ ...template,
165
+ ...convertIModel(siteModel)
166
+ },
167
+ id: siteModel.item.id,
168
+ type: template.type,
169
+ postProcess: true
170
+ };
171
+ response.item.itemId = siteModel.item.id;
172
+ return response;
173
+ }
174
+ })
175
+ .catch(ex => {
176
+ itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);
177
+ throw ex;
178
+ });
179
+ }
180
+ /**
181
+ * Deployer life-cycle hook allowing the Site Processor
182
+ * a chance to apply final processes to all the items that
183
+ * were created as part of the solution.
184
+ * Specifically this will:
185
+ * - share all items to the content team, and (if created)
186
+ * the core team (depends on user privs)
187
+ * - link all Page items that were created, to the Site
188
+ *
189
+ * @param model
190
+ * @param items
191
+ * @param authentication
192
+ * @param templateDictionary
193
+ */
194
+ export function postProcess(id, type, itemInfos, template, templates, templateDictionary, authentication) {
195
+ let hubRo;
196
+ return createHubRequestOptions(authentication, templateDictionary)
197
+ .then(ro => {
198
+ hubRo = ro;
199
+ // get the site model
200
+ return getSiteById(id, hubRo);
201
+ })
202
+ .then(siteModel => {
203
+ // Hub.js does not expect the same structures, so we delegat to a local fn
204
+ return _postProcessSite(siteModel, itemInfos, templateDictionary, hubRo);
205
+ })
206
+ .then(() => {
207
+ // resolve w/ a boolean
208
+ return Promise.resolve(true);
209
+ });
210
+ }
211
+ /**
212
+ * Check of an item type is a Site
213
+ * Hub Site Application is for ArcGIS Online
214
+ * Site Application is for ArcGIS Enterprise
215
+ *
216
+ * @param itemType
217
+ */
218
+ export function isASite(itemType) {
219
+ let result = false;
220
+ if (itemType === "Hub Site Application" || itemType === "Site Application") {
221
+ result = true;
222
+ }
223
+ return result;
224
+ }
225
225
  //# sourceMappingURL=hub-site-processor.js.map
@@ -1,23 +1,23 @@
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 Site and Page item types.
18
- *
19
- * @module hubTypes
20
- */
21
- import * as HubPageProcessor from "./hub-page-processor";
22
- import * as HubSiteProcessor from "./hub-site-processor";
23
- export { HubPageProcessor, HubSiteProcessor };
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 Site and Page item types.
18
+ *
19
+ * @module hubTypes
20
+ */
21
+ import * as HubPageProcessor from "./hub-page-processor";
22
+ import * as HubSiteProcessor from "./hub-site-processor";
23
+ export { HubPageProcessor, HubSiteProcessor };