@esri/solution-velocity 3.0.1 → 4.0.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.
@@ -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;;;;;;;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A0B;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"}
@@ -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 };
@@ -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,61 +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 solutionItemId The solution to contain the item
26
- * @param itemInfo The basic item info
27
- * @param destAuthentication Credentials for requests to the destination organization
28
- * @param srcAuthentication Credentials for requests to source items
29
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
30
- *
31
- * @returns a promise that will resolve the constructed IItemTemplate from the input itemInfo
32
- *
33
- */
34
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession, templateDictionary: any): Promise<IItemTemplate>;
35
- /**
36
- * Create Velocity analytics and feeds from a Template
37
- *
38
- * @param template The template for the volocity items
39
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
40
- * @param destinationAuthentication Credentials for the deployment requests
41
- * @param itemProgressCallback Function for reporting progress updates from type-specific template handlers
42
- *
43
- * @returns a promise that will resolve with the new item info, id, type, and postProcess flag
44
- *
45
- */
46
- export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
47
- /**
48
- * Velocity post-processing actions
49
- *
50
- * Move all velocity items to the deployment folder.
51
- *
52
- * @param {string} itemId The item ID
53
- * @param {string} type The template type
54
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
55
- * @param {IItemTemplate} template The item template
56
- * @param {IItemTemplate[]} templates The full collection of item templates
57
- * @param {any} templateDictionary Hash of facts such as the folder id for the deployment
58
- * @param {UserSession} authentication The destination session info
59
- * @returns Promise resolving to successfulness of update
60
- */
61
- export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: IItemTemplate, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<any>;
@@ -1,136 +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
- const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
29
- /**
30
- * Convert a Velocity item into a Template
31
- *
32
- * @param solutionItemId The solution to contain the item
33
- * @param itemInfo The basic item info
34
- * @param destAuthentication Credentials for requests to the destination organization
35
- * @param srcAuthentication Credentials for requests to source items
36
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
37
- *
38
- * @returns a promise that will resolve the constructed IItemTemplate from the input itemInfo
39
- *
40
- */
41
- function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
42
- const template = (0, solution_common_1.createInitializedItemTemplate)(itemInfo);
43
- return (0, velocity_helpers_1.getVelocityUrl)(srcAuthentication, templateDictionary, itemInfo.type, itemInfo.id).then((url) => {
44
- if (url) {
45
- return fetch(url)
46
- .then(data => data.json())
47
- .then(data_json => {
48
- template.item.title = data_json.label;
49
- template.data = data_json;
50
- return (0, get_velocity_dependencies_1.getVelocityDependencies)(template, srcAuthentication).then(deps => {
51
- template.dependencies = deps;
52
- (0, velocity_helpers_1.cleanDataSourcesAndFeeds)(template, templateDictionary.velocityUrl);
53
- (0, velocity_templatize_1.templatizeVelocity)(template);
54
- template.item = (0, solution_common_1.updateVelocityReferences)(template.item, template.type, templateDictionary);
55
- return Promise.resolve(template);
56
- });
57
- });
58
- }
59
- else {
60
- // In case the org used to have velocity and they still have items
61
- return Promise.reject("Velocity NOT Supported by Organization");
62
- }
63
- }, e => Promise.reject((0, solution_common_1.fail)(e)));
64
- }
65
- exports.convertItemToTemplate = convertItemToTemplate;
66
- /**
67
- * Create Velocity analytics and feeds from a Template
68
- *
69
- * @param template The template for the volocity items
70
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
71
- * @param destinationAuthentication Credentials for the deployment requests
72
- * @param itemProgressCallback Function for reporting progress updates from type-specific template handlers
73
- *
74
- * @returns a promise that will resolve with the new item info, id, type, and postProcess flag
75
- *
76
- */
77
- function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
78
- // let the progress system know we've started...
79
- const startStatus = itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Started, 0);
80
- // and if it returned false, just resolve out
81
- /* istanbul ignore else */
82
- if (!startStatus) {
83
- return Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type));
84
- }
85
- const orgId = template.itemId;
86
- return (0, velocity_helpers_1.postVelocityData)(destinationAuthentication, template, template.data, templateDictionary).then(result => {
87
- const finalStatus = itemProgressCallback(orgId, solution_common_1.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, result.id);
88
- if (!finalStatus) {
89
- 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)));
90
- }
91
- else {
92
- const response = {
93
- item: {
94
- ...template,
95
- ...result
96
- },
97
- id: result.item.id,
98
- type: template.type,
99
- postProcess: true
100
- };
101
- response.item.itemId = result.item.id;
102
- return response;
103
- }
104
- });
105
- }
106
- exports.createItemFromTemplate = createItemFromTemplate;
107
- /**
108
- * Velocity post-processing actions
109
- *
110
- * Move all velocity items to the deployment folder.
111
- *
112
- * @param {string} itemId The item ID
113
- * @param {string} type The template type
114
- * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
115
- * @param {IItemTemplate} template The item template
116
- * @param {IItemTemplate[]} templates The full collection of item templates
117
- * @param {any} templateDictionary Hash of facts such as the folder id for the deployment
118
- * @param {UserSession} authentication The destination session info
119
- * @returns Promise resolving to successfulness of update
120
- */
121
- function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
122
- const itemUpdate = itemInfos.filter(ii => ii.id === itemId);
123
- const item = itemUpdate[0].item.item;
124
- delete item.url;
125
- delete item.origUrl;
126
- return (0, solution_common_1.updateItem)(item, authentication).then(() => {
127
- return (0, arcgis_rest_portal_1.moveItem)({
128
- owner: authentication.username,
129
- itemId,
130
- folderId: templateDictionary.folderId,
131
- authentication
132
- });
133
- });
134
- }
135
- exports.postProcess = postProcess;
136
- //# 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,2DAY+B;AAC/B,uEAAmE;AACnE,mFAA8E;AAC9E,iEAIoC;AACpC,iEAEkC;AAElC;;;;;;;;;;;GAWG;AACH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,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,E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CAAC;IAChB,OAAO,IAAI,CAAC,OAAO,CAAC;IACnB,OAAO,IAAA,4BAAU,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QAChD,OAAO,IAAA,6BAAQ,EAAC;YACd,KAAK,EAAE,cAAc,CAAC,QAAQ;YAC9B,MAAM;YACN,QAAQ,EAAE,kBAAkB,CAAC,QAAQ;YACrC,cAAc;SACf,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACN,CAAC;AArBA,kCAqBA"}
@@ -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,244 +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, IVelocityTitle, UserSession } from "@esri/solution-common";
17
- /**
18
- * Common function to build urls for reading and interacting with the velocity api
19
- *
20
- *
21
- * @param authentication Credentials for the requests
22
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
23
- * @param type The type of velocity item we are constructing a url for
24
- * @param id Optional The id of the velocity item we are constructing a url for
25
- * @param isDeploy Optional Is this being constructed as a part of deployment
26
- * @param urlPrefix Optional prefix args necessary for some url construction
27
- * @param urlSuffix Optional suffix args necessary for some url construction
28
- *
29
- * @returns a promise that will resolve the constructed url
30
- *
31
- */
32
- export declare function getVelocityUrl(authentication: UserSession, templateDictionary: any, type: string, id?: string, isDeploy?: boolean, urlPrefix?: string, urlSuffix?: string): Promise<string>;
33
- /**
34
- * Handles the creation of velocity items.
35
- *
36
- * @param authentication Credentials for the requests
37
- * @param template The current itemTemplate that is being used for deployment
38
- * @param data The velocity item data used to create the items.
39
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
40
- * @param autoStart This can be leveraged to start certain velocity items after they are created.
41
- *
42
- * @returns a promise that will resolve an object containing the item, id, type, and post process flag
43
- *
44
- */
45
- export declare function postVelocityData(authentication: UserSession, template: IItemTemplate, data: any, templateDictionary: any, autoStart?: boolean): Promise<any>;
46
- /**
47
- * Velocity item titles must be unique across the organization.
48
- * Check and ensure we set a unique title
49
- *
50
- * @param authentication Credentials for the requests
51
- * @param label The current label of the item from the solution template
52
- * @param url The base velocity url for checking status
53
- *
54
- * @returns a promise that will resolve a unique title
55
- *
56
- */
57
- export declare function getTitle(authentication: UserSession, label: string, url: string): Promise<IVelocityTitle>;
58
- /**
59
- * Validate the data that will be used and handle any reported issues with the outputs.
60
- * The output names must be unique across the organization.
61
- *
62
- * This function will update the data arg that is passed in with a unique name.
63
- *
64
- * @param authentication Credentials for the requests
65
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
66
- * @param type The type of velocity item
67
- * @param data The data used to construct the velocity item
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
71
- *
72
- * @returns a promise that will resolve the data object passed in with any necessary changes.
73
- *
74
- * @private
75
- */
76
- export declare function _validateOutputs(authentication: UserSession, templateDictionary: any, type: string, data: any, titles: any[], dataOutputs?: any[], feeds?: any[]): Promise<any>;
77
- /**
78
- * Check the validate results for any name conflicts and store the conflicting names.
79
- *
80
- * @param validateResults The results object to check for name conflict errors
81
- *
82
- * @returns a list of names that already exist in the org
83
- *
84
- * @private
85
- */
86
- export declare function _validateMessages(validateResults: any): string[];
87
- /**
88
- * Updates the feed object with a new name when validation fails.
89
- *
90
- * @param feeds The feed objects from the velocity item.
91
- * @param data The full data object used for deploying the velocity item.
92
- * @param names The names that failed due to duplicate error in validation.
93
- *
94
- * @private
95
- */
96
- export declare function _updateFeed(feeds: any[], data: any, names: string[]): void;
97
- /**
98
- * Updates the data object with a new name when validation fails.
99
- *
100
- * @param dataOutputs The data output objects from the velocity item.
101
- * @param data The full data object used for deploying the velocity item.
102
- * @param names The names that failed due to duplicate error in validation.
103
- *
104
- * @private
105
- */
106
- export declare function _updateDataOutput(dataOutputs: any[], data: any, names: string[]): void;
107
- /**
108
- * Get a unique label for the item.
109
- *
110
- * @param names The names that failed due to duplicate error in validation.
111
- * @param dataOutput The current data output that is being evaluated.
112
- *
113
- * @returns an object with a unique label and the outputs id when a name
114
- * conflict is found...otherwise returns undefined
115
- *
116
- * @private
117
- */
118
- export declare function _getOutputLabel(names: any[], dataOutput: any): any;
119
- /**
120
- * Will return the provided title if it does not exist as a property
121
- * in one of the objects at the defined path. Otherwise the title will
122
- * have a numerical value attached.
123
- *
124
- * This is based on "getUniqueTitle" from common but adds the "_" replacement check for velocity names.
125
- * Could switch to using common if Velocity has a way to get a list of all names that are already used.
126
- *
127
- * @param title The root title to test
128
- * @param templateDictionary Hash of the facts
129
- * @param path to the objects to evaluate for potantial name clashes
130
- *
131
- * @returns string The unique title to use
132
- *
133
- */
134
- export declare function getUniqueTitle(title: string, templateDictionary: any, path: string): string;
135
- /**
136
- * Start the item if validation passes and the item is executable.
137
- *
138
- * @param authentication Credentials for the requests
139
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
140
- * @param template the item template that has the details for deployment
141
- * @param id the new id for the velocity item that was deployed
142
- *
143
- * @returns a promise that will resolve with the validation results
144
- * or the start results when validation indicates the item is executable
145
- *
146
- * @private
147
- */
148
- export declare function _validateAndStart(authentication: UserSession, templateDictionary: any, template: IItemTemplate, id: string): Promise<any>;
149
- /**
150
- * Validate the velocity item.
151
- * Used to help find and handle duplicate name errors.
152
- *
153
- * @param authentication Credentials for the requests
154
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
155
- * @param type The type of velocity item we are constructing a url for
156
- * @param id? Optional The id of the velocity item we are constructing a url for
157
- * @param body? Optional the request body to validate.
158
- *
159
- * @returns a promise that will resolve with an object containing messages
160
- * indicating any issues found when validating such as name conflict errors
161
- *
162
- */
163
- export declare function validate(authentication: UserSession, templateDictionary: any, type: string, id?: string, body?: any): Promise<any>;
164
- /**
165
- * Start the given velocity item that has been deployed.
166
- *
167
- * @param authentication Credentials for the requests
168
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
169
- * @param type The type of velocity item we are constructing a url for
170
- * @param id? Optional The id of the velocity item we are constructing a url for
171
- *
172
- * @returns a promise that will resolve with the result of the start call
173
- *
174
- */
175
- export declare function start(authentication: UserSession, templateDictionary: any, type: string, id?: string): Promise<any>;
176
- /**
177
- * Gets the required request options for requests to the velocity API.
178
- *
179
- * @param authentication Credentials for the requests
180
- * @param method Indicate if "GET" or "POST"
181
- *
182
- * @returns generic request options used for various calls to velocity api
183
- *
184
- * @private
185
- */
186
- export declare function _getRequestOpts(authentication: UserSession, method: string): RequestInit;
187
- /**
188
- * Generic fetch function for making calls to the velocity API.
189
- *
190
- * @param authentication Credentials for the requests
191
- * @param url The url from the velocity API to handle reading and writing
192
- * @param method The method for the request "GET" or "POST"
193
- * @param body The body for POST requests
194
- *
195
- * @returns a promise that will resolve with the result of the fetch call
196
- *
197
- * @private
198
- */
199
- export declare function _fetch(authentication: UserSession, url: string, method: string, // GET or POST
200
- body?: any): Promise<any>;
201
- /**
202
- * Remove key properties if the dependency was removed due to having the "IoTFeatureLayer" typeKeyword
203
- * This function will update the input template.
204
- *
205
- * @param template The template that for the velocity item
206
- *
207
- */
208
- export declare function cleanDataSourcesAndFeeds(template: IItemTemplate, velocityUrl: string): void;
209
- /**
210
- * Remove key properties from the input source or feed
211
- *
212
- * @param sourcesOrFeeds The list of dataSources or feeds
213
- * @param dependencies The list of dependencies
214
- *
215
- * @private
216
- */
217
- export declare function _removeIdProps(sourcesOrFeeds: any[], dependencies: string[], velocityUrl: string): void;
218
- /**
219
- * Remove key properties from the outputs.
220
- *
221
- * @param outputs The list of outputs
222
- * @param dependencies The list of dependencies
223
- *
224
- * @private
225
- */
226
- export declare function _removeIdPropsAndSetName(outputs: any[], dependencies: string[]): void;
227
- /**
228
- * Generic helper function to remove key properties .
229
- *
230
- * @param props the list of props to update
231
- * @param prop the individual prop to remove
232
- * @param dependencies The list of dependencies
233
- *
234
- * @private
235
- */
236
- export declare function _removeProp(props: any, prop: string, dependencies: string[]): void;
237
- /**
238
- * Update the feature layer name to include the solution item id.
239
- *
240
- * @param props the list of props to update
241
- *
242
- * @private
243
- */
244
- export declare function _updateName(props: any): void;