@esri/solution-velocity 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/helpers/get-velocity-dependencies.d.ts +1 -1
- package/dist/esm/helpers/get-velocity-dependencies.js +36 -17
- package/dist/esm/helpers/get-velocity-dependencies.js.map +1 -1
- package/dist/esm/helpers/velocity-helpers.d.ts +26 -6
- package/dist/esm/helpers/velocity-helpers.js +183 -103
- package/dist/esm/helpers/velocity-helpers.js.map +1 -1
- package/dist/esm/helpers/velocity-templatize.js +9 -9
- package/dist/esm/helpers/velocity-templatize.js.map +1 -1
- package/dist/esm/velocity-processor.d.ts +18 -2
- package/dist/esm/velocity-processor.js +52 -19
- package/dist/esm/velocity-processor.js.map +1 -1
- package/dist/node/helpers/get-velocity-dependencies.d.ts +1 -1
- package/dist/node/helpers/get-velocity-dependencies.js +36 -17
- package/dist/node/helpers/get-velocity-dependencies.js.map +1 -1
- package/dist/node/helpers/velocity-helpers.d.ts +26 -6
- package/dist/node/helpers/velocity-helpers.js +186 -104
- package/dist/node/helpers/velocity-helpers.js.map +1 -1
- package/dist/node/helpers/velocity-templatize.js +10 -10
- package/dist/node/helpers/velocity-templatize.js.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/velocity-processor.d.ts +18 -2
- package/dist/node/velocity-processor.js +57 -23
- package/dist/node/velocity-processor.js.map +1 -1
- package/dist/umd/helpers/get-velocity-dependencies.d.ts +1 -1
- package/dist/umd/helpers/velocity-helpers.d.ts +26 -6
- package/dist/umd/velocity-processor.d.ts +18 -2
- package/dist/umd/velocity.umd.js +879 -772
- package/dist/umd/velocity.umd.js.map +1 -1
- package/dist/umd/velocity.umd.min.js +3 -3
- package/dist/umd/velocity.umd.min.js.map +1 -1
- package/package.json +17 -17
|
@@ -51,4 +51,4 @@ export declare function _getFeedDependencies(feeds: any[], dependencies: string[
|
|
|
51
51
|
* @param dependencies The current list of dependencies
|
|
52
52
|
* @param prop The individual prop to evaluate
|
|
53
53
|
*/
|
|
54
|
-
export declare function _getDependencies(outputs: any[], dependencies: string[]
|
|
54
|
+
export declare function _getDependencies(outputs: any[], dependencies: string[]): void;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { getProp, getItemBase } from "@esri/solution-common";
|
|
16
|
+
import { getProp, getItemBase, BASE_NAMES, PROP_NAMES } from "@esri/solution-common";
|
|
17
17
|
/**
|
|
18
18
|
* Get the dependencies from the velocity data sources, feeds, and outputs.
|
|
19
19
|
* Only dependencies that do NOT have the typeKeyword "IoTFeatureLayer" are returned.
|
|
@@ -24,11 +24,17 @@ import { getProp, getItemBase } from "@esri/solution-common";
|
|
|
24
24
|
* @return a list of dependency ids
|
|
25
25
|
*/
|
|
26
26
|
export function getVelocityDependencies(template, authentication) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
const dependencies = [];
|
|
28
|
+
[
|
|
29
|
+
getProp(template, "data.feeds") ? template.data.feeds : [],
|
|
30
|
+
getProp(template, "data.feed") ? [template.data.feed] : []
|
|
31
|
+
].forEach(f => _getFeedDependencies(f, dependencies));
|
|
32
|
+
[
|
|
33
|
+
getProp(template, "data.sources") ? template.data.sources : [],
|
|
34
|
+
getProp(template, "data.source") ? [template.data.source] : [],
|
|
35
|
+
getProp(template, "data.outputs") ? template.data.outputs : [],
|
|
36
|
+
getProp(template, "data.output") ? [template.data.output] : []
|
|
37
|
+
].forEach(d => _getDependencies(d, dependencies));
|
|
32
38
|
return _validateDependencies(dependencies, authentication);
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
@@ -42,11 +48,11 @@ export function getVelocityDependencies(template, authentication) {
|
|
|
42
48
|
* @return a list of dependency ids
|
|
43
49
|
*/
|
|
44
50
|
export function _validateDependencies(dependencies, authentication) {
|
|
45
|
-
|
|
51
|
+
const defs = dependencies.map(d => {
|
|
46
52
|
return getItemBase(d, authentication);
|
|
47
53
|
});
|
|
48
|
-
return Promise.all(defs).then(
|
|
49
|
-
return Promise.resolve(itemInfos.reduce(
|
|
54
|
+
return Promise.all(defs).then(itemInfos => {
|
|
55
|
+
return Promise.resolve(itemInfos.reduce((prev, cur) => {
|
|
50
56
|
if (cur.typeKeywords.indexOf("IoTFeatureLayer") < 0) {
|
|
51
57
|
prev.push(cur.id);
|
|
52
58
|
}
|
|
@@ -62,14 +68,18 @@ export function _validateDependencies(dependencies, authentication) {
|
|
|
62
68
|
* @param dependencies The current list of dependencies
|
|
63
69
|
*/
|
|
64
70
|
export function _getFeedDependencies(feeds, dependencies) {
|
|
65
|
-
feeds.reduce(
|
|
66
|
-
|
|
71
|
+
feeds.reduce((prev, cur) => {
|
|
72
|
+
const id = cur.id || undefined;
|
|
67
73
|
/* istanbul ignore else */
|
|
68
74
|
if (id && prev.indexOf(id) < 0) {
|
|
69
75
|
prev.push(id);
|
|
70
76
|
}
|
|
71
77
|
return prev;
|
|
72
78
|
}, dependencies);
|
|
79
|
+
// run through standard dependency check as well
|
|
80
|
+
// in some cases the feed does not have the id property but will have
|
|
81
|
+
// a portalItemId value in the properties
|
|
82
|
+
_getDependencies(feeds, dependencies);
|
|
73
83
|
}
|
|
74
84
|
/**
|
|
75
85
|
* Get the dependencies from the velocity outputs or dataSources.
|
|
@@ -79,12 +89,21 @@ export function _getFeedDependencies(feeds, dependencies) {
|
|
|
79
89
|
* @param dependencies The current list of dependencies
|
|
80
90
|
* @param prop The individual prop to evaluate
|
|
81
91
|
*/
|
|
82
|
-
export function _getDependencies(outputs, dependencies
|
|
83
|
-
outputs.reduce(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
92
|
+
export function _getDependencies(outputs, dependencies) {
|
|
93
|
+
outputs.reduce((prev, cur) => {
|
|
94
|
+
const names = getProp(cur, "name") ? [cur.name] : BASE_NAMES;
|
|
95
|
+
names.forEach(n => {
|
|
96
|
+
PROP_NAMES.forEach(p => {
|
|
97
|
+
// skip map service and stream service ids
|
|
98
|
+
/* istanbul ignore else */
|
|
99
|
+
if (p.indexOf("mapServicePortalItemID") < 0 && p.indexOf("streamServicePortalItemID") < 0) {
|
|
100
|
+
const id = cur.properties ? cur.properties[n + p] : undefined;
|
|
101
|
+
if (id && prev.indexOf(id) < 0) {
|
|
102
|
+
prev.push(id);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
88
107
|
return prev;
|
|
89
108
|
}, dependencies);
|
|
90
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-velocity-dependencies.js","sourceRoot":"","sources":["../../../src/helpers/get-velocity-dependencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,OAAO,EACP,WAAW,
|
|
1
|
+
{"version":3,"file":"get-velocity-dependencies.js","sourceRoot":"","sources":["../../../src/helpers/get-velocity-dependencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,OAAO,EACP,WAAW,EAGX,UAAU,EACV,UAAU,EACX,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CACrC,QAAuB,EACvB,cAA2B;IAE3B,MAAM,YAAY,GAAa,EAAE,CAAC;IAElC;QACE,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QAC1D,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;KAC3D,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,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AAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;oBACtE,IAAI,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE;wBAC9B,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;qBACf;iBACF;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,YAAY,CAAC,CAAC;AACnB,CAAC"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { IItemTemplate, UserSession } from "@esri/solution-common";
|
|
16
|
+
import { IItemTemplate, IVelocityTitle, UserSession } from "@esri/solution-common";
|
|
17
17
|
/**
|
|
18
18
|
* Common function to build urls for reading and interacting with the velocity api
|
|
19
19
|
*
|
|
@@ -54,7 +54,7 @@ export declare function postVelocityData(authentication: UserSession, template:
|
|
|
54
54
|
* @return a promise that will resolve a unique title
|
|
55
55
|
*
|
|
56
56
|
*/
|
|
57
|
-
export declare function getTitle(authentication: UserSession, label: string, url: string): Promise<
|
|
57
|
+
export declare function getTitle(authentication: UserSession, label: string, url: string): Promise<IVelocityTitle>;
|
|
58
58
|
/**
|
|
59
59
|
* Validate the data that will be used and handle any reported issues with the outputs.
|
|
60
60
|
* The output names must be unique across the organization.
|
|
@@ -65,12 +65,32 @@ export declare function getTitle(authentication: UserSession, label: string, url
|
|
|
65
65
|
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
66
66
|
* @param type The type of velocity item
|
|
67
67
|
* @param data The data used to construct the velocity item
|
|
68
|
-
* @param
|
|
68
|
+
* @param titles The list of know titles that exist in the org
|
|
69
|
+
* @param dataOutputs The velocity items output objects
|
|
70
|
+
* @param feeds The velocity items feed objects
|
|
69
71
|
*
|
|
70
72
|
* @return a promise that will resolve the data object passed in with any necessary changes.
|
|
71
73
|
*
|
|
72
74
|
*/
|
|
73
|
-
export declare function _validateOutputs(authentication: UserSession, templateDictionary: any, type: string, data: any,
|
|
75
|
+
export declare function _validateOutputs(authentication: UserSession, templateDictionary: any, type: string, data: any, titles: any[], dataOutputs?: any[], feeds?: any[]): Promise<any>;
|
|
76
|
+
/**
|
|
77
|
+
* Check the validate results for any name conflicts and store the conflicting names.
|
|
78
|
+
*
|
|
79
|
+
* @param validateResults The results object to check for name conflict errors
|
|
80
|
+
*
|
|
81
|
+
* @return a list of names that already exist in the org
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
export declare function _validateMessages(validateResults: any): string[];
|
|
85
|
+
/**
|
|
86
|
+
* Updates the feed object with a new name when validation fails.
|
|
87
|
+
*
|
|
88
|
+
* @param feeds The feed objects from the velocity item.
|
|
89
|
+
* @param data The full data object used for deploying the velocity item.
|
|
90
|
+
* @param names The names that failed due to duplicate error in validation.
|
|
91
|
+
*
|
|
92
|
+
*/
|
|
93
|
+
export declare function _updateFeed(feeds: any[], data: any, names: string[]): void;
|
|
74
94
|
/**
|
|
75
95
|
* Updates the data object with a new name when validation fails.
|
|
76
96
|
*
|
|
@@ -178,7 +198,7 @@ body?: any): Promise<any>;
|
|
|
178
198
|
* @param template The template that for the velocity item
|
|
179
199
|
*
|
|
180
200
|
*/
|
|
181
|
-
export declare function cleanDataSourcesAndFeeds(template: IItemTemplate): void;
|
|
201
|
+
export declare function cleanDataSourcesAndFeeds(template: IItemTemplate, velocityUrl: string): void;
|
|
182
202
|
/**
|
|
183
203
|
* Remove key properties from the input source or feed
|
|
184
204
|
*
|
|
@@ -186,7 +206,7 @@ export declare function cleanDataSourcesAndFeeds(template: IItemTemplate): void;
|
|
|
186
206
|
* @param dependencies The list of dependencies
|
|
187
207
|
*
|
|
188
208
|
*/
|
|
189
|
-
export declare function _removeIdProps(sourcesOrFeeds: any[], dependencies: string[]): void;
|
|
209
|
+
export declare function _removeIdProps(sourcesOrFeeds: any[], dependencies: string[], velocityUrl: string): void;
|
|
190
210
|
/**
|
|
191
211
|
* Remove key properties from the outputs.
|
|
192
212
|
*
|