fiftyone.devicedetection.onpremise 4.3.8 → 4.3.12

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 ADDED
@@ -0,0 +1,46 @@
1
+ /* *********************************************************************
2
+ * This Original Work is copyright of 51 Degrees Mobile Experts Limited.
3
+ * Copyright 2019 51 Degrees Mobile Experts Limited, 5 Charlotte Close,
4
+ * Caversham, Reading, Berkshire, United Kingdom RG4 7BY.
5
+ *
6
+ * This Original Work is licensed under the European Union Public Licence (EUPL)
7
+ * 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
+ * ********************************************************************* */
22
+
23
+ module.exports = {
24
+ /* Match metrics description */
25
+ deviceIdDescription: 'Consists of four components separated by a ' +
26
+ 'hyphen symbol: Hardware-Platform-Browser-IsCrawler where each ' +
27
+ 'Component represents an ID of the corresponding Profile.',
28
+ userAgentsDescription: 'The matched User-Agents.',
29
+ differenceDescription: 'Used when detection method is not Exact or ' +
30
+ 'None. This is an integer value and the larger the value the less ' +
31
+ 'confident the detector is in this result.',
32
+ methodDescription: 'The method used to determine the match result.',
33
+ matchedNodesDescription: 'Indicates the number of hash nodes matched ' +
34
+ 'within the evidence.',
35
+ driftDescription: 'Total difference in character positions where the ' +
36
+ 'substrings hashes were found away from where they were expected.',
37
+ iterationsDescription: 'The number of iterations carried out in order ' +
38
+ 'to find a match. This is the number of nodes in the graph which ' +
39
+ 'have been visited.',
40
+
41
+ /* Match methods */
42
+ none: 'NONE',
43
+ performance: 'PERFORMANCE',
44
+ combined: 'COMBINED',
45
+ predictive: 'PREDICTIVE'
46
+ };
@@ -33,6 +33,7 @@ const path = require('path');
33
33
  const EvidenceKeyFilter = core.BasicListEvidenceKeyFilter;
34
34
  const fs = require('fs');
35
35
  const util = require('util');
36
+ const constants = require('./constants');
36
37
 
37
38
  /**
38
39
  * @typedef {import('fiftyone.pipeline.engines').DataKeyedCache} DataKeyedCache
@@ -347,21 +348,28 @@ class DeviceDetectionOnPremise extends Engine {
347
348
  name: 'DeviceId',
348
349
  type: 'string',
349
350
  category: 'Device metrics',
350
- description: 'Consists of four components separated by a hyphen symbol: Hardware-Platform-Browser-IsCrawler where each Component represents an ID of the corresponding Profile.'
351
+ description: constants.deviceIdDescription
351
352
  };
352
353
 
353
354
  current.properties.userAgents = {
354
355
  name: 'UserAgents',
355
356
  type: 'string[]',
356
357
  category: 'Device metrics',
357
- description: 'The matched User-Agents.'
358
+ description: constants.userAgentsDescription
358
359
  };
359
360
 
360
361
  current.properties.difference = {
361
362
  name: 'Difference',
362
363
  type: 'int',
363
364
  category: 'Device metrics',
364
- description: 'Used when detection method is not Exact or None. This is an integer value and the larger the value the less confident the detector is in this result.'
365
+ description: constants.differenceDescription
366
+ };
367
+
368
+ current.properties.method = {
369
+ name: 'Method',
370
+ type: 'string',
371
+ category: 'Device metrics',
372
+ description: constants.methodDescription
365
373
  };
366
374
 
367
375
  if (swigWrapperType === 'Hash') {
@@ -369,14 +377,21 @@ class DeviceDetectionOnPremise extends Engine {
369
377
  name: 'MatchedNodes',
370
378
  type: 'int',
371
379
  category: 'Device metrics',
372
- description: 'Indicates the number of hash nodes matched within the evidence.'
380
+ description: constants.matchedNodesDescription
373
381
  };
374
382
 
375
383
  current.properties.drift = {
376
384
  name: 'Drift',
377
385
  type: 'int',
378
386
  category: 'Device metrics',
379
- description: 'Total difference in character positions where the substrings hashes were found away from where they were expected.'
387
+ description: constants.driftDescription
388
+ };
389
+
390
+ current.properties.iterations = {
391
+ name: 'Iterations',
392
+ type: 'int',
393
+ category: 'Device metrics',
394
+ description: constants.iterationsDescription
380
395
  };
381
396
  }
382
397
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiftyone.devicedetection.onpremise",
3
- "version": "4.3.8",
3
+ "version": "4.3.12",
4
4
  "description": "Device detection on-premise services for the 51Degrees Pipeline API",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -22,10 +22,10 @@
22
22
  "Tung Pham <tung@51degrees.com> (https://51degrees.com)"
23
23
  ],
24
24
  "dependencies": {
25
- "fiftyone.devicedetection.shared": "^4.3.8",
26
- "fiftyone.pipeline.core": "^4.3.6",
27
- "fiftyone.pipeline.engines": "^4.3.6",
28
- "fiftyone.pipeline.engines.fiftyone": "^4.3.6",
25
+ "fiftyone.devicedetection.shared": "^4.3.12",
26
+ "fiftyone.pipeline.core": "^4.3.8",
27
+ "fiftyone.pipeline.engines": "^4.3.8",
28
+ "fiftyone.pipeline.engines.fiftyone": "^4.3.8",
29
29
  "n-readlines": "^1.0.1"
30
30
  },
31
31
  "devDependencies": {
package/swigData.js CHANGED
@@ -27,6 +27,8 @@ const swigHelpers = require('./swigHelpers');
27
27
 
28
28
  const DataFileMissingPropertyService = require('./dataFileMissingPropertyService');
29
29
 
30
+ const constants = require('./constants');
31
+
30
32
  /**
31
33
  * @typedef {import('fiftyone.pipeline.core').FlowElement} FlowElement
32
34
  */
@@ -97,7 +99,21 @@ class SwigData extends AspectData {
97
99
  }
98
100
 
99
101
  if (key === 'method') {
100
- result.value = this.swigResults.getMethod();
102
+ const method = this.swigResults.getMethod();
103
+ switch (method) {
104
+ case 1:
105
+ result.value = constants.performance;
106
+ break;
107
+ case 2:
108
+ result.value = constants.combined;
109
+ break;
110
+ case 3:
111
+ result.value = constants.predictive;
112
+ break;
113
+ default:
114
+ result.value = constants.none;
115
+ break;
116
+ }
101
117
 
102
118
  return result;
103
119
  }
package/swigHelpers.js CHANGED
@@ -47,7 +47,9 @@ module.exports = {
47
47
  const date = new Date();
48
48
 
49
49
  date.setFullYear(swigDate.getYear());
50
- date.setMonth(swigDate.getMonth());
50
+ // Minus one as Jan starts at 0
51
+ const month = swigDate.getMonth();
52
+ date.setMonth(month > 0 ? month - 1 : month);
51
53
  date.setDate(swigDate.getDay());
52
54
 
53
55
  return date;