fiftyone.devicedetection.onpremise 4.4.68 → 4.4.70

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
@@ -1,26 +1,29 @@
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
  module.exports = {
24
+ /* Default params */
25
+ dataFileUpdateBaseUrl: 'https://distributor.51degrees.com/api/v2/download',
26
+
24
27
  /* Match metrics description */
25
28
  deviceIdDescription: 'Consists of four components separated by a ' +
26
29
  'hyphen symbol: Hardware-Platform-Browser-IsCrawler where each ' +
@@ -235,7 +235,7 @@ class DeviceDetectionOnPremise extends Engine {
235
235
  dataFilePath,
236
236
  autoUpdate,
237
237
  cache,
238
- dataFileUpdateBaseUrl = 'https://distributor.51degrees.com/api/v2/download',
238
+ dataFileUpdateBaseUrl = constants.dataFileUpdateBaseUrl,
239
239
  restrictedProperties,
240
240
  licenceKeys,
241
241
  download,
@@ -457,14 +457,15 @@ class DeviceDetectionOnPremise extends Engine {
457
457
 
458
458
  // Disable features that require a license key if one was
459
459
  // not supplied.
460
- if (licenceKeys) {
461
- autoUpdate = autoUpdate && licenceKeys.length > 0;
462
- updateOnStart = updateOnStart && licenceKeys.length > 0;
463
- } else {
464
- autoUpdate = false;
465
- updateOnStart = false;
460
+ if(dataFileUpdateBaseUrl === constants.dataFileUpdateBaseUrl) {
461
+ if (licenceKeys) {
462
+ autoUpdate = autoUpdate && licenceKeys.length > 0;
463
+ updateOnStart = updateOnStart && licenceKeys.length > 0;
464
+ } else {
465
+ autoUpdate = false;
466
+ updateOnStart = false;
467
+ }
466
468
  }
467
-
468
469
  // Construct datafile
469
470
  const dataFileSettings = {
470
471
  flowElement: this,
@@ -1,28 +1,29 @@
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 os = require('os');
24
24
  const core = require('fiftyone.pipeline.core');
25
25
  const DeviceDetectionOnPremise = require('./deviceDetectionOnPremise');
26
+ const constants = require('./constants');
26
27
  const PipelineBuilder = core.PipelineBuilder;
27
28
  const ShareUsageElement = require('fiftyone.pipeline.engines.fiftyone').ShareUsage;
28
29
  const errorMessages = require('fiftyone.devicedetection.shared').errorMessages;
@@ -44,6 +45,7 @@ class DeviceDetectionOnPremisePipelineBuilder extends PipelineBuilder {
44
45
  * to be disabled.
45
46
  * @param {string} options.dataFile dataFile path for the on premise engine
46
47
  * @param {boolean} options.autoUpdate whether to autoUpdate the dataFile
48
+ * @param {string} options.dataFileUpdateBaseUrl base url for the datafile
47
49
  * @param {number} options.pollingInterval How often to poll for
48
50
  * updates to the datafile (minutes)
49
51
  * @param {number} options.updateTimeMaximumRandomisation
@@ -102,6 +104,7 @@ class DeviceDetectionOnPremisePipelineBuilder extends PipelineBuilder {
102
104
  licenceKeys = null,
103
105
  dataFile = null,
104
106
  autoUpdate = true,
107
+ dataFileUpdateBaseUrl = null,
105
108
  pollingInterval = 30,
106
109
  updateTimeMaximumRandomisation = 10,
107
110
  shareUsage = true,
@@ -129,14 +132,18 @@ class DeviceDetectionOnPremisePipelineBuilder extends PipelineBuilder {
129
132
  this.flowElements.push(new ShareUsageElement());
130
133
  }
131
134
 
135
+ if (dataFileUpdateBaseUrl == null) {
136
+ dataFileUpdateBaseUrl = constants.dataFileUpdateBaseUrl;
137
+ }
138
+
132
139
  if (cacheSize) {
133
140
  throw errorMessages.cacheNotSupport;
134
141
  }
135
-
136
142
  this.flowElements.push(new DeviceDetectionOnPremise(
137
143
  {
138
144
  dataFilePath: dataFile,
139
145
  autoUpdate,
146
+ dataFileUpdateBaseUrl,
140
147
  fileSystemWatcher,
141
148
  pollingInterval,
142
149
  updateTimeMaximumRandomisation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiftyone.devicedetection.onpremise",
3
- "version": "4.4.68",
3
+ "version": "4.4.70",
4
4
  "description": "Device detection on-premise services for the 51Degrees Pipeline API",
5
5
  "main": "index.js",
6
6
  "directories": {