@esri/solution-velocity 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.
Files changed (31) hide show
  1. package/package.json +3 -3
  2. package/dist/cjs/helpers/get-velocity-dependencies.d.ts +0 -57
  3. package/dist/cjs/helpers/get-velocity-dependencies.js +0 -120
  4. package/dist/cjs/helpers/get-velocity-dependencies.js.map +0 -1
  5. package/dist/cjs/helpers/velocity-helpers.d.ts +0 -244
  6. package/dist/cjs/helpers/velocity-helpers.js +0 -567
  7. package/dist/cjs/helpers/velocity-helpers.js.map +0 -1
  8. package/dist/cjs/helpers/velocity-templatize.d.ts +0 -71
  9. package/dist/cjs/helpers/velocity-templatize.js +0 -114
  10. package/dist/cjs/helpers/velocity-templatize.js.map +0 -1
  11. package/dist/cjs/index.d.ts +0 -17
  12. package/dist/cjs/index.js +0 -22
  13. package/dist/cjs/index.js.map +0 -1
  14. package/dist/cjs/velocity-processor.d.ts +0 -60
  15. package/dist/cjs/velocity-processor.js +0 -134
  16. package/dist/cjs/velocity-processor.js.map +0 -1
  17. package/dist/esm/helpers/get-velocity-dependencies.d.ts +0 -57
  18. package/dist/esm/helpers/get-velocity-dependencies.js +0 -113
  19. package/dist/esm/helpers/get-velocity-dependencies.js.map +0 -1
  20. package/dist/esm/helpers/velocity-helpers.d.ts +0 -244
  21. package/dist/esm/helpers/velocity-helpers.js +0 -545
  22. package/dist/esm/helpers/velocity-helpers.js.map +0 -1
  23. package/dist/esm/helpers/velocity-templatize.d.ts +0 -71
  24. package/dist/esm/helpers/velocity-templatize.js +0 -106
  25. package/dist/esm/helpers/velocity-templatize.js.map +0 -1
  26. package/dist/esm/index.d.ts +0 -17
  27. package/dist/esm/index.js +0 -18
  28. package/dist/esm/index.js.map +0 -1
  29. package/dist/esm/velocity-processor.d.ts +0 -60
  30. package/dist/esm/velocity-processor.js +0 -128
  31. package/dist/esm/velocity-processor.js.map +0 -1
