@esri/solution-velocity 4.1.2 → 5.0.1

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.
@@ -1,57 +1,57 @@
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 { IItemTemplate, UserSession } from "@esri/solution-common";
17
- /**
18
- * Get the dependencies from the velocity data sources, feeds, and outputs.
19
- * Only dependencies that do NOT have the typeKeyword "IoTFeatureLayer" are returned.
20
- *
21
- * @param template The template that for the velocity item
22
- * @param authentication The credentials for any requests
23
- *
24
- * @returns a list of dependency ids
25
- */
26
- export declare function getVelocityDependencies(template: IItemTemplate, authentication: UserSession): Promise<string[]>;
27
- /**
28
- * Any feature services with the typeKeyword "IoTFeatureLayer" should not be templatized or
29
- * listed as a dependency.
30
- * We can’t create Velocity feature layers in their spatiotemporal datastore as we have no api.
31
- *
32
- * @param dependencies Any dependencies that have been found for this item
33
- * @param authentication The credentials for any requests
34
- *
35
- * @returns a list of dependency ids
36
- * @private
37
- */
38
- export declare function _validateDependencies(dependencies: string[], authentication: UserSession): Promise<string[]>;
39
- /**
40
- * Get the dependencies from the velocity feeds
41
- * This function will update the input dependencies argument
42
- *
43
- * @param feeds The list of feeds from the velocity template
44
- * @param dependencies The current list of dependencies
45
- * @private
46
- */
47
- export declare function _getFeedDependencies(feeds: any[], dependencies: string[]): void;
48
- /**
49
- * Get the dependencies from the velocity outputs or dataSources.
50
- * This function will update the input dependencies argument
51
- *
52
- * @param outputs The list of outputs from the velocity item
53
- * @param dependencies The current list of dependencies
54
- * @param prop The individual prop to evaluate
55
- * @private
56
- */
57
- export declare function _getDependencies(outputs: any[], dependencies: string[]): void;
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 { IItemTemplate, UserSession } from "@esri/solution-common";
17
+ /**
18
+ * Get the dependencies from the velocity data sources, feeds, and outputs.
19
+ * Only dependencies that do NOT have the typeKeyword "IoTFeatureLayer" are returned.
20
+ *
21
+ * @param template The template that for the velocity item
22
+ * @param authentication The credentials for any requests
23
+ *
24
+ * @returns a list of dependency ids
25
+ */
26
+ export declare function getVelocityDependencies(template: IItemTemplate, authentication: UserSession): Promise<string[]>;
27
+ /**
28
+ * Any feature services with the typeKeyword "IoTFeatureLayer" should not be templatized or
29
+ * listed as a dependency.
30
+ * We can’t create Velocity feature layers in their spatiotemporal datastore as we have no api.
31
+ *
32
+ * @param dependencies Any dependencies that have been found for this item
33
+ * @param authentication The credentials for any requests
34
+ *
35
+ * @returns a list of dependency ids
36
+ * @private
37
+ */
38
+ export declare function _validateDependencies(dependencies: string[], authentication: UserSession): Promise<string[]>;
39
+ /**
40
+ * Get the dependencies from the velocity feeds
41
+ * This function will update the input dependencies argument
42
+ *
43
+ * @param feeds The list of feeds from the velocity template
44
+ * @param dependencies The current list of dependencies
45
+ * @private
46
+ */
47
+ export declare function _getFeedDependencies(feeds: any[], dependencies: string[]): void;
48
+ /**
49
+ * Get the dependencies from the velocity outputs or dataSources.
50
+ * This function will update the input dependencies argument
51
+ *
52
+ * @param outputs The list of outputs from the velocity item
53
+ * @param dependencies The current list of dependencies
54
+ * @param prop The individual prop to evaluate
55
+ * @private
56
+ */
57
+ export declare function _getDependencies(outputs: any[], dependencies: string[]): void;
@@ -1,120 +1,120 @@
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._getDependencies = exports._getFeedDependencies = exports._validateDependencies = exports.getVelocityDependencies = void 0;
19
- const solution_common_1 = require("@esri/solution-common");
20
- /**
21
- * Get the dependencies from the velocity data sources, feeds, and outputs.
22
- * Only dependencies that do NOT have the typeKeyword "IoTFeatureLayer" are returned.
23
- *
24
- * @param template The template that for the velocity item
25
- * @param authentication The credentials for any requests
26
- *
27
- * @returns a list of dependency ids
28
- */
29
- function getVelocityDependencies(template, authentication) {
30
- const dependencies = [];
31
- [
32
- (0, solution_common_1.getProp)(template, "data.feeds") ? template.data.feeds : [],
33
- (0, solution_common_1.getProp)(template, "data.feed") ? [template.data.feed] : []
34
- ].forEach(f => _getFeedDependencies(f, dependencies));
35
- [
36
- (0, solution_common_1.getProp)(template, "data.sources") ? template.data.sources : [],
37
- (0, solution_common_1.getProp)(template, "data.source") ? [template.data.source] : [],
38
- (0, solution_common_1.getProp)(template, "data.outputs") ? template.data.outputs : [],
39
- (0, solution_common_1.getProp)(template, "data.output") ? [template.data.output] : []
40
- ].forEach(d => _getDependencies(d, dependencies));
41
- return _validateDependencies(dependencies, authentication);
42
- }
43
- exports.getVelocityDependencies = getVelocityDependencies;
44
- /**
45
- * Any feature services with the typeKeyword "IoTFeatureLayer" should not be templatized or
46
- * listed as a dependency.
47
- * We can’t create Velocity feature layers in their spatiotemporal datastore as we have no api.
48
- *
49
- * @param dependencies Any dependencies that have been found for this item
50
- * @param authentication The credentials for any requests
51
- *
52
- * @returns a list of dependency ids
53
- * @private
54
- */
55
- function _validateDependencies(dependencies, authentication) {
56
- const defs = dependencies.map(d => {
57
- return (0, solution_common_1.getItemBase)(d, authentication);
58
- });
59
- return Promise.all(defs).then(itemInfos => {
60
- return Promise.resolve(itemInfos.reduce((prev, cur) => {
61
- if (cur.typeKeywords.indexOf("IoTFeatureLayer") < 0) {
62
- prev.push(cur.id);
63
- }
64
- return prev;
65
- }, []));
66
- });
67
- }
68
- exports._validateDependencies = _validateDependencies;
69
- /**
70
- * Get the dependencies from the velocity feeds
71
- * This function will update the input dependencies argument
72
- *
73
- * @param feeds The list of feeds from the velocity template
74
- * @param dependencies The current list of dependencies
75
- * @private
76
- */
77
- function _getFeedDependencies(feeds, dependencies) {
78
- feeds.reduce((prev, cur) => {
79
- const id = cur.id || undefined;
80
- /* istanbul ignore else */
81
- if (id && prev.indexOf(id) < 0) {
82
- prev.push(id);
83
- }
84
- return prev;
85
- }, dependencies);
86
- // run through standard dependency check as well
87
- // in some cases the feed does not have the id property but will have
88
- // a portalItemId value in the properties
89
- _getDependencies(feeds, dependencies);
90
- }
91
- exports._getFeedDependencies = _getFeedDependencies;
92
- /**
93
- * Get the dependencies from the velocity outputs or dataSources.
94
- * This function will update the input dependencies argument
95
- *
96
- * @param outputs The list of outputs from the velocity item
97
- * @param dependencies The current list of dependencies
98
- * @param prop The individual prop to evaluate
99
- * @private
100
- */
101
- function _getDependencies(outputs, dependencies) {
102
- outputs.reduce((prev, cur) => {
103
- const names = (0, solution_common_1.getProp)(cur, "name") ? [cur.name] : solution_common_1.BASE_NAMES;
104
- names.forEach(n => {
105
- solution_common_1.PROP_NAMES.forEach(p => {
106
- // skip map service and stream service ids
107
- /* istanbul ignore else */
108
- if (p.indexOf("mapServicePortalItemID") < 0 && p.indexOf("streamServicePortalItemID") < 0) {
109
- const id = cur.properties ? cur.properties[n + p] : undefined;
110
- if (id && prev.indexOf(id) < 0) {
111
- prev.push(id);
112
- }
113
- }
114
- });
115
- });
116
- return prev;
117
- }, dependencies);
118
- }
119
- exports._getDependencies = _getDependencies;
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._getDependencies = exports._getFeedDependencies = exports._validateDependencies = exports.getVelocityDependencies = void 0;
19
+ const solution_common_1 = require("@esri/solution-common");
20
+ /**
21
+ * Get the dependencies from the velocity data sources, feeds, and outputs.
22
+ * Only dependencies that do NOT have the typeKeyword "IoTFeatureLayer" are returned.
23
+ *
24
+ * @param template The template that for the velocity item
25
+ * @param authentication The credentials for any requests
26
+ *
27
+ * @returns a list of dependency ids
28
+ */
29
+ function getVelocityDependencies(template, authentication) {
30
+ const dependencies = [];
31
+ [
32
+ (0, solution_common_1.getProp)(template, "data.feeds") ? template.data.feeds : [],
33
+ (0, solution_common_1.getProp)(template, "data.feed") ? [template.data.feed] : []
34
+ ].forEach(f => _getFeedDependencies(f, dependencies));
35
+ [
36
+ (0, solution_common_1.getProp)(template, "data.sources") ? template.data.sources : [],
37
+ (0, solution_common_1.getProp)(template, "data.source") ? [template.data.source] : [],
38
+ (0, solution_common_1.getProp)(template, "data.outputs") ? template.data.outputs : [],
39
+ (0, solution_common_1.getProp)(template, "data.output") ? [template.data.output] : []
40
+ ].forEach(d => _getDependencies(d, dependencies));
41
+ return _validateDependencies(dependencies, authentication);
42
+ }
43
+ exports.getVelocityDependencies = getVelocityDependencies;
44
+ /**
45
+ * Any feature services with the typeKeyword "IoTFeatureLayer" should not be templatized or
46
+ * listed as a dependency.
47
+ * We can’t create Velocity feature layers in their spatiotemporal datastore as we have no api.
48
+ *
49
+ * @param dependencies Any dependencies that have been found for this item
50
+ * @param authentication The credentials for any requests
51
+ *
52
+ * @returns a list of dependency ids
53
+ * @private
54
+ */
55
+ function _validateDependencies(dependencies, authentication) {
56
+ const defs = dependencies.map(d => {
57
+ return (0, solution_common_1.getItemBase)(d, authentication);
58
+ });
59
+ return Promise.all(defs).then(itemInfos => {
60
+ return Promise.resolve(itemInfos.reduce((prev, cur) => {
61
+ if (cur.typeKeywords.indexOf("IoTFeatureLayer") < 0) {
62
+ prev.push(cur.id);
63
+ }
64
+ return prev;
65
+ }, []));
66
+ });
67
+ }
68
+ exports._validateDependencies = _validateDependencies;
69
+ /**
70
+ * Get the dependencies from the velocity feeds
71
+ * This function will update the input dependencies argument
72
+ *
73
+ * @param feeds The list of feeds from the velocity template
74
+ * @param dependencies The current list of dependencies
75
+ * @private
76
+ */
77
+ function _getFeedDependencies(feeds, dependencies) {
78
+ feeds.reduce((prev, cur) => {
79
+ const id = cur.id || undefined;
80
+ /* istanbul ignore else */
81
+ if (id && prev.indexOf(id) < 0) {
82
+ prev.push(id);
83
+ }
84
+ return prev;
85
+ }, dependencies);
86
+ // run through standard dependency check as well
87
+ // in some cases the feed does not have the id property but will have
88
+ // a portalItemId value in the properties
89
+ _getDependencies(feeds, dependencies);
90
+ }
91
+ exports._getFeedDependencies = _getFeedDependencies;
92
+ /**
93
+ * Get the dependencies from the velocity outputs or dataSources.
94
+ * This function will update the input dependencies argument
95
+ *
96
+ * @param outputs The list of outputs from the velocity item
97
+ * @param dependencies The current list of dependencies
98
+ * @param prop The individual prop to evaluate
99
+ * @private
100
+ */
101
+ function _getDependencies(outputs, dependencies) {
102
+ outputs.reduce((prev, cur) => {
103
+ const names = (0, solution_common_1.getProp)(cur, "name") ? [cur.name] : solution_common_1.BASE_NAMES;
104
+ names.forEach(n => {
105
+ solution_common_1.PROP_NAMES.forEach(p => {
106
+ // skip map service and stream service ids
107
+ /* istanbul ignore else */
108
+ if (p.indexOf("mapServicePortalItemID") < 0 && p.indexOf("streamServicePortalItemID") < 0) {
109
+ const id = cur.properties ? cur.properties[n + p] : undefined;
110
+ if (id && prev.indexOf(id) < 0) {
111
+ prev.push(id);
112
+ }
113
+ }
114
+ });
115
+ });
116
+ return prev;
117
+ }, dependencies);
118
+ }
119
+ exports._getDependencies = _getDependencies;
120
120
  //# sourceMappingURL=get-velocity-dependencies.js.map