@bluedot-innovation/models 10.3.0 → 10.5.0

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,9 @@
1
+ ## 10.5.0
2
+ - Remove beacons references
3
+
4
+ ## 10.4.0
5
+ - Adds verificationCodeEnabled to project
6
+
1
7
  ## 10.3.0
2
8
  - Adds service type Users
3
9
 
@@ -124,7 +124,8 @@
124
124
  "hello": {
125
125
  "activeTtl": 604800,
126
126
  "finalTtl": 86400,
127
- "ssoLinkingCode": "HGDUS69SDJJ0"
127
+ "ssoLinkingCode": "HGDUS69SDJJ0",
128
+ "verificationCodeEnabled": true
128
129
  },
129
130
  "reportConfigurations": [
130
131
  {
@@ -21,38 +21,9 @@
21
21
  "trackingOnGpsAccuracyThreshold": 200.0,
22
22
  "checkoutTimeAccuracy": 60.0,
23
23
  "checkoutDistanceAccuracy": 50.0,
24
- "beaconReevaluationDistance": 25.0,
25
- "beaconActivationCoefficient": 0.5,
26
- "beaconActivationDistance": 30.0,
27
24
  "endpointUrl": "https://www.pointapi.bluedot.com.au/pointapi-v1/",
28
25
  "filteringEnabled": false,
29
26
  "applicationLoggingEnabled": false,
30
- "telemetry" : {
31
- "telemetryLoggingEnabled" : false,
32
- "telemetryBatchSize" : 25,
33
- "telemetryTimeOut": 30.0,
34
- "telemetryEventsBlacklist" : [
35
- "location",
36
- "batteryLevel",
37
- "beaconDiscovered",
38
- "beaconDiscoveryStarted",
39
- "beaconLost",
40
- "gpsAccuracyRequested",
41
- "rulesDownloadRequested",
42
- "rulesLoaded",
43
- "zoneCheckedIntoFence",
44
- "zoneCheckedIntoBeacon",
45
- "zoneCheckedOutFromBeacon",
46
- "zoneCheckedOutFromFence",
47
- "sdkStarted",
48
- "sdkStopped",
49
- "noMotion",
50
- "log",
51
- "heading",
52
- "fenceCrossed",
53
- "rulesDownloadBegin",
54
- "rulesDownloadEnd" ]
55
- },
56
27
  "useCaseType" : "Retail",
57
28
  "maximumPageSize": 256,
58
29
  "triggerEngine": "BD",
@@ -64,9 +35,6 @@
64
35
  "trackingOnGpsAccuracyThreshold" : 400.0,
65
36
  "checkoutTimeAccuracy" : 60.0,
66
37
  "checkoutDistanceAccuracy" : 50.0,
67
- "beaconReevaluationDistance" : 10.0,
68
- "beaconActivationCoefficient" : 0.5,
69
- "beaconActivationDistance" : 30.0,
70
38
  "periodicPollingEnabled" : true,
71
39
  "triggeringOnPollingLocationBasicThreshold" : 1000.0,
72
40
  "triggeringOnPollingLocationFurtherThreshold" : 3000.0,
@@ -90,31 +58,6 @@
90
58
  "starvationDetectorSecsAllowedPerMetre" : 0.0225,
91
59
  "starvationDetectorMinAllowedStarvationTimeInterval" : 30.0
92
60
  },
93
- "telemetry" : {
94
- "telemetryLoggingEnabled" : false,
95
- "telemetryBatchSize" : 25,
96
- "telemetryTimeOut": 30.0,
97
- "telemetryEventsBlacklist" : [ "location",
98
- "batteryLevel",
99
- "beaconDiscovered",
100
- "beaconDiscoveryStarted",
101
- "beaconLost",
102
- "gpsAccuracyRequested",
103
- "rulesDownloadRequested",
104
- "rulesLoaded",
105
- "zoneCheckedIntoFence",
106
- "zoneCheckedIntoBeacon",
107
- "zoneCheckedOutFromBeacon",
108
- "zoneCheckedOutFromFence",
109
- "sdkStarted",
110
- "sdkStopped",
111
- "noMotion",
112
- "log",
113
- "heading",
114
- "fenceCrossed",
115
- "rulesDownloadBegin",
116
- "rulesDownloadEnd" ]
117
- },
118
61
  "maximumPageSize": 256,
119
62
  "triggerEngine": "BD",
120
63
  "nativeCheckinAccuracyThreshold" : 101,
@@ -330,28 +330,6 @@ describe('Zone', () => {
330
330
  }
331
331
  })
