@esri/solution-web-experience 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.
- package/dist/cjs/helpers/convert-web-experience-to-template.d.ts +27 -0
- package/dist/cjs/helpers/convert-web-experience-to-template.js +67 -0
- package/dist/cjs/helpers/convert-web-experience-to-template.js.map +1 -0
- package/dist/cjs/helpers/create-web-experience-model-from-template.d.ts +26 -0
- package/dist/cjs/helpers/create-web-experience-model-from-template.js +42 -0
- package/dist/cjs/helpers/create-web-experience-model-from-template.js.map +1 -0
- package/dist/cjs/helpers/create-web-experience.d.ts +25 -0
- package/dist/cjs/helpers/create-web-experience.js +119 -0
- package/dist/cjs/helpers/create-web-experience.js.map +1 -0
- package/dist/cjs/helpers/get-experience-subdomain.d.ts +23 -0
- package/dist/cjs/helpers/get-experience-subdomain.js +26 -0
- package/dist/cjs/helpers/get-experience-subdomain.js.map +1 -0
- package/dist/cjs/helpers/get-web-experience-dependencies.d.ts +23 -0
- package/dist/cjs/helpers/get-web-experience-dependencies.js +33 -0
- package/dist/cjs/helpers/get-web-experience-dependencies.js.map +1 -0
- package/dist/cjs/helpers/get-web-experience-url-template.d.ts +23 -0
- package/dist/cjs/helpers/get-web-experience-url-template.js +26 -0
- package/dist/cjs/helpers/get-web-experience-url-template.js.map +1 -0
- package/dist/cjs/index.d.ts +17 -0
- package/dist/cjs/index.js +22 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/web-experience-processor.d.ts +50 -0
- package/dist/cjs/web-experience-processor.js +124 -0
- package/dist/cjs/web-experience-processor.js.map +1 -0
- package/dist/esm/helpers/convert-web-experience-to-template.d.ts +27 -0
- package/dist/esm/helpers/convert-web-experience-to-template.js +63 -0
- package/dist/esm/helpers/convert-web-experience-to-template.js.map +1 -0
- package/dist/esm/helpers/create-web-experience-model-from-template.d.ts +26 -0
- package/dist/esm/helpers/create-web-experience-model-from-template.js +38 -0
- package/dist/esm/helpers/create-web-experience-model-from-template.js.map +1 -0
- package/dist/esm/helpers/create-web-experience.d.ts +25 -0
- package/dist/esm/helpers/create-web-experience.js +115 -0
- package/dist/esm/helpers/create-web-experience.js.map +1 -0
- package/dist/esm/helpers/get-experience-subdomain.d.ts +23 -0
- package/dist/esm/helpers/get-experience-subdomain.js +22 -0
- package/dist/esm/helpers/get-experience-subdomain.js.map +1 -0
- package/dist/esm/helpers/get-web-experience-dependencies.d.ts +23 -0
- package/dist/esm/helpers/get-web-experience-dependencies.js +29 -0
- package/dist/esm/helpers/get-web-experience-dependencies.js.map +1 -0
- package/dist/esm/helpers/get-web-experience-url-template.d.ts +23 -0
- package/dist/esm/helpers/get-web-experience-url-template.js +22 -0
- package/dist/esm/helpers/get-web-experience-url-template.js.map +1 -0
- package/dist/esm/index.d.ts +17 -0
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web-experience-processor.d.ts +50 -0
- package/dist/esm/web-experience-processor.js +118 -0
- package/dist/esm/web-experience-processor.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,124 @@
|
|
|
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 create_web_experience_model_from_template_1 = require("./helpers/create-web-experience-model-from-template");
|
|
27
|
+
const create_web_experience_1 = require("./helpers/create-web-experience");
|
|
28
|
+
const convert_web_experience_to_template_1 = require("./helpers/convert-web-experience-to-template");
|
|
29
|
+
/**
|
|
30
|
+
* Convert a Web Experience item into a Template
|
|
31
|
+
*
|
|
32
|
+
* @param itemInfo
|
|
33
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
34
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
35
|
+
* @param isGroup
|
|
36
|
+
*/
|
|
37
|
+
function convertItemToTemplate(itemInfo, destAuthentication, srcAuthentication) {
|
|
38
|
+
// use the itemInfo to setup a model
|
|
39
|
+
const model = {
|
|
40
|
+
item: itemInfo,
|
|
41
|
+
data: {},
|
|
42
|
+
};
|
|
43
|
+
// fetch the data.json
|
|
44
|
+
return (0, solution_common_1.getItemData)(itemInfo.id, { authentication: srcAuthentication }).then((data) => {
|
|
45
|
+
// append into the model
|
|
46
|
+
model.data = data;
|
|
47
|
+
// and use that to create a template
|
|
48
|
+
return (0, convert_web_experience_to_template_1.convertWebExperienceToTemplate)(model);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.convertItemToTemplate = convertItemToTemplate;
|
|
52
|
+
/**
|
|
53
|
+
* Create a Web Experience from a Template
|
|
54
|
+
*
|
|
55
|
+
* @param template
|
|
56
|
+
* @param templateDictionary
|
|
57
|
+
* @param destinationAuthentication
|
|
58
|
+
* @param itemProgressCallback
|
|
59
|
+
*/
|
|
60
|
+
function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
61
|
+
// let the progress system know we've started...
|
|
62
|
+
const startStatus = itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Started, 0);
|
|
63
|
+
// and if it returned false, just resolve out
|
|
64
|
+
if (!startStatus) {
|
|
65
|
+
return Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type));
|
|
66
|
+
}
|
|
67
|
+
let exbModel;
|
|
68
|
+
return (0, create_web_experience_model_from_template_1.createWebExperienceModelFromTemplate)(template, templateDictionary, {}, destinationAuthentication)
|
|
69
|
+
.then((model) => {
|
|
70
|
+
exbModel = model;
|
|
71
|
+
return (0, create_web_experience_1.createWebExperience)(model, templateDictionary.folderId, {}, destinationAuthentication);
|
|
72
|
+
})
|
|
73
|
+
.then((createdModel) => {
|
|
74
|
+
exbModel.item.id = createdModel.item.id;
|
|
75
|
+
exbModel.item.url = createdModel.item.url;
|
|
76
|
+
// Update the template dictionary
|
|
77
|
+
// TODO: This should be done in whatever recieves
|
|
78
|
+
// the outcome of this promise chain
|
|
79
|
+
templateDictionary[template.itemId] = {
|
|
80
|
+
itemId: createdModel.item.id,
|
|
81
|
+
};
|
|
82
|
+
const finalStatus = itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, createdModel.item.id);
|
|
83
|
+
if (!finalStatus) {
|
|
84
|
+
// clean up the site we just created
|
|
85
|
+
const failSafeRemove = (0, hub_common_1.failSafe)(solution_common_1.restRemoveItem, { success: true });
|
|
86
|
+
return failSafeRemove({
|
|
87
|
+
id: exbModel.item.id,
|
|
88
|
+
authentication: destinationAuthentication,
|
|
89
|
+
}).then(() => {
|
|
90
|
+
return Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type));
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// finally, return ICreateItemFromTemplateResponse
|
|
95
|
+
const response = {
|
|
96
|
+
item: {
|
|
97
|
+
...template,
|
|
98
|
+
...(0, solution_common_1.convertIModel)(exbModel),
|
|
99
|
+
},
|
|
100
|
+
id: exbModel.item.id,
|
|
101
|
+
type: template.type,
|
|
102
|
+
postProcess: false,
|
|
103
|
+
};
|
|
104
|
+
response.item.itemId = exbModel.item.id;
|
|
105
|
+
return response;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
exports.createItemFromTemplate = createItemFromTemplate;
|
|
110
|
+
/**
|
|
111
|
+
* Post-Process an Experience
|
|
112
|
+
*
|
|
113
|
+
* @param {string} itemId The item ID
|
|
114
|
+
* @param {string} type The template type
|
|
115
|
+
* @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
|
|
116
|
+
* @param {any} templateDictionary The template dictionary
|
|
117
|
+
* @param {UserSession} authentication The destination session info
|
|
118
|
+
* @returns Promise resolving to successfulness of update
|
|
119
|
+
*/
|
|
120
|
+
function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
|
|
121
|
+
return (0, solution_common_1.updateItemTemplateFromDictionary)(itemId, templateDictionary, authentication);
|
|
122
|
+
}
|
|
123
|
+
exports.postProcess = postProcess;
|
|
124
|
+
//# sourceMappingURL=web-experience-processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-experience-processor.js","sourceRoot":"","sources":["../../src/web-experience-processor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,2DAY+B;AAC/B,iDAAoD;AACpD,mHAA2G;AAC3G,2EAAsE;AACtE,qGAA8F;AAE9F;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,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,6BAAW,EAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,iB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Ac,CAAC,CAAC;AACtF,CAAC;AAVD,kCAUC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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>;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 { normalizeSolutionTemplateItem, cloneObject, propifyString, createId } from "@esri/hub-common";
|
|
17
|
+
import { createPlaceholderTemplate } from "@esri/solution-common";
|
|
18
|
+
import { getWebExperienceDependencies } from "./get-web-experience-dependencies";
|
|
19
|
+
/**
|
|
20
|
+
* Convert an Experience item into a template
|
|
21
|
+
*
|
|
22
|
+
* Pretty simpler conversion - remove extra item props, extract out
|
|
23
|
+
* items from the data.dataSources hash.
|
|
24
|
+
*
|
|
25
|
+
* @param model
|
|
26
|
+
* @param authentication
|
|
27
|
+
*/
|
|
28
|
+
export function convertWebExperienceToTemplate(model) {
|
|
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
|
+
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;
|
|
36
|
+
tmpl.item = normalizeSolutionTemplateItem(clone.item);
|
|
37
|
+
tmpl.item.created = created;
|
|
38
|
+
tmpl.item.modified = modified;
|
|
39
|
+
// templatize the url. This is updated during the createModelFromTemplate phase
|
|
40
|
+
// of the deployment process
|
|
41
|
+
tmpl.item.url = "{{experienceUrlTemplate}}";
|
|
42
|
+
// use typeKeyword to mark item as published (we decided to discard unpublished drafts)
|
|
43
|
+
const typeKeywords = tmpl.item.typeKeywords;
|
|
44
|
+
if (typeKeywords.indexOf(changedTypeKW) !== -1) {
|
|
45
|
+
tmpl.item.typeKeywords = [publishedTypeKW].concat(tmpl.item.typeKeywords.filter((word) => word !== changedTypeKW));
|
|
46
|
+
}
|
|
47
|
+
tmpl.dependencies = getWebExperienceDependencies(model);
|
|
48
|
+
return Promise.resolve(tmpl);
|
|
49
|
+
// TODO: For now, we let the generic process handle item resources
|
|
50
|
+
// However, many newer item types have complex type-specific resource handling
|
|
51
|
+
// requirements so this code may be useful in the future
|
|
52
|
+
// ------------------------------------------------------
|
|
53
|
+
// return getItemResources(tmpl.itemId, authentication)
|
|
54
|
+
// .then((response) => {
|
|
55
|
+
// tmpl.resources = response.resources.map(e => e.resource)
|
|
56
|
+
// // Discard draft version
|
|
57
|
+
// .filter(filename => filename !== 'config.json');
|
|
58
|
+
// return tmpl;
|
|
59
|
+
// });
|
|
60
|
+
}
|
|
61
|
+
const publishedTypeKW = "status: Published";
|
|
62
|
+
const changedTypeKW = "status: Changed";
|
|
63
|
+
//# sourceMappingURL=convert-web-experience-to-template.js.map
|
|
@@ -0,0 +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,EAAU,6BAA6B,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE/G,OAAO,EAAwB,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF;;;;;;;;GAQG;AACH,MAAM,UAAU,8BAA8B,CAAC,KAAa;IAC1D,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,CAAC,GAAG,CAAC,EAAE,CAAC;IAEjE,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAEvB,sFAAsF;IACtF,MAAM,OA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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
|
+
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>;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { getWebExperiencepUrlTemplate } from "./get-web-experience-url-template";
|
|
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 function createWebExperienceModelFromTemplate(templateModel, settings, transforms, authentication) {
|
|
27
|
+
// get the experience base url
|
|
28
|
+
settings.experienceUrlTemplate = getWebExperiencepUrlTemplate(authentication);
|
|
29
|
+
const model = interpolate(templateModel, settings, transforms);
|
|
30
|
+
// ensure this is set - there may be some templates w/o `{{experienceTemplateUrl}}
|
|
31
|
+
model.item.url = settings.experienceUrlTemplate;
|
|
32
|
+
/* istanbul ignore else */
|
|
33
|
+
if (templateModel.item.thumbnail) {
|
|
34
|
+
model.item.thumbnail = templateModel.item.thumbnail; // interpolation trashes thumbnail binary
|
|
35
|
+
}
|
|
36
|
+
return Promise.resolve(model);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=create-web-experience-model-from-template.js.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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>;
|
|
@@ -0,0 +1,115 @@
|
|
|
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 { cloneObject, failSafe, serializeModel, interpolateItemId, stringToBlob, objectToJsonBlob, } from "@esri/hub-common";
|
|
17
|
+
import { addItemResource, createItem, moveItem, restUpdateItem, } 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 function createWebExperience(model, folderId, options, authentication) {
|
|
26
|
+
const resources = [];
|
|
27
|
+
// For unkown reasons we can not seem to spy on createItemInFolder
|
|
28
|
+
// so we will create-then-move for now
|
|
29
|
+
const createOptions = {
|
|
30
|
+
// need to serialize
|
|
31
|
+
item: serializeModel(model),
|
|
32
|
+
authentication,
|
|
33
|
+
};
|
|
34
|
+
/* istanbul ignore else */
|
|
35
|
+
if (model.item.thumbnail) {
|
|
36
|
+
createOptions.params = {
|
|
37
|
+
// Pass thumbnail file in via params because item property is serialized, which discards a blob
|
|
38
|
+
thumbnail: model.item.thumbnail,
|
|
39
|
+
};
|
|
40
|
+
delete createOptions.item.thumbnail;
|
|
41
|
+
}
|
|
42
|
+
// Create the item
|
|
43
|
+
return (createItem(createOptions)
|
|
44
|
+
.then((createResponse) => {
|
|
45
|
+
model.item.id = createResponse.id;
|
|
46
|
+
const savedThumbnail = model.item.thumbnail;
|
|
47
|
+
model = interpolateItemId(model);
|
|
48
|
+
model.item.thumbnail = savedThumbnail; // interpolation trashes thumbnail binary
|
|
49
|
+
// Experiences store draft data in a resource attached to the item
|
|
50
|
+
// We'll just use the published data for the first "draft"
|
|
51
|
+
// changed from stringToBlob to objectToJsonBlob for issue #742
|
|
52
|
+
const draftResourceModel = cloneObject(model.data);
|
|
53
|
+
resources.push({
|
|
54
|
+
name: "config.json",
|
|
55
|
+
prefix: "config",
|
|
56
|
+
file: objectToJsonBlob(draftResourceModel),
|
|
57
|
+
});
|
|
58
|
+
// there may also be this image resources list
|
|
59
|
+
const imageListModel = cloneObject(model.properties.imageResourcesList);
|
|
60
|
+
if (imageListModel) {
|
|
61
|
+
resources.push({
|
|
62
|
+
name: "image-resources-list.json",
|
|
63
|
+
prefix: "images",
|
|
64
|
+
file: stringToBlob(JSON.stringify(imageListModel)),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
delete model.properties;
|
|
68
|
+
// update the experience with the newly interpolated model
|
|
69
|
+
const updateOptions = {
|
|
70
|
+
item: serializeModel(model),
|
|
71
|
+
authentication,
|
|
72
|
+
};
|
|
73
|
+
if (model.item.thumbnail) {
|
|
74
|
+
updateOptions.params = {
|
|
75
|
+
// Pass thumbnail file in via params because item property is serialized, which discards a blob
|
|
76
|
+
thumbnail: model.item.thumbnail,
|
|
77
|
+
};
|
|
78
|
+
delete updateOptions.item.thumbnail;
|
|
79
|
+
}
|
|
80
|
+
return Promise.all([restUpdateItem(updateOptions), authentication.getUsername()]);
|
|
81
|
+
})
|
|
82
|
+
.then((responses) => {
|
|
83
|
+
const username = responses[1];
|
|
84
|
+
const failSafeAddItemResource = failSafe(addItemResource, {
|
|
85
|
+
success: true,
|
|
86
|
+
});
|
|
87
|
+
// upload the data and oembed resources
|
|
88
|
+
const resourceUploadPromises = resources.map((resource) => failSafeAddItemResource({
|
|
89
|
+
id: model.item.id,
|
|
90
|
+
owner: username,
|
|
91
|
+
resource: resource.file,
|
|
92
|
+
name: resource.name,
|
|
93
|
+
prefix: resource.prefix,
|
|
94
|
+
authentication,
|
|
95
|
+
}));
|
|
96
|
+
// fire and forget
|
|
97
|
+
return Promise.all(resourceUploadPromises);
|
|
98
|
+
})
|
|
99
|
+
// .then(() => {
|
|
100
|
+
// // TODO: Can we leave this to the main process?
|
|
101
|
+
// return uploadResourcesFromUrl(model, options.assets || [], authentication);
|
|
102
|
+
// })
|
|
103
|
+
.then(() => {
|
|
104
|
+
// Move it
|
|
105
|
+
return moveItem({
|
|
106
|
+
itemId: model.item.id,
|
|
107
|
+
folderId,
|
|
108
|
+
authentication,
|
|
109
|
+
});
|
|
110
|
+
})
|
|
111
|
+
.then(() => {
|
|
112
|
+
return model;
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=create-web-experience.js.map
|
|
@@ -0,0 +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,EACZ,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAIL,eAAe,EACf,UAAU,EACV,QAAQ,EACR,cAAc,GAEf,MAAM,uBAAuB,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAa,EACb,QAAgB,EAChB,OAAY,EACZ,cAA2B;IAE3B,MAAM,SAAS,GAAU,EAAE,CAAC;IAE5B,kEAAkE;IAClE,sCAAsC;IACtC,MAAM,aAAa,GAAuB;QACxC,oBAAoB;QACpB,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;QAC3B,cAAc;KACf,CAAC;IAEF,0BAA0B;IAC1B,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE;QACxB,aAAa,CAAC,MAAM,GAAG;YACrB,+FAA+F;YAC/F,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS;SAChC,CA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
+
* 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;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the subdomain for an experience based on the api the session is
|
|
3
|
+
* authenticated against
|
|
4
|
+
*
|
|
5
|
+
* @param authentication UserSession
|
|
6
|
+
*/
|
|
7
|
+
export function getExperienceSubdomain(authentication) {
|
|
8
|
+
const portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
|
|
9
|
+
// TODO: Sort out how we locate experiences on portal?
|
|
10
|
+
let result;
|
|
11
|
+
if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
|
|
12
|
+
result = "experienceqa";
|
|
13
|
+
}
|
|
14
|
+
else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
|
|
15
|
+
result = "experiencedev";
|
|
16
|
+
}
|
|
17
|
+
else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
|
|
18
|
+
result = "experience";
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=get-experience-subdomain.js.map
|
|
@@ -0,0 +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,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,IAAI,qCAAqC,CAAC;IACjF,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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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[];
|
|
@@ -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 { getProp, maybePush } 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 function getWebExperienceDependencies(model) {
|
|
24
|
+
const dataSources = getProp(model, "data.dataSources") || {};
|
|
25
|
+
return Object.keys(dataSources).reduce((acc, key) => {
|
|
26
|
+
return maybePush(getProp(dataSources, `${key}.itemId`), acc);
|
|
27
|
+
}, []);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=get-web-experience-dependencies.js.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getExperienceSubdomain } from "./get-experience-subdomain";
|
|
2
|
+
/**
|
|
3
|
+
* For a given environment Prod/qa/dev/portal
|
|
4
|
+
* return the correct storymaps base url
|
|
5
|
+
*
|
|
6
|
+
* @param authentication
|
|
7
|
+
*/
|
|
8
|
+
export function getWebExperiencepUrlTemplate(authentication) {
|
|
9
|
+
let baseUrl = "";
|
|
10
|
+
const subdomain = getExperienceSubdomain(authentication);
|
|
11
|
+
if (subdomain) {
|
|
12
|
+
baseUrl = `https://${subdomain}.arcgis.com/experience/{{appid}}`;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
// we're on portal
|
|
16
|
+
// chop off the /sharing/rest to get the baseUrl
|
|
17
|
+
const portalBaseUrl = authentication.portal.replace("/sharing/rest", "");
|
|
18
|
+
baseUrl = `${portalBaseUrl}/apps/experiencebuilder/?id={{appid}}`;
|
|
19
|
+
}
|
|
20
|
+
return baseUrl;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=get-web-experience-url-template.js.map
|
|
@@ -0,0 +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,CAAC,cAA2B;IACtE,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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 };
|
|
@@ -0,0 +1,18 @@
|
|
|
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 };
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC;AAErE,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|