@esri/solution-velocity 5.2.3 → 5.2.4
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/get-velocity-dependencies.d.ts +57 -0
- package/dist/cjs/helpers/get-velocity-dependencies.js +120 -0
- package/dist/cjs/helpers/get-velocity-dependencies.js.map +1 -0
- package/dist/cjs/helpers/velocity-helpers.d.ts +244 -0
- package/dist/cjs/helpers/velocity-helpers.js +572 -0
- package/dist/cjs/helpers/velocity-helpers.js.map +1 -0
- package/dist/cjs/helpers/velocity-templatize.d.ts +71 -0
- package/dist/cjs/helpers/velocity-templatize.js +114 -0
- package/dist/cjs/helpers/velocity-templatize.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/package.json +3 -0
- package/dist/cjs/velocity-processor.d.ts +60 -0
- package/dist/cjs/velocity-processor.js +135 -0
- package/dist/cjs/velocity-processor.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/package.json +4 -4
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** @license
|
|
3
|
+
* Copyright 2021 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._templatizeDatasources = exports._templatizeFeed = exports._templatizeFeeds = exports._templatize = exports.templatizeVelocity = void 0;
|
|
19
|
+
const solution_common_1 = require("@esri/solution-common");
|
|
20
|
+
/**
|
|
21
|
+
* Updates the template by adding variables for key properties that will
|
|
22
|
+
* need to be swapped when deploying
|
|
23
|
+
*
|
|
24
|
+
* @param template velocity item info that should be templatized
|
|
25
|
+
*
|
|
26
|
+
* @returns void
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
function templatizeVelocity(template) {
|
|
30
|
+
_templatize(template, "data.sources", _templatizeDatasources);
|
|
31
|
+
_templatize(template, "data.feeds", _templatizeFeeds);
|
|
32
|
+
_templatize(template, "data.feed", _templatizeFeed);
|
|
33
|
+
}
|
|
34
|
+
exports.templatizeVelocity = templatizeVelocity;
|
|
35
|
+
/**
|
|
36
|
+
* Generic wrapper for the templatize functions that
|
|
37
|
+
* will get and set the key properties
|
|
38
|
+
*
|
|
39
|
+
* @param template velocity item info that should be templatized
|
|
40
|
+
* @param prop the prop path to evaluate and set with a templatized variable
|
|
41
|
+
* @param fn the templatize function that should be called for this prop
|
|
42
|
+
*
|
|
43
|
+
* @returns void
|
|
44
|
+
*
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
function _templatize(template, prop, fn) {
|
|
48
|
+
const obj = (0, solution_common_1.getProp)(template, prop);
|
|
49
|
+
/* istanbul ignore else */
|
|
50
|
+
if (obj) {
|
|
51
|
+
(0, solution_common_1.setProp)(template, prop, fn(obj));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports._templatize = _templatize;
|
|
55
|
+
/**
|
|
56
|
+
* Updates the template by adding variables for the itemId and the label
|
|
57
|
+
* The label controls the name and must be unique for the org.
|
|
58
|
+
*
|
|
59
|
+
* @param feeds array of velocity feeds that should be templatized
|
|
60
|
+
*
|
|
61
|
+
* @returns The updated list of feed objects with templatized id and label
|
|
62
|
+
*
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
function _templatizeFeeds(feeds) {
|
|
66
|
+
return feeds.map((feed) => {
|
|
67
|
+
feed.label = feed.label && feed.id ? `{{${feed.id}.label}}` : feed.label;
|
|
68
|
+
feed.id = feed.id ? `{{${feed.id}.itemId}}` : feed.id;
|
|
69
|
+
return feed;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
exports._templatizeFeeds = _templatizeFeeds;
|
|
73
|
+
/**
|
|
74
|
+
* Updates the portal item id and feature layer id variables for the feed properties.
|
|
75
|
+
*
|
|
76
|
+
* @param feed the feed object from the item
|
|
77
|
+
*
|
|
78
|
+
* @returns the updated feed object with templatized portalItemId and layer id
|
|
79
|
+
*
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
function _templatizeFeed(feed) {
|
|
83
|
+
let id = (0, solution_common_1.getProp)(feed, "properties.feature-layer.portalItemId");
|
|
84
|
+
/* istanbul ignore else */
|
|
85
|
+
if (feed.properties) {
|
|
86
|
+
/* istanbul ignore else */
|
|
87
|
+
if (feed.properties["feature-layer.portalItemId"]) {
|
|
88
|
+
id = feed.properties["feature-layer.portalItemId"];
|
|
89
|
+
feed.properties["feature-layer.portalItemId"] = `{{${id}.itemId}}`;
|
|
90
|
+
}
|
|
91
|
+
/* istanbul ignore else */
|
|
92
|
+
if (id && feed.properties.hasOwnProperty("feature-layer.layerId")) {
|
|
93
|
+
const flId = feed.properties["feature-layer.layerId"];
|
|
94
|
+
feed.properties["feature-layer.layerId"] = `{{${id}.layer${flId}.layerId}}`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return feed;
|
|
98
|
+
}
|
|
99
|
+
exports._templatizeFeed = _templatizeFeed;
|
|
100
|
+
/**
|
|
101
|
+
* Velocity datasources share the same props as feeds so they can leverage
|
|
102
|
+
* the same templatize function
|
|
103
|
+
*
|
|
104
|
+
* @param dataSources array of data sources from the item
|
|
105
|
+
*
|
|
106
|
+
* @returns the updated dataSources object with templatized ids and labels
|
|
107
|
+
*
|
|
108
|
+
* @private
|
|
109
|
+
*/
|
|
110
|
+
function _templatizeDatasources(dataSources) {
|
|
111
|
+
return dataSources.map((ds) => _templatizeFeed(ds));
|
|
112
|
+
}
|
|
113
|
+
exports._templatizeDatasources = _templatizeDatasources;
|
|
114
|
+
//# sourceMappingURL=velocity-templatize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"velocity-templatize.js","sourceRoot":"","sources":["../../../src/helpers/velocity-templatize.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2DAAwE;AAExE;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAC,QAAuB;IACxD,WAAW,CAAC,QAAQ,EAAE,cAAc,EAAE,sBAAsB,CAAC,CAAC;IAC9D,WAAW,CAAC,QAAQ,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;IACtD,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;AACtD,CAAC;AAJD,gDAIC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,WAAW,CACzB,QAAuB,EACvB,IAAY,EACZ,EAAsB;IAEtB,MAAM,GAAG,GAAQ,IAAA,yBAAO,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACzC,0BAA0B;IAC1B,IAAI,GAAG,EAAE;QACP,IAAA,yBAAO,EAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;KAClC;AACH,CAAC;AAVD,kCAUC;AAED;;;;;;;;;GASG;AACH,SAAgB,gBAAgB,CAAC,KAAY;IAC3C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QACzE,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAND,4CAMC;AAED;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAAC,IAAS;IACvC,IAAI,EAAE,GAAG,IAAA,yBAAO,EAAC,IAAI,EAAE,uCAAuC,CAAC,CAAC;IAChE,0BAA0B;IAC1B,IAAI,IAAI,CAAC,UAAU,EAAE;QACnB,0BAA0B;QAC1B,IAAI,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAAC,EAAE;YACjD,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAC;YACnD,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAAC,GAAG,KAAK,EAAE,WAAW,CAAC;SACpE;QACD,0BAA0B;QAC1B,IAAI,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,uBAAuB,CAAC,EAAE;YACjE,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;YACtD,IAAI,CAAC,UAAU,CACb,uBAAuB,CACxB,GAAG,KAAK,EAAE,SAAS,IAAI,YAAY,CAAC;SACtC;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAlBD,0CAkBC;AAED;;;;;;;;;GASG;AACH,SAAgB,sBAAsB,CAAC,WAAkB;IACvD,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,EAAO,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAFD,wDAEC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @license
|
|
2
|
+
* Copyright 2021 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 VelocityProcessor from "./velocity-processor";
|
|
17
|
+
export { VelocityProcessor };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** @license
|
|
3
|
+
* Copyright 2021 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.VelocityProcessor = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const VelocityProcessor = tslib_1.__importStar(require("./velocity-processor"));
|
|
21
|
+
exports.VelocityProcessor = VelocityProcessor;
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,gFAA0D;AAEjD,8CAAiB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** @license
|
|
2
|
+
* Copyright 2021 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 velocity item types.
|
|
18
|
+
*
|
|
19
|
+
* @module velocity
|
|
20
|
+
*/
|
|
21
|
+
import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse } from "@esri/solution-common";
|
|
22
|
+
/**
|
|
23
|
+
* Convert a Velocity item into a Template
|
|
24
|
+
*
|
|
25
|
+
* @param itemInfo The basic item info
|
|
26
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
27
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
28
|
+
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
29
|
+
*
|
|
30
|
+
* @returns a promise that will resolve the constructed IItemTemplate from the input itemInfo
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
export declare function convertItemToTemplate(itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession, templateDictionary: any): Promise<IItemTemplate>;
|
|
34
|
+
/**
|
|
35
|
+
* Create Velocity analytics and feeds from a Template
|
|
36
|
+
*
|
|
37
|
+
* @param template The template for the volocity items
|
|
38
|
+
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
39
|
+
* @param destinationAuthentication Credentials for the deployment requests
|
|
40
|
+
* @param itemProgressCallback Function for reporting progress updates from type-specific template handlers
|
|
41
|
+
*
|
|
42
|
+
* @returns a promise that will resolve with the new item info, id, type, and postProcess flag
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Velocity post-processing actions
|
|
48
|
+
*
|
|
49
|
+
* Move all velocity items to the deployment folder.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} itemId The item ID
|
|
52
|
+
* @param {string} type The template type
|
|
53
|
+
* @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
|
|
54
|
+
* @param {IItemTemplate} template The item template
|
|
55
|
+
* @param {IItemTemplate[]} templates The full collection of item templates
|
|
56
|
+
* @param {any} templateDictionary Hash of facts such as the folder id for the deployment
|
|
57
|
+
* @param {UserSession} authentication The destination session info
|
|
58
|
+
* @returns Promise resolving to successfulness of update
|
|
59
|
+
*/
|
|
60
|
+
export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: IItemTemplate, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<any>;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** @license
|
|
3
|
+
* Copyright 2021 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 velocity item types.
|
|
21
|
+
*
|
|
22
|
+
* @module velocity
|
|
23
|
+
*/
|
|
24
|
+
const solution_common_1 = require("@esri/solution-common");
|
|
25
|
+
const velocity_templatize_1 = require("./helpers/velocity-templatize");
|
|
26
|
+
const get_velocity_dependencies_1 = require("./helpers/get-velocity-dependencies");
|
|
27
|
+
const velocity_helpers_1 = require("./helpers/velocity-helpers");
|
|
28
|
+
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
29
|
+
/**
|
|
30
|
+
* Convert a Velocity item into a Template
|
|
31
|
+
*
|
|
32
|
+
* @param itemInfo The basic item info
|
|
33
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
34
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
35
|
+
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
36
|
+
*
|
|
37
|
+
* @returns a promise that will resolve the constructed IItemTemplate from the input itemInfo
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
function convertItemToTemplate(itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
|
|
41
|
+
const template = (0, solution_common_1.createInitializedItemTemplate)(itemInfo);
|
|
42
|
+
return (0, velocity_helpers_1.getVelocityUrl)(srcAuthentication, templateDictionary, itemInfo.type, itemInfo.id).then((url) => {
|
|
43
|
+
if (url) {
|
|
44
|
+
return fetch(url)
|
|
45
|
+
.then(data => data.json())
|
|
46
|
+
.then(data_json => {
|
|
47
|
+
template.item.title = data_json.label;
|
|
48
|
+
template.data = data_json;
|
|
49
|
+
return (0, get_velocity_dependencies_1.getVelocityDependencies)(template, srcAuthentication).then(deps => {
|
|
50
|
+
template.dependencies = deps;
|
|
51
|
+
(0, velocity_helpers_1.cleanDataSourcesAndFeeds)(template, templateDictionary.velocityUrl);
|
|
52
|
+
(0, velocity_templatize_1.templatizeVelocity)(template);
|
|
53
|
+
template.item = (0, solution_common_1.updateVelocityReferences)(template.item, template.type, templateDictionary);
|
|
54
|
+
return Promise.resolve(template);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// In case the org used to have velocity and they still have items
|
|
60
|
+
return Promise.reject("Velocity NOT Supported by Organization");
|
|
61
|
+
}
|
|
62
|
+
}, e => Promise.reject((0, solution_common_1.fail)(e)));
|
|
63
|
+
}
|
|
64
|
+
exports.convertItemToTemplate = convertItemToTemplate;
|
|
65
|
+
/**
|
|
66
|
+
* Create Velocity analytics and feeds from a Template
|
|
67
|
+
*
|
|
68
|
+
* @param template The template for the volocity items
|
|
69
|
+
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
70
|
+
* @param destinationAuthentication Credentials for the deployment requests
|
|
71
|
+
* @param itemProgressCallback Function for reporting progress updates from type-specific template handlers
|
|
72
|
+
*
|
|
73
|
+
* @returns a promise that will resolve with the new item info, id, type, and postProcess flag
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
77
|
+
// let the progress system know we've started...
|
|
78
|
+
const startStatus = itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Started, 0);
|
|
79
|
+
// and if it returned false, just resolve out
|
|
80
|
+
/* istanbul ignore else */
|
|
81
|
+
if (!startStatus) {
|
|
82
|
+
return Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type));
|
|
83
|
+
}
|
|
84
|
+
const orgId = template.itemId;
|
|
85
|
+
return (0, velocity_helpers_1.postVelocityData)(destinationAuthentication, template, template.data, templateDictionary).then(result => {
|
|
86
|
+
const finalStatus = itemProgressCallback(orgId, solution_common_1.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, result.id);
|
|
87
|
+
if (!finalStatus) {
|
|
88
|
+
return (0, solution_common_1.removeItem)(result.id, destinationAuthentication).then(() => Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type)), () => Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type)));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const response = {
|
|
92
|
+
item: {
|
|
93
|
+
...template,
|
|
94
|
+
...result
|
|
95
|
+
},
|
|
96
|
+
id: result.item.id,
|
|
97
|
+
type: template.type,
|
|
98
|
+
postProcess: true
|
|
99
|
+
};
|
|
100
|
+
response.item.itemId = result.item.id;
|
|
101
|
+
return response;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
exports.createItemFromTemplate = createItemFromTemplate;
|
|
106
|
+
/**
|
|
107
|
+
* Velocity post-processing actions
|
|
108
|
+
*
|
|
109
|
+
* Move all velocity items to the deployment folder.
|
|
110
|
+
*
|
|
111
|
+
* @param {string} itemId The item ID
|
|
112
|
+
* @param {string} type The template type
|
|
113
|
+
* @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
|
|
114
|
+
* @param {IItemTemplate} template The item template
|
|
115
|
+
* @param {IItemTemplate[]} templates The full collection of item templates
|
|
116
|
+
* @param {any} templateDictionary Hash of facts such as the folder id for the deployment
|
|
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
|
+
const itemUpdate = itemInfos.filter(ii => ii.id === itemId);
|
|
122
|
+
const item = itemUpdate[0].item.item;
|
|
123
|
+
delete item.url;
|
|
124
|
+
delete item.origUrl;
|
|
125
|
+
return (0, solution_common_1.updateItem)(item, authentication).then(() => {
|
|
126
|
+
return (0, arcgis_rest_portal_1.moveItem)({
|
|
127
|
+
owner: authentication.username,
|
|
128
|
+
itemId,
|
|
129
|
+
folderId: templateDictionary.folderId,
|
|
130
|
+
authentication
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
exports.postProcess = postProcess;
|
|
135
|
+
//# sourceMappingURL=velocity-processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"velocity-processor.js","sourceRoot":"","sources":["../../src/velocity-processor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,2DAY+B;AAC/B,uEAAmE;AACnE,mFAA8E;AAC9E,iEAIoC;AACpC,iEAEkC;AAElC;;;;;;;;;;GAUG;AACH,SAAgB,qBAAqB,CACnC,QAAa,EACb,kBAA+B,EAC/B,iBAA8B,EAC9B,kBAAuB;IAEvB,MAAM,QAAQ,GAAG,IAAA,+CAA6B,EAAC,QAAQ,CAAC,CAAC;IACzD,OAAO,IAAA,iCAAc,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,CAAC,IAAI,EACb,QAAQ,CAAC,EAAE,CACZ,CAAC,IAAI,CACJ,CAAC,GAAW,EAAE,EAAE;QACd,IAAI,GAAG,EAAE;YACP,OAAO,KAAK,CAAC,GAAG,CAAC;iBACd,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;iBACzB,IAAI,CAAC,SAAS,CAAC,EAAE;gBAChB,QAAQ,CAAC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;gBACtC,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC;gBAC1B,OAAO,IAAA,mDAAuB,EAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAC9D,IAAI,CAAC,EAAE;oBACL,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC;oBAC7B,IAAA,2CAAwB,EAAC,QAAQ,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;oBACnE,IAAA,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QAAQ;YAC9B,MAAM;YACN,QAAQ,EAAE,kBAAkB,CAAC,QAAQ;YACrC,cAAc;SACf,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACN,CAAC;AArBA,kCAqBA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/solution-velocity",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.4",
|
|
4
4
|
"description": "Manages the creation and deployment of Velocity item types for @esri/solution.js.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"@esri/hub-initiatives": "^14.0.0",
|
|
28
28
|
"@esri/hub-sites": "^14.2.2",
|
|
29
29
|
"@esri/hub-teams": "^14.1.0",
|
|
30
|
-
"@esri/solution-common": "^5.2.
|
|
31
|
-
"@esri/solution-simple-types": "^5.2.
|
|
30
|
+
"@esri/solution-common": "^5.2.4",
|
|
31
|
+
"@esri/solution-simple-types": "^5.2.4",
|
|
32
32
|
"@types/jasmine": "^5.1.4",
|
|
33
33
|
"fetch-mock": "^7.7.3",
|
|
34
34
|
"jasmine": "^5.1.0",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"esri",
|
|
83
83
|
"ES6"
|
|
84
84
|
],
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "c3329c6814c1d7b898eb130bf3a7feeda12f074f"
|
|
86
86
|
}
|