fiftyone.pipeline.core 4.4.55 → 4.4.57

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.
@@ -0,0 +1,601 @@
1
+ fiftyoneDegreesManager = function() {
2
+ 'use-strict';
3
+ var json = {{&_jsonObject}};
4
+ var parameters = {{&_parameters}};
5
+ var sessionId = "{{&_sessionId}}";
6
+ var sessionKey = "{{_objName}}_" + sessionId;
7
+ this.sessionId = sessionId;
8
+ var sequence = {{&_sequence}};
9
+
10
+ // Log any errors returned in the JSON object.
11
+ if(json.error !== undefined){
12
+ console.log(json.error);
13
+ }
14
+
15
+ // Log any warnings returned in the JSON object.
16
+ if (json.warnings !== undefined) {
17
+ console.log(json.warnings);
18
+ }
19
+
20
+ // Set to true when the JSON object is complete.
21
+ var completed = false;
22
+
23
+ // changeFuncs is an array of functions. When onChange is called and passed
24
+ // a function, the function is registered and is called when processing is
25
+ // complete.
26
+ var changeFuncs = [];
27
+
28
+ // Counter is used to count how many pieces of callbacks are expected. Every
29
+ // time the completedCallback method is called, the counter is decremented
30
+ // by 1.
31
+ var callbackCounter = 0;
32
+
33
+ // Array of JavaScript properties that have started evaluation.
34
+ var jsPropertiesStarted = [];
35
+
36
+ // startsWith polyfill.
37
+ var startsWith = function(source, searchValue) {
38
+ return source.lastIndexOf(searchValue, 0) === 0;
39
+ }
40
+
41
+ // endsWith polyfill.
42
+ var endsWith = function(source, searchValue) {
43
+ return source.substring(source.length - searchValue.length, source.length) === searchValue;
44
+ }
45
+
46
+ var clearCache = function() {
47
+ if (sessionStorage) {
48
+ for (i = 0; i < sessionStorage.length; i++) {
49
+ key = sessionStorage.key(i);
50
+ if (startsWith(key, sessionKey)) {
51
+ sessionStorage.removeItem(key);
52
+ }
53
+ }
54
+ }
55
+ }
56
+
57
+ var loadParameters = function() {
58
+ if (sessionStorage) {
59
+ var parametersString = sessionStorage.getItem(sessionKey + "_parameters");
60
+ if (parametersString) {
61
+ parameters = JSON.parse(parametersString);
62
+ }
63
+ }
64
+ return parameters;
65
+ }
66
+
67
+ var saveParameters = function(sourceParams) {
68
+ if (sourceParams) {
69
+ parameters = sourceParams
70
+ }
71
+
72
+ if (sessionStorage) {
73
+ var parametersString = JSON.stringify(parameters);
74
+ sessionStorage.setItem(sessionKey + "_parameters", parametersString);
75
+ }
76
+ }
77
+
78
+ // Get cookies with the '51D_' prefix that have been added to the request
79
+ // and return the data as key value pairs. This method is needed to extract
80
+ // cookie values for inclusion in the GET or POST request for situations
81
+ // where CORS will prevent cookies being sent to third parties.
82
+ var getFodCookies = function(){
83
+ var keyValuePairs = document.cookie.split(/; */);
84
+ var fodCookies = [];
85
+ for(var i = 0; i < keyValuePairs.length; i++) {
86
+ var name = keyValuePairs[i].substring(0, keyValuePairs[i].indexOf('='));
87
+ if(startsWith(name, "51D_")){
88
+ var value = keyValuePairs[i].substring(keyValuePairs[i].indexOf('=')+1);
89
+ fodCookies[name] = value;
90
+ }
91
+ }
92
+ return fodCookies;
93
+ };
94
+
95
+ // Extract key value pairs from the '51D_' prefixed cookies and concatenates
96
+ // them to form a query string for the subsequent json refresh.
97
+ var getParametersFromCookies = function(){
98
+ var fodCookies = getFodCookies();
99
+ var keyValuePairs = [];
100
+ for (var key in fodCookies) {
101
+ if (fodCookies.hasOwnProperty(key)) {
102
+ // Url encode the cookie value.
103
+ // This is done to ensure that invalid characters (e.g. = chars at the end of
104
+ // base 64 encoded strings) reach the server intact.
105
+ // The server will automatically decode the value before passing it into the
106
+ // Pipeline API.
107
+ keyValuePairs.push(key+"="+encodeURIComponent(fodCookies[key]));
108
+ }
109
+ }
110
+ return keyValuePairs;
111
+ };
112
+
113
+ // Delete a cookie.
114
+ function deleteCookie(name) {
115
+ document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
116
+ }
117
+
118
+ // Fetch a value safely from the json object. If a key somewhere down the
119
+ // '.' separated hierarchy of keys is not present then 'undefined' is
120
+ // returned rather than letting an exception occur.
121
+ var getFromJson = function(key, allowObjects, allowBooleans) {
122
+ var result = undefined;
123
+ if(typeof allowObjects === 'undefined') { allowObjects = false; }
124
+ if(typeof allowBooleans === 'undefined') { allowBooleans = false; }
125
+
126
+ if (typeof(key) === 'string') {
127
+ var functions = json;
128
+ var segments = key.split('.');
129
+ var i = 0;
130
+ while (functions !== undefined && i < segments.length) {
131
+ functions = functions[segments[i++]];
132
+ }
133
+ if (typeof(functions) === "string") {
134
+ result = functions;
135
+ } else if (allowBooleans && typeof(functions) === "boolean") {
136
+ result = functions;
137
+ } else if (allowObjects && typeof functions === 'object' && functions !== null) {
138
+ result = functions;
139
+ }
140
+ }
141
+ return result;
142
+ }
143
+
144
+ // Executed at the end of the processJSproperties method or for each piece
145
+ // of JavaScript which has 51D code injected. When there are 0 pieces of
146
+ // JavaScript left to process then reload the JSON object.
147
+ var completedCallback = function(resolve, reject){
148
+ callbackCounter--;
149
+ if (callbackCounter === 0) {
150
+ {{#_updateEnabled}}
151
+ processRequest(resolve, reject);
152
+ {{/_updateEnabled}}
153
+ } else if (callbackCounter < 0){
154
+ reject('Too many callbacks.');
155
+ }
156
+ }
157
+
158
+ // Executes any JavaScript contained in the JSON data. Session storage is
159
+ // used to check the process state of the JavaScript property, if the name
160
+ // of the property exists as a key then it has been processed. If all the
161
+ // processed JavaScript properties have been flagged as processed already
162
+ // then session storage is checked again for a JSON payload. If it exists
163
+ // then this is loaded into the managers internal data store. If not or if
164
+ // JavaScript properties have been processed then the call-back is
165
+ // processed with any new evidence produced by the JavaScript properties.
166
+ // If JavaScript properties are processed then a key containing the name of
167
+ // the JavaScript property is added to session storage. The complete flag is
168
+ // set to true when there is no further JavaScript to be processed.
169
+ var processJsProperties = function(resolve, reject, jsProperties, ignoreDelayFlag) {
170
+ var executeCallback = true;
171
+ var started = 0;
172
+ var cached = 0;
173
+ var cachedResponse = undefined;
174
+ var toProcess = 0;
175
+
176
+ // If there is no cached response and there are JavaScript code snippets
177
+ // then process them and perform any call-backs required.
178
+ if (jsProperties !== undefined && jsProperties.length > 0) {
179
+
180
+ // Execute each of the JavaScript property code snippets using the
181
+ // index of the value to access the value to avoid problems with
182
+ // JavaScript returning erroneous values.
183
+ for (var index = 0; index < jsProperties.length; index++) {
184
+ var name = jsProperties[index];
185
+ if (jsPropertiesStarted.indexOf(name) === -1) {
186
+ var body = getFromJson(name);
187
+
188
+ // If there is a body then this property should be processed.
189
+ if (body) {
190
+ toProcess++;
191
+ }
192
+ var isCached = sessionStorage && sessionStorage.getItem(sessionKey + "_" + name);
193
+
194
+ if (!isCached) {
195
+ // Create new function bound to this instance and execute it.
196
+ // This is needed to ensure the scope of the function is
197
+ // associated with this instance if any members are altered or
198
+ // added. Avoids global scoped variables.
199
+
200
+ var delay = getFromJson(name + 'delayexecution', false, true);
201
+
202
+ if ((ignoreDelayFlag || (delay === undefined || delay === false)) &&
203
+ body !== undefined) {
204
+ var func = undefined;
205
+ var searchString = '// 51D replace this comment with callback function.';
206
+ completed = false;
207
+ jsPropertiesStarted.push(name);
208
+ started++;
209
+
210
+ if (body.indexOf(searchString) !== -1){
211
+ callbackCounter++;
212
+ body = body.replace(/\/\/ 51D replace this comment with callback function./g, 'callbackFunc(resolveFunc, rejectFunc);');
213
+ func = new Function('callbackFunc', 'resolveFunc', 'rejectFunc',
214
+ "try {\n" +
215
+ body + "\n" +
216
+ "} catch (err) {\n" +
217
+ "console.log(err);" +
218
+ "}"
219
+ );
220
+ func(completedCallback, resolve, reject);
221
+ executeCallback = false;
222
+ } else {
223
+ func = new Function(
224
+ "try {\n" +
225
+ body + "\n" +
226
+ "} catch (err) {\n" +
227
+ "console.log(err);" +
228
+ "}"
229
+ );
230
+ func();
231
+ }
232
+ if (sessionStorage) {
233
+ sessionStorage.setItem(sessionKey + "_" + name, true)
234
+ }
235
+ }
236
+ } else {
237
+ cached++;
238
+ }
239
+ }
240
+ }
241
+ }
242
+ if(cached === toProcess || started === 0) {
243
+ if (sessionStorage) {
244
+ var cachedResponse = sessionStorage.getItem(sessionKey);
245
+ if (cachedResponse) {
246
+ loadJSON(resolve, reject, cachedResponse);
247
+ executeCallback = false;
248
+ }
249
+ }
250
+ }
251
+
252
+ if (started === 0) {
253
+ executeCallback = false;
254
+ completed = true;
255
+ }
256
+ if (executeCallback) {
257
+ callbackCounter = 1;
258
+ completedCallback(resolve, reject);
259
+ }
260
+ };
261
+
262
+ {{#_updateEnabled}}
263
+ {{^_supportsFetch}}
264
+ // Standard method to create a CORS HTTP request ready to send data.
265
+ var createCORSRequest = function(method, url) {
266
+ var xhr;
267
+ try {
268
+ xhr = new XMLHttpRequest();
269
+ } catch(err){
270
+ xhr = null;
271
+ }
272
+ if (xhr !== null && "withCredentials" in xhr) {
273
+
274
+ // Check if the XMLHttpRequest object has a "withCredentials"
275
+ // property.
276
+ // "withCredentials" only exists on XMLHTTPRequest2 objects.
277
+ xhr.open(method, url, true);
278
+ } else if (typeof XDomainRequest != "undefined") {
279
+
280
+ // Otherwise, check if XDomainRequest.
281
+ // XDomainRequest only exists in IE, and is IE's way of making CORS
282
+ // requests.
283
+ xhr = new XDomainRequest();
284
+ xhr.open(method, url);
285
+ } else {
286
+
287
+ // Otherwise, CORS is not supported by the browser.
288
+ xhr = null;
289
+ }
290
+ return xhr;
291
+ };
292
+ {{/_supportsFetch}}
293
+ {{/_updateEnabled}}
294
+
295
+ // Check if the JSON object still has any JavaScript snippets to run.
296
+ var hasJSFunctions = function() {
297
+ for (var i = i; i < json.javascriptProperties; i++) {
298
+ var body = getFromJson(json.javascriptProperties[i]);
299
+ if (body !== undefined && body.length > 0) {
300
+ return true;
301
+ }
302
+ }
303
+ return false;
304
+ }
305
+
306
+ // Process the JavaScript properties.
307
+ var process = function(resolve, reject){
308
+ processJsProperties(resolve, reject, json.javascriptProperties, false);
309
+ }
310
+
311
+ var fireChangeFuncs = function(json) {
312
+ for (var i = 0; i < changeFuncs.length; i++) {
313
+ if (typeof changeFuncs[i] === 'function' &&
314
+ changeFuncs[i].length === 1) {
315
+ changeFuncs[i](json);
316
+ }
317
+ }
318
+ }
319
+
320
+ {{#_updateEnabled}}
321
+ // Process the response as json and call the resolve method.
322
+ var loadJSON = function(resolve, reject, responseText) {
323
+ json = JSON.parse(responseText);
324
+
325
+ if (hasJSFunctions()) {
326
+ // json updated so fire 'on change' functions
327
+ // before executing any new JS properties that
328
+ // have come back.
329
+ fireChangeFuncs(json);
330
+ process(resolve, reject);
331
+ } else {
332
+ completed = true;
333
+ // json updated so fire 'on change' functions
334
+ // This must happen after completed = true in order
335
+ // for 'complete' functions to fire.
336
+ fireChangeFuncs(json);
337
+ resolve(json);
338
+ {{^_enableCookies}}
339
+ var fodCookies = getFodCookies();
340
+ for (var key in fodCookies) {
341
+ if (fodCookies.hasOwnProperty(key)) {
342
+ deleteCookie(key);
343
+ }
344
+ }
345
+ {{/_enableCookies}}
346
+ }
347
+ }
348
+
349
+ // Sends a POST request to the call-back URL to retrieve and updated
350
+ // JSON payload from the cloud service. A POST request is used so that
351
+ // parameters can be passed in the request body, this is to get around
352
+ // the limitations on the length of query strings. As POST requests are not
353
+ // cached by browsers, the result of the POST request is stored in session
354
+ // storage on a successful response. This can then be checked before making
355
+ // repeat requests to the call-back URL.
356
+ // Any cookie parameters that have been set by the executed JavaScript
357
+ // properties are added to the list of parameters, this list is then
358
+ // serialized as Form Data and sent in the POST body to the call-back URL,
359
+ // refreshing the JSON data. The new JSON is then loaded if the request is
360
+ // returned with a success status code. If there was a problem then the
361
+ // session storage items are invalidated and reject is called.
362
+ var processRequest = function(resolve, reject){
363
+ loadParameters();
364
+
365
+ // Get additional parameters from cookies in case they are not sent
366
+ // by the browser.
367
+ var cookieParams = getParametersFromCookies();
368
+ for(var cookie in cookieParams) {
369
+ var parts = cookieParams[cookie].split('=');
370
+ parameters[parts[0]] = parts[1];
371
+ }
372
+
373
+ saveParameters();
374
+
375
+ var params = [];
376
+ for (var param in parameters) {
377
+ if (parameters.hasOwnProperty(param)) {
378
+ params.push(param+"="+parameters[param])
379
+ }
380
+ }
381
+
382
+ // Add the session and sequence to the request
383
+ if (sessionId) {
384
+ params.push("session-id=" + sessionId);
385
+ }
386
+ if (sequence) {
387
+ params.push("sequence=" + sequence);
388
+ }
389
+
390
+ var postBody = "";
391
+ if (params.length > 0) {
392
+ postBody = params.join('&').replace(/%20/g, '+');
393
+ }
394
+
395
+ {{#_supportsFetch}}
396
+ fetch('{{{_url}}}', {
397
+ method: 'POST',
398
+ mode: 'cors',
399
+ headers: {
400
+ 'Content-Type': 'application/x-www-form-urlencoded',
401
+ },
402
+ body: postBody
403
+ })
404
+ .then(response => {
405
+ return response.text();
406
+ })
407
+ .then(responseText => {
408
+ {{/_supportsFetch}}
409
+ {{^_supportsFetch}}
410
+ // Request callback URL with additional parameters.
411
+ var xhr = createCORSRequest('POST', '{{{_url}}}');
412
+
413
+ // If there is no support for HTTP requests then call reject and throw
414
+ // a no CORS support error.
415
+ if (!xhr) {
416
+ reject(new Error('CORS not supported'));
417
+ return;
418
+ }
419
+
420
+ // Add the HTTP header for POST form data.
421
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
422
+
423
+ xhr.onload = function () {
424
+
425
+ // Get the response body from the request.
426
+ var responseText = xhr.responseText;
427
+
428
+ {{/_supportsFetch}}
429
+ // Cache the response text.
430
+ if (sessionStorage) {
431
+ sessionStorage.setItem(sessionKey, responseText);
432
+ }
433
+ // Load the JSON object from the response text
434
+ loadJSON(resolve, reject, responseText);
435
+ // Increment the sequence on a successful request
436
+ sequence++;
437
+ {{#_supportsFetch}}
438
+ })
439
+ .catch(error => {
440
+ // Invalidate the cache on error.
441
+ clearCache();
442
+ reject(error);
443
+ });
444
+ {{/_supportsFetch}}
445
+ {{^_supportsFetch}}
446
+ };
447
+
448
+ xhr.onerror = function () {
449
+ // An error occurred with the request. Invalidate the cache and
450
+ // return the details in the call to reject method.
451
+ clearCache();
452
+ reject(Error(xhr.statusText));
453
+ };
454
+
455
+ // Send the GET request.
456
+ xhr.send(postBody);
457
+ {{/_supportsFetch}}
458
+ }
459
+ {{/_updateEnabled}}
460
+
461
+ // Function logs errors, used to 'reject' a promise or for error callbacks.
462
+ var catchError = function(value) {
463
+ console.log(value.message || value);
464
+ }
465
+
466
+ // Populate this instance of the FOD object with getters to access the
467
+ // properties. If the value is null then get the noValueMessage from the
468
+ // JSON object corresponding to the property.
469
+ var update = function(data){
470
+ var self = this;
471
+ Object.getOwnPropertyNames(data).forEach(function(key) {
472
+ self[key] = {};
473
+ for(var i in data[key]){
474
+ var obj = self[key];
475
+ (function(i) {
476
+ Object.defineProperty(obj, i, {
477
+ get: function (){
478
+ if(data[key][i] === null && (i !== "javascriptProperties")){
479
+ return data[key][i + "nullreason"];
480
+ } else {
481
+ return data[key][i];
482
+ }
483
+ }
484
+ })
485
+ })(i);
486
+ }
487
+ });
488
+ }
489
+
490
+ {{#_hasDelayedProperties}}
491
+ // Get the JS property(s) that, when evaluated, will populate
492
+ // evidence that can be used to determine the value of the
493
+ // supplied property.
494
+ // The supplied name can either be a complete property name or a top level
495
+ // aspect name.
496
+ // Where the aspect name is given, ALL evidence properties under that
497
+ // key will be returned.
498
+ // Example property names are 'location.country' or 'devices.profiles.hardwarename'
499
+ // Example aspect names are 'location' or 'devices'
500
+ var getEvidenceProperties = function (name) {
501
+ var evidenceProperties = getFromJson(name + 'evidenceproperties');
502
+ if(typeof evidenceProperties === "undefined") {
503
+ var item = getFromJson(name, true);
504
+ evidenceProperties = getEvidencePropertiesFromObject(item);
505
+ }
506
+ return evidenceProperties;
507
+ }
508
+
509
+ // Get all values in any 'evidenceproperty' fields on this object
510
+ // or sub-objects.
511
+ var getEvidencePropertiesFromObject = function (dataObject) {
512
+ evidenceProperties = [];
513
+
514
+ for (var prop in dataObject) {
515
+ if (dataObject.hasOwnProperty(prop)) {
516
+ var value = dataObject[prop];
517
+ // Property name ends with 'evidenceproperties' so is
518
+ // what we're looking for.
519
+ // Add the values to the array if we don't already have it.
520
+ if (value !== null && Array.isArray(value) && endsWith(prop, 'evidenceproperties')) {
521
+ value.forEach(function(item, index) {
522
+ if(evidenceProperties.indexOf(item) === -1) {
523
+ evidenceProperties.push(item);
524
+ }
525
+ });
526
+ }
527
+ // Item is an object so recursively call this method
528
+ // and add any resulting evidence properties to the list.
529
+ else if(typeof value === 'object' && value !== null) {
530
+ getEvidencePropertiesFromObject(value).forEach(function(item, index) {
531
+ if(evidenceProperties.indexOf(item) === -1) {
532
+ evidenceProperties.push(item);
533
+ }
534
+ });
535
+ }
536
+ }
537
+ }
538
+
539
+ return evidenceProperties;
540
+ }
541
+ {{/_hasDelayedProperties}}
542
+
543
+ {{#_supportsPromises}}
544
+ this.promise = new Promise(function(resolve, reject) {
545
+ process(resolve,reject);
546
+ });
547
+ {{/_supportsPromises}}
548
+
549
+ this.onChange = function(resolve) {
550
+ changeFuncs.push(resolve);
551
+ }
552
+
553
+ this.complete = function(resolve, properties) {
554
+ {{#_hasDelayedProperties}}
555
+ // If properties is set then check if we need to kick off
556
+ // processing of anything.
557
+ if(typeof properties !== "undefined") {
558
+ // If properties is a string then split on comma to produce
559
+ // an array of one or more key names.
560
+ if(typeof properties === "string") {
561
+ properties = properties.split(',');
562
+ }
563
+ if(Array.isArray(properties)) {
564
+ properties.forEach(function(key, i) {
565
+ // We pass an empty function rather than 'resolve' because we
566
+ // don't want to call resolve when a single evidence function
567
+ // evaluates but after all of them have completed.
568
+ // This is handled by the 'if(complete)' code below.
569
+ processJsProperties(function(json) {}, catchError, getEvidenceProperties(key), true);
570
+ });
571
+ }
572
+ }
573
+
574
+ {{/_hasDelayedProperties}}
575
+ if(completed){
576
+ resolve(json);
577
+ }else{
578
+ this.onChange(function(data) {
579
+ if(completed){
580
+ resolve(data);
581
+ }
582
+ })
583
+ }
584
+ };
585
+
586
+ // Update this instance with the initial JSON payload.
587
+ update.call(this, json);
588
+ {{#_supportsPromises}}
589
+ var parent = this;
590
+ this.promise.then(function(value) {
591
+ // JSON has been updated so replace the current instance.
592
+ update.call(parent, value);
593
+ completed = true;
594
+ }).catch(catchError);
595
+ {{/_supportsPromises}}
596
+ {{^_supportsPromises}}
597
+ process(function(json) {}, catchError);
598
+ {{/_supportsPromises}}
599
+ }
600
+
601
+ var {{_objName}} = new fiftyoneDegreesManager();
@@ -0,0 +1,8 @@
1
+ ## Purpose
2
+
3
+ Store shared (mustache) templates to be used by the implementation of `JavaScriptBuilderElement` and other components across the languages.
4
+
5
+ ## Background
6
+
7
+ The [language-independent specification](https://github.com/51Degrees/specifications) describes how JavaScriptBuilderElement is used [here](https://github.com/51Degrees/specifications/blob/36ff732360acb49221dc81237281264dac4eb897/pipeline-specification/pipeline-elements/javascript-builder.md). The mechanics is: javascript file is requested from the server (on-premise web integration) and is created from this mustache template by the JavaScriptBuilderElement. It then collects more evidence, sends it to the server and upon response calls a callback function providing the client with more precise device data.
8
+
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "51degrees/fiftyone.pipeline.javascript-templates",
3
+ "description": "51Degrees JavascriptResource Mustache template",
4
+ "authors": [
5
+ {
6
+ "name": "Filip Hnízdo",
7
+ "email": "filip@octophin.com",
8
+ "homepage": "https://octophindigital.com/"
9
+ },
10
+ {
11
+ "name": "Steve Ballantine",
12
+ "email": "stephen@51degrees.com"
13
+ },
14
+ {
15
+ "name": "Ben Shilito",
16
+ "email": "ben@51degrees.com"
17
+ },
18
+ {
19
+ "name": "Joseph Dix",
20
+ "email": "joseph@51degrees.com"
21
+ },
22
+ {
23
+ "name": "Luka Reihl",
24
+ "email": "luka.reihl@postindustria.com"
25
+ }
26
+ ],
27
+ "license": "EUPL-1.2",
28
+ "type": "library",
29
+ "require": {}
30
+ }
@@ -1,23 +1,23 @@
1
- /* *********************************************************************
2
- * This Original Work is copyright of 51 Degrees Mobile Experts Limited.
3
- * Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
4
- * Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
5
- *
6
- * This Original Work is licensed under the European Union Public Licence
7
- * (EUPL) v.1.2 and is subject to its terms as set out below.
8
- *
9
- * If a copy of the EUPL was not distributed with this file, You can obtain
10
- * one at https://opensource.org/licenses/EUPL-1.2.
11
- *
12
- * The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
13
- * amended by the European Commission) shall be deemed incompatible for
14
- * the purposes of the Work and the provisions of the compatibility
15
- * clause in Article 5 of the EUPL shall not apply.
16
- *
17
- * If using the Work as, or as part of, a network application, by
18
- * including the attribution notice(s) required under Article 5 of the EUPL
19
- * in the end user terms of the application under an appropriate heading,
20
- * such notice(s) shall fulfill the requirements of that article.
1
+ /* *********************************************************************
2
+ * This Original Work is copyright of 51 Degrees Mobile Experts Limited.
3
+ * Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
4
+ * Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
5
+ *
6
+ * This Original Work is licensed under the European Union Public Licence
7
+ * (EUPL) v.1.2 and is subject to its terms as set out below.
8
+ *
9
+ * If a copy of the EUPL was not distributed with this file, You can obtain
10
+ * one at https://opensource.org/licenses/EUPL-1.2.
11
+ *
12
+ * The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
13
+ * amended by the European Commission) shall be deemed incompatible for
14
+ * the purposes of the Work and the provisions of the compatibility
15
+ * clause in Article 5 of the EUPL shall not apply.
16
+ *
17
+ * If using the Work as, or as part of, a network application, by
18
+ * including the attribution notice(s) required under Article 5 of the EUPL
19
+ * in the end user terms of the application under an appropriate heading,
20
+ * such notice(s) shall fulfill the requirements of that article.
21
21
  * ********************************************************************* */
22
22
 
23
23
  const mustache = require('mustache');
@@ -25,7 +25,7 @@ const fs = require('fs');
25
25
  const querystring = require('querystring');
26
26
 
27
27
  const template = fs.readFileSync(
28
- __dirname + '/JavaScriptResource.mustache',
28
+ __dirname + '/javascript-templates/JavaScriptResource.mustache',
29
29
  'utf8'
30
30
  );
31
31
 
@@ -162,6 +162,7 @@ class JavaScriptBuilderElement extends FlowElement {
162
162
  }
163
163
 
164
164
  const urlQuery = querystring.stringify(query);
165
+ settings._parameters = JSON.stringify(query);
165
166
 
166
167
  // Does the URL already have a query string in it?
167
168
 
@@ -194,6 +195,9 @@ class JavaScriptBuilderElement extends FlowElement {
194
195
 
195
196
  settings._hasDelayedProperties = settings._jsonObject.includes('delayexecution');
196
197
 
198
+ settings._sessionId = flowData.evidence.get('query.session-id');
199
+ settings._sequence = flowData.evidence.get('query.sequence');
200
+
197
201
  let output = mustache.render(template, settings);
198
202
 
199
203
  if (settings._minify) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiftyone.pipeline.core",
3
- "version": "4.4.55",
3
+ "version": "4.4.57",
4
4
  "description": "Core library for the 51Degrees Pipeline API",
5
5
  "directories": {
6
6
  "test": "tests"