@bluedot-innovation/models 3.0.6 → 3.0.7-alpha.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 3.0.7
2
+ - `proximityUUID` is now mandatory
3
+
1
4
  ## 3.0.6
2
5
  - `txPower` no longer mandatory
3
6
 
@@ -4,9 +4,9 @@
4
4
  {
5
5
  "property": "beaconType",
6
6
  "pairings": [
7
- {"value": "ios", "requiredFields": ["major", "minor"]},
7
+ {"value": "ios", "requiredFields": ["proximityUUID", "major", "minor"]},
8
8
  {"value": "android", "requiredFields": ["macAddress"]},
9
- {"value": "both", "requiredFields": ["major", "minor", "macAddress"]}
9
+ {"value": "both", "requiredFields": ["proximityUUID", "major", "minor", "macAddress"]}
10
10
  ]
11
11
  }
12
12
  ]
package/models/Beacon.js CHANGED
@@ -54,26 +54,23 @@ function validateMajorMinor (v) {
54
54
  return v >= 0 && v <= 65535
55
55
  }
56
56
 
57
- function validateBeaconType (v, magicCallback) {
57
+ function validateBeaconType (v, callback) {
58
58
  'use strict'
59
59
  const beaconType = v
60
- const minor = this.minor
61
- const major = this.major
62
- const macAddress = this.macAddress
63
- const txPower = this.txPower
60
+ const { minor, major, macAddress, proximityUUID } = this;
64
61
 
65
62
  let androidRegex = new RegExp(/(android)/ig)
66
63
  let iosRegex = new RegExp(/(ios)/ig)
67
64
  let bothRegex = new RegExp(/(both)/ig)
68
65
 
69
66
  if (androidRegex.test(beaconType)) {
70
- magicCallback((!!macAddress), 'Beacon type `Android` must have a mac address')
67
+ callback((!!macAddress), "Beacon type 'Android' must have a mac address")
71
68
  } else if (iosRegex.test(beaconType)) {
72
- magicCallback((!!minor && !!major), 'Beacon type `IOS` must have both minor and major values')
69
+ callback((!!proximityUUID && !!minor && !!major), "Beacon type 'IOS' must have 'proximityUUID', 'minor' and 'major' values")
73
70
  } else if (bothRegex.test(beaconType)) {
74
- magicCallback((!!minor && !!major && !!macAddress), 'Beacon type `Both` must have all of minor, major, and mac address values')
71
+ callback((!!proximityUUID && !!minor && !!major && !!macAddress), "Beacon type 'Both' must have all of 'proximityUUID', 'minor', 'major', and 'mac address' values")
75
72
  } else {
76
- magicCallback(true)
73
+ callback(true)
77
74
  }
78
75
  }
79
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "3.0.6",
3
+ "version": "3.0.7-alpha.1",
4
4
  "main": "Models.js",
5
5
  "scripts": {
6
6
  "lint": "./node_modules/.bin/eslint -c .eslintrc.js ./models/*.js ./__tests__/**/*.js ./__tests__/**/**/*.js ./schemas/*.js",