332
332
 
333
- it('should throw an error when it contains both a beacon and a travelDirection condition', async () => {
334
- zone.conditions.push(require('../condition/travelDirection/travelDirection.data.json'));
335
- let Zone = new ZoneModel(zone)
336
- try {
337
- await Zone.validate()
338
- } catch (err) {
339
- assert.exists(err, 'err object should exist')
340
- assert(err instanceof Error, "Should throw error.")
341
- }
342
- })
343
-
344
- it('should throw an error when it contains both a beacon and a speed condition', async () => {
345
- zone.conditions.push(require('../condition/speed/speed.data.json'));
346
- let Zone = new ZoneModel(zone)
347
- try {
348
- await Zone.validate()
349
- } catch (err) {
350
- assert.exists(err, 'err object should exist')
351
- assert(err instanceof Error, "Should throw error.")
352
- }
353
- })
354
-
355
333
  it('should throw an error when triggerOnExit is null', async () => {
356
334
  zone.triggerOnExit = null
357
335
  await helpers.testNullValue(zone, ZoneModel)
@@ -1,4 +1,3 @@
1
- exports.BEACON = 'beacon'
2
1
  exports.LOW_ACCURACY = 'low'
3
2
  exports.TRAVEL_DIRECTION = 'travelDirection'
4
3
  exports.SPEED = 'speed'
package/helpers.js CHANGED
@@ -2,7 +2,7 @@ var equal = require('deep-equal');
2
2
  const { clean } = require('./utils');
3
3
  const area = require('@turf/area').default;
4
4
  const {polygon} = require('@turf/helpers');
5
- const {BEACON, LOW_ACCURACY, TRAVEL_DIRECTION, SPEED} = require('./constants/commonConstants')
5
+ const {LOW_ACCURACY, TRAVEL_DIRECTION, SPEED} = require('./constants/commonConstants')
6
6
 
7
7
  let helpers = {}
8
8
 
@@ -141,7 +141,7 @@ helpers.checkValidLowAccuracyFence = function(zone, next) {
141
141
  if (!zone.geofeatures || !zone.geofeatures.length) return next()
142
142
  zone.geofeatures.forEach(geofeature => {
143
143
  if(!geofeature) return next(new Error("Geofeature must have a type"))
144
- if(geofeature.type !== BEACON && geofeature.accuracy === LOW_ACCURACY){
144
+ if(geofeature.accuracy === LOW_ACCURACY){
145
145
  hasLowAccuracyFence = true
146
146
  }
147
147
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "10.3.0",
3
+ "version": "10.5.0",
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",
@@ -15,11 +15,6 @@ let AndroidSchema = new mongoose.Schema({
15
15
  trackingOnGpsAccuracyThreshold: {type: Number, required: true},
16
16
  checkoutTimeAccuracy: {type: Number, required: true},
17
17
  checkoutDistanceAccuracy: {type: Number, required: true},
18
- beaconReevaluationDistance: {type: Number, required: true},
19
- beaconActivationCoefficient: {type: Number, required: true},
20
- beaconActivationDistance: {type: Number, required: true},
21
- beaconDiscoveyCycleSecs: {type: Number, required: true, default: 20}, // The typo in `Discovey` is intentional to match the SDK
22
- beaconCooloffCycleSecs: {type: Number, required: true, default: 10},
23
18
  filteringEnabled: {type: Boolean, default: false},
24
19
  applicationLoggingEnabled: {type: Boolean, default: false}, //Local logging on the device
25
20
  useCaseType : {type: String, enum: useCaseTypeEnum, default: "Default"},
@@ -1,6 +1,5 @@
1
1
  let mongoose = require('mongoose')
2
2
  let validators = require('../utils/validators')
3
- let telemetrySchema = require('./Telemetry')
4
3
  let accuracySuppressionSchema = require('./AccuracySuppression')
5
4
  let starvationDetectionSchema = require('./StarvationDetection')
6
5
  let TempoConfigSchema = require('./TempoConfig')
@@ -22,9 +21,6 @@ let IosSchema = new mongoose.Schema({
22
21
  trackingOnGpsAccuracyThreshold : {type: Number, required: true},
23
22
  checkoutTimeAccuracy : {type: Number, required: true},
24
23
  checkoutDistanceAccuracy : {type: Number, required: true},
25
- beaconReevaluationDistance : {type: Number, required: true},
26
- beaconActivationCoefficient : {type: Number, required: true},
27
- beaconActivationDistance : {type: Number, required: true},
28
24
  periodicPollingEnabled : {type: Boolean, default: true},
29
25
  triggeringOnPollingLocationBasicThreshold : {type: Number, required: true},
30
26
  triggeringOnPollingLocationFurtherThreshold : {type: Number, required: true},
@@ -4,7 +4,8 @@ const helpers = require('../helpers')
4
4
  let ProjectHelloSchema = new mongoose.Schema({
5
5
  activeTtl: {type: Number, min: 0, max: 1209600, validate: { validator: Number.isInteger, msg: 'hello.activeTtl should be an integer number' }},
6
6
  finalTtl: {type: Number, min: 0, max: 1209600, validate: { validator: Number.isInteger, msg: 'hello.finalTtl should be an integer number' }},
7
- ssoLinkingCode: {type: String, validate: {validator: helpers.validateSsoLinkingCode, msg: 'SSO linking code must be a 12 character capital alphanumeric text'}}
7
+ ssoLinkingCode: {type: String, validate: {validator: helpers.validateSsoLinkingCode, msg: 'SSO linking code must be a 12 character capital alphanumeric text'}},
8
+ verificationCodeEnabled: { type: Boolean }
8
9
  }, {
9
10
  _id: false
10
11
  })
@@ -1,37 +0,0 @@
1
- let mongoose = require('mongoose')
2
-
3
- let telemetryBlacklistEnum = {
4
- values: [ "location",
5
- "batteryLevel",
6
- "beaconDiscovered",
7
- "beaconDiscoveryStarted",
8
- "beaconLost",
9
- "gpsAccuracyRequested",
10
- "rulesDownloadRequested",
11
- "rulesLoaded",
12
- "zoneCheckedIntoFence",
13
- "zoneCheckedIntoBeacon",
14
- "zoneCheckedOutFromBeacon",
15
- "zoneCheckedOutFromFence",
16
- "sdkStarted",
17
- "sdkStopped",
18
- "noMotion",
19
- "log",
20
- "heading",
21
- "fenceCrossed",
22
- "rulesDownloadBegin",
23
- "rulesDownloadEnd",
24
- "debug"],
25
- message: 'enum validator failed for path `{PATH}` with value `{VALUE}`'
26
- }
27
-
28
- let TelemetrySchema = new mongoose.Schema({
29
- telemetryLoggingEnabled : {type: Boolean, required: true},
30
- telemetryBatchSize : {type: Number, required: true},
31
- telemetryTimeOut: {type: Number, required: true},
32
- telemetryEventsBlacklist : [{type: String, enum: telemetryBlacklistEnum, required: true}]
33
- }, {
34
- _id: false
35
- })
36
-
37
- module.exports = TelemetrySchema