@esri/solution-web-experience 3.0.0 → 3.1.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 (37) hide show
  1. package/package.json +5 -5
  2. package/dist/node/helpers/convert-web-experience-to-template.d.ts +0 -27
  3. package/dist/node/helpers/convert-web-experience-to-template.js +0 -67
  4. package/dist/node/helpers/convert-web-experience-to-template.js.map +0 -1
  5. package/dist/node/helpers/create-web-experience-model-from-template.d.ts +0 -26
  6. package/dist/node/helpers/create-web-experience-model-from-template.js +0 -42
  7. package/dist/node/helpers/create-web-experience-model-from-template.js.map +0 -1
  8. package/dist/node/helpers/create-web-experience.d.ts +0 -25
  9. package/dist/node/helpers/create-web-experience.js +0 -122
  10. package/dist/node/helpers/create-web-experience.js.map +0 -1
  11. package/dist/node/helpers/get-experience-subdomain.d.ts +0 -23
  12. package/dist/node/helpers/get-experience-subdomain.js +0 -26
  13. package/dist/node/helpers/get-experience-subdomain.js.map +0 -1
  14. package/dist/node/helpers/get-web-experience-dependencies.d.ts +0 -23
  15. package/dist/node/helpers/get-web-experience-dependencies.js +0 -33
  16. package/dist/node/helpers/get-web-experience-dependencies.js.map +0 -1
  17. package/dist/node/helpers/get-web-experience-url-template.d.ts +0 -23
  18. package/dist/node/helpers/get-web-experience-url-template.js +0 -26
  19. package/dist/node/helpers/get-web-experience-url-template.js.map +0 -1
  20. package/dist/node/index.d.ts +0 -17
  21. package/dist/node/index.js +0 -22
  22. package/dist/node/index.js.map +0 -1
  23. package/dist/node/web-experience-processor.d.ts +0 -51
  24. package/dist/node/web-experience-processor.js +0 -126
  25. package/dist/node/web-experience-processor.js.map +0 -1
  26. package/dist/umd/web-experience/src/helpers/convert-web-experience-to-template.d.ts +0 -27
  27. package/dist/umd/web-experience/src/helpers/create-web-experience-model-from-template.d.ts +0 -26
  28. package/dist/umd/web-experience/src/helpers/create-web-experience.d.ts +0 -25
  29. package/dist/umd/web-experience/src/helpers/get-experience-subdomain.d.ts +0 -23
  30. package/dist/umd/web-experience/src/helpers/get-web-experience-dependencies.d.ts +0 -23
  31. package/dist/umd/web-experience/src/helpers/get-web-experience-url-template.d.ts +0 -23
  32. package/dist/umd/web-experience/src/index.d.ts +0 -17
  33. package/dist/umd/web-experience/src/web-experience-processor.d.ts +0 -51
  34. package/dist/umd/web-experience.umd.js +0 -428
  35. package/dist/umd/web-experience.umd.js.map +0 -1
  36. package/dist/umd/web-experience.umd.min.js +0 -19
  37. package/dist/umd/web-experience.umd.min.js.map +0 -1
