@esri/solution-web-experience 4.1.2 → 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 (33) hide show
  1. package/dist/cjs/helpers/convert-web-experience-to-template.d.ts +27 -27
  2. package/dist/cjs/helpers/convert-web-experience-to-template.js +66 -66
  3. package/dist/cjs/helpers/create-web-experience-model-from-template.d.ts +26 -26
  4. package/dist/cjs/helpers/create-web-experience-model-from-template.js +41 -41
  5. package/dist/cjs/helpers/create-web-experience.d.ts +25 -25
  6. package/dist/cjs/helpers/create-web-experience.js +121 -121
  7. package/dist/cjs/helpers/get-experience-subdomain.d.ts +23 -23
  8. package/dist/cjs/helpers/get-experience-subdomain.js +25 -25
  9. package/dist/cjs/helpers/get-web-experience-dependencies.d.ts +23 -23
  10. package/dist/cjs/helpers/get-web-experience-dependencies.js +32 -32
  11. package/dist/cjs/helpers/get-web-experience-url-template.d.ts +23 -23
  12. package/dist/cjs/helpers/get-web-experience-url-template.js +25 -25
  13. package/dist/cjs/index.d.ts +17 -17
  14. package/dist/cjs/index.js +21 -21
  15. package/dist/cjs/web-experience-processor.d.ts +51 -51
  16. package/dist/cjs/web-experience-processor.js +125 -125
  17. package/dist/esm/helpers/convert-web-experience-to-template.d.ts +27 -27
  18. package/dist/esm/helpers/convert-web-experience-to-template.js +62 -62
  19. package/dist/esm/helpers/create-web-experience-model-from-template.d.ts +26 -26
  20. package/dist/esm/helpers/create-web-experience-model-from-template.js +37 -37
  21. package/dist/esm/helpers/create-web-experience.d.ts +25 -25
  22. package/dist/esm/helpers/create-web-experience.js +117 -117
  23. package/dist/esm/helpers/get-experience-subdomain.d.ts +23 -23
  24. package/dist/esm/helpers/get-experience-subdomain.js +21 -21
  25. package/dist/esm/helpers/get-web-experience-dependencies.d.ts +23 -23
  26. package/dist/esm/helpers/get-web-experience-dependencies.js +28 -28
  27. package/dist/esm/helpers/get-web-experience-url-template.d.ts +23 -23
  28. package/dist/esm/helpers/get-web-experience-url-template.js +21 -21
  29. package/dist/esm/index.d.ts +17 -17
  30. package/dist/esm/index.js +17 -17
  31. package/dist/esm/web-experience-processor.d.ts +51 -51
  32. package/dist/esm/web-experience-processor.js +119 -119
  33. package/package.json +4 -4
