@esri/solution-storymap 6.0.5-alpha.0 → 6.1.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/package.json +4 -4
- package/dist/cjs/classic-storymap-processor.d.ts +0 -24
- package/dist/cjs/classic-storymap-processor.js +0 -69
- package/dist/cjs/classic-storymap-processor.js.map +0 -1
- package/dist/cjs/helpers/convert-storymap-to-template.d.ts +0 -24
- package/dist/cjs/helpers/convert-storymap-to-template.js +0 -99
- package/dist/cjs/helpers/convert-storymap-to-template.js.map +0 -1
- package/dist/cjs/helpers/create-storymap-model-from-template.d.ts +0 -22
- package/dist/cjs/helpers/create-storymap-model-from-template.js +0 -43
- package/dist/cjs/helpers/create-storymap-model-from-template.js.map +0 -1
- package/dist/cjs/helpers/create-storymap.d.ts +0 -25
- package/dist/cjs/helpers/create-storymap.js +0 -119
- package/dist/cjs/helpers/create-storymap.js.map +0 -1
- package/dist/cjs/helpers/get-portal-env.d.ts +0 -17
- package/dist/cjs/helpers/get-portal-env.js +0 -19
- package/dist/cjs/helpers/get-portal-env.js.map +0 -1
- package/dist/cjs/helpers/get-storymap-base-url.d.ts +0 -23
- package/dist/cjs/helpers/get-storymap-base-url.js +0 -26
- package/dist/cjs/helpers/get-storymap-base-url.js.map +0 -1
- package/dist/cjs/helpers/get-storymap-dependencies.d.ts +0 -23
- package/dist/cjs/helpers/get-storymap-dependencies.js +0 -36
- package/dist/cjs/helpers/get-storymap-dependencies.js.map +0 -1
- package/dist/cjs/helpers/get-storymap-subdomain.d.ts +0 -17
- package/dist/cjs/helpers/get-storymap-subdomain.js +0 -20
- package/dist/cjs/helpers/get-storymap-subdomain.js.map +0 -1
- package/dist/cjs/helpers/remap-webmap-keys.d.ts +0 -24
- package/dist/cjs/helpers/remap-webmap-keys.js +0 -44
- package/dist/cjs/helpers/remap-webmap-keys.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -23
- package/dist/cjs/index.js +0 -29
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/storymap-processor.d.ts +0 -39
- package/dist/cjs/storymap-processor.js +0 -139
- package/dist/cjs/storymap-processor.js.map +0 -1
- package/dist/esm/classic-storymap-processor.d.ts +0 -24
- package/dist/esm/classic-storymap-processor.js +0 -62
- package/dist/esm/classic-storymap-processor.js.map +0 -1
- package/dist/esm/helpers/convert-storymap-to-template.d.ts +0 -24
- package/dist/esm/helpers/convert-storymap-to-template.js +0 -95
- package/dist/esm/helpers/convert-storymap-to-template.js.map +0 -1
- package/dist/esm/helpers/create-storymap-model-from-template.d.ts +0 -22
- package/dist/esm/helpers/create-storymap-model-from-template.js +0 -39
- package/dist/esm/helpers/create-storymap-model-from-template.js.map +0 -1
- package/dist/esm/helpers/create-storymap.d.ts +0 -25
- package/dist/esm/helpers/create-storymap.js +0 -115
- package/dist/esm/helpers/create-storymap.js.map +0 -1
- package/dist/esm/helpers/get-portal-env.d.ts +0 -17
- package/dist/esm/helpers/get-portal-env.js +0 -15
- package/dist/esm/helpers/get-portal-env.js.map +0 -1
- package/dist/esm/helpers/get-storymap-base-url.d.ts +0 -23
- package/dist/esm/helpers/get-storymap-base-url.js +0 -22
- package/dist/esm/helpers/get-storymap-base-url.js.map +0 -1
- package/dist/esm/helpers/get-storymap-dependencies.d.ts +0 -23
- package/dist/esm/helpers/get-storymap-dependencies.js +0 -32
- package/dist/esm/helpers/get-storymap-dependencies.js.map +0 -1
- package/dist/esm/helpers/get-storymap-subdomain.d.ts +0 -17
- package/dist/esm/helpers/get-storymap-subdomain.js +0 -16
- package/dist/esm/helpers/get-storymap-subdomain.js.map +0 -1
- package/dist/esm/helpers/remap-webmap-keys.d.ts +0 -24
- package/dist/esm/helpers/remap-webmap-keys.js +0 -40
- package/dist/esm/helpers/remap-webmap-keys.js.map +0 -1
- package/dist/esm/index.d.ts +0 -23
- package/dist/esm/index.js +0 -24
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/storymap-processor.d.ts +0 -39
- package/dist/esm/storymap-processor.js +0 -133
- package/dist/esm/storymap-processor.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-storymap-model-from-template.js","sourceRoot":"","sources":["../../../src/helpers/create-storymap-model-from-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,UAAU,+BAA+B,CAC7C,aAA6B,EAC7B,QAAa,EACb,UAAe,EACf,cAA2B;IAE3B,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IACvC,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;IAC/C,QAAQ,CAAC,MAAM,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACvD,QAAQ,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IAC1C,iEAAiE;IACjE,mEAAmE;IACnE,yDAAyD;IACzD,QAAQ,CAAC,eAAe,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAC9D,QAAQ,CAAC,mBAAmB,GAAG,GAAG,QAAQ,CAAC,eAAe,oBAAoB,CAAC;IAC/E,QAAQ,CAAC,mBAAmB,GAAG,GAAG,cAAc,CAAC,MAAM,kEAAkE,SAAS,EAAE,CAAC;IAErI,MAAM,KAAK,GAAG,WAAW,CAAC,aAAa,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAE/D,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -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
|
-
* Create a StoryMap from an interpolated template
|
|
20
|
-
*
|
|
21
|
-
* @param model
|
|
22
|
-
* @param options
|
|
23
|
-
* @param authentication
|
|
24
|
-
*/
|
|
25
|
-
export declare function createStoryMap(model: IModel, folderId: string, options: any, authentication: UserSession): Promise<IModel>;
|
|
@@ -1,115 +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
|
-
// TODO ENSURE THIS CREATES IN THE TARGET FOLDER
|
|
17
|
-
import { failSafe, serializeModel, interpolateItemId, stringToBlob } from "@esri/hub-common";
|
|
18
|
-
import { addItemResource, createItem, moveItem, restUpdateItem, } from "@esri/solution-common";
|
|
19
|
-
/**
|
|
20
|
-
* Create a StoryMap from an interpolated template
|
|
21
|
-
*
|
|
22
|
-
* @param model
|
|
23
|
-
* @param options
|
|
24
|
-
* @param authentication
|
|
25
|
-
*/
|
|
26
|
-
export function createStoryMap(model, folderId, options, authentication) {
|
|
27
|
-
// create an array to hold well-known resources
|
|
28
|
-
// that we have to generate from the passed in model
|
|
29
|
-
const resources = [];
|
|
30
|
-
// The data section has been de-templatized. Some entries need to be encoded URLs, so we'll find and encode them.
|
|
31
|
-
model.data = JSON.parse(JSON.stringify(model.data).replace(/portalUrl=https:\/\//g, "portalUrl=https%3A%2F%2F"));
|
|
32
|
-
// For unknown reasons we can not seem to spy on createItemInFolder
|
|
33
|
-
// so we will create-then-move for now
|
|
34
|
-
const createOptions = {
|
|
35
|
-
// need to serialize
|
|
36
|
-
item: serializeModel(model),
|
|
37
|
-
authentication,
|
|
38
|
-
};
|
|
39
|
-
/* istanbul ignore else */
|
|
40
|
-
if (model.item.thumbnail) {
|
|
41
|
-
createOptions.params = {
|
|
42
|
-
// Pass thumbnail file in via params because item property is serialized, which discards a blob
|
|
43
|
-
thumbnail: model.item.thumbnail,
|
|
44
|
-
};
|
|
45
|
-
delete createOptions.item.thumbnail;
|
|
46
|
-
}
|
|
47
|
-
// Create the item
|
|
48
|
-
return createItem(createOptions)
|
|
49
|
-
.then((createResponse) => {
|
|
50
|
-
// hold the id in the model
|
|
51
|
-
model.item.id = createResponse.id;
|
|
52
|
-
// and re-interpolate the item id
|
|
53
|
-
model = interpolateItemId(model);
|
|
54
|
-
// Compute the item url based on current environment
|
|
55
|
-
// Storymaps store draft data in a timestamped resource attached to the item
|
|
56
|
-
// We'll just use the published data for the first "draft"
|
|
57
|
-
const dataBlob = stringToBlob(JSON.stringify(model.data));
|
|
58
|
-
resources.push({
|
|
59
|
-
name: model.properties.draftFileName,
|
|
60
|
-
file: dataBlob,
|
|
61
|
-
});
|
|
62
|
-
resources.push({
|
|
63
|
-
name: "oembed.json",
|
|
64
|
-
file: stringToBlob(JSON.stringify(model.properties.oembed)),
|
|
65
|
-
});
|
|
66
|
-
resources.push({
|
|
67
|
-
name: "oembed.xml",
|
|
68
|
-
file: stringToBlob(model.properties.oembedXML),
|
|
69
|
-
});
|
|
70
|
-
resources.push({
|
|
71
|
-
name: "published_data.json",
|
|
72
|
-
file: dataBlob,
|
|
73
|
-
});
|
|
74
|
-
// remove the properties hash now that we've gotten what we need
|
|
75
|
-
delete model.properties;
|
|
76
|
-
// update the item with the newly re-interpolated model
|
|
77
|
-
return Promise.all([
|
|
78
|
-
restUpdateItem({
|
|
79
|
-
item: serializeModel(model),
|
|
80
|
-
authentication,
|
|
81
|
-
}),
|
|
82
|
-
authentication.getUsername(),
|
|
83
|
-
]);
|
|
84
|
-
})
|
|
85
|
-
.then((responses) => {
|
|
86
|
-
const username = responses[1];
|
|
87
|
-
// add the resources
|
|
88
|
-
const failSafeAddItemResource = failSafe(addItemResource, {
|
|
89
|
-
success: true,
|
|
90
|
-
});
|
|
91
|
-
const resourcePromises = resources.map((resource) => {
|
|
92
|
-
return failSafeAddItemResource({
|
|
93
|
-
id: model.item.id,
|
|
94
|
-
owner: username,
|
|
95
|
-
resource: resource.file,
|
|
96
|
-
name: resource.name,
|
|
97
|
-
authentication,
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
// Fire and forget as these are not critical-path
|
|
101
|
-
return Promise.all(resourcePromises);
|
|
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-storymap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-storymap.js","sourceRoot":"","sources":["../../../src/helpers/create-storymap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,gDAAgD;AAChD,OAAO,EAAU,QAAQ,EAAE,cAAc,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErG,OAAO,EAGL,eAAe,EACf,UAAU,EACV,QAAQ,EACR,cAAc,GAEf,MAAM,uBAAuB,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAa,EACb,QAAgB,EAChB,OAAY,EACZ,cAA2B;IAE3B,+CAA+C;IAC/C,oDAAoD;IACpD,MAAM,SAAS,GAAU,EAAE,CAAC;IAE5B,iHAAiH;IACjH,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,CAAC,CAAC;IAEjH,mEAAmE;IACnE,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,CAAC;QACF,OAAO,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC;KACrC;IAED,kBAAkB;IAClB,OAAO,UAAU,CAAC,aAAa,CAAC;SAC7B,IAAI,CAAC,CAAC,cAAmC,EAAE,EAAE;QAC5C,2BAA2B;QAC3B,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,cAAc,CAAC,EAAE,CAAC;QAClC,iCA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,QAAQ,EAAE,EAAE;YAClD,OAAO,uBAAuB,CAAC;gBAC7B,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;gBACjB,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,QAAQ,CAAC,IAAI;gBACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,cAAc;aACf,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,iDAAiD;QACjD,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACvC,CAAC,CAAC;SACD,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,CAAC;AACP,CAAC"}
|
|
@@ -1,17 +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
|
-
export declare function getPortalEnv(authentication: UserSession): string;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function getPortalEnv(authentication) {
|
|
2
|
-
const portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
|
|
3
|
-
let result = "portal";
|
|
4
|
-
if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
|
|
5
|
-
result = "qaext";
|
|
6
|
-
}
|
|
7
|
-
else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
|
|
8
|
-
result = "devext";
|
|
9
|
-
}
|
|
10
|
-
else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
|
|
11
|
-
result = "www";
|
|
12
|
-
}
|
|
13
|
-
return result;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=get-portal-env.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-portal-env.js","sourceRoot":"","sources":["../../../src/helpers/get-portal-env.ts"],"names":[],"mappings":"AAiBA,MAAM,UAAU,YAAY,CAAC,cAA2B;IACtD,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,IAAI,qCAAqC,CAAC;IACjF,IAAI,MAAM,GAAG,QAAQ,CAAC;IACtB,IAAI,SAAS,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;QACnD,MAAM,GAAG,OAAO,CAAC;KAClB;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE;QAC/D,MAAM,GAAG,QAAQ,CAAC;KACnB;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE;QACtD,MAAM,GAAG,KAAK,CAAC;KAChB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -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 getStoryMapBaseUrl(authentication: UserSession): string;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getStoryMapSubdomain } from "./get-storymap-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 getStoryMapBaseUrl(authentication) {
|
|
9
|
-
let baseUrl = "";
|
|
10
|
-
const subdomain = getStoryMapSubdomain(authentication);
|
|
11
|
-
if (subdomain) {
|
|
12
|
-
baseUrl = `https://${subdomain}.arcgis.com`;
|
|
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/storymaps`;
|
|
19
|
-
}
|
|
20
|
-
return baseUrl;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=get-storymap-base-url.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-storymap-base-url.js","sourceRoot":"","sources":["../../../src/helpers/get-storymap-base-url.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,cAA2B;IAC5D,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,MAAM,SAAS,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACvD,IAAI,SAAS,EAAE;QACb,OAAO,GAAG,WAAW,SAAS,aAAa,CAAC;KAC7C;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,iBAAiB,CAAC;KAC7C;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,23 +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 { IModel } from "@esri/hub-common";
|
|
17
|
-
/**
|
|
18
|
-
* Extract a list of Items this storymap depends on
|
|
19
|
-
* At this point we are just extracting webmaps
|
|
20
|
-
*
|
|
21
|
-
* @param model IModel
|
|
22
|
-
*/
|
|
23
|
-
export declare function getStoryMapDependencies(model: IModel): any[];
|
|
@@ -1,32 +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 { getProp } from "@esri/hub-common";
|
|
17
|
-
/**
|
|
18
|
-
* Extract a list of Items this storymap depends on
|
|
19
|
-
* At this point we are just extracting webmaps
|
|
20
|
-
*
|
|
21
|
-
* @param model IModel
|
|
22
|
-
*/
|
|
23
|
-
export function getStoryMapDependencies(model) {
|
|
24
|
-
const resources = getProp(model, "data.resources") || {};
|
|
25
|
-
return Object.keys(resources).reduce((acc, key) => {
|
|
26
|
-
if (getProp(resources, `${key}.type`) === "webmap") {
|
|
27
|
-
acc.push(getProp(resources, `${key}.data.itemId`));
|
|
28
|
-
}
|
|
29
|
-
return acc;
|
|
30
|
-
}, []);
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=get-storymap-dependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-storymap-dependencies.js","sourceRoot":"","sources":["../../../src/helpers/get-storymap-dependencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAU,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAa;IACnD,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,EAAE,gBAAgB,CAAC,IAAI,EAAE,CAAC;IACzD,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAChD,IAAI,OAAO,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,KAAK,QAAQ,EAAE;YAClD,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,GAAG,cAAc,CAAC,CAAC,CAAC;SACpD;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
|
|
@@ -1,17 +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
|
-
export declare function getStoryMapSubdomain(authentication: UserSession): string;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export function getStoryMapSubdomain(authentication) {
|
|
2
|
-
const portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
|
|
3
|
-
// TODO: Sort out how we locate storymaps on portal?
|
|
4
|
-
let result;
|
|
5
|
-
if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
|
|
6
|
-
result = "storymapsqa";
|
|
7
|
-
}
|
|
8
|
-
else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
|
|
9
|
-
result = "storymapsdev";
|
|
10
|
-
}
|
|
11
|
-
else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
|
|
12
|
-
result = "storymaps";
|
|
13
|
-
}
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=get-storymap-subdomain.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-storymap-subdomain.js","sourceRoot":"","sources":["../../../src/helpers/get-storymap-subdomain.ts"],"names":[],"mappings":"AAiBA,MAAM,UAAU,oBAAoB,CAAC,cAA2B;IAC9D,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,IAAI,qCAAqC,CAAC;IACjF,oDAAoD;IACpD,IAAI,MAAM,CAAC;IACX,IAAI,SAAS,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;QACnD,MAAM,GAAG,aAAa,CAAC;KACxB;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE;QAC/D,MAAM,GAAG,cAAc,CAAC;KACzB;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE;QACtD,MAAM,GAAG,WAAW,CAAC;KACtB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,24 +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
|
-
* For some reason, the webmap resource key names are fancier than other resource keys
|
|
18
|
-
* They look like this: r-<webmap-item-id>-<timestamp>
|
|
19
|
-
* This interpolation is hard to accomplish given our current setup, so we're just overwriting
|
|
20
|
-
* them with "webmap0", "webmap1" and so forth. This _seems_ to make no difference.
|
|
21
|
-
*
|
|
22
|
-
* @param model
|
|
23
|
-
*/
|
|
24
|
-
export declare function remapWebmapKeys(resources?: any): any[];
|
|
@@ -1,40 +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 { getProp } from "@esri/hub-common";
|
|
17
|
-
/**
|
|
18
|
-
* For some reason, the webmap resource key names are fancier than other resource keys
|
|
19
|
-
* They look like this: r-<webmap-item-id>-<timestamp>
|
|
20
|
-
* This interpolation is hard to accomplish given our current setup, so we're just overwriting
|
|
21
|
-
* them with "webmap0", "webmap1" and so forth. This _seems_ to make no difference.
|
|
22
|
-
*
|
|
23
|
-
* @param model
|
|
24
|
-
*/
|
|
25
|
-
export function remapWebmapKeys(resources = {}) {
|
|
26
|
-
let webmapCounter = 0;
|
|
27
|
-
return Object.keys(resources).reduce((acc, key) => {
|
|
28
|
-
if (getProp(resources, `${key}.type`) === "webmap") {
|
|
29
|
-
if (key !== `webmap${webmapCounter}`) {
|
|
30
|
-
acc.push({
|
|
31
|
-
original: key,
|
|
32
|
-
updated: `webmap${webmapCounter}`,
|
|
33
|
-
});
|
|
34
|
-
webmapCounter++;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return acc;
|
|
38
|
-
}, []);
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=remap-webmap-keys.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remap-webmap-keys.js","sourceRoot":"","sources":["../../../src/helpers/remap-webmap-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,YAAiB,EAAE;IACjD,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAChD,IAAI,OAAO,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,KAAK,QAAQ,EAAE;YAClD,IAAI,GAAG,KAAK,SAAS,aAAa,EAAE,EAAE;gBACpC,GAAG,CAAC,IAAI,CAAC;oBACP,QAAQ,EAAE,GAAG;oBACb,OAAO,EAAE,SAAS,aAAa,EAAE;iBAClC,CAAC,CAAC;gBACH,aAAa,EAAE,CAAC;aACjB;SACF;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
|
package/dist/esm/index.d.ts
DELETED
|
@@ -1,23 +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 Story Map item types.
|
|
18
|
-
*
|
|
19
|
-
* @module storymap
|
|
20
|
-
*/
|
|
21
|
-
import * as StoryMapProcessor from "./storymap-processor";
|
|
22
|
-
import * as ClassicStoryMapProcessor from "./classic-storymap-processor";
|
|
23
|
-
export { StoryMapProcessor, ClassicStoryMapProcessor };
|
package/dist/esm/index.js
DELETED
|
@@ -1,24 +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 Story Map item types.
|
|
18
|
-
*
|
|
19
|
-
* @module storymap
|
|
20
|
-
*/
|
|
21
|
-
import * as StoryMapProcessor from "./storymap-processor";
|
|
22
|
-
import * as ClassicStoryMapProcessor from "./classic-storymap-processor";
|
|
23
|
-
export { StoryMapProcessor, ClassicStoryMapProcessor };
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,wBAAwB,MAAM,8BAA8B,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -1,39 +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 Story Map item types.
|
|
18
|
-
*
|
|
19
|
-
* @module storymap
|
|
20
|
-
*/
|
|
21
|
-
import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse, UserSession } from "@esri/solution-common";
|
|
22
|
-
/**
|
|
23
|
-
* Convert a StoryMap to a template
|
|
24
|
-
*
|
|
25
|
-
* @param itemInfo
|
|
26
|
-
* @param destAuthentication Credentials for requests to the destination organization
|
|
27
|
-
* @param srcAuthentication Credentials for requests to source items
|
|
28
|
-
*/
|
|
29
|
-
export declare function convertItemToTemplate(itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession): Promise<IItemTemplate>;
|
|
30
|
-
/**
|
|
31
|
-
* Create a StoryMap from the passed in template
|
|
32
|
-
*
|
|
33
|
-
* @param template
|
|
34
|
-
* @param templateDictionary
|
|
35
|
-
* @param destinationAuthentication
|
|
36
|
-
* @param itemProgressCallback
|
|
37
|
-
*/
|
|
38
|
-
export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
|
|
39
|
-
export declare function isAStoryMap(itemType: string): boolean;
|
|
@@ -1,133 +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 Story Map item types.
|
|
18
|
-
*
|
|
19
|
-
* @module storymap
|
|
20
|
-
*/
|
|
21
|
-
import { EItemProgressStatus, convertIModel, generateEmptyCreationResponse, getItemData, restRemoveItem, } from "@esri/solution-common";
|
|
22
|
-
import { failSafe } from "@esri/hub-common";
|
|
23
|
-
import { convertStoryMapToTemplate } from "./helpers/convert-storymap-to-template";
|
|
24
|
-
import { createStoryMapModelFromTemplate } from "./helpers/create-storymap-model-from-template";
|
|
25
|
-
import { createStoryMap } from "./helpers/create-storymap";
|
|
26
|
-
/**
|
|
27
|
-
* Convert a StoryMap to a template
|
|
28
|
-
*
|
|
29
|
-
* @param itemInfo
|
|
30
|
-
* @param destAuthentication Credentials for requests to the destination organization
|
|
31
|
-
* @param srcAuthentication Credentials for requests to source items
|
|
32
|
-
*/
|
|
33
|
-
export function convertItemToTemplate(itemInfo, destAuthentication, srcAuthentication) {
|
|
34
|
-
const model = {
|
|
35
|
-
item: itemInfo,
|
|
36
|
-
data: {},
|
|
37
|
-
};
|
|
38
|
-
// fetch the data.json
|
|
39
|
-
return getItemData(itemInfo.id, { authentication: srcAuthentication })
|
|
40
|
-
.then((data) => {
|
|
41
|
-
// append into the model
|
|
42
|
-
model.data = data;
|
|
43
|
-
// and use that to create a template
|
|
44
|
-
return convertStoryMapToTemplate(model);
|
|
45
|
-
})
|
|
46
|
-
.then((tmpl) => {
|
|
47
|
-
return tmpl;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Create a StoryMap from the passed in 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
|
-
// ensure we have a solution object in the templateDictionary hash
|
|
66
|
-
if (!templateDictionary.solution) {
|
|
67
|
-
templateDictionary.solution = {};
|
|
68
|
-
}
|
|
69
|
-
// .title should always be set on the templateDictionary
|
|
70
|
-
templateDictionary.solution.title = templateDictionary.title;
|
|
71
|
-
// TODO: Determine if we need any transforms in this new env
|
|
72
|
-
const transforms = {};
|
|
73
|
-
// create an object to hold the created site through
|
|
74
|
-
// subsequent promise calls
|
|
75
|
-
let model;
|
|
76
|
-
// Create the "siteModel" from the template. Does not save the site item yet
|
|
77
|
-
// Note: depending on licensing and user privs, will also create the team groups
|
|
78
|
-
// and initiative item.
|
|
79
|
-
return createStoryMapModelFromTemplate(template, templateDictionary, transforms, destinationAuthentication)
|
|
80
|
-
.then((interpolated) => {
|
|
81
|
-
const options = {
|
|
82
|
-
assets: interpolated.assets || [],
|
|
83
|
-
};
|
|
84
|
-
return createStoryMap(interpolated, templateDictionary.folderId, options, destinationAuthentication);
|
|
85
|
-
})
|
|
86
|
-
.then((createdModel) => {
|
|
87
|
-
model = createdModel;
|
|
88
|
-
// Update the template dictionary
|
|
89
|
-
// TODO: This should be done in whatever receives
|
|
90
|
-
// the outcome of this promise chain
|
|
91
|
-
templateDictionary[template.itemId] = {
|
|
92
|
-
itemId: model.item.id,
|
|
93
|
-
};
|
|
94
|
-
// call the progress callback, which also mutates templateDictionary
|
|
95
|
-
const finalStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, model.item.id);
|
|
96
|
-
if (!finalStatus) {
|
|
97
|
-
// clean up the site we just created
|
|
98
|
-
const failSafeRemove = failSafe(restRemoveItem, { success: true });
|
|
99
|
-
return failSafeRemove({
|
|
100
|
-
id: model.item.id,
|
|
101
|
-
authentication: destinationAuthentication,
|
|
102
|
-
}).then(() => {
|
|
103
|
-
return Promise.resolve(generateEmptyCreationResponse(template.type));
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
// finally, return ICreateItemFromTemplateResponse
|
|
108
|
-
const response = {
|
|
109
|
-
item: {
|
|
110
|
-
...template,
|
|
111
|
-
...convertIModel(model),
|
|
112
|
-
},
|
|
113
|
-
id: model.item.id,
|
|
114
|
-
type: template.type,
|
|
115
|
-
postProcess: false,
|
|
116
|
-
};
|
|
117
|
-
response.item.itemId = model.item.id;
|
|
118
|
-
return response;
|
|
119
|
-
}
|
|
120
|
-
})
|
|
121
|
-
.catch((ex) => {
|
|
122
|
-
itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);
|
|
123
|
-
throw ex;
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
export function isAStoryMap(itemType) {
|
|
127
|
-
let result = false;
|
|
128
|
-
if (itemType === "StoryMap") {
|
|
129
|
-
result = true;
|
|
130
|
-
}
|
|
131
|
-
return result;
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=storymap-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storymap-processor.js","sourceRoot":"","sources":["../../src/storymap-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,EAIL,mBAAmB,EAEnB,aAAa,EACb,6BAA6B,EAC7B,WAAW,EACX,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAU,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAa,EACb,kBAA+B,EAC/B,iBAA8B;IAE9B,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;SACnE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACb,wBAAwB;QACxB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,oCAAoC;QACpC,OAAO,yBAAyB,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACb,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,QAAuB,EACvB,kBAAuB,E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