@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,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,235 @@
1
+ "use strict";
2
+ /** @license
3
+ * Copyright 2020 Esri
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.isASite = exports.postProcess = exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
19
+ /**
20
+ * Manages the creation and deployment of Hub Site item types.
21
+ *
22
+ * @module hub-site-processor
23
+ */
24
+ const solution_common_1 = require("@esri/solution-common");
25
+ const hub_sites_1 = require("@esri/hub-sites");
26
+ const hub_common_1 = require("@esri/hub-common");
27
+ const move_model_to_folder_1 = require("./helpers/move-model-to-folder");
28
+ const _post_process_site_1 = require("./helpers/_post-process-site");
29
+ const replace_item_ids_1 = require("./helpers/replace-item-ids");
30
+ /**
31
+ * Converts a Site item into a template.
32
+ *
33
+ * @param itemInfo Info about the item
34
+ * @param destAuthentication Credentials for requests to the destination organization
35
+ * @param srcAuthentication Credentials for requests to source items (placeholder--not used)
36
+ * @returns A promise that will resolve when the template has been created
37
+ */
38
+ function convertItemToTemplate(itemInfo, destAuthentication, srcAuthentication = null) {
39
+ let created = 0;
40
+ let modified = 0;
41
+ let itemTitle;
42
+ let dataTitle;
43
+ let hubRo;
44
+ // get hubRequestOptions
45
+ return (0, solution_common_1.createHubRequestOptions)(destAuthentication)
46
+ .then((ro) => {
47
+ hubRo = ro;
48
+ return (0, hub_sites_1.getSiteById)(itemInfo.id, hubRo);
49
+ })
50
+ .then((siteModel) => {
51
+ // We need to save these properties in order to restore them after hub.js deletes them
52
+ created = siteModel.item.created;
53
+ modified = siteModel.item.modified;
54
+ itemTitle = siteModel.item.title;
55
+ dataTitle = siteModel.data.values.title;
56
+ return (0, hub_sites_1.convertSiteToTemplate)(siteModel, hubRo);
57
+ })
58
+ .then((tmpl) => {
59
+ // add in some stuff Hub.js does not yet add
60
+ tmpl.item.created = created;
61
+ tmpl.item.modified = modified;
62
+ tmpl.item.title = itemTitle;
63
+ tmpl.item.typeKeywords = (0, hub_common_1.without)(tmpl.item.typeKeywords, "doNotDelete");
64
+ tmpl.data.values.title = dataTitle;
65
+ tmpl.groups = [];
66
+ tmpl.estimatedDeploymentCostFactor = 2;
67
+ tmpl.resources = [];
68
+ if (!(0, solution_common_1.getProp)(tmpl, "properties")) {
69
+ tmpl.properties = {};
70
+ }
71
+ // swap out dependency id's to {{<depid>.itemId}}
72
+ // so it will be re-interpolated
73
+ tmpl.dependencies = (0, solution_common_1.dedupe)(tmpl.dependencies);
74
+ tmpl = (0, replace_item_ids_1.replaceItemIds)(tmpl);
75
+ // and return it
76
+ return tmpl;
77
+ });
78
+ }
79
+ exports.convertItemToTemplate = convertItemToTemplate;
80
+ /**
81
+ * Handle deployment of Site item templates
82
+ *
83
+ * @export
84
+ * @param {IItemTemplate} template
85
+ * @param {*} templateDictionary
86
+ * @param {UserSession} destinationAuthentication
87
+ * @param {IItemProgressCallback} itemProgressCallback
88
+ * @returns {Promise<ICreateItemFromTemplateResponse>}
89
+ */
90
+ function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
91
+ // let the progress system know we've started...
92
+ const startStatus = itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Started, 0);
93
+ // if it returned false, just resolve out
94
+ if (!startStatus) {
95
+ return Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type));
96
+ }
97
+ // TODO: Reassess with resource unification
98
+ if (template.assets && template.resources) {
99
+ delete template.assets;
100
+ }
101
+ // ensure we have a solution object in the templateDictionary hash
102
+ if (!templateDictionary.solution) {
103
+ templateDictionary.solution = {};
104
+ }
105
+ // .title should always be set on the templateDictionary
106
+ templateDictionary.solution.title = templateDictionary.title;
107
+ // TODO: Determine if we need any transforms in this new env
108
+ const transforms = {};
109
+ // create an object to hold the created site through
110
+ // subsequent promise calls
111
+ let siteModel;
112
+ // Create the "siteModel" from the template. Does not save the site item yet
113
+ // Note: depending on licensing and user privs, will also create the team groups
114
+ // and initiative item.
115
+ let hubRo;
116
+ const thumbnail = template.item.thumbnail; // createSiteModelFromTemplate trashes thumbnail
117
+ return (0, solution_common_1.createHubRequestOptions)(destinationAuthentication, templateDictionary)
118
+ .then((ro) => {
119
+ hubRo = ro;
120
+ return (0, hub_sites_1.createSiteModelFromTemplate)(template, templateDictionary, transforms, hubRo);
121
+ })
122
+ .then((interpolated) => {
123
+ const options = {
124
+ assets: interpolated.assets || [],
125
+ };
126
+ // Now create the item, register for oAuth, register domain etc
127
+ return (0, hub_sites_1.createSite)(interpolated, options, hubRo);
128
+ })
129
+ .then((site) => {
130
+ // hold onto the site
131
+ siteModel = site;
132
+ // Move the site and initiative to the solution folder
133
+ // this is essentially fire and forget. We fail-safe the actual moveItem
134
+ // call since it's not critical to the outcome
135
+ return (0, move_model_to_folder_1.moveModelToFolder)(site, templateDictionary.folderId, destinationAuthentication);
136
+ })
137
+ .then(() => {
138
+ // Fix the thumbnail
139
+ const updateOptions = {
140
+ item: {
141
+ id: siteModel.item.id,
142
+ },
143
+ params: {
144
+ // Pass thumbnail in via params because item property is serialized, which discards a blob
145
+ thumbnail,
146
+ },
147
+ authentication: destinationAuthentication,
148
+ };
149
+ return (0, solution_common_1.restUpdateItem)(updateOptions);
150
+ })
151
+ .then(() => {
152
+ // Update the template dictionary
153
+ // TODO: This should be done in whatever recieves
154
+ // the outcome of this promise chain
155
+ templateDictionary[template.itemId] = {
156
+ itemId: siteModel.item.id,
157
+ };
158
+ // call the progress callback, which also mutates templateDictionary
159
+ const finalStatus = itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, siteModel.item.id);
160
+ if (!finalStatus) {
161
+ // clean up the site we just created
162
+ const failSafeRemove = (0, hub_common_1.failSafe)(hub_sites_1.removeSite, { success: true });
163
+ return failSafeRemove(siteModel, hubRo).then(() => {
164
+ return Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type));
165
+ });
166
+ }
167
+ else {
168
+ // finally, return ICreateItemFromTemplateResponse
169
+ const response = {
170
+ item: {
171
+ ...template,
172
+ ...(0, solution_common_1.convertIModel)(siteModel),
173
+ },
174
+ id: siteModel.item.id,
175
+ type: template.type,
176
+ postProcess: true,
177
+ };
178
+ response.item.itemId = siteModel.item.id;
179
+ return response;
180
+ }
181
+ })
182
+ .catch((ex) => {
183
+ itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Failed, 0);
184
+ throw ex;
185
+ });
186
+ }
187
+ exports.createItemFromTemplate = createItemFromTemplate;
188
+ /**
189
+ * Deployer life-cycle hook allowing the Site Processor
190
+ * a chance to apply final processes to all the items that
191
+ * were created as part of the solution.
192
+ * Specifically this will:
193
+ * - share all items to the content team, and (if created)
194
+ * the core team (depends on user privs)
195
+ * - link all Page items that were created, to the Site
196
+ *
197
+ * @param model
198
+ * @param items
199
+ * @param authentication
200
+ * @param templateDictionary
201
+ */
202
+ function postProcess(id, type, itemInfos, template, templates, templateDictionary, authentication) {
203
+ let hubRo;
204
+ return (0, solution_common_1.createHubRequestOptions)(authentication, templateDictionary)
205
+ .then((ro) => {
206
+ hubRo = ro;
207
+ // get the site model
208
+ return (0, hub_sites_1.getSiteById)(id, hubRo);
209
+ })
210
+ .then((siteModel) => {
211
+ // Hub.js does not expect the same structures, so we delegat to a local fn
212
+ return (0, _post_process_site_1._postProcessSite)(siteModel, itemInfos, templateDictionary, hubRo);
213
+ })
214
+ .then(() => {
215
+ // resolve w/ a boolean
216
+ return Promise.resolve(true);
217
+ });
218
+ }
219
+ exports.postProcess = postProcess;
220
+ /**
221
+ * Check of an item type is a Site
222
+ * Hub Site Application is for ArcGIS Online
223
+ * Site Application is for ArcGIS Enterprise
224
+ *
225
+ * @param itemType
226
+ */
227
+ function isASite(itemType) {
228
+ let result = false;
229
+ if (itemType === "Hub Site Application" || itemType === "Site Application") {
230
+ result = true;
231
+ }
232
+ return result;
233
+ }
234
+ exports.isASite = isASite;
235
+ //# 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":[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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 };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /** @license
3
+ * Copyright 2018 Esri
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.HubSiteProcessor = exports.HubPageProcessor = void 0;
19
+ const tslib_1 = require("tslib");
20
+ /**
21
+ * Manages the creation and deployment of Hub Site and Page item types.
22
+ *
23
+ * @module hubTypes
24
+ */
25
+ const HubPageProcessor = tslib_1.__importStar(require("./hub-page-processor"));
26
+ exports.HubPageProcessor = HubPageProcessor;
27
+ const HubSiteProcessor = tslib_1.__importStar(require("./hub-site-processor"));
28
+ exports.HubSiteProcessor = HubSiteProcessor;
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH,+EAAyD;AAGhD,4CAAgB;AAFzB,+EAAyD;AAE9B,4CAAgB"}
@@ -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 { IModel, IHubUserRequestOptions } from "@esri/hub-common";
17
+ export declare function _postProcessPage(pageModel: IModel, itemInfos: any[], templateDictionary: any, hubRequestOptions: IHubUserRequestOptions): Promise<boolean>;
@@ -0,0 +1,29 @@
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 { interpolate } from "@esri/hub-common";
17
+ import { updatePage } from "@esri/hub-sites";
18
+ //TODO: function doc
19
+ export function _postProcessPage(pageModel, itemInfos, templateDictionary, hubRequestOptions) {
20
+ // re-interpolate the siteModel using the itemInfos; no patches supplied
21
+ pageModel = interpolate(pageModel, templateDictionary, {});
22
+ return updatePage(pageModel, {
23
+ ...hubRequestOptions,
24
+ allowList: [],
25
+ }).then(() => {
26
+ return true;
27
+ });
28
+ }
29
+ //# sourceMappingURL=_post-process-page.js.map
@@ -0,0 +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,oBAAoB;AACpB,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"}
@@ -0,0 +1,29 @@
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 { IModel, IHubUserRequestOptions } from "@esri/hub-common";
17
+ /**
18
+ * Post Process a Site
19
+ * - share all items to the Hub teams created as part of the site
20
+ * - link any created page to the site item
21
+ * - re-interpolate any remaining item ids that were not direct deps of the site
22
+ *
23
+ * @param siteModel
24
+ * @param itemInfos
25
+ * @param templateDictionary
26
+ * @param hubRequestOptions
27
+ * @private
28
+ */
29
+ export declare function _postProcessSite(siteModel: IModel, itemInfos: any[], templateDictionary: any, hubRequestOptions: IHubUserRequestOptions): Promise<boolean>;
@@ -0,0 +1,49 @@
1
+ import { shareItemsToSiteGroups, updateSite, interpolateSite } from "@esri/hub-sites";
2
+ import { _updateSitePages } from "./_update-site-pages";
3
+ /**
4
+ * Post Process a Site
5
+ * - share all items to the Hub teams created as part of the site
6
+ * - link any created page to the site item
7
+ * - re-interpolate any remaining item ids that were not direct deps of the site
8
+ *
9
+ * @param siteModel
10
+ * @param itemInfos
11
+ * @param templateDictionary
12
+ * @param hubRequestOptions
13
+ * @private
14
+ */
15
+ export function _postProcessSite(siteModel, itemInfos, templateDictionary, hubRequestOptions) {
16
+ const infosWithoutSite = itemInfos.filter((info) => info.id !== siteModel.item.id);
17
+ // convert the itemInfo's into things that look enough like a model
18
+ // that we can call shareItemsToSiteGroups
19
+ const pseudoModels = infosWithoutSite.map((e) => {
20
+ return {
21
+ item: {
22
+ id: e.id,
23
+ type: e.type,
24
+ },
25
+ };
26
+ });
27
+ let secondPassPromises = [];
28
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
29
+ secondPassPromises = secondPassPromises.concat(shareItemsToSiteGroups(siteModel, pseudoModels, hubRequestOptions));
30
+ // we can't use that same trick w/ the page sharing
31
+ // because we really need the models themselves
32
+ // so we delegate to a local function
33
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
34
+ secondPassPromises = secondPassPromises.concat(_updateSitePages(siteModel, infosWithoutSite, hubRequestOptions));
35
+ // need to get all the child items and add into site.item.properties.children
36
+ const childItemIds = infosWithoutSite.map((i) => i.id);
37
+ siteModel.item.properties.children = childItemIds;
38
+ // re-interpolate the siteModel using the itemInfos
39
+ siteModel = interpolateSite(siteModel, templateDictionary, {});
40
+ // and update the model
41
+ secondPassPromises.push(updateSite(siteModel, {
42
+ ...hubRequestOptions,
43
+ allowList: undefined,
44
+ }));
45
+ return Promise.all(secondPassPromises).then(() => {
46
+ return true;
47
+ });
48
+ }
49
+ //# sourceMappingURL=_post-process-site.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_post-process-site.js","sourceRoot":"","sources":["../../../src/helpers/_post-process-site.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,kBAAuB,EACvB,iBAAyC;IAEzC,MAAM,gBAAgB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEnF,mEAAmE;IACnE,0CAA0C;IAC1C,MAAM,YAAY,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAC9C,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,mEAAmE;IACnE,kBAAkB,GAAG,kBAAkB,CAAC,MAAM,CAC5C,sBAAsB,CAAC,SAAS,EAAE,YAAmC,EAAE,iBAAiB,CAAC,CAC1F,CAAC;IAEF,mDAAmD;IACnD,+CAA+C;IAC/C,qCAAqC;IACrC,mEAAmE;IACnE,kBAAkB,GAAG,kBAAkB,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CAAC,CAAC;IACjH,6EAA6E;IAC7E,MAAM,YAAY,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAEvD,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,YAAY,CAAC;IAElD,mDAAmD;IACnD,SAAS,GAAG,eAAe,CAAC,SAAS,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAC/D,uBAAuB;IACvB,kBAAkB,CAAC,IAAI,CACrB,UAAU,CAAC,SAAS,EAAE;QACpB,GAAG,iBAAiB;QACpB,SAAS,EAAE,SAAS;KACrB,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"}
@@ -0,0 +1,24 @@
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 { IModel, IHubUserRequestOptions } from "@esri/hub-common";
17
+ /**
18
+ *
19
+ * @param siteModel
20
+ * @param itemInfos
21
+ * @param hubRequestOptions
22
+ * @private
23
+ */
24
+ export declare function _updateSitePages(siteModel: IModel, itemInfos: any[], hubRequestOptions: IHubUserRequestOptions): Promise<any>;
@@ -0,0 +1,39 @@
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 { getModel } from "@esri/hub-common";
17
+ import { _updatePages } from "@esri/hub-sites";
18
+ /**
19
+ *
20
+ * @param siteModel
21
+ * @param itemInfos
22
+ * @param hubRequestOptions
23
+ * @private
24
+ */
25
+ export function _updateSitePages(siteModel, itemInfos, hubRequestOptions) {
26
+ const pageIds = itemInfos
27
+ .filter((e) => {
28
+ return e.type.indexOf("Page") > -1;
29
+ })
30
+ .map((e) => e.id);
31
+ // now get all those models
32
+ return Promise.all(pageIds.map((id) => {
33
+ return getModel(id, hubRequestOptions);
34
+ })).then((pageModels) => {
35
+ // now delegate back to hub.js internal _updatePages fn
36
+ return _updatePages(siteModel, pageModels, hubRequestOptions);
37
+ });
38
+ }
39
+ //# sourceMappingURL=_update-site-pages.js.map
@@ -0,0 +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;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,SAAgB,EAChB,iBAAyC;IAEzC,MAAM,OAAO,GAAG,SAAS;SACtB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QACZ,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAEpB,2BAA2B;IAC3B,OAAO,OAAO,CAAC,GAAG,CAChB,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;QACjB,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"}
@@ -0,0 +1,26 @@
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
+ import { IModel } from "@esri/hub-common";
17
+ import { UserSession } from "@esri/solution-common";
18
+ /**
19
+ * Move the created site item, and optionally the Initiative, into
20
+ * the solution folder
21
+ *
22
+ * @param siteModel
23
+ * @param folderId
24
+ * @param authentication
25
+ */
26
+ export declare function moveModelToFolder(siteModel: IModel, folderId: string, authentication: UserSession): Promise<any>;
@@ -0,0 +1,46 @@
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
+ import { getProp, failSafe } from "@esri/hub-common";
17
+ import { moveItem } from "@esri/solution-common";
18
+ /**
19
+ * Move the created site item, and optionally the Initiative, into
20
+ * the solution folder
21
+ *
22
+ * @param siteModel
23
+ * @param folderId
24
+ * @param authentication
25
+ */
26
+ export function moveModelToFolder(siteModel, folderId, authentication) {
27
+ // Fail-Safe the move call as it's not critical if it fails
28
+ const failSafeMove = failSafe(moveItem, { success: true });
29
+ const movePromises = [
30
+ failSafeMove({
31
+ itemId: siteModel.item.id,
32
+ folderId,
33
+ authentication,
34
+ }),
35
+ ];
36
+ // if an initiative was created...
37
+ if (getProp(siteModel, "item.properties.parentInitiativeId")) {
38
+ movePromises.push(failSafeMove({
39
+ itemId: siteModel.item.properties.parentInitiativeId,
40
+ folderId,
41
+ authentication,
42
+ }));
43
+ }
44
+ return Promise.all(movePromises);
45
+ }
46
+ //# sourceMappingURL=move-model-to-folder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-model-to-folder.js","sourceRoot":"","sources":["../../../src/helpers/move-model-to-folder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAU,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAe,MAAM,uBAAuB,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB,EAAE,QAAgB,EAAE,cAA2B;IAChG,2DAA2D;IAC3D,MAAM,YAAY,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAE3D,MAAM,YAAY,GAAG;QACnB,YAAY,CAAC;YACX,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE;YACzB,QAAQ;YACR,cAAc;SACf,CAAC;KACH,CAAC;IACF,kCAAkC;IAClC,IAAI,OAAO,CAAC,SAAS,EAAE,oCAAoC,CAAC,EAAE;QAC5D,YAAY,CAAC,IAAI,CACf,YAAY,CAAC;YACX,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB;YACpD,QAAQ;YACR,cAAc;SACf,CAAC,CACH,CAAC;KACH;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AACnC,CAAC"}