@@ -1,51 +1,51 @@
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 web-experience item types.
18
- *
19
- * @module solution-web-experience
20
- */
21
- import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse, IUpdateItemResponse } from "@esri/solution-common";
22
- /**
23
- * Convert a Web Experience item into a Template
24
- *
25
- * @param solutionItemId
26
- * @param itemInfo
27
- * @param destAuthentication Credentials for requests to the destination organization
28
- * @param srcAuthentication Credentials for requests to source items
29
- * @param isGroup
30
- */
31
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession): Promise<IItemTemplate>;
32
- /**
33
- * Create a Web Experience from a Template
34
- *
35
- * @param template
36
- * @param templateDictionary
37
- * @param destinationAuthentication
38
- * @param itemProgressCallback
39
- */
40
- export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
41
- /**
42
- * Post-Process an Experience
43
- *
44
- * @param {string} itemId The item ID
45
- * @param {string} type The template type
46
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
47
- * @param {any} templateDictionary The template dictionary
48
- * @param {UserSession} authentication The destination session info
49
- * @returns Promise resolving to successfulness of update
50
- */
51
- export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: IItemTemplate, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<IUpdateItemResponse>;
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 web-experience item types.
18
+ *
19
+ * @module solution-web-experience
20
+ */
21
+ import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse, IUpdateItemResponse } from "@esri/solution-common";
22
+ /**
23
+ * Convert a Web Experience item into a Template
24
+ *
25
+ * @param solutionItemId
26
+ * @param itemInfo
27
+ * @param destAuthentication Credentials for requests to the destination organization
28
+ * @param srcAuthentication Credentials for requests to source items
29
+ * @param isGroup
30
+ */
31
+ export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession): Promise<IItemTemplate>;
32
+ /**
33
+ * Create a Web Experience from a Template
34
+ *
35
+ * @param template
36
+ * @param templateDictionary
37
+ * @param destinationAuthentication
38
+ * @param itemProgressCallback
39
+ */
40
+ export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
41
+ /**
42
+ * Post-Process an Experience
43
+ *
44
+ * @param {string} itemId The item ID
45
+ * @param {string} type The template type
46
+ * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
47
+ * @param {any} templateDictionary The template dictionary
48
+ * @param {UserSession} authentication The destination session info
49
+ * @returns Promise resolving to successfulness of update
50
+ */
51
+ export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: IItemTemplate, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<IUpdateItemResponse>;
@@ -1,120 +1,120 @@
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 web-experience item types.
18
- *
19
- * @module solution-web-experience
20
- */
21
- import { EItemProgressStatus, convertIModel, generateEmptyCreationResponse, updateItemTemplateFromDictionary } from "@esri/solution-common";
22
- import { failSafe } from "@esri/hub-common";
23
- import { getItemData, removeItem } from "@esri/arcgis-rest-portal";
24
- import { createWebExperienceModelFromTemplate } from "./helpers/create-web-experience-model-from-template";
25
- import { createWebExperience } from "./helpers/create-web-experience";
26
- import { convertWebExperienceToTemplate } from "./helpers/convert-web-experience-to-template";
27
- /**
28
- * Convert a Web Experience item into a Template
29
- *
30
- * @param solutionItemId
31
- * @param itemInfo
32
- * @param destAuthentication Credentials for requests to the destination organization
33
- * @param srcAuthentication Credentials for requests to source items
34
- * @param isGroup
35
- */
36
- export function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
37
- // use the itemInfo to setup a model
38
- const model = {
39
- item: itemInfo,
40
- data: {}
41
- };
42
- // fetch the data.json
43
- return getItemData(itemInfo.id, { authentication: srcAuthentication }).then(data => {
44
- // append into the model
45
- model.data = data;
46
- // and use that to create a template
47
- return convertWebExperienceToTemplate(model);
48
- });
49
- }
50
- /**
51
- * Create a Web Experience from a Template
52
- *
53
- * @param template
54
- * @param templateDictionary
55
- * @param destinationAuthentication
56
- * @param itemProgressCallback
57
- */
58
- export function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
59
- // let the progress system know we've started...
60
- const startStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Started, 0);
61
- // and if it returned false, just resolve out
62
- if (!startStatus) {
63
- return Promise.resolve(generateEmptyCreationResponse(template.type));
64
- }
65
- let exbModel;
66
- return createWebExperienceModelFromTemplate(template, templateDictionary, {}, destinationAuthentication)
67
- .then(model => {
68
- exbModel = model;
69
- return createWebExperience(model, templateDictionary.folderId, {}, destinationAuthentication);
70
- })
71
- .then(createdModel => {
72
- exbModel.item.id = createdModel.item.id;
73
- exbModel.item.url = createdModel.item.url;
74
- // Update the template dictionary
75
- // TODO: This should be done in whatever recieves
76
- // the outcome of this promise chain
77
- templateDictionary[template.itemId] = {
78
- itemId: createdModel.item.id
79
- };
80
- const finalStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, createdModel.item.id);
81
- if (!finalStatus) {
82
- // clean up the site we just created
83
- const failSafeRemove = failSafe(removeItem, { success: true });
84
- return failSafeRemove({
85
- id: exbModel.item.id,
86
- authentication: destinationAuthentication
87
- }).then(() => {
88
- return Promise.resolve(generateEmptyCreationResponse(template.type));
89
- });
90
- }
91
- else {
92
- // finally, return ICreateItemFromTemplateResponse
93
- const response = {
94
- item: {
95
- ...template,
96
- ...convertIModel(exbModel)
97
- },
98
- id: exbModel.item.id,
99
- type: template.type,
100
- postProcess: false
101
- };
102
- response.item.itemId = exbModel.item.id;
103
- return response;
104
- }
105
- });
106
- }
107
- /**
108
- * Post-Process an Experience
109
- *
110
- * @param {string} itemId The item ID
111
- * @param {string} type The template type
112
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
113
- * @param {any} templateDictionary The template dictionary
114
- * @param {UserSession} authentication The destination session info
115
- * @returns Promise resolving to successfulness of update
116
- */
117
- export function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
118
- return updateItemTemplateFromDictionary(itemId, templateDictionary, authentication);
119
- }
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 web-experience item types.
18
+ *
19
+ * @module solution-web-experience
20
+ */
21
+ import { EItemProgressStatus, convertIModel, generateEmptyCreationResponse, updateItemTemplateFromDictionary } from "@esri/solution-common";
22
+ import { failSafe } from "@esri/hub-common";
23
+ import { getItemData, removeItem } from "@esri/arcgis-rest-portal";
24
+ import { createWebExperienceModelFromTemplate } from "./helpers/create-web-experience-model-from-template";
25
+ import { createWebExperience } from "./helpers/create-web-experience";
26
+ import { convertWebExperienceToTemplate } from "./helpers/convert-web-experience-to-template";
27
+ /**
28
+ * Convert a Web Experience item into a Template
29
+ *
30
+ * @param solutionItemId
31
+ * @param itemInfo
32
+ * @param destAuthentication Credentials for requests to the destination organization
33
+ * @param srcAuthentication Credentials for requests to source items
34
+ * @param isGroup
35
+ */
36
+ export function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
37
+ // use the itemInfo to setup a model
38
+ const model = {
39
+ item: itemInfo,
40
+ data: {}
41
+ };
42
+ // fetch the data.json
43
+ return getItemData(itemInfo.id, { authentication: srcAuthentication }).then(data => {
44
+ // append into the model
45
+ model.data = data;
46
+ // and use that to create a template
47
+ return convertWebExperienceToTemplate(model);
48
+ });
49
+ }
50
+ /**
51
+ * Create a Web Experience from a Template
52
+ *
53
+ * @param template
54
+ * @param templateDictionary
55
+ * @param destinationAuthentication
56
+ * @param itemProgressCallback
57
+ */
58
+ export function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
59
+ // let the progress system know we've started...
60
+ const startStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Started, 0);
61
+ // and if it returned false, just resolve out
62
+ if (!startStatus) {
63
+ return Promise.resolve(generateEmptyCreationResponse(template.type));
64
+ }
65
+ let exbModel;
66
+ return createWebExperienceModelFromTemplate(template, templateDictionary, {}, destinationAuthentication)
67
+ .then(model => {
68
+ exbModel = model;
69
+ return createWebExperience(model, templateDictionary.folderId, {}, destinationAuthentication);
70
+ })
71
+ .then(createdModel => {
72
+ exbModel.item.id = createdModel.item.id;
73
+ exbModel.item.url = createdModel.item.url;
74
+ // Update the template dictionary
75
+ // TODO: This should be done in whatever recieves
76
+ // the outcome of this promise chain
77
+ templateDictionary[template.itemId] = {
78
+ itemId: createdModel.item.id
79
+ };
80
+ const finalStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, createdModel.item.id);
81
+ if (!finalStatus) {
82
+ // clean up the site we just created
83
+ const failSafeRemove = failSafe(removeItem, { success: true });
84
+ return failSafeRemove({
85
+ id: exbModel.item.id,
86
+ authentication: destinationAuthentication
87
+ }).then(() => {
88
+ return Promise.resolve(generateEmptyCreationResponse(template.type));
89
+ });
90
+ }
91
+ else {
92
+ // finally, return ICreateItemFromTemplateResponse
93
+ const response = {
94
+ item: {
95
+ ...template,
96
+ ...convertIModel(exbModel)
97
+ },
98
+ id: exbModel.item.id,
99
+ type: template.type,
100
+ postProcess: false
101
+ };
102
+ response.item.itemId = exbModel.item.id;
103
+ return response;
104
+ }
105
+ });
106
+ }
107
+ /**
108
+ * Post-Process an Experience
109
+ *
110
+ * @param {string} itemId The item ID
111
+ * @param {string} type The template type
112
+ * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
113
+ * @param {any} templateDictionary The template dictionary
114
+ * @param {UserSession} authentication The destination session info
115
+ * @returns Promise resolving to successfulness of update
116
+ */
117
+ export function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
118
+ return updateItemTemplateFromDictionary(itemId, templateDictionary, authentication);
119
+ }
120
120
  //# sourceMappingURL=web-experience-processor.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-web-experience",
3
- "version": "4.1.2",
3
+ "version": "5.0.0",
4
4
  "description": "Manages the creation and deployment of Web Experience item types for @esri/solution.js.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -25,8 +25,8 @@
25
25
  "@esri/arcgis-rest-service-admin": "^3.6.0",
26
26
  "@esri/hub-common": "^13.4.1",
27
27
  "@esri/hub-initiatives": "^13.0.0",
28
- "@esri/solution-common": "^4.1.2",
29
- "@esri/solution-simple-types": "^4.1.2",
28
+ "@esri/solution-common": "^5.0.0",
29
+ "@esri/solution-simple-types": "^5.0.0",
30
30
  "rollup": "2.79.1"
31
31
  },
32
32
  "dependencies": {
@@ -69,5 +69,5 @@
69
69
  "esri",
70
70
  "ES6"
71
71
  ],
72
- "gitHead": "13ea49fdd2fc75cabe55a19c3620580c4c47643d"
72
+ "gitHead": "a6cbcc049fb712d19e98b7d59a94734aad4dd17f"
73
73
  }