@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.
- package/package.json +3 -3
- package/dist/cjs/helpers/get-velocity-dependencies.d.ts +0 -57
- package/dist/cjs/helpers/get-velocity-dependencies.js +0 -120
- package/dist/cjs/helpers/get-velocity-dependencies.js.map +0 -1
- package/dist/cjs/helpers/velocity-helpers.d.ts +0 -244
- package/dist/cjs/helpers/velocity-helpers.js +0 -567
- package/dist/cjs/helpers/velocity-helpers.js.map +0 -1
- package/dist/cjs/helpers/velocity-templatize.d.ts +0 -71
- package/dist/cjs/helpers/velocity-templatize.js +0 -114
- package/dist/cjs/helpers/velocity-templatize.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -17
- package/dist/cjs/index.js +0 -22
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/velocity-processor.d.ts +0 -60
- package/dist/cjs/velocity-processor.js +0 -134
- package/dist/cjs/velocity-processor.js.map +0 -1
- package/dist/esm/helpers/get-velocity-dependencies.d.ts +0 -57
- package/dist/esm/helpers/get-velocity-dependencies.js +0 -113
- package/dist/esm/helpers/get-velocity-dependencies.js.map +0 -1
- package/dist/esm/helpers/velocity-helpers.d.ts +0 -244
- package/dist/esm/helpers/velocity-helpers.js +0 -545
- package/dist/esm/helpers/velocity-helpers.js.map +0 -1
- package/dist/esm/helpers/velocity-templatize.d.ts +0 -71
- package/dist/esm/helpers/velocity-templatize.js +0 -106
- package/dist/esm/helpers/velocity-templatize.js.map +0 -1
- package/dist/esm/index.d.ts +0 -17
- package/dist/esm/index.js +0 -18
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/velocity-processor.d.ts +0 -60
- package/dist/esm/velocity-processor.js +0 -128
- package/dist/esm/velocity-processor.js.map +0 -1
|
@@ -1,545 +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 { getVelocityUrlBase, replaceInTemplate, getProp, fail, BASE_NAMES, PROP_NAMES, } 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 function getVelocityUrl(authentication, templateDictionary, type, id = "", isDeploy = false, urlPrefix = "", urlSuffix = "") {
|
|
33
|
-
return getVelocityUrlBase(authentication, templateDictionary).then((url) => {
|
|
34
|
-
if (url) {
|
|
35
|
-
const _type = type === "Real Time Analytic"
|
|
36
|
-
? "analytics/realtime"
|
|
37
|
-
: type === "Big Data Analytic"
|
|
38
|
-
? "analytics/bigdata"
|
|
39
|
-
: type.toLowerCase();
|
|
40
|
-
const suffix = urlSuffix ? `/${urlSuffix}` : "";
|
|
41
|
-
const prefix = urlPrefix ? `/${urlPrefix}` : "";
|
|
42
|
-
return Promise.resolve(isDeploy
|
|
43
|
-
? `${url}/iot/${_type}${prefix}${suffix}`
|
|
44
|
-
: id
|
|
45
|
-
? `${url}/iot/${_type}${prefix}/${id}${suffix}/?f=json&token=${authentication.token}`
|
|
46
|
-
: `${url}/iot/${_type}${prefix}${suffix}/?f=json&token=${authentication.token}`);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
return Promise.resolve(url);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Handles the creation of velocity items.
|
|
55
|
-
*
|
|
56
|
-
* @param authentication Credentials for the requests
|
|
57
|
-
* @param template The current itemTemplate that is being used for deployment
|
|
58
|
-
* @param data The velocity item data used to create the items.
|
|
59
|
-
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
60
|
-
* @param autoStart This can be leveraged to start certain velocity items after they are created.
|
|
61
|
-
*
|
|
62
|
-
* @returns a promise that will resolve an object containing the item, id, type, and post process flag
|
|
63
|
-
*
|
|
64
|
-
*/
|
|
65
|
-
export function postVelocityData(authentication, template, data, templateDictionary, autoStart = false) {
|
|
66
|
-
return getVelocityUrl(authentication, templateDictionary, template.type, undefined, true).then((url) => {
|
|
67
|
-
if (url) {
|
|
68
|
-
return getTitle(authentication, data.label, url).then((titleInfo) => {
|
|
69
|
-
const titles = titleInfo.titles;
|
|
70
|
-
data.label = titleInfo.label;
|
|
71
|
-
data.id = "";
|
|
72
|
-
const body = replaceInTemplate(data, templateDictionary);
|
|
73
|
-
const dataOutputs = (data.outputs ? data.outputs : data.output ? [data.output] : []).map((o) => {
|
|
74
|
-
return {
|
|
75
|
-
id: o.id,
|
|
76
|
-
name: o.properties[`${o.name}.name`],
|
|
77
|
-
};
|
|
78
|
-
});
|
|
79
|
-
const feeds = (body.feeds ? body.feeds : body.feed ? [body.feed] : []).map((o) => {
|
|
80
|
-
return {
|
|
81
|
-
id: o.id ? o.id : o.properties[`${o.name}.portalItemId`] || "",
|
|
82
|
-
name: o.label ? o.label : data.label,
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
|
-
return _validateOutputs(authentication, templateDictionary, template.type, body, titles, dataOutputs, feeds).then((updatedBody) => {
|
|
86
|
-
return _fetch(authentication, url, "POST", updatedBody).then((rr) => {
|
|
87
|
-
template.item.url = `${url}/${rr.id}`;
|
|
88
|
-
template.item.title = data.label;
|
|
89
|
-
// Update the template dictionary
|
|
90
|
-
templateDictionary[template.itemId]["url"] = template.item.url;
|
|
91
|
-
templateDictionary[template.itemId]["label"] = data.label;
|
|
92
|
-
templateDictionary[template.itemId]["itemId"] = rr.id;
|
|
93
|
-
const finalResult = {
|
|
94
|
-
item: replaceInTemplate(template.item, templateDictionary),
|
|
95
|
-
id: rr.id,
|
|
96
|
-
type: template.type,
|
|
97
|
-
postProcess: false,
|
|
98
|
-
};
|
|
99
|
-
if (autoStart) {
|
|
100
|
-
return _validateAndStart(authentication, templateDictionary, template, rr.id).then(() => {
|
|
101
|
-
return Promise.resolve(finalResult);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
return Promise.resolve(finalResult);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
return Promise.reject(fail("Velocity NOT Supported by Organization"));
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Velocity item titles must be unique across the organization.
|
|
118
|
-
* Check and ensure we set a unique title
|
|
119
|
-
*
|
|
120
|
-
* @param authentication Credentials for the requests
|
|
121
|
-
* @param label The current label of the item from the solution template
|
|
122
|
-
* @param url The base velocity url for checking status
|
|
123
|
-
*
|
|
124
|
-
* @returns a promise that will resolve a unique title
|
|
125
|
-
*
|
|
126
|
-
*/
|
|
127
|
-
export function getTitle(authentication, label, url) {
|
|
128
|
-
return _fetch(authentication, `${url}StatusList?view=admin`, "GET").then((items) => {
|
|
129
|
-
const titles = items && Array.isArray(items)
|
|
130
|
-
? items.map((item) => {
|
|
131
|
-
return { title: item.label };
|
|
132
|
-
})
|
|
133
|
-
: [];
|
|
134
|
-
return Promise.resolve({ label: getUniqueTitle(label, { titles }, "titles"), titles: titles.map((t) => t.title) });
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Validate the data that will be used and handle any reported issues with the outputs.
|
|
139
|
-
* The output names must be unique across the organization.
|
|
140
|
-
*
|
|
141
|
-
* This function will update the data arg that is passed in with a unique name.
|
|
142
|
-
*
|
|
143
|
-
* @param authentication Credentials for the requests
|
|
144
|
-
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
145
|
-
* @param type The type of velocity item
|
|
146
|
-
* @param data The data used to construct the velocity item
|
|
147
|
-
* @param titles The list of know titles that exist in the org
|
|
148
|
-
* @param dataOutputs The velocity items output objects
|
|
149
|
-
* @param feeds The velocity items feed objects
|
|
150
|
-
*
|
|
151
|
-
* @returns a promise that will resolve the data object passed in with any necessary changes.
|
|
152
|
-
*
|
|
153
|
-
* @private
|
|
154
|
-
*/
|
|
155
|
-
export function _validateOutputs(authentication, templateDictionary, type, data, titles, dataOutputs = [], feeds = []) {
|
|
156
|
-
if (dataOutputs.length > 0 || feeds.length > 0) {
|
|
157
|
-
return validate(authentication, templateDictionary, type, "", data).then((validateResults) => {
|
|
158
|
-
const names = _validateMessages(validateResults);
|
|
159
|
-
if (names.length > 0) {
|
|
160
|
-
/* istanbul ignore else */
|
|
161
|
-
if (dataOutputs.length > 0) {
|
|
162
|
-
_updateDataOutput(dataOutputs, data, names);
|
|
163
|
-
}
|
|
164
|
-
/* istanbul ignore else */
|
|
165
|
-
if (feeds.length > 0) {
|
|
166
|
-
_updateFeed(feeds, data, names.concat(titles));
|
|
167
|
-
}
|
|
168
|
-
return _validateOutputs(authentication, templateDictionary, type, data, titles, dataOutputs, feeds);
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
return Promise.resolve(data);
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
return Promise.resolve(data);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Check the validate results for any name conflicts and store the conflicting names.
|
|
181
|
-
*
|
|
182
|
-
* @param validateResults The results object to check for name conflict errors
|
|
183
|
-
*
|
|
184
|
-
* @returns a list of names that already exist in the org
|
|
185
|
-
*
|
|
186
|
-
* @private
|
|
187
|
-
*/
|
|
188
|
-
export function _validateMessages(validateResults) {
|
|
189
|
-
let messages = getProp(validateResults, "validation.messages");
|
|
190
|
-
const nodes = getProp(validateResults, "nodes");
|
|
191
|
-
/* istanbul ignore else */
|
|
192
|
-
if (nodes && Array.isArray(nodes)) {
|
|
193
|
-
nodes.forEach((node) => {
|
|
194
|
-
messages = messages.concat(getProp(node, "validation.messages") || []);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
let names = [];
|
|
198
|
-
/* istanbul ignore else */
|
|
199
|
-
if (messages && Array.isArray(messages)) {
|
|
200
|
-
messages.forEach((message) => {
|
|
201
|
-
// I don't see a way to ask for all output names that exist
|
|
202
|
-
// velocityUrl + /outputs/ just gives you generic defaults not what currently exists
|
|
203
|
-
const nameErrors = [
|
|
204
|
-
"VALIDATION_ANALYTICS__MULTIPLE_CREATE_FEATURE_LAYER_OUTPUTS_REFERENCE_SAME_LAYER_NAME",
|
|
205
|
-
"VALIDATION_ANALYTICS__MULTIPLE_CREATE_STREAM_LAYER_OUTPUTS_REFERENCE_SAME_LAYER_NAME",
|
|
206
|
-
"ITEM_MANAGER__CREATE_ANALYTIC_FAILED_DUPLICATE_OUTPUT_NAMES_IN_ORGANIZATION_NOT_ALLOWED",
|
|
207
|
-
"ITEM_MANAGER__CREATE_BIG_DATA_ANALYTIC_FAILED_DUPLICATE_NAMES_NOT_ALLOWED",
|
|
208
|
-
"ITEM_MANAGER__CREATE_REAL_TIME_ANALYTIC_FAILED_DUPLICATE_NAMES_NOT_ALLOWED",
|
|
209
|
-
"ITEM_MANAGER__CREATE_FEED_FAILED_DUPLICATE_NAME",
|
|
210
|
-
];
|
|
211
|
-
// The names returned here seem to replace " " with "_" so they do not match exactly
|
|
212
|
-
/* istanbul ignore else */
|
|
213
|
-
if (nameErrors.indexOf(message.key) > -1) {
|
|
214
|
-
names = names.concat(message.args);
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
return names;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Updates the feed object with a new name when validation fails.
|
|
222
|
-
*
|
|
223
|
-
* @param feeds The feed objects from the velocity item.
|
|
224
|
-
* @param data The full data object used for deploying the velocity item.
|
|
225
|
-
* @param names The names that failed due to duplicate error in validation.
|
|
226
|
-
*
|
|
227
|
-
* @private
|
|
228
|
-
*/
|
|
229
|
-
export function _updateFeed(feeds, data, names) {
|
|
230
|
-
feeds.forEach((f) => {
|
|
231
|
-
const update = _getOutputLabel(names, f);
|
|
232
|
-
/* istanbul ignore else */
|
|
233
|
-
if (update) {
|
|
234
|
-
data.label = update.label;
|
|
235
|
-
f.name = update.label;
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Updates the data object with a new name when validation fails.
|
|
241
|
-
*
|
|
242
|
-
* @param dataOutputs The data output objects from the velocity item.
|
|
243
|
-
* @param data The full data object used for deploying the velocity item.
|
|
244
|
-
* @param names The names that failed due to duplicate error in validation.
|
|
245
|
-
*
|
|
246
|
-
* @private
|
|
247
|
-
*/
|
|
248
|
-
export function _updateDataOutput(dataOutputs, data, names) {
|
|
249
|
-
dataOutputs.forEach((dataOutput) => {
|
|
250
|
-
const update = _getOutputLabel(names, dataOutput);
|
|
251
|
-
/* istanbul ignore else */
|
|
252
|
-
if (update) {
|
|
253
|
-
const _outputs = (data.outputs ? data.outputs : data.output ? [data.output] : []).map((_dataOutput) => {
|
|
254
|
-
/* istanbul ignore else */
|
|
255
|
-
if (_dataOutput.id === update.id) {
|
|
256
|
-
/* istanbul ignore else */
|
|
257
|
-
if (_dataOutput.properties) {
|
|
258
|
-
const nameProp = `${_dataOutput.name}.name`;
|
|
259
|
-
/* istanbul ignore else */
|
|
260
|
-
if (Object.keys(_dataOutput.properties).indexOf(nameProp) > -1) {
|
|
261
|
-
_dataOutput.properties[nameProp] = update.label;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
return _dataOutput;
|
|
266
|
-
});
|
|
267
|
-
/* istanbul ignore else */
|
|
268
|
-
if (data.outputs) {
|
|
269
|
-
data.outputs = _outputs;
|
|
270
|
-
}
|
|
271
|
-
/* istanbul ignore else */
|
|
272
|
-
if (data.output) {
|
|
273
|
-
data.output = _outputs[0];
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Get a unique label for the item.
|
|
280
|
-
*
|
|
281
|
-
* @param names The names that failed due to duplicate error in validation.
|
|
282
|
-
* @param dataOutput The current data output that is being evaluated.
|
|
283
|
-
*
|
|
284
|
-
* @returns an object with a unique label and the outputs id when a name
|
|
285
|
-
* conflict is found...otherwise returns undefined
|
|
286
|
-
*
|
|
287
|
-
* @private
|
|
288
|
-
*/
|
|
289
|
-
export function _getOutputLabel(names, dataOutput) {
|
|
290
|
-
const titles = names.map((name) => {
|
|
291
|
-
return { title: name };
|
|
292
|
-
});
|
|
293
|
-
const label = getUniqueTitle(dataOutput.name, { titles }, "titles");
|
|
294
|
-
return label !== dataOutput.name
|
|
295
|
-
? {
|
|
296
|
-
label,
|
|
297
|
-
id: dataOutput.id,
|
|
298
|
-
}
|
|
299
|
-
: undefined;
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Will return the provided title if it does not exist as a property
|
|
303
|
-
* in one of the objects at the defined path. Otherwise the title will
|
|
304
|
-
* have a numerical value attached.
|
|
305
|
-
*
|
|
306
|
-
* This is based on "getUniqueTitle" from common but adds the "_" replacement check for velocity names.
|
|
307
|
-
* Could switch to using common if Velocity has a way to get a list of all names that are already used.
|
|
308
|
-
*
|
|
309
|
-
* @param title The root title to test
|
|
310
|
-
* @param templateDictionary Hash of the facts
|
|
311
|
-
* @param path to the objects to evaluate for potantial name clashes
|
|
312
|
-
*
|
|
313
|
-
* @returns string The unique title to use
|
|
314
|
-
*
|
|
315
|
-
*/
|
|
316
|
-
export function getUniqueTitle(title, templateDictionary, path) {
|
|
317
|
-
title = title ? title.trim() : "_";
|
|
318
|
-
const objs = getProp(templateDictionary, path) || [];
|
|
319
|
-
const titles = objs.map((obj) => {
|
|
320
|
-
return obj.title;
|
|
321
|
-
});
|
|
322
|
-
let newTitle = title;
|
|
323
|
-
let i = 0;
|
|
324
|
-
// replace added for velocitcy
|
|
325
|
-
// validation seems to add "_" to names listed in outputs..so no way to compare without hacking the name
|
|
326
|
-
while (titles.indexOf(newTitle) > -1 || titles.indexOf(newTitle.replace(/ /g, "_")) > -1) {
|
|
327
|
-
i++;
|
|
328
|
-
newTitle = title + " " + i;
|
|
329
|
-
}
|
|
330
|
-
return newTitle;
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Start the item if validation passes and the item is executable.
|
|
334
|
-
*
|
|
335
|
-
* @param authentication Credentials for the requests
|
|
336
|
-
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
337
|
-
* @param template the item template that has the details for deployment
|
|
338
|
-
* @param id the new id for the velocity item that was deployed
|
|
339
|
-
*
|
|
340
|
-
* @returns a promise that will resolve with the validation results
|
|
341
|
-
* or the start results when validation indicates the item is executable
|
|
342
|
-
*
|
|
343
|
-
* @private
|
|
344
|
-
*/
|
|
345
|
-
export function _validateAndStart(authentication, templateDictionary, template, id) {
|
|
346
|
-
return validate(authentication, templateDictionary, template.type, id).then((validateResult) => {
|
|
347
|
-
if (validateResult.executable) {
|
|
348
|
-
return start(authentication, templateDictionary, template.type, id);
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
return Promise.resolve(validateResult);
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Validate the velocity item.
|
|
357
|
-
* Used to help find and handle duplicate name errors.
|
|
358
|
-
*
|
|
359
|
-
* @param authentication Credentials for the requests
|
|
360
|
-
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
361
|
-
* @param type The type of velocity item we are constructing a url for
|
|
362
|
-
* @param id? Optional The id of the velocity item we are constructing a url for
|
|
363
|
-
* @param body? Optional the request body to validate.
|
|
364
|
-
*
|
|
365
|
-
* @returns a promise that will resolve with an object containing messages
|
|
366
|
-
* indicating any issues found when validating such as name conflict errors
|
|
367
|
-
*
|
|
368
|
-
*/
|
|
369
|
-
export function validate(authentication, templateDictionary, type, id, body) {
|
|
370
|
-
// /iot/feed/validate/{id}/
|
|
371
|
-
// /iot/analytics/realtime/validate/{id}/
|
|
372
|
-
return getVelocityUrl(authentication, templateDictionary, type, id, false, "validate", "").then((url) => {
|
|
373
|
-
return _fetch(authentication, url, "POST", body).then((result) => {
|
|
374
|
-
return Promise.resolve(result);
|
|
375
|
-
});
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Start the given velocity item that has been deployed.
|
|
380
|
-
*
|
|
381
|
-
* @param authentication Credentials for the requests
|
|
382
|
-
* @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
383
|
-
* @param type The type of velocity item we are constructing a url for
|
|
384
|
-
* @param id? Optional The id of the velocity item we are constructing a url for
|
|
385
|
-
*
|
|
386
|
-
* @returns a promise that will resolve with the result of the start call
|
|
387
|
-
*
|
|
388
|
-
*/
|
|
389
|
-
export function start(authentication, templateDictionary, type, id) {
|
|
390
|
-
// /iot/feed/{id}/start/
|
|
391
|
-
// /iot/analytics/realtime/{id}/start/
|
|
392
|
-
return getVelocityUrl(authentication, templateDictionary, type, id, false, "", "start").then((url) => {
|
|
393
|
-
return _fetch(authentication, url, "GET").then((result) => {
|
|
394
|
-
return Promise.resolve(result);
|
|
395
|
-
});
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* Gets the required request options for requests to the velocity API.
|
|
400
|
-
*
|
|
401
|
-
* @param authentication Credentials for the requests
|
|
402
|
-
* @param method Indicate if "GET" or "POST"
|
|
403
|
-
*
|
|
404
|
-
* @returns generic request options used for various calls to velocity api
|
|
405
|
-
*
|
|
406
|
-
* @private
|
|
407
|
-
*/
|
|
408
|
-
export function _getRequestOpts(authentication, method) {
|
|
409
|
-
return {
|
|
410
|
-
headers: {
|
|
411
|
-
"Accept": "application/json",
|
|
412
|
-
"Content-Type": "application/json",
|
|
413
|
-
"Authorization": "token=" + authentication.token,
|
|
414
|
-
},
|
|
415
|
-
method,
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
/**
|
|
419
|
-
* Generic fetch function for making calls to the velocity API.
|
|
420
|
-
*
|
|
421
|
-
* @param authentication Credentials for the requests
|
|
422
|
-
* @param url The url from the velocity API to handle reading and writing
|
|
423
|
-
* @param method The method for the request "GET" or "POST"
|
|
424
|
-
* @param body The body for POST requests
|
|
425
|
-
*
|
|
426
|
-
* @returns a promise that will resolve with the result of the fetch call
|
|
427
|
-
*
|
|
428
|
-
* @private
|
|
429
|
-
*/
|
|
430
|
-
export function _fetch(authentication, url, method, // GET or POST
|
|
431
|
-
body) {
|
|
432
|
-
const requestOpts = _getRequestOpts(authentication, method);
|
|
433
|
-
/* istanbul ignore else */
|
|
434
|
-
if (body) {
|
|
435
|
-
requestOpts.body = JSON.stringify(body);
|
|
436
|
-
}
|
|
437
|
-
return fetch(url, requestOpts).then((r) => Promise.resolve(r.json()));
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Remove key properties if the dependency was removed due to having the "IoTFeatureLayer" typeKeyword
|
|
441
|
-
* This function will update the input template.
|
|
442
|
-
*
|
|
443
|
-
* @param template The template that for the velocity item
|
|
444
|
-
*
|
|
445
|
-
*/
|
|
446
|
-
export function cleanDataSourcesAndFeeds(template, velocityUrl) {
|
|
447
|
-
const dependencies = template.dependencies;
|
|
448
|
-
[
|
|
449
|
-
getProp(template, "data.sources") ? template.data.sources : [],
|
|
450
|
-
getProp(template, "data.source") ? [template.data.source] : [],
|
|
451
|
-
getProp(template, "data.feeds") ? template.data.feeds : [],
|
|
452
|
-
getProp(template, "data.feed") ? [template.data.feed] : [],
|
|
453
|
-
].forEach((d) => _removeIdProps(d, dependencies, velocityUrl));
|
|
454
|
-
[
|
|
455
|
-
getProp(template, "data.outputs") ? template.data.outputs : [],
|
|
456
|
-
getProp(template, "data.output") ? [template.data.output] : [],
|
|
457
|
-
].forEach((outputs) => _removeIdPropsAndSetName(outputs, dependencies));
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* Remove key properties from the input source or feed
|
|
461
|
-
*
|
|
462
|
-
* @param sourcesOrFeeds The list of dataSources or feeds
|
|
463
|
-
* @param dependencies The list of dependencies
|
|
464
|
-
*
|
|
465
|
-
* @private
|
|
466
|
-
*/
|
|
467
|
-
export function _removeIdProps(sourcesOrFeeds, dependencies, velocityUrl) {
|
|
468
|
-
sourcesOrFeeds.forEach((dataSource) => {
|
|
469
|
-
const idProp = "feature-layer.portalItemId";
|
|
470
|
-
const layerIdProp = "feature-layer.layerId";
|
|
471
|
-
/* istanbul ignore else */
|
|
472
|
-
if (dataSource.properties) {
|
|
473
|
-
/* istanbul ignore else */
|
|
474
|
-
if (dataSource.properties[idProp]) {
|
|
475
|
-
const id = dataSource.properties[idProp];
|
|
476
|
-
/* istanbul ignore else */
|
|
477
|
-
if (id && dependencies.indexOf(id) < 0) {
|
|
478
|
-
delete dataSource.properties[idProp];
|
|
479
|
-
delete dataSource.properties[layerIdProp];
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
const urlProp = "simulator.url";
|
|
483
|
-
const url = dataSource.properties[urlProp];
|
|
484
|
-
// only remove velocity based simulator urls
|
|
485
|
-
// otherwise we will leave as is with no templatization
|
|
486
|
-
/* istanbul ignore else */
|
|
487
|
-
if (url && url.indexOf(velocityUrl) > -1) {
|
|
488
|
-
delete dataSource.properties[urlProp];
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Remove key properties from the outputs.
|
|
495
|
-
*
|
|
496
|
-
* @param outputs The list of outputs
|
|
497
|
-
* @param dependencies The list of dependencies
|
|
498
|
-
*
|
|
499
|
-
* @private
|
|
500
|
-
*/
|
|
501
|
-
export function _removeIdPropsAndSetName(outputs, dependencies) {
|
|
502
|
-
outputs.forEach((output) => {
|
|
503
|
-
/* istanbul ignore else */
|
|
504
|
-
if (output.properties) {
|
|
505
|
-
const names = getProp(output, "name") ? [output.name] : BASE_NAMES;
|
|
506
|
-
names.forEach((n) => {
|
|
507
|
-
PROP_NAMES.forEach((p) => _removeProp(output.properties, n + p, dependencies));
|
|
508
|
-
});
|
|
509
|
-
_updateName(output.properties);
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
/**
|
|
514
|
-
* Generic helper function to remove key properties .
|
|
515
|
-
*
|
|
516
|
-
* @param props the list of props to update
|
|
517
|
-
* @param prop the individual prop to remove
|
|
518
|
-
* @param dependencies The list of dependencies
|
|
519
|
-
*
|
|
520
|
-
* @private
|
|
521
|
-
*/
|
|
522
|
-
export function _removeProp(props, prop, dependencies) {
|
|
523
|
-
const id = props[prop];
|
|
524
|
-
/* istanbul ignore else */
|
|
525
|
-
if (id && dependencies.indexOf(id) < 0) {
|
|
526
|
-
delete props[prop];
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Update the feature layer name to include the solution item id.
|
|
531
|
-
*
|
|
532
|
-
* @param props the list of props to update
|
|
533
|
-
*
|
|
534
|
-
* @private
|
|
535
|
-
*/
|
|
536
|
-
export function _updateName(props) {
|
|
537
|
-
["feat-lyr-new.name", "stream-lyr-new.name", "feat-lyr-existing.name"].forEach((n) => {
|
|
538
|
-
const name = props[n];
|
|
539
|
-
/* istanbul ignore else */
|
|
540
|
-
if (name && name.indexOf("{{solutionItemId}}") < 0) {
|
|
541
|
-
props[n] = `${name}_{{solutionItemId}}`;
|
|
542
|
-
}
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
//# sourceMappingURL=velocity-helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"velocity-helpers.js","sourceRoot":"","sources":["../../../src/helpers/velocity-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAEjB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,UAAU,GACX,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAC5B,cAA2B,EAC3B,kBAAuB,EACvB,IAAY,EACZ,KAAa,EAAE,EACf,WAAoB,KAAK,EACzB,YAAoB,EAAE,EACtB,YAAoB,EAAE;IAEtB,OAAO,kBAAkB,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;QACzE,IAAI,GAAG,EAAE;YACP,MAAM,KAAK,GACT,IAAI,KAAK,oBAAoB;gBAC3B,CAAC,CAAC,oBAAoB;gBACtB,CAAC,CAAC,IAAI,KAAK,mBAAmB;oBAC5B,CAAC,CAAC,mBAAmB;oBACrB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAE3B,MAAM,MAAM,GAAW,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACxD,MAAM,MAAM,GAAW,SAAS,CAA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oB,CAAC,GAAG,CAAC,EAAE;YAClD,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,qBAAqB,CAAC;SACzC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,71 +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 } 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;
|