@@ -1,126 +0,0 @@
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.postProcess = exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
19
- /**
20
- * Manages the creation and deployment of web-experience item types.
21
- *
22
- * @module solution-web-experience
23
- */
24
- const solution_common_1 = require("@esri/solution-common");
25
- const hub_common_1 = require("@esri/hub-common");
26
- const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
27
- const create_web_experience_model_from_template_1 = require("./helpers/create-web-experience-model-from-template");
28
- const create_web_experience_1 = require("./helpers/create-web-experience");
29
- const convert_web_experience_to_template_1 = require("./helpers/convert-web-experience-to-template");
30
- /**
31
- * Convert a Web Experience item into a Template
32
- *
33
- * @param solutionItemId
34
- * @param itemInfo
35
- * @param destAuthentication Credentials for requests to the destination organization
36
- * @param srcAuthentication Credentials for requests to source items
37
- * @param isGroup
38
- */
39
- function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
40
- // use the itemInfo to setup a model
41
- const model = {
42
- item: itemInfo,
43
- data: {}
44
- };
45
- // fetch the data.json
46
- return (0, arcgis_rest_portal_1.getItemData)(itemInfo.id, { authentication: srcAuthentication }).then(data => {
47
- // append into the model
48
- model.data = data;
49
- // and use that to create a template
50
- return (0, convert_web_experience_to_template_1.convertWebExperienceToTemplate)(model);
51
- });
52
- }
53
- exports.convertItemToTemplate = convertItemToTemplate;
54
- /**
55
- * Create a Web Experience from a Template
56
- *
57
- * @param template
58
- * @param templateDictionary
59
- * @param destinationAuthentication
60
- * @param itemProgressCallback
61
- */
62
- function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
63
- // let the progress system know we've started...
64
- const startStatus = itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Started, 0);
65
- // and if it returned false, just resolve out
66
- if (!startStatus) {
67
- return Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type));
68
- }
69
- let exbModel;
70
- return (0, create_web_experience_model_from_template_1.createWebExperienceModelFromTemplate)(template, templateDictionary, {}, destinationAuthentication)
71
- .then(model => {
72
- exbModel = model;
73
- return (0, create_web_experience_1.createWebExperience)(model, templateDictionary.folderId, {}, destinationAuthentication);
74
- })
75
- .then(createdModel => {
76
- exbModel.item.id = createdModel.item.id;
77
- exbModel.item.url = createdModel.item.url;
78
- // Update the template dictionary
79
- // TODO: This should be done in whatever recieves
80
- // the outcome of this promise chain
81
- templateDictionary[template.itemId] = {
82
- itemId: createdModel.item.id
83
- };
84
- const finalStatus = itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, createdModel.item.id);
85
- if (!finalStatus) {
86
- // clean up the site we just created
87
- const failSafeRemove = (0, hub_common_1.failSafe)(arcgis_rest_portal_1.removeItem, { success: true });
88
- return failSafeRemove({
89
- id: exbModel.item.id,
90
- authentication: destinationAuthentication
91
- }).then(() => {
92
- return Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type));
93
- });
94
- }
95
- else {
96
- // finally, return ICreateItemFromTemplateResponse
97
- const response = {
98
- item: {
99
- ...template,
100
- ...exbModel
101
- },
102
- id: exbModel.item.id,
103
- type: template.type,
104
- postProcess: false
105
- };
106
- response.item.itemId = exbModel.item.id;
107
- return response;
108
- }
109
- });
110
- }
111
- exports.createItemFromTemplate = createItemFromTemplate;
112
- /**
113
- * Post-Process an Experience
114
- *
115
- * @param {string} itemId The item ID
116
- * @param {string} type The template type
117
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
118
- * @param {any} templateDictionary The template dictionary
119
- * @param {UserSession} authentication The destination session info
120
- * @returns Promise resolving to successfulness of update
121
- */
122
- function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
123
- return (0, solution_common_1.updateItemTemplateFromDictionary)(itemId, templateDictionary, authentication);
124
- }
125
- exports.postProcess = postProcess;
126
- //# sourceMappingURL=web-experience-processor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"web-experience-processor.js","sourceRoot":"","sources":["../../src/web-experience-processor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,2DAS+B;AAC/B,iDAAoD;AACpD,iEAAmE;AACnE,mHAA2G;AAC3G,2EAAsE;AACtE,qGAA8F;AAE9F;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAA+B,EAC/B,iBAA8B;IAE9B,oCAAoC;IACpC,MAAM,KAAK,GAAG;QACZ,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,EAAE;KACC,CAAC;IACZ,sBAAsB;IACtB,OAAO,IAAA,gCAAW,EAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACjF,wBAAwB;QACxB,KAAK,CAAC,IAAI,GAAG,IA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AQ,CAAC,6BAA6B,IAAI,CAAC,EAC3C,YAAY,CAAC,IAAI,CAAC,EAAE,CACrB,CAAC;QAEF,IAAI,CAAC,WAAW,EAAE;YAChB,oCAAoC;YACpC,MAAM,cAAc,GAAG,IAAA,qBAAQ,EAAC,+BAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;YAC/D,OAAO,cAAc,CAAC;gBACpB,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACpB,cAAc,EAAE,yBAAyB;aAC1C,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBACX,OAAO,OAAO,CAAC,OAAO,CAAC,IAAA,+CAA6B,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YACvE,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,kDAAkD;YAClD,MAAM,QAAQ,GAAoC;gBAChD,IAAI,EAAE;oBACJ,GAAG,QAAQ;oBACX,GAAG,QAAQ;iBACZ;gBACD,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACpB,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,WAAW,EAAE,KAAK;aACnB,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,OAAO,QAAQ,CAAC;SACjB;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AA1ED,wDA0EC;AAED;;;;;;;;;GASG;AACH,SAAgB,WAAW,CACzB,MAAc,EACd,IAAY,EACZ,SAAgB,EAChB,QAAuB,EACvB,SAA0B,EAC1B,kBAAuB,EACvB,cAA2B;IAE3B,OAAO,IAAA,kDAAgC,EACrC,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf,CAAC;AACJ,CAAC;AAdD,kCAcC"}
@@ -1,27 +0,0 @@
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 } from "@esri/hub-common";
17
- import { IItemTemplate } from "@esri/solution-common";
18
- /**
19
- * Convert an Experience item into a template
20
- *
21
- * Pretty simpler conversion - remove extra item props, extract out
22
- * items from the data.dataSources hash.
23
- *
24
- * @param model
25
- * @param authentication
26
- */
27
- export declare function convertWebExperienceToTemplate(model: IModel): Promise<IItemTemplate>;
@@ -1,26 +0,0 @@
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
- import { UserSession } from "@esri/solution-common";
18
- /**
19
- * Convert a Web Experience template into a Model that can be persisted to the Portal API
20
- *
21
- * @param templateModel Template
22
- * @param settings Hash of values to interpolate into the template
23
- * @param transforms Hash of transform functions to use in the interpolation
24
- * @param authentication UserSession
25
- */
26
- export declare function createWebExperienceModelFromTemplate(templateModel: IModelTemplate, settings: any, transforms: any, authentication: UserSession): Promise<any>;
@@ -1,25 +0,0 @@
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 } from "@esri/hub-common";
17
- import { UserSession } from "@esri/solution-common";
18
- /**
19
- * Given a Model for a Web Experience, create the item in the Portal API
20
- *
21
- * @param model
22
- * @param options
23
- * @param authentication
24
- */
25
- export declare function createWebExperience(model: IModel, folderId: string, options: any, authentication: UserSession): Promise<IModel>;
@@ -1,23 +0,0 @@
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 { UserSession } from "@esri/solution-common";
17
- /**
18
- * Returns the subdomain for an experience based on the api the session is
19
- * authenticated against
20
- *
21
- * @param authentication UserSession
22
- */
23
- export declare function getExperienceSubdomain(authentication: UserSession): string;
@@ -1,23 +0,0 @@
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 } from "@esri/hub-common";
17
- /**
18
- * Given an Web Experience model, extract out all the
19
- * items it depends on from the `dataSources` hash
20
- *
21
- * @param model IModel
22
- */
23
- export declare function getWebExperienceDependencies(model: IModel): any[];
@@ -1,23 +0,0 @@
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 { UserSession } from "@esri/solution-common";
17
- /**
18
- * For a given environment Prod/qa/dev/portal
19
- * return the correct storymaps base url
20
- *
21
- * @param authentication
22
- */
23
- export declare function getWebExperiencepUrlTemplate(authentication: UserSession): string;
@@ -1,17 +0,0 @@
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 * as WebExperienceProcessor from "./web-experience-processor";
17
- export { WebExperienceProcessor };
@@ -1,51 +0,0 @@
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>;