fiftyone.devicedetection.onpremise 4.4.128 → 4.4.130

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/component.js CHANGED
@@ -18,22 +18,41 @@
18
18
  * including the attribution notice(s) required under Article 5 of the EUPL
19
19
  * in the end user terms of the application under an appropriate heading,
20
20
  * such notice(s) shall fulfill the requirements of that article.
21
- * ********************************************************************* */
22
-
23
- class Component {
24
- constructor (metadata, engineMetadata) {
25
- this.metadata = metadata;
26
- this.engineMetadata = engineMetadata;
27
- this.name = metadata.getName();
28
- this.properties = engineMetadata.getPropertiesForComponent(metadata);
29
- }
30
-
31
- * getProperties () {
32
- const Property = require('./property');
33
- for (let i = 0; i < this.properties.getSize(); i++) {
34
- yield new Property(this.properties.getByIndex(i), this.engineMetadata);
35
- }
36
- }
37
- }
38
-
39
- module.exports = Component;
21
+ * ********************************************************************* */
22
+
23
+ class Component {
24
+ /**
25
+ * Constructor for Component
26
+ *
27
+ * @param {object} metadata Metadata
28
+ * @param {object} engineMetadata Engine metadata
29
+ */
30
+ constructor (metadata, engineMetadata) {
31
+ this.metadata = metadata;
32
+ this.engineMetadata = engineMetadata;
33
+ /**
34
+ * @type {string}
35
+ */
36
+ this.name = metadata.getName();
37
+ /**
38
+ * @type {object}
39
+ */
40
+ this.properties = engineMetadata.getPropertiesForComponent(metadata);
41
+ }
42
+
43
+ /**
44
+ * Yield component properties
45
+ *
46
+ * @generator
47
+ * @yields {Property}
48
+ * @returns {void}
49
+ */
50
+ * getProperties () {
51
+ const Property = require('./property');
52
+ for (let i = 0; i < this.properties.getSize(); i++) {
53
+ yield new Property(this.properties.getByIndex(i), this.engineMetadata);
54
+ }
55
+ }
56
+ }
57
+
58
+ module.exports = Component;
@@ -31,14 +31,19 @@ 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
- *
35
- * @param {string} options.useUrlFormatter whether to append default URL params for Data File download
36
34
  **/
