@esri/solution-velocity 4.1.2-alpha.0 → 5.0.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,71 +1,71 @@
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 } from "@esri/solution-common";
17
- /**
18
- * Updates the template by adding variables for key properties that will
19
- * need to be swapped when deploying
20
- *
21
- * @param template velocity item info that should be templatized
22
- *
23
- * @returns void
24
- *
25
- */
26
- export declare function templatizeVelocity(template: IItemTemplate): void;
27
- /**
28
- * Generic wrapper for the templatize functions that
29
- * will get and set the key properties
30
- *
31
- * @param template velocity item info that should be templatized
32
- * @param prop the prop path to evaluate and set with a templatized variable
33
- * @param fn the templatize function that should be called for this prop
34
- *
35
- * @returns void
36
- *
37
- * @private
38
- */
39
- export declare function _templatize(template: IItemTemplate, prop: string, fn: (arg: any) => void): void;
40
- /**
41
- * Updates the template by adding variables for the itemId and the label
42
- * The label controls the name and must be unique for the org.
43
- *
44
- * @param feeds array of velocity feeds that should be templatized
45
- *
46
- * @returns The updated list of feed objects with templatized id and label
47
- *
48
- * @private
49
- */
50
- export declare function _templatizeFeeds(feeds: any[]): any;
51
- /**
52
- * Updates the portal item id and feature layer id variables for the feed properties.
53
- *
54
- * @param feed the feed object from the item
55
- *
56
- * @returns the updated feed object with templatized portalItemId and layer id
57
- *
58
- * @private
59
- */
60
- export declare function _templatizeFeed(feed: any): any;
61
- /**
62
- * Velocity datasources share the same props as feeds so they can leverage
63
- * the same templatize function
64
- *
65
- * @param dataSources array of data sources from the item
66
- *
67
- * @returns the updated dataSources object with templatized ids and labels
68
- *
69
- * @private
70
- */
71
- export declare function _templatizeDatasources(dataSources: any[]): any;
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 } from "@esri/solution-common";
17
+ /**
18
+ * Updates the template by adding variables for key properties that will
19
+ * need to be swapped when deploying
20
+ *
21
+ * @param template velocity item info that should be templatized
22
+ *
23
+ * @returns void
24
+ *
25
+ */
26
+ export declare function templatizeVelocity(template: IItemTemplate): void;
27
+ /**
28
+ * Generic wrapper for the templatize functions that
29
+ * will get and set the key properties
30
+ *
31
+ * @param template velocity item info that should be templatized
32
+ * @param prop the prop path to evaluate and set with a templatized variable
33
+ * @param fn the templatize function that should be called for this prop
34
+ *
35
+ * @returns void
36
+ *
37
+ * @private
38
+ */
39
+ export declare function _templatize(template: IItemTemplate, prop: string, fn: (arg: any) => void): void;
40
+ /**
41
+ * Updates the template by adding variables for the itemId and the label
42
+ * The label controls the name and must be unique for the org.
43
+ *
44
+ * @param feeds array of velocity feeds that should be templatized
45
+ *
46
+ * @returns The updated list of feed objects with templatized id and label
47
+ *
48
+ * @private
49
+ */
50
+ export declare function _templatizeFeeds(feeds: any[]): any;
51
+ /**
52
+ * Updates the portal item id and feature layer id variables for the feed properties.
53
+ *
54
+ * @param feed the feed object from the item
55
+ *
56
+ * @returns the updated feed object with templatized portalItemId and layer id
57
+ *
58
+ * @private
59
+ */
60
+ export declare function _templatizeFeed(feed: any): any;
61
+ /**
62
+ * Velocity datasources share the same props as feeds so they can leverage
63
+ * the same templatize function
64
+ *
65
+ * @param dataSources array of data sources from the item
66
+ *
67
+ * @returns the updated dataSources object with templatized ids and labels
68
+ *
69
+ * @private
70
+ */
71
+ export declare function _templatizeDatasources(dataSources: any[]): any;
@@ -1,106 +1,106 @@
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, setProp } from "@esri/solution-common";
17
- /**
18
- * Updates the template by adding variables for key properties that will
19
- * need to be swapped when deploying
20
- *
21
- * @param template velocity item info that should be templatized
22
- *
23
- * @returns void
24
- *
25
- */
26
- export function templatizeVelocity(template) {
27
- _templatize(template, "data.sources", _templatizeDatasources);
28
- _templatize(template, "data.feeds", _templatizeFeeds);
29
- _templatize(template, "data.feed", _templatizeFeed);
30
- }
31
- /**
32
- * Generic wrapper for the templatize functions that
33
- * will get and set the key properties
34
- *
35
- * @param template velocity item info that should be templatized
36
- * @param prop the prop path to evaluate and set with a templatized variable
37
- * @param fn the templatize function that should be called for this prop
38
- *
39
- * @returns void
40
- *
41
- * @private
42
- */
43
- export function _templatize(template, prop, fn) {
44
- const obj = getProp(template, prop);
45
- /* istanbul ignore else */
46
- if (obj) {
47
- setProp(template, prop, fn(obj));
48
- }
49
- }
50
- /**
51
- * Updates the template by adding variables for the itemId and the label
52
- * The label controls the name and must be unique for the org.
53
- *
54
- * @param feeds array of velocity feeds that should be templatized
55
- *
56
- * @returns The updated list of feed objects with templatized id and label
57
- *
58
- * @private
59
- */
60
- export function _templatizeFeeds(feeds) {
61
- return feeds.map((feed) => {
62
- feed.label = feed.label && feed.id ? `{{${feed.id}.label}}` : feed.label;
63
- feed.id = feed.id ? `{{${feed.id}.itemId}}` : feed.id;
64
- return feed;
65
- });
66
- }
67
- /**
68
- * Updates the portal item id and feature layer id variables for the feed properties.
69
- *
70
- * @param feed the feed object from the item
71
- *
72
- * @returns the updated feed object with templatized portalItemId and layer id
73
- *
74
- * @private
75
- */
76
- export function _templatizeFeed(feed) {
77
- let id = getProp(feed, "properties.feature-layer.portalItemId");
78
- /* istanbul ignore else */
79
- if (feed.properties) {
80
- /* istanbul ignore else */
81
- if (feed.properties["feature-layer.portalItemId"]) {
82
- id = feed.properties["feature-layer.portalItemId"];
83
- feed.properties["feature-layer.portalItemId"] = `{{${id}.itemId}}`;
84
- }
85
- /* istanbul ignore else */
86
- if (id && feed.properties.hasOwnProperty("feature-layer.layerId")) {
87
- const flId = feed.properties["feature-layer.layerId"];
88
- feed.properties["feature-layer.layerId"] = `{{${id}.layer${flId}.layerId}}`;
89
- }
90
- }
91
- return feed;
92
- }
93
- /**
94
- * Velocity datasources share the same props as feeds so they can leverage
95
- * the same templatize function
96
- *
97
- * @param dataSources array of data sources from the item
98
- *
99
- * @returns the updated dataSources object with templatized ids and labels
100
- *
101
- * @private
102
- */
103
- export function _templatizeDatasources(dataSources) {
104
- return dataSources.map((ds) => _templatizeFeed(ds));
105
- }
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, setProp } from "@esri/solution-common";
17
+ /**
18
+ * Updates the template by adding variables for key properties that will
19
+ * need to be swapped when deploying
20
+ *
21
+ * @param template velocity item info that should be templatized
22
+ *
23
+ * @returns void
24
+ *
25
+ */
26
+ export function templatizeVelocity(template) {
27
+ _templatize(template, "data.sources", _templatizeDatasources);
28
+ _templatize(template, "data.feeds", _templatizeFeeds);
29
+ _templatize(template, "data.feed", _templatizeFeed);
30
+ }
31
+ /**
32
+ * Generic wrapper for the templatize functions that
33
+ * will get and set the key properties
34
+ *
35
+ * @param template velocity item info that should be templatized
36
+ * @param prop the prop path to evaluate and set with a templatized variable
37
+ * @param fn the templatize function that should be called for this prop
38
+ *
39
+ * @returns void
40
+ *
41
+ * @private
42
+ */
43
+ export function _templatize(template, prop, fn) {
44
+ const obj = getProp(template, prop);
45
+ /* istanbul ignore else */
46
+ if (obj) {
47
+ setProp(template, prop, fn(obj));
48
+ }
49
+ }
50
+ /**
51
+ * Updates the template by adding variables for the itemId and the label
52
+ * The label controls the name and must be unique for the org.
53
+ *
54
+ * @param feeds array of velocity feeds that should be templatized
55
+ *
56
+ * @returns The updated list of feed objects with templatized id and label
57
+ *
58
+ * @private
59
+ */
60
+ export function _templatizeFeeds(feeds) {
61
+ return feeds.map((feed) => {
62
+ feed.label = feed.label && feed.id ? `{{${feed.id}.label}}` : feed.label;
63
+ feed.id = feed.id ? `{{${feed.id}.itemId}}` : feed.id;
64
+ return feed;
65
+ });
66
+ }
67
+ /**
68
+ * Updates the portal item id and feature layer id variables for the feed properties.
69
+ *
70
+ * @param feed the feed object from the item
71
+ *
72
+ * @returns the updated feed object with templatized portalItemId and layer id
73
+ *
74
+ * @private
75
+ */
76
+ export function _templatizeFeed(feed) {
77
+ let id = getProp(feed, "properties.feature-layer.portalItemId");
78
+ /* istanbul ignore else */
79
+ if (feed.properties) {
80
+ /* istanbul ignore else */
81
+ if (feed.properties["feature-layer.portalItemId"]) {
82
+ id = feed.properties["feature-layer.portalItemId"];
83
+ feed.properties["feature-layer.portalItemId"] = `{{${id}.itemId}}`;
84
+ }
85
+ /* istanbul ignore else */
86
+ if (id && feed.properties.hasOwnProperty("feature-layer.layerId")) {
87
+ const flId = feed.properties["feature-layer.layerId"];
88
+ feed.properties["feature-layer.layerId"] = `{{${id}.layer${flId}.layerId}}`;
89
+ }
90
+ }
91
+ return feed;
92
+ }
93
+ /**
94
+ * Velocity datasources share the same props as feeds so they can leverage
95
+ * the same templatize function
96
+ *
97
+ * @param dataSources array of data sources from the item
98
+ *
99
+ * @returns the updated dataSources object with templatized ids and labels
100
+ *
101
+ * @private
102
+ */
103
+ export function _templatizeDatasources(dataSources) {
104
+ return dataSources.map((ds) => _templatizeFeed(ds));
105
+ }
106
106
  //# sourceMappingURL=velocity-templatize.js.map
@@ -1,17 +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 };
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/esm/index.js CHANGED
@@ -1,18 +1,18 @@
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
+ /** @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 };
18
18
  //# sourceMappingURL=index.js.map
@@ -1,61 +1,61 @@
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
+ /** @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>;