fiftyone.devicedetection.onpremise 4.4.70 → 4.4.72

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/constants.js CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  module.exports = {
24
24
  /* Default params */
25
- dataFileUpdateBaseUrl: 'https://distributor.51degrees.com/api/v2/download',
25
+ dataUpdateUrl: 'https://distributor.51degrees.com/api/v2/download',
26
26
 
27
27
  /* Match metrics description */
28
28
  deviceIdDescription: 'Consists of four components separated by a ' +
@@ -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 querystring = require('querystring');
@@ -31,8 +31,13 @@ const DataFile = engines.DataFile;
31
31
  * update url which contains the product, type and licensekeys.
32
32
  * These paramaters are passed in to the datafile constructor's
33
33
  * updateURLParams parameter
34
+ * @param {string} options.useUrlFormatter whether to append default URL params for Data File download
34
35
  **/
35
36
  class DeviceDetectionDataFile extends DataFile {
37
+ constructor ({ useUrlFormatter = true, ...rest}) {
38
+ super({...rest});
39
+ this.useUrlFormatter = useUrlFormatter;
40
+ }
36
41
  /**
37
42
  * Uses the product, type and licensekey parameters the datafile
38
43
  * was constructed with to generate a querystring used in the datafile
@@ -44,14 +49,19 @@ class DeviceDetectionDataFile extends DataFile {
44
49
  const queryParams = {
45
50
  Product: this.updateURLParams.product,
46
51
  Type: this.updateURLParams.Type
47
-
48
52
  };
49
53
 
54
+ let URL = this.updateURLParams.baseURL;
55
+
50
56
  if (this.updateURLParams.licenseKeys) {
51
57
  queryParams.licenseKeys = this.updateURLParams.licenseKeys;
52
58
  }
53
59
 
54
- return this.updateURLParams.baseURL + '?' + querystring.stringify(queryParams);
60
+ if(this.useUrlFormatter){
61
+ URL += '?' + querystring.stringify(queryParams);
62
+ }
63
+
64
+ return URL;
55
65
  }
56
66
  }
57
67
 
@@ -181,8 +181,10 @@ class DeviceDetectionOnPremise extends Engine {
181
181
  * @param {DataKeyedCache} options.cache an instance of the Cache class from
182
182
  * Fiftyone.Pipeline.Engines. NOTE: This is no longer supported for
183
183
  * on-premise engine.
184
- * @param {string} options.dataFileUpdateBaseUrl base url for the datafile
184
+ * @param {string} options.dataUpdateUrl base url for the datafile
185
185
  * update service
186
+ * @param {boolean} options.dataUpdateVerifyMd5 whether to check MD5 of datafile
187
+ * @param {boolean} options.dataUpdateUseUrlFormatter whether to append default URL params for Data File download
186
188
  * @param {Array} options.restrictedProperties list of properties the engine
187
189
  * will be restricted to
188
190
  * @param {string} options.licenceKeys license key(s) used by the
@@ -235,7 +237,9 @@ class DeviceDetectionOnPremise extends Engine {
235
237
  dataFilePath,
236
238
  autoUpdate,
237
239
  cache,
238
- dataFileUpdateBaseUrl = constants.dataFileUpdateBaseUrl,
240
+ dataUpdateUrl = constants.dataUpdateUrl,
241
+ dataUpdateVerifyMd5 = true,
242
+ dataUpdateUseUrlFormatter= true,
239
243
  restrictedProperties,
240
244
  licenceKeys,
241
245
  download,
@@ -457,7 +461,7 @@ class DeviceDetectionOnPremise extends Engine {
457
461
 
458
462
  // Disable features that require a license key if one was
459
463
  // not supplied.
460
- if(dataFileUpdateBaseUrl === constants.dataFileUpdateBaseUrl) {
464
+ if(dataUpdateUrl === constants.dataUpdateUrl) {
461
465
  if (licenceKeys) {
462
466
  autoUpdate = autoUpdate && licenceKeys.length > 0;
463
467
  updateOnStart = updateOnStart && licenceKeys.length > 0;
@@ -466,10 +470,11 @@ class DeviceDetectionOnPremise extends Engine {
466
470
  updateOnStart = false;
467
471
  }
468
472
  }
473
+
469
474
  // Construct datafile
470
475
  const dataFileSettings = {
471
476
  flowElement: this,
472
- verifyMD5: true,
477
+ verifyMD5: dataUpdateVerifyMd5,
473
478
  autoUpdate,
474
479
  updateOnStart,
475
480
  decompress: true,
@@ -477,7 +482,8 @@ class DeviceDetectionOnPremise extends Engine {
477
482
  download,
478
483
  fileSystemWatcher,
479
484
  pollingInterval,
480
- updateTimeMaximumRandomisation
485
+ updateTimeMaximumRandomisation,
486
+ useUrlFormatter: dataUpdateUseUrlFormatter
481
487
  };
482
488
 
483
489
  dataFileSettings.getDatePublished = function () {
@@ -515,7 +521,7 @@ class DeviceDetectionOnPremise extends Engine {
515
521
  params.licenseKeys = licenceKeys;
516
522
  }
517
523
 
518
- params.baseURL = dataFileUpdateBaseUrl;
524
+ params.baseURL = dataUpdateUrl;
519
525
 
520
526
  dataFileSettings.updateURLParams = params;
521
527
 
@@ -44,8 +44,10 @@ class DeviceDetectionOnPremisePipelineBuilder extends PipelineBuilder {
44
44
  * an empty string, but this will cause automatic updates
45
45
  * to be disabled.
46
46
  * @param {string} options.dataFile dataFile path for the on premise engine
47
+ * @param {boolean} options.dataUpdateVerifyMd5 whether to check MD5 of datafile
48
+ * @param {boolean} options.dataUpdateUseUrlFormatter whether to append default URL params for Data File download
47
49
  * @param {boolean} options.autoUpdate whether to autoUpdate the dataFile
48
- * @param {string} options.dataFileUpdateBaseUrl base url for the datafile
50
+ * @param {string} options.dataUpdateUrl base url for the datafile
49
51
  * @param {number} options.pollingInterval How often to poll for
50
52
  * updates to the datafile (minutes)
51
53
  * @param {number} options.updateTimeMaximumRandomisation
@@ -103,8 +105,10 @@ class DeviceDetectionOnPremisePipelineBuilder extends PipelineBuilder {
103
105
  dataFileUpdateService = null,
104
106
  licenceKeys = null,
105
107
  dataFile = null,
108
+ dataUpdateVerifyMd5 = true,
109
+ dataUpdateUseUrlFormatter= true,
106
110
  autoUpdate = true,
107
- dataFileUpdateBaseUrl = null,
111
+ dataUpdateUrl = null,
108
112
  pollingInterval = 30,
109
113
  updateTimeMaximumRandomisation = 10,
110
114
  shareUsage = true,
@@ -132,8 +136,8 @@ class DeviceDetectionOnPremisePipelineBuilder extends PipelineBuilder {
132
136
  this.flowElements.push(new ShareUsageElement());
133
137
  }
134
138
 
135
- if (dataFileUpdateBaseUrl == null) {
136
- dataFileUpdateBaseUrl = constants.dataFileUpdateBaseUrl;
139
+ if (dataUpdateUrl == null) {
140
+ dataUpdateUrl = constants.dataUpdateUrl;
137
141
  }
138
142
 
139
143
  if (cacheSize) {
@@ -143,7 +147,9 @@ class DeviceDetectionOnPremisePipelineBuilder extends PipelineBuilder {
143
147
  {
144
148
  dataFilePath: dataFile,
145
149
  autoUpdate,
146
- dataFileUpdateBaseUrl,
150
+ dataUpdateUrl,
151
+ dataUpdateVerifyMd5,
152
+ dataUpdateUseUrlFormatter,
147
153
  fileSystemWatcher,
148
154
  pollingInterval,
149
155
  updateTimeMaximumRandomisation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiftyone.devicedetection.onpremise",
3
- "version": "4.4.70",
3
+ "version": "4.4.72",
4
4
  "description": "Device detection on-premise services for the 51Degrees Pipeline API",
5
5
  "main": "index.js",
6
6
  "directories": {