@esri/solution-web-experience 1.1.2 → 1.2.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.
- package/dist/esm/helpers/convert-web-experience-to-template.js +12 -7
- package/dist/esm/helpers/convert-web-experience-to-template.js.map +1 -1
- package/dist/esm/helpers/create-web-experience-model-from-template.js +1 -1
- package/dist/esm/helpers/create-web-experience-model-from-template.js.map +1 -1
- package/dist/esm/helpers/create-web-experience.js +27 -28
- package/dist/esm/helpers/create-web-experience.js.map +1 -1
- package/dist/esm/helpers/get-experience-subdomain.js +2 -2
- package/dist/esm/helpers/get-experience-subdomain.js.map +1 -1
- package/dist/esm/helpers/get-web-experience-dependencies.js +3 -3
- package/dist/esm/helpers/get-web-experience-dependencies.js.map +1 -1
- package/dist/esm/helpers/get-web-experience-url-template.js +5 -5
- package/dist/esm/helpers/get-web-experience-url-template.js.map +1 -1
- package/dist/esm/web-experience-processor.d.ts +15 -3
- package/dist/esm/web-experience-processor.js +31 -15
- package/dist/esm/web-experience-processor.js.map +1 -1
- package/dist/node/helpers/convert-web-experience-to-template.js +15 -10
- package/dist/node/helpers/convert-web-experience-to-template.js.map +1 -1
- package/dist/node/helpers/create-web-experience-model-from-template.js +3 -3
- package/dist/node/helpers/create-web-experience-model-from-template.js.map +1 -1
- package/dist/node/helpers/create-web-experience.js +28 -29
- package/dist/node/helpers/create-web-experience.js.map +1 -1
- package/dist/node/helpers/get-experience-subdomain.js +2 -2
- package/dist/node/helpers/get-experience-subdomain.js.map +1 -1
- package/dist/node/helpers/get-web-experience-dependencies.js +4 -4
- package/dist/node/helpers/get-web-experience-dependencies.js.map +1 -1
- package/dist/node/helpers/get-web-experience-url-template.js +6 -6
- package/dist/node/helpers/get-web-experience-url-template.js.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/web-experience-processor.d.ts +15 -3
- package/dist/node/web-experience-processor.js +38 -21
- package/dist/node/web-experience-processor.js.map +1 -1
- package/dist/umd/web-experience-processor.d.ts +15 -3
- package/dist/umd/web-experience.umd.js +400 -404
- package/dist/umd/web-experience.umd.js.map +1 -1
- package/dist/umd/web-experience.umd.min.js +3 -3
- package/dist/umd/web-experience.umd.min.js.map +1 -1
- package/package.json +21 -21
|
@@ -26,18 +26,23 @@ import { getWebExperienceDependencies } from "./get-web-experience-dependencies"
|
|
|
26
26
|
* @param authentication
|
|
27
27
|
*/
|
|
28
28
|
export function convertWebExperienceToTemplate(model) {
|
|
29
|
-
|
|
30
|
-
tmpl.key = propifyString(model.item.title)
|
|
31
|
-
|
|
29
|
+
const tmpl = createPlaceholderTemplate(model.item.id, model.item.type);
|
|
30
|
+
tmpl.key = `${propifyString(model.item.title)}_${createId("i")}`;
|
|
31
|
+
const clone = cloneObject(model);
|
|
32
32
|
tmpl.data = clone.data;
|
|
33
|
+
// We need to save these properties in order to restore them after hub.js deletes them
|
|
34
|
+
const created = clone.item.created;
|
|
35
|
+
const modified = clone.item.modified;
|
|
33
36
|
tmpl.item = normalizeSolutionTemplateItem(clone.item);
|
|
37
|
+
tmpl.item.created = created;
|
|
38
|
+
tmpl.item.modified = modified;
|
|
34
39
|
// templatize the url. This is updated during the createModelFromTemplate phase
|
|
35
40
|
// of the deployment process
|
|
36
41
|
tmpl.item.url = "{{experienceUrlTemplate}}";
|
|
37
42
|
// use typeKeyword to mark item as published (we decided to discard unpublished drafts)
|
|
38
|
-
|
|
43
|
+
const typeKeywords = tmpl.item.typeKeywords;
|
|
39
44
|
if (typeKeywords.indexOf(changedTypeKW) !== -1) {
|
|
40
|
-
tmpl.item.typeKeywords = [publishedTypeKW].concat(tmpl.item.typeKeywords.filter(
|
|
45
|
+
tmpl.item.typeKeywords = [publishedTypeKW].concat(tmpl.item.typeKeywords.filter(word => word !== changedTypeKW));
|
|
41
46
|
}
|
|
42
47
|
tmpl.dependencies = getWebExperienceDependencies(model);
|
|
43
48
|
return Promise.resolve(tmpl);
|
|
@@ -53,6 +58,6 @@ export function convertWebExperienceToTemplate(model) {
|
|
|
53
58
|
// return tmpl;
|
|
54
59
|
// });
|
|
55
60
|
}
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
const publishedTypeKW = "status: Published";
|
|
62
|
+
const changedTypeKW = "status: Changed";
|
|
58
63
|
//# sourceMappingURL=convert-web-experience-to-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-web-experience-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-web-experience-to-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,6BAA6B,EAC7B,WAAW,EACX,aAAa,EACb,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEL,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF;;;;;;;;GAQG;AACH,MAAM,UAAU,8BAA8B,CAC5C,KAAa;IAEb,
|
|
1
|
+
{"version":3,"file":"convert-web-experience-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-web-experience-to-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,6BAA6B,EAC7B,WAAW,EACX,aAAa,EACb,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEL,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF;;;;;;;;GAQG;AACH,MAAM,UAAU,8BAA8B,CAC5C,KAAa;IAEb,MAAM,IAAI,GAAG,yBAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,IAAI,CAAC,GAAG,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,QAAQ,C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AAM,aAAa,GAAG,iBAAiB,CAAC"}
|
|
@@ -26,7 +26,7 @@ import { getWebExperiencepUrlTemplate } from "./get-web-experience-url-template"
|
|
|
26
26
|
export function createWebExperienceModelFromTemplate(templateModel, settings, transforms, authentication) {
|
|
27
27
|
// get the experience base url
|
|
28
28
|
settings.experienceUrlTemplate = getWebExperiencepUrlTemplate(authentication);
|
|
29
|
-
|
|
29
|
+
const model = interpolate(templateModel, settings, transforms);
|
|
30
30
|
// ensure this is set - there may be some templates w/o `{{experienceTemplateUrl}}
|
|
31
31
|
model.item.url = settings.experienceUrlTemplate;
|
|
32
32
|
/* istanbul ignore else */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-web-experience-model-from-template.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience-model-from-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF;;;;;;;GAOG;AACH,MAAM,UAAU,oCAAoC,CAClD,aAA6B,EAC7B,QAAa,EACb,UAAe,EACf,cAA2B;IAE3B,8BAA8B;IAC9B,QAAQ,CAAC,qBAAqB,GAAG,4BAA4B,CAAC,cAAc,CAAC,CAAC;IAC9E,
|
|
1
|
+
{"version":3,"file":"create-web-experience-model-from-template.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience-model-from-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF;;;;;;;GAOG;AACH,MAAM,UAAU,oCAAoC,CAClD,aAA6B,EAC7B,QAAa,EACb,UAAe,EACf,cAA2B;IAE3B,8BAA8B;IAC9B,QAAQ,CAAC,qBAAqB,GAAG,4BAA4B,CAAC,cAAc,CAAC,CAAC;IAC9E,MAAM,KAAK,GAAG,WAAW,CAAC,aAAa,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/D,kFAAkF;IAClF,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,qBAAqB,CAAC;IAChD,0BAA0B;IAC1B,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE;QAChC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,yCAAyC;KAC/F;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { cloneObject, failSafe, serializeModel, interpolateItemId, stringToBlob } from "@esri/hub-common";
|
|
16
|
+
import { cloneObject, failSafe, serializeModel, interpolateItemId, stringToBlob, objectToJsonBlob } from "@esri/hub-common";
|
|
17
17
|
import { createItem, updateItem, addItemResource, moveItem } from "@esri/arcgis-rest-portal";
|
|
18
18
|
/**
|
|
19
19
|
* Given a Model for a Web Experience, create the item in the Portal API
|
|
@@ -23,13 +23,13 @@ import { createItem, updateItem, addItemResource, moveItem } from "@esri/arcgis-
|
|
|
23
23
|
* @param authentication
|
|
24
24
|
*/
|
|
25
25
|
export function createWebExperience(model, folderId, options, authentication) {
|
|
26
|
-
|
|
26
|
+
const resources = [];
|
|
27
27
|
// For unkown reasons we can not seem to spy on createItemInFolder
|
|
28
28
|
// so we will create-then-move for now
|
|
29
|
-
|
|
29
|
+
const createOptions = {
|
|
30
30
|
// need to serialize
|
|
31
31
|
item: serializeModel(model),
|
|
32
|
-
authentication
|
|
32
|
+
authentication
|
|
33
33
|
};
|
|
34
34
|
/* istanbul ignore else */
|
|
35
35
|
if (model.item.thumbnail) {
|
|
@@ -41,21 +41,22 @@ export function createWebExperience(model, folderId, options, authentication) {
|
|
|
41
41
|
}
|
|
42
42
|
// Create the item
|
|
43
43
|
return (createItem(createOptions)
|
|
44
|
-
.then(
|
|
44
|
+
.then((createResponse) => {
|
|
45
45
|
model.item.id = createResponse.id;
|
|
46
|
-
|
|
46
|
+
const savedThumbnail = model.item.thumbnail;
|
|
47
47
|
model = interpolateItemId(model);
|
|
48
48
|
model.item.thumbnail = savedThumbnail; // interpolation trashes thumbnail binary
|
|
49
49
|
// Experiences store draft data in a resource attached to the item
|
|
50
50
|
// We'll just use the published data for the first "draft"
|
|
51
|
-
|
|
51
|
+
// changed from stringToBlob to objectToJsonBlob for issue #742
|
|
52
|
+
const draftResourceModel = cloneObject(model.data);
|
|
52
53
|
resources.push({
|
|
53
54
|
name: "config.json",
|
|
54
55
|
prefix: "config",
|
|
55
|
-
file:
|
|
56
|
+
file: objectToJsonBlob(draftResourceModel)
|
|
56
57
|
});
|
|
57
58
|
// there may also be this image resources list
|
|
58
|
-
|
|
59
|
+
const imageListModel = cloneObject(model.properties.imageResourcesList);
|
|
59
60
|
if (imageListModel) {
|
|
60
61
|
resources.push({
|
|
61
62
|
name: "image-resources-list.json",
|
|
@@ -65,9 +66,9 @@ export function createWebExperience(model, folderId, options, authentication) {
|
|
|
65
66
|
}
|
|
66
67
|
delete model.properties;
|
|
67
68
|
// update the experience with the newly interpolated model
|
|
68
|
-
|
|
69
|
+
const updateOptions = {
|
|
69
70
|
item: serializeModel(model),
|
|
70
|
-
authentication
|
|
71
|
+
authentication
|
|
71
72
|
};
|
|
72
73
|
if (model.item.thumbnail) {
|
|
73
74
|
updateOptions.params = {
|
|
@@ -81,22 +82,20 @@ export function createWebExperience(model, folderId, options, authentication) {
|
|
|
81
82
|
authentication.getUsername()
|
|
82
83
|
]);
|
|
83
84
|
})
|
|
84
|
-
.then(
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
.then((responses) => {
|
|
86
|
+
const username = responses[1];
|
|
87
|
+
const failSafeAddItemResource = failSafe(addItemResource, {
|
|
87
88
|
success: true
|
|
88
89
|
});
|
|
89
90
|
// upload the data and oembed resources
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
});
|
|
99
|
-
});
|
|
91
|
+
const resourceUploadPromises = resources.map(resource => failSafeAddItemResource({
|
|
92
|
+
id: model.item.id,
|
|
93
|
+
owner: username,
|
|
94
|
+
resource: resource.file,
|
|
95
|
+
name: resource.name,
|
|
96
|
+
prefix: resource.prefix,
|
|
97
|
+
authentication
|
|
98
|
+
}));
|
|
100
99
|
// fire and forget
|
|
101
100
|
return Promise.all(resourceUploadPromises);
|
|
102
101
|
})
|
|
@@ -104,15 +103,15 @@ export function createWebExperience(model, folderId, options, authentication) {
|
|
|
104
103
|
// // TODO: Can we leave this to the main process?
|
|
105
104
|
// return uploadResourcesFromUrl(model, options.assets || [], authentication);
|
|
106
105
|
// })
|
|
107
|
-
.then(
|
|
106
|
+
.then(() => {
|
|
108
107
|
// Move it
|
|
109
108
|
return moveItem({
|
|
110
109
|
itemId: model.item.id,
|
|
111
|
-
folderId
|
|
112
|
-
authentication
|
|
110
|
+
folderId,
|
|
111
|
+
authentication
|
|
113
112
|
});
|
|
114
113
|
})
|
|
115
|
-
.then(
|
|
114
|
+
.then(() => {
|
|
116
115
|
return model;
|
|
117
116
|
}));
|
|
118
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-web-experience.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAEL,WAAW,EACX,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,YAAY,
|
|
1
|
+
{"version":3,"file":"create-web-experience.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAE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vB,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,cAAc;SACf,CAAC,CACH,CAAC;QACF,kBAAkB;QAClB,OAAO,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IAC7C,CAAC,CAAC;QACF,gBAAgB;QAChB,oDAAoD;QACpD,gFAAgF;QAChF,KAAK;SACJ,IAAI,CAAC,GAAG,EAAE;QACT,UAAU;QACV,OAAO,QAAQ,CAAC;YACd,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;YACrB,QAAQ;YACR,cAAc;SACf,CAAC,CAAC;IACL,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,EAAE;QACT,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* @param authentication UserSession
|
|
6
6
|
*/
|
|
7
7
|
export function getExperienceSubdomain(authentication) {
|
|
8
|
-
|
|
8
|
+
const portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
|
|
9
9
|
// TODO: Sort out how we locate experiences on portal?
|
|
10
|
-
|
|
10
|
+
let result;
|
|
11
11
|
if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
|
|
12
12
|
result = "experienceqa";
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-experience-subdomain.js","sourceRoot":"","sources":["../../../src/helpers/get-experience-subdomain.ts"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,cAA2B;IAChE,
|
|
1
|
+
{"version":3,"file":"get-experience-subdomain.js","sourceRoot":"","sources":["../../../src/helpers/get-experience-subdomain.ts"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,cAA2B;IAChE,MAAM,SAAS,GACb,cAAc,CAAC,MAAM,IAAI,qCAAqC,CAAC;IACjE,sDAAsD;IACtD,IAAI,MAAM,CAAC;IACX,IAAI,SAAS,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;QACnD,MAAM,GAAG,cAAc,CAAC;KACzB;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE;QAC/D,MAAM,GAAG,eAAe,CAAC;KAC1B;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE;QACtD,MAAM,GAAG,YAAY,CAAC;KACvB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -21,9 +21,9 @@ import { getProp, maybePush } from "@esri/hub-common";
|
|
|
21
21
|
* @param model IModel
|
|
22
22
|
*/
|
|
23
23
|
export function getWebExperienceDependencies(model) {
|
|
24
|
-
|
|
25
|
-
return Object.keys(dataSources).reduce(
|
|
26
|
-
return maybePush(getProp(dataSources, key
|
|
24
|
+
const dataSources = getProp(model, "data.dataSources") || {};
|
|
25
|
+
return Object.keys(dataSources).reduce((acc, key) => {
|
|
26
|
+
return maybePush(getProp(dataSources, `${key}.itemId`), acc);
|
|
27
27
|
}, []);
|
|
28
28
|
}
|
|
29
29
|
//# sourceMappingURL=get-web-experience-dependencies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-web-experience-dependencies.js","sourceRoot":"","sources":["../../../src/helpers/get-web-experience-dependencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAU,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAa;IACxD,
|
|
1
|
+
{"version":3,"file":"get-web-experience-dependencies.js","sourceRoot":"","sources":["../../../src/helpers/get-web-experience-dependencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAU,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAa;IACxD,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE,kBAAkB,CAAC,IAAI,EAAE,CAAC;IAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAClD,OAAO,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,GAAG,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC;IAC/D,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
|
|
@@ -6,16 +6,16 @@ import { getExperienceSubdomain } from "./get-experience-subdomain";
|
|
|
6
6
|
* @param authentication
|
|
7
7
|
*/
|
|
8
8
|
export function getWebExperiencepUrlTemplate(authentication) {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
let baseUrl = "";
|
|
10
|
+
const subdomain = getExperienceSubdomain(authentication);
|
|
11
11
|
if (subdomain) {
|
|
12
|
-
baseUrl =
|
|
12
|
+
baseUrl = `https://${subdomain}.arcgis.com/experience/{{appid}}`;
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
15
|
// we're on portal
|
|
16
16
|
// chop off the /sharing/rest to get the baseUrl
|
|
17
|
-
|
|
18
|
-
baseUrl = portalBaseUrl
|
|
17
|
+
const portalBaseUrl = authentication.portal.replace("/sharing/rest", "");
|
|
18
|
+
baseUrl = `${portalBaseUrl}/apps/experiencebuilder/?id={{appid}}`;
|
|
19
19
|
}
|
|
20
20
|
return baseUrl;
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-web-experience-url-template.js","sourceRoot":"","sources":["../../../src/helpers/get-web-experience-url-template.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,cAA2B;IAE3B,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,
|
|
1
|
+
{"version":3,"file":"get-web-experience-url-template.js","sourceRoot":"","sources":["../../../src/helpers/get-web-experience-url-template.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,cAA2B;IAE3B,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,MAAM,SAAS,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACzD,IAAI,SAAS,EAAE;QACb,OAAO,GAAG,WAAW,SAAS,kCAAkC,CAAC;KAClE;SAAM;QACL,kBAAkB;QAClB,gDAAgD;QAChD,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QACzE,OAAO,GAAG,GAAG,aAAa,uCAAuC,CAAC;KACnE;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -18,16 +18,17 @@
|
|
|
18
18
|
*
|
|
19
19
|
* @module solution-web-experience
|
|
20
20
|
*/
|
|
21
|
-
import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse } from "@esri/solution-common";
|
|
21
|
+
import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse, IUpdateItemResponse } from "@esri/solution-common";
|
|
22
22
|
/**
|
|
23
23
|
* Convert a Web Experience item into a Template
|
|
24
24
|
*
|
|
25
25
|
* @param solutionItemId
|
|
26
26
|
* @param itemInfo
|
|
27
|
-
* @param
|
|
27
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
28
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
28
29
|
* @param isGroup
|
|
29
30
|
*/
|
|
30
|
-
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any,
|
|
31
|
+
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession): Promise<IItemTemplate>;
|
|
31
32
|
/**
|
|
32
33
|
* Create a Web Experience from a Template
|
|
33
34
|
*
|
|
@@ -37,3 +38,14 @@ export declare function convertItemToTemplate(solutionItemId: string, itemInfo:
|
|
|
37
38
|
* @param itemProgressCallback
|
|
38
39
|
*/
|
|
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>;
|
|
@@ -13,13 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { __assign } from "tslib";
|
|
17
16
|
/**
|
|
18
17
|
* Manages the creation and deployment of web-experience item types.
|
|
19
18
|
*
|
|
20
19
|
* @module solution-web-experience
|
|
21
20
|
*/
|
|
22
|
-
import { EItemProgressStatus, generateEmptyCreationResponse } from "@esri/solution-common";
|
|
21
|
+
import { EItemProgressStatus, generateEmptyCreationResponse, updateItemTemplateFromDictionary } from "@esri/solution-common";
|
|
23
22
|
import { failSafe } from "@esri/hub-common";
|
|
24
23
|
import { getItemData, removeItem } from "@esri/arcgis-rest-portal";
|
|
25
24
|
import { createWebExperienceModelFromTemplate } from "./helpers/create-web-experience-model-from-template";
|
|
@@ -30,17 +29,18 @@ import { convertWebExperienceToTemplate } from "./helpers/convert-web-experience
|
|
|
30
29
|
*
|
|
31
30
|
* @param solutionItemId
|
|
32
31
|
* @param itemInfo
|
|
33
|
-
* @param
|
|
32
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
33
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
34
34
|
* @param isGroup
|
|
35
35
|
*/
|
|
36
|
-
export function convertItemToTemplate(solutionItemId, itemInfo,
|
|
36
|
+
export function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
|
|
37
37
|
// use the itemInfo to setup a model
|
|
38
|
-
|
|
38
|
+
const model = {
|
|
39
39
|
item: itemInfo,
|
|
40
40
|
data: {}
|
|
41
41
|
};
|
|
42
42
|
// fetch the data.json
|
|
43
|
-
return getItemData(itemInfo.id, { authentication:
|
|
43
|
+
return getItemData(itemInfo.id, { authentication: srcAuthentication }).then(data => {
|
|
44
44
|
// append into the model
|
|
45
45
|
model.data = data;
|
|
46
46
|
// and use that to create a template
|
|
@@ -57,18 +57,18 @@ export function convertItemToTemplate(solutionItemId, itemInfo, authentication)
|
|
|
57
57
|
*/
|
|
58
58
|
export function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
59
59
|
// let the progress system know we've started...
|
|
60
|
-
|
|
60
|
+
const startStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Started, 0);
|
|
61
61
|
// and if it returned false, just resolve out
|
|
62
62
|
if (!startStatus) {
|
|
63
63
|
return Promise.resolve(generateEmptyCreationResponse(template.type));
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
let exbModel;
|
|
66
66
|
return createWebExperienceModelFromTemplate(template, templateDictionary, {}, destinationAuthentication)
|
|
67
|
-
.then(
|
|
67
|
+
.then(model => {
|
|
68
68
|
exbModel = model;
|
|
69
69
|
return createWebExperience(model, templateDictionary.folderId, {}, destinationAuthentication);
|
|
70
70
|
})
|
|
71
|
-
.then(
|
|
71
|
+
.then(createdModel => {
|
|
72
72
|
exbModel.item.id = createdModel.item.id;
|
|
73
73
|
exbModel.item.url = createdModel.item.url;
|
|
74
74
|
// Update the template dictionary
|
|
@@ -77,21 +77,24 @@ export function createItemFromTemplate(template, templateDictionary, destination
|
|
|
77
77
|
templateDictionary[template.itemId] = {
|
|
78
78
|
itemId: createdModel.item.id
|
|
79
79
|
};
|
|
80
|
-
|
|
80
|
+
const finalStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, createdModel.item.id);
|
|
81
81
|
if (!finalStatus) {
|
|
82
82
|
// clean up the site we just created
|
|
83
|
-
|
|
83
|
+
const failSafeRemove = failSafe(removeItem, { success: true });
|
|
84
84
|
return failSafeRemove({
|
|
85
85
|
id: exbModel.item.id,
|
|
86
86
|
authentication: destinationAuthentication
|
|
87
|
-
}).then(
|
|
87
|
+
}).then(() => {
|
|
88
88
|
return Promise.resolve(generateEmptyCreationResponse(template.type));
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
92
92
|
// finally, return ICreateItemFromTemplateResponse
|
|
93
|
-
|
|
94
|
-
item:
|
|
93
|
+
const response = {
|
|
94
|
+
item: {
|
|
95
|
+
...template,
|
|
96
|
+
...exbModel
|
|
97
|
+
},
|
|
95
98
|
id: exbModel.item.id,
|
|
96
99
|
type: template.type,
|
|
97
100
|
postProcess: false
|
|
@@ -101,4 +104,17 @@ export function createItemFromTemplate(template, templateDictionary, destination
|
|
|
101
104
|
}
|
|
102
105
|
});
|
|
103
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
|
+
}
|
|
104
120
|
//# sourceMappingURL=web-experience-processor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-experience-processor.js","sourceRoot":"","sources":["../../src/web-experience-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"web-experience-processor.js","sourceRoot":"","sources":["../../src/web-experience-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,EAEL,mBAAmB,EAKnB,6BAA6B,EAC7B,gCAAgC,EACjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAU,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,oCAAoC,EAAE,MAAM,qDAAqD,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AAE9F;;;;;;;;GAQG;AACH,MAAM,UAAU,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,WAAW,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACjF,wBAAwB;QACxB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,oCAAoC;QACpC,OAAO,8BAA8B,CAAC,KAA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AI,CAAC,WAAW,EAAE;YAChB,oCAAoC;YACpC,MAAM,cAAc,GAAG,QAAQ,CAAC,UAAU,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,6BAA6B,CAAC,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;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CACzB,MAAc,EACd,IAAY,EACZ,SAAgB,EAChB,QAAuB,EACvB,SAA0B,EAC1B,kBAAuB,EACvB,cAA2B;IAE3B,OAAO,gCAAgC,CACrC,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf,CAAC;AACJ,CAAC"}
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.convertWebExperienceToTemplate = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const hub_common_1 = require("@esri/hub-common");
|
|
20
|
+
const solution_common_1 = require("@esri/solution-common");
|
|
21
|
+
const get_web_experience_dependencies_1 = require("./get-web-experience-dependencies");
|
|
22
22
|
/**
|
|
23
23
|
* Convert an Experience item into a template
|
|
24
24
|
*
|
|
@@ -29,18 +29,23 @@ var get_web_experience_dependencies_1 = require("./get-web-experience-dependenci
|
|
|
29
29
|
* @param authentication
|
|
30
30
|
*/
|
|
31
31
|
function convertWebExperienceToTemplate(model) {
|
|
32
|
-
|
|
33
|
-
tmpl.key = (0, hub_common_1.propifyString)(model.item.title)
|
|
34
|
-
|
|
32
|
+
const tmpl = (0, solution_common_1.createPlaceholderTemplate)(model.item.id, model.item.type);
|
|
33
|
+
tmpl.key = `${(0, hub_common_1.propifyString)(model.item.title)}_${(0, hub_common_1.createId)("i")}`;
|
|
34
|
+
const clone = (0, hub_common_1.cloneObject)(model);
|
|
35
35
|
tmpl.data = clone.data;
|
|
36
|
+
// We need to save these properties in order to restore them after hub.js deletes them
|
|
37
|
+
const created = clone.item.created;
|
|
38
|
+
const modified = clone.item.modified;
|
|
36
39
|
tmpl.item = (0, hub_common_1.normalizeSolutionTemplateItem)(clone.item);
|
|
40
|
+
tmpl.item.created = created;
|
|
41
|
+
tmpl.item.modified = modified;
|
|
37
42
|
// templatize the url. This is updated during the createModelFromTemplate phase
|
|
38
43
|
// of the deployment process
|
|
39
44
|
tmpl.item.url = "{{experienceUrlTemplate}}";
|
|
40
45
|
// use typeKeyword to mark item as published (we decided to discard unpublished drafts)
|
|
41
|
-
|
|
46
|
+
const typeKeywords = tmpl.item.typeKeywords;
|
|
42
47
|
if (typeKeywords.indexOf(changedTypeKW) !== -1) {
|
|
43
|
-
tmpl.item.typeKeywords = [publishedTypeKW].concat(tmpl.item.typeKeywords.filter(
|
|
48
|
+
tmpl.item.typeKeywords = [publishedTypeKW].concat(tmpl.item.typeKeywords.filter(word => word !== changedTypeKW));
|
|
44
49
|
}
|
|
45
50
|
tmpl.dependencies = (0, get_web_experience_dependencies_1.getWebExperienceDependencies)(model);
|
|
46
51
|
return Promise.resolve(tmpl);
|
|
@@ -57,6 +62,6 @@ function convertWebExperienceToTemplate(model) {
|
|
|
57
62
|
// });
|
|
58
63
|
}
|
|
59
64
|
exports.convertWebExperienceToTemplate = convertWebExperienceToTemplate;
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
const publishedTypeKW = "status: Published";
|
|
66
|
+
const changedTypeKW = "status: Changed";
|
|
62
67
|
//# sourceMappingURL=convert-web-experience-to-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-web-experience-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-web-experience-to-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH
|
|
1
|
+
{"version":3,"file":"convert-web-experience-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-web-experience-to-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iDAM0B;AAE1B,2DAG+B;AAE/B,uFAAiF;AAEjF;;;;;;;;GAQG;AACH,SAAgB,8BAA8B,CAC5C,KAAa;IAEb,MAAM,IAAI,GAAG,IAAA,2CAAyB,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,IAAI,CAAC,GAAG,GAAG,GAAG,IAAA,0BAAa,EAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAA,qBAAQ,EAAC,GAAG,CAAC,EAAE,CAAC;IAEjE,MAAM,KAAK,GAAG,IAAA,wBAAW,EAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAEvB,sFAAsF;IACtF,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;IACnC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;IACrC,IAAI,CAAC,IAAI,GAAG,IAAA,0CAA6B,EAAC,KAAK,CAAC,IAAI,CAAU,CAAC;IAC/D,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC5B,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE9B,+EAA+E;IAC/E,4BAA4B;IAC5B,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,2BAA2B,CAAC;IAE5C,uFAAuF;IACvF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;IAC5C,IAAI,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QAC9C,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAC/C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,aAAa,CAAC,CAC9D,CAAC;KACH;IAED,IAAI,CAAC,YAAY,GAAG,IAAA,8DAA4B,EAAC,KAAK,CAAC,CAAC;IAExD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,kEAAkE;IAClE,8EAA8E;IAC9E,wDAAwD;IACxD,yDAAyD;IACzD,uDAAuD;IACvD,0BAA0B;IAC1B,+DAA+D;IAC/D,iCAAiC;IACjC,yDAAyD;IACzD,mBAAmB;IACnB,QAAQ;AACV,CAAC;AA1CD,wEA0CC;AAED,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,aAAa,GAAG,iBAAiB,CAAC"}
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.createWebExperienceModelFromTemplate = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const hub_common_1 = require("@esri/hub-common");
|
|
20
|
+
const get_web_experience_url_template_1 = require("./get-web-experience-url-template");
|
|
21
21
|
/**
|
|
22
22
|
* Convert a Web Experience template into a Model that can be persisted to the Portal API
|
|
23
23
|
*
|
|
@@ -29,7 +29,7 @@ var get_web_experience_url_template_1 = require("./get-web-experience-url-templa
|
|
|
29
29
|
function createWebExperienceModelFromTemplate(templateModel, settings, transforms, authentication) {
|
|
30
30
|
// get the experience base url
|
|
31
31
|
settings.experienceUrlTemplate = (0, get_web_experience_url_template_1.getWebExperiencepUrlTemplate)(authentication);
|
|
32
|
-
|
|
32
|
+
const model = (0, hub_common_1.interpolate)(templateModel, settings, transforms);
|
|
33
33
|
// ensure this is set - there may be some templates w/o `{{experienceTemplateUrl}}
|
|
34
34
|
model.item.url = settings.experienceUrlTemplate;
|
|
35
35
|
/* istanbul ignore else */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-web-experience-model-from-template.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience-model-from-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH
|
|
1
|
+
{"version":3,"file":"create-web-experience-model-from-template.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience-model-from-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iDAA+D;AAE/D,uFAAiF;AACjF;;;;;;;GAOG;AACH,SAAgB,oCAAoC,CAClD,aAA6B,EAC7B,QAAa,EACb,UAAe,EACf,cAA2B;IAE3B,8BAA8B;IAC9B,QAAQ,CAAC,qBAAqB,GAAG,IAAA,8DAA4B,EAAC,cAAc,CAAC,CAAC;IAC9E,MAAM,KAAK,GAAG,IAAA,wBAAW,EAAC,aAAa,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/D,kFAAkF;IAClF,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,qBAAqB,CAAC;IAChD,0BAA0B;IAC1B,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE;QAChC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,yCAAyC;KAC/F;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAjBD,oFAiBC"}
|