37
35
  class DeviceDetectionDataFile extends DataFile {
36
+ /**
37
+ * Constructor for Device Detection DataFile
38
+ *
39
+ * @param {object} options options for the datafile
40
+ * @param {string} options.useUrlFormatter whether to append default URL params for Data File download
41
+ **/
38
42
  constructor ({ useUrlFormatter = true, ...rest }) {
39
43
  super({ ...rest });
40
44
  this.useUrlFormatter = useUrlFormatter;
41
45
  }
46
+
42
47
  /**
43
48
  * Uses the product, type and licensekey parameters the datafile
44
49
  * was constructed with to generate a querystring used in the datafile
@@ -46,7 +51,6 @@ class DeviceDetectionDataFile extends DataFile {
46
51
  *
47
52
  * @returns {string} url
48
53
  */
49
-
50
54
  urlFormatter () {
51
55
  const queryParams = {
52
56
  Product: this.updateURLParams.product,
@@ -43,6 +43,14 @@ const Profile = require('./profile');
43
43
  * @typedef {import('fiftyone.pipeline.engines').DataKeyedCache} DataKeyedCache
44
44
  */
45
45
 
46
+ /**
47
+ * @typedef {import('fiftyone.pipeline.engines').Engine} Engine
48
+ */
49
+
50
+ /**
51
+ * @typedef {import('fiftyone.pipeline.core').FlowData} FlowData
52
+ */
53
+
46
54
  // Determine if Windows or linux and which node version
47
55
 
48
56
  const nodeVersion = Number(process.version.match(/^v(\d+\.)/)[1]);
@@ -185,7 +193,7 @@ class DeviceDetectionOnPremise extends Engine {
185
193
  * update service
186
194
  * @param {boolean} options.dataUpdateVerifyMd5 whether to check MD5 of datafile
187
195
  * @param {boolean} options.dataUpdateUseUrlFormatter whether to append default URL params for Data File download
188
- * @param {Array} options.restrictedProperties list of properties the engine
196
+ * @param {Array<string>} options.restrictedProperties list of properties the engine
189
197
  * will be restricted to
190
198
  * @param {string} options.licenceKeys license key(s) used by the
191
199
  * data file update service. A key can be obtained from the
@@ -206,7 +214,7 @@ class DeviceDetectionOnPremise extends Engine {
206
214
  * use the same file to prevent high disk usage.
207
215
  * @param {boolean} options.updateMatchedUserAgent True if the detection
208
216
  * should record the matched characters from the target User-Agent
209
- * @param {object} options.maxMatchedUserAgentLength Number of characters to
217
+ * @param {number} options.maxMatchedUserAgentLength Number of characters to
210
218
  * consider in the matched User-Agent. Ignored if updateMatchedUserAgent
211
219
  * is false
212
220
  * @param {number} options.drift Set maximum drift in hash position to
@@ -417,10 +425,13 @@ class DeviceDetectionOnPremise extends Engine {
417
425
 
418
426
  const current = this;
419
427
 
420
- // Function for initialising the engine, wrapped like this so
421
- // that an engine can be initialised once the datafile is
422
- // retrieved if updateOnStart is set to true
423
-
428
+ /**
429
+ * Function for initialising the engine, wrapped like this so
430
+ * that an engine can be initialised once the datafile is
431
+ * retrieved if updateOnStart is set to true
432
+ *
433
+ * @returns {Promise<void>} init Engine Promise
434
+ */
424
435
  this.initEngine = function () {
425
436
  return new Promise(function (resolve, reject) {
426
437
  const engine = new swigWrapper['Engine' + swigWrapperType + 'Swig'](dataFilePath, config, requiredProperties);
@@ -545,7 +556,7 @@ class DeviceDetectionOnPremise extends Engine {
545
556
  * the FlowData.
546
557
  *
547
558
  * @param {FlowData} flowData FlowData to process
548
- * @returns {Promise} the result of processing
559
+ * @returns {Promise<void>} the result of processing
549
560
  **/
550
561
  processInternal (flowData) {
551
562
  const dd = this;
@@ -65,7 +65,7 @@ class DeviceDetectionOnPremisePipelineBuilder extends PipelineBuilder {
65
65
  * @param {number} options.cacheSize size of the default cache
66
66
  * (includes cache if set). NOTE: This is not supported for on-premise
67
67
  * engine.
68
- * @param {Array} options.restrictedProperties list of properties the engine
68
+ * @param {Array<string>} options.restrictedProperties list of properties the engine
69
69
  * will be restricted to
70
70
  * @param {string} options.performanceProfile used to control the tradeoff
71
71
  * between performance and system memory usage (Only applies to on-premise,
package/index.js CHANGED
@@ -18,13 +18,11 @@
18
18
  * including the attribution notice(s) required under Article 5 of the EUPL
19
19
  * in the end user terms of the application under an appropriate heading,
20
20
  * such notice(s) shall fulfill the requirements of that article.
21
- * ********************************************************************* */
22
-
23
- module.exports = {
24
-
25
- DeviceDetectionOnPremise: require('./deviceDetectionOnPremise'),
26
- DeviceDetectionOnPremisePipelineBuilder: require('./deviceDetectionOnPremisePipelineBuilder'),
27
- SwigData: require('./swigData'),
28
- swigHelpers: require('../fiftyone.devicedetection.onpremise/swigHelpers')
29
-
30
- };
21
+ * ********************************************************************* */
22
+
23
+ module.exports = {
24
+ DeviceDetectionOnPremise: require('./deviceDetectionOnPremise'),
25
+ DeviceDetectionOnPremisePipelineBuilder: require('./deviceDetectionOnPremisePipelineBuilder'),
26
+ SwigData: require('./swigData'),
27
+ swigHelpers: require('../fiftyone.devicedetection.onpremise/swigHelpers')
28
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fiftyone.devicedetection.onpremise",
3
- "version": "4.4.128",
3
+ "version": "4.4.130",
4
4
  "description": "Device detection on-premise services for the 51Degrees Pipeline API",
5
5
  "keywords": [
6
6
  "51degrees",
package/profile.js CHANGED
@@ -18,18 +18,30 @@
18
18
  * including the attribution notice(s) required under Article 5 of the EUPL
19
19
  * in the end user terms of the application under an appropriate heading,
20
20
  * such notice(s) shall fulfill the requirements of that article.
21
- * ********************************************************************* */
22
-
23
- class Profile {
24
- constructor (metadata, engineMetadata) {
25
- this.metadata = metadata;
26
- this.engineMetadata = engineMetadata;
27
-
28
- const Component = require('./component');
29
- this.component = new Component(
30
- engineMetadata.getComponentForProfile(metadata), engineMetadata);
31
- this.profileId = metadata.getProfileId();
32
- }
33
- }
34
-
35
- module.exports = Profile;
21
+ * ********************************************************************* */
22
+
23
+ class Profile {
24
+ /**
25
+ * Constructor for Profile
26
+ *
27
+ * @param {object} metadata Metadata
28
+ * @param {object} engineMetadata Engine metadata
29
+ */
30
+ constructor (metadata, engineMetadata) {
31
+ this.metadata = metadata;
32
+ this.engineMetadata = engineMetadata;
33
+
34
+ const Component = require('./component');
35
+ /**
36
+ * @type {Component}
37
+ */
38
+ this.component = new Component(
39
+ engineMetadata.getComponentForProfile(metadata), engineMetadata);
40
+ /**
41
+ * @type {number} uint32
42
+ */
43
+ this.profileId = metadata.getProfileId();
44
+ }
45
+ }
46
+
47
+ module.exports = Profile;
package/property.js CHANGED
@@ -1,51 +1,90 @@
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 swigHelpers = require('./swigHelpers');
24
24
 
25
25
  class Property {
26
+ /**
27
+ * Constructor for Property
28
+ *
29
+ * @param {object} metadata Metadata
30
+ * @param {object} engineMetadata Engine metadata
31
+ */
26
32
  constructor (
27
33
  metadata,
28
34
  engineMetadata) {
29
35
  this.metadata = metadata;
30
36
  this.engineMetadata = engineMetadata;
37
+ /**
38
+ * @type {string}
39
+ */
31
40
  this.name = metadata.getName();
41
+ /**
42
+ * @type {string}
43
+ */
32
44
  this.type = metadata.getType();
45
+ /**
46
+ * @type {Array<string>}
47
+ */
33
48
  this.dataFiles = swigHelpers.vectorToArray(metadata.getDataFilesWherePresent());
49
+ /**
50
+ * @type {string}
51
+ */
34
52
  this.category = metadata.getCategory();
53
+ /**
54
+ * @type {string}
55
+ */
35
56
  this.description = metadata.getDescription();
36
57
 
37
58
  const Component = require('./component');
59
+ /**
60
+ * @type {Component}
61
+ */
38
62
  this.component = new Component(
39
63
  engineMetadata.getComponentForProperty(metadata), engineMetadata);
64
+ /**
65
+ * @type {object}
66
+ */
40
67
  this.values = engineMetadata.getValuesForProperty(metadata);
41
68
  }
42
69
 
70
+ /**
71
+ * Yield property values
72
+ *
73
+ * @generator
74
+ * @yields {object}
75
+ * @returns {void}
76
+ */
43
77
  * getValues () {
44
78
  for (let i = 0; i < this.values.getSize(); i++) {
45
79
  yield this.values.getByIndex(i);
46
80
  }
47
81
  }
48
82
 
83
+ /**
84
+ * Get number of values in the property
85
+ *
86
+ * @returns {number} uint32
87
+ */
49
88
  getNumberOfValues () {
50
89
  return this.values.getSize();
51
90
  }
package/swigData.js CHANGED
@@ -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 AspectData = require('fiftyone.pipeline.engines').AspectData;
@@ -43,7 +43,7 @@ class SwigData extends AspectData {
43
43
  * @param {object} options options object
44
44
  * @param {FlowElement} options.flowElement the FlowElement the
45
45
  * data is part of
46
- * @param {ResultsHashSwig} options.swigResults the results from the
46
+ * @param {object} options.swigResults the results from the
47
47
  * swig engine
48
48
  */
49
49
  constructor ({
@@ -59,7 +59,7 @@ class SwigData extends AspectData {
59
59
  * correct type via a check of the engine's property list metadata
60
60
  *
61
61
  * @param {string} key the property key to retrieve
62
- * @returns {mixed} value property value
62
+ * @returns {AspectPropertyValue} value property value
63
63
  */
64
64
  getInternal (key) {
65
65
  // Start with special properties