@@ -1,114 +0,0 @@
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
@@ -1 +0,0 @@
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,cAA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AE,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,CAAC,uBAAuB,CAAC,GAAG,KAAK,EAAE,SAAS,IAAI,YAAY,CAAC;SAC7E;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAhBD,0CAgBC;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"}
@@ -1,17 +0,0 @@
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 };
package/dist/cjs/index.js DELETED
@@ -1,22 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,gFAA0D;AAEjD,8CAAiB"}
@@ -1,60 +0,0 @@
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>;
@@ -1,134 +0,0 @@
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
- /**
29
- * Convert a Velocity item into a Template
30
- *
31
- * @param itemInfo The basic item info
32
- * @param destAuthentication Credentials for requests to the destination organization
33
- * @param srcAuthentication Credentials for requests to source items
34
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
35
- *
36
- * @returns a promise that will resolve the constructed IItemTemplate from the input itemInfo
37
- *
38
- */
39
- function convertItemToTemplate(itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
40
- const template = (0, solution_common_1.createInitializedItemTemplate)(itemInfo);
41
- return (0, velocity_helpers_1.getVelocityUrl)(srcAuthentication, templateDictionary, itemInfo.type, itemInfo.id).then((url) => {
42
- if (url) {
43
- return fetch(url)
44
- .then((data) => data.json())
45
- .then((data_json) => {
46
- template.item.title = data_json.label;
47
- template.data = data_json;
48
- return (0, get_velocity_dependencies_1.getVelocityDependencies)(template, srcAuthentication).then((deps) => {
49
- template.dependencies = deps;
50
- (0, velocity_helpers_1.cleanDataSourcesAndFeeds)(template, templateDictionary.velocityUrl);
51
- (0, velocity_templatize_1.templatizeVelocity)(template);
52
- template.item = (0, solution_common_1.updateVelocityReferences)(template.item, template.type, templateDictionary);
53
- return Promise.resolve(template);
54
- });
55
- });
56
- }
57
- else {
58
- // In case the org used to have velocity and they still have items
59
- return Promise.reject("Velocity NOT Supported by Organization");
60
- }
61
- }, (e) => Promise.reject((0, solution_common_1.fail)(e)));
62
- }
63
- exports.convertItemToTemplate = convertItemToTemplate;
64
- /**
65
- * Create Velocity analytics and feeds from a Template
66
- *
67
- * @param template The template for the volocity items
68
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
69
- * @param destinationAuthentication Credentials for the deployment requests
70
- * @param itemProgressCallback Function for reporting progress updates from type-specific template handlers
71
- *
72
- * @returns a promise that will resolve with the new item info, id, type, and postProcess flag
73
- *
74
- */
75
- function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
76
- // let the progress system know we've started...
77
- const startStatus = itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Started, 0);
78
- // and if it returned false, just resolve out
79
- /* istanbul ignore else */
80
- if (!startStatus) {
81
- return Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type));
82
- }
83
- const orgId = template.itemId;
84
- return (0, velocity_helpers_1.postVelocityData)(destinationAuthentication, template, template.data, templateDictionary).then((result) => {
85
- const finalStatus = itemProgressCallback(orgId, solution_common_1.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, result.id);
86
- if (!finalStatus) {
87
- 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)));
88
- }
89
- else {
90
- const response = {
91
- item: {
92
- ...template,
93
- ...result,
94
- },
95
- id: result.item.id,
96
- type: template.type,
97
- postProcess: true,
98
- };
99
- response.item.itemId = result.item.id;
100
- return response;
101
- }
102
- });
103
- }
104
- exports.createItemFromTemplate = createItemFromTemplate;
105
- /**
106
- * Velocity post-processing actions
107
- *
108
- * Move all velocity items to the deployment folder.
109
- *
110
- * @param {string} itemId The item ID
111
- * @param {string} type The template type
112
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
113
- * @param {IItemTemplate} template The item template
114
- * @param {IItemTemplate[]} templates The full collection of item templates
115
- * @param {any} templateDictionary Hash of facts such as the folder id for the deployment
116
- * @param {UserSession} authentication The destination session info
117
- * @returns Promise resolving to successfulness of update
118
- */
119
- function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
120
- const itemUpdate = itemInfos.filter((ii) => ii.id === itemId);
121
- const item = itemUpdate[0].item.item;
122
- delete item.url;
123
- delete item.origUrl;
124
- return (0, solution_common_1.updateItem)(item, authentication).then(() => {
125
- return (0, solution_common_1.moveItem)({
126
- owner: authentication.username,
127
- itemId,
128
- folderId: templateDictionary.folderId,
129
- authentication,
130
- });
131
- });
132
- }
133
- exports.postProcess = postProcess;
134
- //# sourceMappingURL=velocity-processor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"velocity-processor.js","sourceRoot":"","sources":["../../src/velocity-processor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,2DAa+B;AAC/B,uEAAmE;AACnE,mFAA8E;AAC9E,iEAAwG;AAExG;;;;;;;;;;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,EAAC,iBAAiB,EAAE,kBAAkB,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAC3F,CAAC,GAAW,EAAE,EAAE;QACd,IAAI,GAAG,EAAE;YACP,OAAO,KAAK,CAAC,GAAG,CAAC;iBACd,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;iBAC3B,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;gBAClB,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,CAAC,CAAC,IAAI,EAAE,EAAE;oBACxE,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC;oBAC7B,IAAA,2CAAwB,EAAC,QAAQ,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;oBACnE,IAAA,wCAAkB,EAAC,QAAQ,CAAC,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AQ;YAC9B,MAAM;YACN,QAAQ,EAAE,kBAAkB,CAAC,QAAQ;YACrC,cAAc;SACf,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AArBD,kCAqBC"}
@@ -1,57 +0,0 @@
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,113 +0,0 @@
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 { getProp, getItemBase, BASE_NAMES, PROP_NAMES } 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 function getVelocityDependencies(template, authentication) {
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));
38
- return _validateDependencies(dependencies, authentication);
39
- }
40
- /**
41
- * Any feature services with the typeKeyword "IoTFeatureLayer" should not be templatized or
42
- * listed as a dependency.
43
- * We can’t create Velocity feature layers in their spatiotemporal datastore as we have no api.
44
- *
45
- * @param dependencies Any dependencies that have been found for this item
46
- * @param authentication The credentials for any requests
47
- *
48
- * @returns a list of dependency ids
49
- * @private
50
- */
51
- export function _validateDependencies(dependencies, authentication) {
52
- const defs = dependencies.map((d) => {
53
- return getItemBase(d, authentication);
54
- });
55
- return Promise.all(defs).then((itemInfos) => {
56
- return Promise.resolve(itemInfos.reduce((prev, cur) => {
57
- if (cur.typeKeywords.indexOf("IoTFeatureLayer") < 0) {
58
- prev.push(cur.id);
59
- }
60
- return prev;
61
- }, []));
62
- });
63
- }
64
- /**
65
- * Get the dependencies from the velocity feeds
66
- * This function will update the input dependencies argument
67
- *
68
- * @param feeds The list of feeds from the velocity template
69
- * @param dependencies The current list of dependencies
70
- * @private
71
- */
72
- export function _getFeedDependencies(feeds, dependencies) {
73
- feeds.reduce((prev, cur) => {
74
- const id = cur.id || undefined;
75
- /* istanbul ignore else */
76
- if (id && prev.indexOf(id) < 0) {
77
- prev.push(id);
78
- }
79
- return prev;
80
- }, dependencies);
81
- // run through standard dependency check as well
82
- // in some cases the feed does not have the id property but will have
83
- // a portalItemId value in the properties
84
- _getDependencies(feeds, dependencies);
85
- }
86
- /**
87
- * Get the dependencies from the velocity outputs or dataSources.
88
- * This function will update the input dependencies argument
89
- *
90
- * @param outputs The list of outputs from the velocity item
91
- * @param dependencies The current list of dependencies
92
- * @param prop The individual prop to evaluate
93
- * @private
94
- */
95
- export function _getDependencies(outputs, dependencies) {
96
- outputs.reduce((prev, cur) => {
97
- const names = getProp(cur, "name") ? [cur.name] : BASE_NAMES;
98
- names.forEach((n) => {
99
- PROP_NAMES.forEach((p) => {
100
- // skip map service and stream service ids
101
- /* istanbul ignore else */
102
- if (p.indexOf("mapServicePortalItemID") < 0 && p.indexOf("streamServicePortalItemID") < 0) {
103
- const id = cur.properties ? cur.properties[n + p] : undefined;
104
- if (id && prev.indexOf(id) < 0) {
105
- prev.push(id);
106
- }
107
- }
108
- });
109
- });
110
- return prev;
111
- }, dependencies);
112
- }
113
- //# sourceMappingURL=get-velocity-dependencies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-velocity-dependencies.js","sourceRoot":"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