@bluedot-innovation/models 5.0.0 → 5.0.2
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/.gitlab-ci.yml +2 -1
- package/__tests__/action/message/messageAction.spec.js +12 -0
- package/__tests__/beacon/beacon.rules.json +3 -3
- package/__tests__/condition/dayRange/dayRange.spec.js +21 -0
- package/__tests__/condition/percentageCrossed/travelPath.spec.js +11 -1
- package/__tests__/condition/speed/speed.spec.js +20 -1
- package/__tests__/condition/timeActive/timeActive.rules.json +8 -1
- package/__tests__/condition/timeActive/timeActive.spec.js +9 -0
- package/__tests__/condition/travelDirection/travelDirection.spec.js +9 -0
- package/__tests__/geofeature/boundingBox/boundingBox.spec.js +9 -0
- package/__tests__/geofeature/polygon/polygon.spec.js +5 -0
- package/__tests__/geofeature/zoneBeacon/zoneBeacon.spec.js +9 -0
- package/__tests__/monthlyStats/monthlyStats.spec.js +9 -0
- package/__tests__/project/project.remote.config.json +122 -0
- package/__tests__/project/project.spec.js +9 -1
- package/__tests__/ruleRequestAggregation/ruleRequestAggregation.spec.js +9 -0
- package/__tests__/utils/utils.spec.js +3 -1
- package/__tests__/zone/zone.spec.js +6 -0
- package/models/Beacon.js +1 -1
- package/models/MessageAction.js +0 -2
- package/models/MonthlyStats.js +1 -1
- package/models/Project.js +6 -1
- package/models/UrlAction.js +2 -11
- package/models/conditions/DayRange.js +5 -13
- package/models/conditions/TimeActive.js +1 -1
- package/models/conditions/TravelDirection.js +0 -8
- package/package.json +2 -2
- package/schemas/AccuracySuppression.js +14 -0
- package/schemas/AndroidConfig.js +35 -0
- package/schemas/IosConfig.js +38 -0
- package/schemas/StarvationDetection.js +11 -0
- package/schemas/Telemetry.js +36 -0
- package/schemas/Webhook.js +2 -7
- package/utils/validators.js +6 -0
package/.gitlab-ci.yml
CHANGED
|
@@ -3,6 +3,8 @@ let mongoose = require('mongoose')
|
|
|
3
3
|
mongoose.Promise = global.Promise
|
|
4
4
|
|
|
5
5
|
let MessageActionModel = require('../../../Models').MessageAction(mongoose)
|
|
6
|
+
let MessageActionModelBuiltInMongoose = require('../../../Models').MessageAction()
|
|
7
|
+
|
|
6
8
|
let testCase = require('mocha').describe
|
|
7
9
|
let assertions = require('mocha').it
|
|
8
10
|
let chai = require('chai')
|
|
@@ -29,6 +31,16 @@ testCase('MessageAction', () => {
|
|
|
29
31
|
})
|
|
30
32
|
})
|
|
31
33
|
})
|
|
34
|
+
testCase('Valid MessageAction', () => {
|
|
35
|
+
assertions('should validate a valid messageAction ', (done) => {
|
|
36
|
+
let MessageAction = new MessageActionModelBuiltInMongoose(messageAction)
|
|
37
|
+
MessageAction.validate((err, res) => {
|
|
38
|
+
assert.notExists(res)
|
|
39
|
+
assert(err === null, 'err should equals null')
|
|
40
|
+
done()
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
})
|
|
32
44
|
|
|
33
45
|
testCase('Invalid MessageAction', () => {
|
|
34
46
|
assertions('should not validate a messageAction with invalid MessageAction', (done) => {
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
{
|
|
5
5
|
"property": "beaconType",
|
|
6
6
|
"pairings": [
|
|
7
|
-
{"value": "
|
|
8
|
-
{"value": "
|
|
9
|
-
{"value": "
|
|
7
|
+
{"value": "IOS", "requiredFields": ["proximityUUID", "major", "minor"]},
|
|
8
|
+
{"value": "Android", "requiredFields": ["macAddress"]},
|
|
9
|
+
{"value": "Both", "requiredFields": ["proximityUUID", "major", "minor", "macAddress"]}
|
|
10
10
|
]
|
|
11
11
|
}
|
|
12
12
|
]
|
|
@@ -3,6 +3,7 @@ let mongoose = require('mongoose')
|
|
|
3
3
|
mongoose.Promise = global.Promise
|
|
4
4
|
|
|
5
5
|
let DayRangeModel = require('../../../Models').DayRange(mongoose)
|
|
6
|
+
let DayRangeModelBuiltInSchema = require('../../../Models').DayRange()
|
|
6
7
|
let testCase = require('mocha').describe
|
|
7
8
|
let assertions = require('mocha').it
|
|
8
9
|
let chai = require('chai')
|
|
@@ -30,6 +31,16 @@ testCase('DayRangeCondition', () => {
|
|
|
30
31
|
})
|
|
31
32
|
})
|
|
32
33
|
})
|
|
34
|
+
testCase('Valid DayRangeCondition', () => {
|
|
35
|
+
assertions('should validate a valid dayRange', (done) => {
|
|
36
|
+
let DayRangeCondition = new DayRangeModelBuiltInSchema(dayRange)
|
|
37
|
+
DayRangeCondition.validate((err, res) => {
|
|
38
|
+
assert.notExists(res)
|
|
39
|
+
assert(err === null, 'err should equals null')
|
|
40
|
+
done()
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
})
|
|
33
44
|
|
|
34
45
|
testCase('Invalid DayRangeCondition', () => {
|
|
35
46
|
assertions('should not validate a dayRange with invalid DayRangeCondition', (done) => {
|
|
@@ -42,6 +53,16 @@ testCase('DayRangeCondition', () => {
|
|
|
42
53
|
})
|
|
43
54
|
})
|
|
44
55
|
|
|
56
|
+
assertions('should not validate a dayRange with startDate < endDate', (done) => {
|
|
57
|
+
dayRange.endDate = '1990-11-14'
|
|
58
|
+
let DayRangeCondition = new DayRangeModel(dayRange)
|
|
59
|
+
DayRangeCondition.validate((err, res) => {
|
|
60
|
+
assert.exists(err, 'err object should exist')
|
|
61
|
+
assert.isObject(err)
|
|
62
|
+
assert.match(err.message, /startDate.*less than.*endDate/i)
|
|
63
|
+
done()
|
|
64
|
+
})
|
|
65
|
+
})
|
|
45
66
|
assertions('should throw an error if both startDate and endDate are not provided', (done) => {
|
|
46
67
|
delete dayRange.startDate
|
|
47
68
|
delete dayRange.endDate
|
|
@@ -3,6 +3,7 @@ let mongoose = require('mongoose')
|
|
|
3
3
|
mongoose.Promise = global.Promise
|
|
4
4
|
|
|
5
5
|
let TravelPathConditionModel = require('../../../Models').TravelPath(mongoose)
|
|
6
|
+
let TravelPathConditionModelBuiltInMongoose = require('../../../Models').TravelPath()
|
|
6
7
|
let testCase = require('mocha').describe
|
|
7
8
|
let assertions = require('mocha').it
|
|
8
9
|
let chai = require('chai')
|
|
@@ -30,7 +31,16 @@ testCase('PercentageCrossedCondition', () => {
|
|
|
30
31
|
})
|
|
31
32
|
})
|
|
32
33
|
})
|
|
33
|
-
|
|
34
|
+
testCase('Valid PercentageCrossedCondition', () => {
|
|
35
|
+
assertions('should validate a valid travelPath ', (done) => {
|
|
36
|
+
let PercentageCrossedCondition = new TravelPathConditionModelBuiltInMongoose(travelPath)
|
|
37
|
+
PercentageCrossedCondition.validate((err, res) => {
|
|
38
|
+
assert.notExists(res)
|
|
39
|
+
assert(err === null, 'err should equals null')
|
|
40
|
+
done()
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
})
|
|
34
44
|
testCase('Invalid PercentageCrossedCondition', () => {
|
|
35
45
|
assertions('should not validate a travelPath with invalid PercentageCrossedCondition', (done) => {
|
|
36
46
|
delete travelPath[rules.requiredFields[0]]
|
|
@@ -3,6 +3,7 @@ let mongoose = require('mongoose')
|
|
|
3
3
|
mongoose.Promise = global.Promise
|
|
4
4
|
|
|
5
5
|
let SpeedConditionModel = require('../../../Models').Speed(mongoose)
|
|
6
|
+
let SpeedConditionModelBuiltInMongoose = require('../../../Models').Speed()
|
|
6
7
|
let testCase = require('mocha').describe
|
|
7
8
|
let assertions = require('mocha').it
|
|
8
9
|
let chai = require('chai')
|
|
@@ -29,6 +30,14 @@ testCase('SpeedCondition', () => {
|
|
|
29
30
|
done()
|
|
30
31
|
})
|
|
31
32
|
})
|
|
33
|
+
assertions('should validate a valid speedCondition ', (done) => {
|
|
34
|
+
let SpeedCondition = new SpeedConditionModelBuiltInMongoose(speedCondition)
|
|
35
|
+
SpeedCondition.validate((err, res) => {
|
|
36
|
+
assert.notExists(res)
|
|
37
|
+
assert(err === null, 'err should equals null')
|
|
38
|
+
done()
|
|
39
|
+
})
|
|
40
|
+
})
|
|
32
41
|
})
|
|
33
42
|
|
|
34
43
|
testCase('Invalid SpeedCondition', () => {
|
|
@@ -41,7 +50,7 @@ testCase('SpeedCondition', () => {
|
|
|
41
50
|
done()
|
|
42
51
|
})
|
|
43
52
|
})
|
|
44
|
-
assertions('should throw an error when maxSpeed is less than 5
|
|
53
|
+
assertions('should throw an error when maxSpeed is less than 5 greater than minSpeed', (done) => {
|
|
45
54
|
speedCondition.minimumSpeed = 10
|
|
46
55
|
speedCondition.maximumSpeed = 11
|
|
47
56
|
let SpeedCondition = new SpeedConditionModel(speedCondition)
|
|
@@ -52,6 +61,16 @@ testCase('SpeedCondition', () => {
|
|
|
52
61
|
done()
|
|
53
62
|
})
|
|
54
63
|
})
|
|
64
|
+
assertions('should throw an error when maxSpeed is less than 5 m/s', (done) => {
|
|
65
|
+
speedCondition.maximumSpeed = 4
|
|
66
|
+
let SpeedCondition = new SpeedConditionModel(speedCondition)
|
|
67
|
+
SpeedCondition.validate((err, res) => {
|
|
68
|
+
assert.exists(err, 'err object should exist')
|
|
69
|
+
assert.isObject(err)
|
|
70
|
+
assert.nestedProperty(err, `errors.maximumSpeed`, 'error should have a maximumSpeed property')
|
|
71
|
+
done()
|
|
72
|
+
})
|
|
73
|
+
})
|
|
55
74
|
testCase('check each required property of the model and validate that it is present', () => {
|
|
56
75
|
let requiredFields = rules.requiredFields
|
|
57
76
|
requiredFields.map((i) => {
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
"requiredFields":["fromTime", "toTime"],
|
|
3
3
|
"customValidators":[
|
|
4
4
|
{"name": "fromTime", "invalidInput": [6800, "24:00:00", "invalid-input"]},
|
|
5
|
-
{"name": "toTime", "invalidInput": [6800, "24:00:00", "invalid-input"]}
|
|
5
|
+
{"name": "toTime", "invalidInput": [6800, "24:00:00", "invalid-input"]},
|
|
6
|
+
{"name": "fromTime", "invalidInput": [6800, "0:00:01", "invalid-input"]},
|
|
7
|
+
{"name": "toTime", "invalidInput": [6800, "00:0:01", "invalid-input"]},
|
|
8
|
+
{"name": "toTime", "invalidInput": [6800, "00:00:1", "invalid-input"]},
|
|
9
|
+
{"name": "toTime", "invalidInput": [6800, "00:60:60", "invalid-input"]},
|
|
10
|
+
{"name": "toTime", "invalidInput": [6800, "00:590:00", "invalid-input"]},
|
|
11
|
+
{"name": "toTime", "invalidInput": [6800, "00:59:100", "invalid-input"]},
|
|
12
|
+
{"name": "toTime", "invalidInput": [6800, "000:000:060", "invalid-input"]}
|
|
6
13
|
]
|
|
7
14
|
}
|
|
@@ -3,6 +3,7 @@ let mongoose = require('mongoose')
|
|
|
3
3
|
mongoose.Promise = global.Promise
|
|
4
4
|
|
|
5
5
|
let TimeActiveConditionModel = require('../../../Models').TimeActive(mongoose)
|
|
6
|
+
let TimeActiveConditionModelBuiltInMongoose = require('../../../Models').TimeActive()
|
|
6
7
|
let testCase = require('mocha').describe
|
|
7
8
|
let assertions = require('mocha').it
|
|
8
9
|
let chai = require('chai')
|
|
@@ -28,6 +29,14 @@ testCase('TimeOfDayRangeCondition', () => {
|
|
|
28
29
|
done()
|
|
29
30
|
})
|
|
30
31
|
})
|
|
32
|
+
assertions('should validate a valid timeActiveCondition ', (done) => {
|
|
33
|
+
let TimeOfDayRangeCondition = new TimeActiveConditionModelBuiltInMongoose(timeActiveCondition)
|
|
34
|
+
TimeOfDayRangeCondition.validate((err, res) => {
|
|
35
|
+
assert.notExists(res)
|
|
36
|
+
assert(err === null, 'err should equals null')
|
|
37
|
+
done()
|
|
38
|
+
})
|
|
39
|
+
})
|
|
31
40
|
})
|
|
32
41
|
|
|
33
42
|
testCase('Invalid TimeOfDayRangeCondition', () => {
|
|
@@ -2,6 +2,7 @@ let mongoose = require('mongoose')
|
|
|
2
2
|
mongoose.Promise = global.Promise
|
|
3
3
|
|
|
4
4
|
const TravelDirectionModel = require('../../../Models').TravelDirection(mongoose)
|
|
5
|
+
const TravelDirectionModelBuiltInMongoose = require('../../../Models').TravelDirection()
|
|
5
6
|
const { isMinimumNinetyApart } = require.main.require('models/conditions/TravelDirection')
|
|
6
7
|
const describe = require('mocha').describe
|
|
7
8
|
const it = require('mocha').it
|
|
@@ -27,6 +28,14 @@ describe('TravelDirection', () => {
|
|
|
27
28
|
done()
|
|
28
29
|
})
|
|
29
30
|
})
|
|
31
|
+
it('should validate a valid travelDirectionCondition ', (done) => {
|
|
32
|
+
let TravelDirection = new TravelDirectionModelBuiltInMongoose(travelDirectionCondition)
|
|
33
|
+
TravelDirection.validate((err, res) => {
|
|
34
|
+
assert.notExists(res)
|
|
35
|
+
assert(err === null, 'err should equals null')
|
|
36
|
+
done()
|
|
37
|
+
})
|
|
38
|
+
})
|
|
30
39
|
})
|
|
31
40
|
|
|
32
41
|
describe('Invalid TravelDirection', () => {
|
|
@@ -3,6 +3,7 @@ let mongoose = require('mongoose')
|
|
|
3
3
|
mongoose.Promise = global.Promise
|
|
4
4
|
|
|
5
5
|
let BoundingBoxModel = require('../../../Models').BoundingBox(mongoose)
|
|
6
|
+
let BoundingBoxModelBuiltInMongoose = require('../../../Models').BoundingBox()
|
|
6
7
|
let describe = require('mocha').describe
|
|
7
8
|
let it = require('mocha').it
|
|
8
9
|
let chai = require('chai')
|
|
@@ -29,6 +30,14 @@ describe('BoundingBox', () => {
|
|
|
29
30
|
done()
|
|
30
31
|
})
|
|
31
32
|
})
|
|
33
|
+
it('should validate a valid boundingBox ', (done) => {
|
|
34
|
+
let BoundingBox = new BoundingBoxModelBuiltInMongoose(boundingBox)
|
|
35
|
+
BoundingBox.validate((err, res) => {
|
|
36
|
+
assert.notExists(res)
|
|
37
|
+
assert(err === null, 'err should equals null')
|
|
38
|
+
done()
|
|
39
|
+
})
|
|
40
|
+
})
|
|
32
41
|
})
|
|
33
42
|
|
|
34
43
|
describe('Invalid BoundingBox', () => {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
mongoose.Promise = global.Promise
|
|
1
3
|
let PolygonModel = require('../../../Models').Polygon(mongoose)
|
|
2
4
|
let PolygonModelBuiltInMongoose = require('../../../Models').Polygon()
|
|
3
5
|
const { VERTICES_TOO_CLOSE, CANT_HAVE_THREE_OR_MORE_VERTICES } = require('../../../constants/errorMessages')
|
|
4
6
|
let rules = require('./polygon.rules.json')
|
|
7
|
+
let chai = require('chai')
|
|
8
|
+
let assert = chai.assert
|
|
9
|
+
|
|
5
10
|
|
|
6
11
|
let polygon
|
|
7
12
|
|
|
@@ -3,6 +3,7 @@ let mongoose = require('mongoose')
|
|
|
3
3
|
mongoose.Promise = global.Promise
|
|
4
4
|
|
|
5
5
|
let ZoneBeaconModel = require('../../../Models').ZoneBeacon(mongoose)
|
|
6
|
+
let ZoneBeaconModelBuiltInMongoose = require('../../../Models').ZoneBeacon()
|
|
6
7
|
let describe = require('mocha').describe
|
|
7
8
|
let it = require('mocha').it
|
|
8
9
|
let chai = require('chai')
|
|
@@ -29,6 +30,14 @@ describe('ZoneBeacon', () => {
|
|
|
29
30
|
done()
|
|
30
31
|
})
|
|
31
32
|
})
|
|
33
|
+
it('should validate a valid zoneBeacon ', (done) => {
|
|
34
|
+
const ZoneBeacon = new ZoneBeaconModelBuiltInMongoose(zoneBeacon)
|
|
35
|
+
ZoneBeacon.validate((err, res) => {
|
|
36
|
+
assert.notExists(res)
|
|
37
|
+
assert(err === null, 'err should equals null')
|
|
38
|
+
done()
|
|
39
|
+
})
|
|
40
|
+
})
|
|
32
41
|
})
|
|
33
42
|
|
|
34
43
|
describe('Invalid ZoneBeacon', () => {
|
|
@@ -3,6 +3,7 @@ let mongoose = require('mongoose')
|
|
|
3
3
|
mongoose.Promise = global.Promise
|
|
4
4
|
|
|
5
5
|
let MonthlyStatsModel = require('../../Models').MonthlyStat(mongoose)
|
|
6
|
+
let MonthlyStatsModelBuiltInMongoose = require('../../Models').MonthlyStat()
|
|
6
7
|
let describe = require('mocha').describe
|
|
7
8
|
let it = require('mocha').it
|
|
8
9
|
let chai = require('chai')
|
|
@@ -27,6 +28,14 @@ describe('MonthlyStat', () => {
|
|
|
27
28
|
done()
|
|
28
29
|
})
|
|
29
30
|
})
|
|
31
|
+
it('should validate a valid MonthlyStat document ', (done) => {
|
|
32
|
+
let MonthlyStats = new MonthlyStatsModelBuiltInMongoose(monthlyStats)
|
|
33
|
+
MonthlyStats.validate((err, res) => {
|
|
34
|
+
assert.notExists(res)
|
|
35
|
+
assert(err === null, 'err should equals null')
|
|
36
|
+
done()
|
|
37
|
+
})
|
|
38
|
+
})
|
|
30
39
|
it('should not accept a invalid customerId', (done) => {
|
|
31
40
|
monthlyStats.customerId = 'invalid-customerId'
|
|
32
41
|
let MonthlyStats = new MonthlyStatsModel(monthlyStats)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
{
|
|
2
|
+
"state": "ACTIVE",
|
|
3
|
+
"nextRuleUpdateInterval": 3600,
|
|
4
|
+
"lastUpdateTime": "2018-02-14T04:12:02.103Z",
|
|
5
|
+
"creationTime": "2018-02-14T04:12:02.103Z",
|
|
6
|
+
"name": "A New Project",
|
|
7
|
+
"accountId":"b0824b76-ce73-4fcf-81f8-1b63edb1114e",
|
|
8
|
+
"webhooks": {
|
|
9
|
+
"type": "trigger",
|
|
10
|
+
"url": "https://webhooklistener.bluedotinnovation.com",
|
|
11
|
+
"enabled": true,
|
|
12
|
+
"headers" : {
|
|
13
|
+
"securityToken" : "value"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"firebaseApiKey": "88888888-4444-4444-4444-121212121212",
|
|
17
|
+
"apiKey": "88888888-4444-4444-4444-123412341234",
|
|
18
|
+
"configurationParameters": {
|
|
19
|
+
"androidConfig": {
|
|
20
|
+
"triggeringOnWifiAccuracyThreshold": 100.0,
|
|
21
|
+
"triggeringOnGpsAccuracyThreshold": 20.0,
|
|
22
|
+
"trackingOnGpsAccuracyThreshold": 200.0,
|
|
23
|
+
"checkoutTimeAccuracy": 60.0,
|
|
24
|
+
"checkoutDistanceAccuracy": 50.0,
|
|
25
|
+
"beaconReevaluationDistance": 25.0,
|
|
26
|
+
"beaconActivationCoefficient": 0.5,
|
|
27
|
+
"beaconActivationDistance": 30.0,
|
|
28
|
+
"endpointUrl": "https://www.pointapi.bluedot.com.au/pointapi-v1/",
|
|
29
|
+
"filteringEnabled": false,
|
|
30
|
+
"applicationLoggingEnabled": false,
|
|
31
|
+
"telemetry" : {
|
|
32
|
+
"telemetryLoggingEnabled" : false,
|
|
33
|
+
"telemetryBatchSize" : 25,
|
|
34
|
+
"telemetryTimeOut": 30.0,
|
|
35
|
+
"telemetryEventsBlacklist" : [
|
|
36
|
+
"location",
|
|
37
|
+
"batteryLevel",
|
|
38
|
+
"beaconDiscovered",
|
|
39
|
+
"beaconDiscoveryStarted",
|
|
40
|
+
"beaconLost",
|
|
41
|
+
"gpsAccuracyRequested",
|
|
42
|
+
"rulesDownloadRequested",
|
|
43
|
+
"rulesLoaded",
|
|
44
|
+
"zoneCheckedIntoFence",
|
|
45
|
+
"zoneCheckedIntoBeacon",
|
|
46
|
+
"zoneCheckedOutFromBeacon",
|
|
47
|
+
"zoneCheckedOutFromFence",
|
|
48
|
+
"sdkStarted",
|
|
49
|
+
"sdkStopped",
|
|
50
|
+
"noMotion",
|
|
51
|
+
"log",
|
|
52
|
+
"heading",
|
|
53
|
+
"fenceCrossed",
|
|
54
|
+
"rulesDownloadBegin",
|
|
55
|
+
"rulesDownloadEnd" ]
|
|
56
|
+
},
|
|
57
|
+
"useCaseType" : "Retail",
|
|
58
|
+
"maximumPageSize": 256,
|
|
59
|
+
"triggerEngine": "BD"
|
|
60
|
+
},
|
|
61
|
+
"iosConfig": {
|
|
62
|
+
"triggeringOnWifiAccuracyThreshold" : 70.0,
|
|
63
|
+
"triggeringOnGpsAccuracyThreshold" : 30.0,
|
|
64
|
+
"trackingOnGpsAccuracyThreshold" : 400.0,
|
|
65
|
+
"checkoutTimeAccuracy" : 60.0,
|
|
66
|
+
"checkoutDistanceAccuracy" : 50.0,
|
|
67
|
+
"beaconReevaluationDistance" : 10.0,
|
|
68
|
+
"beaconActivationCoefficient" : 0.5,
|
|
69
|
+
"beaconActivationDistance" : 30.0,
|
|
70
|
+
"periodicPollingEnabled" : true,
|
|
71
|
+
"triggeringOnPollingLocationBasicThreshold" : 1000.0,
|
|
72
|
+
"triggeringOnPollingLocationFurtherThreshold" : 3000.0,
|
|
73
|
+
"triggeringOnPollingLocationFarthestThreshold" : 5000.0,
|
|
74
|
+
"focalDistanceAccuracyCoefficient" : 0.9,
|
|
75
|
+
"accelerometerEnablementThreshold" : 1000.0,
|
|
76
|
+
"endpointUrl" : "https://www.pointapi.bluedot.com.au/pointapi-v1/",
|
|
77
|
+
"filteringEnabled" : false,
|
|
78
|
+
"applicationLoggingEnabled" : false,
|
|
79
|
+
"useCaseType" : "Retail",
|
|
80
|
+
"accuracySuppression" : {
|
|
81
|
+
"accuracySuppressionEnabled" : false,
|
|
82
|
+
"accuracySuppressionMaxAccuracy" : 5.0,
|
|
83
|
+
"accuracySuppressionMaxAccuracyTimeInterval": 30.0,
|
|
84
|
+
"accuracySuppressionMinAccuracy" : 3000.0,
|
|
85
|
+
"accuracySuppressionMinAccuracyTimeInterval" : 60.0,
|
|
86
|
+
"accuracySuppressionGracePeriod" : 600.0
|
|
87
|
+
},
|
|
88
|
+
"starvationDetector" : {
|
|
89
|
+
"starvationDetectorEnabled" : false,
|
|
90
|
+
"starvationDetectorSecsAllowedPerMetre" : 0.0225,
|
|
91
|
+
"starvationDetectorMinAllowedStarvationTimeInterval" : 30.0
|
|
92
|
+
},
|
|
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
|
+
"maximumPageSize": 256,
|
|
119
|
+
"triggerEngine": "BD"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -28,6 +28,14 @@ testCase('Project', () => {
|
|
|
28
28
|
done()
|
|
29
29
|
})
|
|
30
30
|
})
|
|
31
|
+
assertions('should validate a valid project with android config', (done) => {
|
|
32
|
+
let project = JSON.parse(JSON.stringify(require('./project.remote.config.json')))
|
|
33
|
+
let Project = new ProjectModel(project)
|
|
34
|
+
Project.validate((err, res) => {
|
|
35
|
+
assert.notExists(err)
|
|
36
|
+
done()
|
|
37
|
+
})
|
|
38
|
+
})
|
|
31
39
|
})
|
|
32
40
|
testCase('Valid Project ', () => {
|
|
33
41
|
assertions('should validate a valid project ', (done) => {
|
|
@@ -89,4 +97,4 @@ testCase('Project', () => {
|
|
|
89
97
|
})
|
|
90
98
|
})
|
|
91
99
|
})
|
|
92
|
-
})
|
|
100
|
+
})
|
|
@@ -3,6 +3,7 @@ let mongoose = require('mongoose')
|
|
|
3
3
|
mongoose.Promise = global.Promise
|
|
4
4
|
|
|
5
5
|
let RuleRequestAggregationModel = require('../../Models').RuleRequestAggregation(mongoose)
|
|
6
|
+
let RuleRequestAggregationModelBuiltInMongoose = require('../../Models').RuleRequestAggregation()
|
|
6
7
|
let testCase = require('mocha').describe
|
|
7
8
|
let assertions = require('mocha').it
|
|
8
9
|
let chai = require('chai')
|
|
@@ -27,6 +28,14 @@ testCase('RuleRequestAggregation', () => {
|
|
|
27
28
|
done()
|
|
28
29
|
})
|
|
29
30
|
})
|
|
31
|
+
assertions('should validate a valid RuleRequestAggregation document ', (done) => {
|
|
32
|
+
let RuleRequestAggregation = new RuleRequestAggregationModelBuiltInMongoose(ruleRequestAggregation)
|
|
33
|
+
RuleRequestAggregation.validate((err, res) => {
|
|
34
|
+
assert.notExists(res)
|
|
35
|
+
assert(err === null, 'err should equals null')
|
|
36
|
+
done()
|
|
37
|
+
})
|
|
38
|
+
})
|
|
30
39
|
assertions('should not accept a invalid customerId', (done) => {
|
|
31
40
|
ruleRequestAggregation.customerId = 'invalid-customerId'
|
|
32
41
|
let RuleRequestAggregation = new RuleRequestAggregationModel(ruleRequestAggregation)
|
package/models/Beacon.js
CHANGED
package/models/MessageAction.js
CHANGED
package/models/MonthlyStats.js
CHANGED
|
@@ -34,7 +34,7 @@ let model = (mongooseInstance) => {
|
|
|
34
34
|
if (mongooseInstance) {
|
|
35
35
|
MonthlyStats = mongooseInstance.model('MonthlyStat', MonthlyStatsSchema)
|
|
36
36
|
} else {
|
|
37
|
-
MonthlyStats = mongoose.model('MonthlyStat',
|
|
37
|
+
MonthlyStats = mongoose.model('MonthlyStat', MonthlyStatsSchema)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
return MonthlyStats
|
package/models/Project.js
CHANGED
|
@@ -12,6 +12,8 @@ let patcher = require('mongoose-json-patch')
|
|
|
12
12
|
let helpers = require('../helpers')
|
|
13
13
|
|
|
14
14
|
let WebhookSchema = require('../schemas/Webhook')
|
|
15
|
+
let iosConfig = require('../schemas/IosConfig')
|
|
16
|
+
let androidConfig = require('../schemas/AndroidConfig')
|
|
15
17
|
|
|
16
18
|
let ProjectSchema = new mongoose.Schema({
|
|
17
19
|
_id: {type: String, default: uuidv4},
|
|
@@ -31,7 +33,10 @@ let ProjectSchema = new mongoose.Schema({
|
|
|
31
33
|
name: {type: String, required: [true, 'name is required']},
|
|
32
34
|
accountId: {type: String, required: true, validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'default error message'}},
|
|
33
35
|
webhooks: [WebhookSchema],
|
|
34
|
-
configurationParameters: {
|
|
36
|
+
configurationParameters: {
|
|
37
|
+
iosConfig: iosConfig, // when we want to enable this {type: iosConfig, required: true}
|
|
38
|
+
androidConfig: androidConfig, // when we want to enable this {type: androidConfig, required: true}
|
|
39
|
+
}, // http://collab.bluedot.io/display/PD/Remote+configuration => https://bluedotinnovation.atlassian.net/wiki/spaces/ENG/pages/223150126/Remote+Config+details
|
|
35
40
|
firebaseApiKey: {type: String},
|
|
36
41
|
apiKey: {type: String}
|
|
37
42
|
},
|
package/models/UrlAction.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
let mongoose = require('mongoose')
|
|
2
|
-
let
|
|
3
|
-
let uuidv4 = require('uuid/v4')
|
|
2
|
+
let validators = require('../utils/validators')
|
|
4
3
|
|
|
5
4
|
let schema = {
|
|
6
5
|
url: {
|
|
@@ -8,7 +7,7 @@ let schema = {
|
|
|
8
7
|
required: [true, 'url is required. '],
|
|
9
8
|
validate: {
|
|
10
9
|
isAsync: true,
|
|
11
|
-
validator:
|
|
10
|
+
validator: validators.validateUrl
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
}
|
|
@@ -22,14 +21,6 @@ URLActionSchema.add({
|
|
|
22
21
|
type: {type: String, required: true}
|
|
23
22
|
})
|
|
24
23
|
|
|
25
|
-
function validateURL (url, magicCallback) {
|
|
26
|
-
let urlRegex = new RegExp('^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?')
|
|
27
|
-
if (!urlRegex.test(url)) {
|
|
28
|
-
return magicCallback(false, `${url} is not a valid URL`)
|
|
29
|
-
}
|
|
30
|
-
magicCallback(true)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
24
|
// optional mongoose
|
|
34
25
|
const model = (mongooseInstance) => {
|
|
35
26
|
let Urlaction
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
let mongoose = require('mongoose')
|
|
2
|
-
let uuidv4 = require('uuid/v4')
|
|
3
2
|
|
|
4
3
|
let schema = {
|
|
5
4
|
startDate: {type: Date},
|
|
@@ -19,21 +18,14 @@ function validateDateRange (type, callback) {
|
|
|
19
18
|
let startDate = this.startDate;
|
|
20
19
|
let endDate = this.endDate;
|
|
21
20
|
|
|
22
|
-
if (!startDate && !endDate)
|
|
23
|
-
return callback(false, `Must have a startDate, endDate, or both.`)
|
|
24
|
-
}
|
|
21
|
+
if (!startDate && !endDate) return callback(false, `Must have a startDate, endDate, or both.`)
|
|
25
22
|
|
|
26
|
-
if (this.startDate)
|
|
27
|
-
startDate = new Date(this.startDate)
|
|
28
|
-
}
|
|
23
|
+
if (!startDate) startDate = new Date(this.startDate)
|
|
29
24
|
|
|
30
|
-
if (endDate)
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
if (!endDate) endDate = new Date(endDate)
|
|
26
|
+
|
|
27
|
+
if (startDate && endDate && endDate < startDate) return callback(false, `startDate has to be less than endDate.`)
|
|
33
28
|
|
|
34
|
-
if (startDate && endDate && endDate < startDate) {
|
|
35
|
-
return callback(false, `startDate has to be less than endDate.`)
|
|
36
|
-
}
|
|
37
29
|
callback(true)
|
|
38
30
|
}
|
|
39
31
|
|
|
@@ -24,7 +24,7 @@ function validateTime (toTime, magicCallback) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function validateTimeHHmmssFormat(time, magicCallback) {
|
|
27
|
-
const expression = `^(2[0-3]|[
|
|
27
|
+
const expression = `^(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])$`
|
|
28
28
|
const regex = new RegExp(expression, 'i')
|
|
29
29
|
|
|
30
30
|
if(!regex.test(time)){
|
|
@@ -19,14 +19,6 @@ TravelDirectionConditionSchema.add({
|
|
|
19
19
|
function validateAngles (toAngle, callback) {
|
|
20
20
|
let fromAngle = this.fromAngle
|
|
21
21
|
|
|
22
|
-
if (toAngle === undefined) {
|
|
23
|
-
return callback(false, 'toAngle is required')
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (fromAngle === undefined) {
|
|
27
|
-
return callback(false, 'fromAngle is required')
|
|
28
|
-
}
|
|
29
|
-
|
|
30
22
|
if (!isMinimumNinetyApart(fromAngle, toAngle)) {
|
|
31
23
|
return callback(false, 'From Angle and To Angle must be separated by at least 90 degrees in either direction')
|
|
32
24
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluedot-innovation/models",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
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",
|
|
7
7
|
"test": "mocha --require __tests__/setup __tests__/**/*.spec.js __tests__/**/**/*.spec.js",
|
|
8
8
|
"test:coverage": "nyc mocha --require __tests__/setup __tests__/**/*.spec.js __tests__/**/**/*.spec.js",
|
|
9
|
-
"test:coverage-check": "nyc check-coverage --lines 90 --functions 90 --branches
|
|
9
|
+
"test:coverage-check": "nyc check-coverage --lines 90 --functions 90 --branches 80",
|
|
10
10
|
"test:ci": "npm run lint && npm run test:coverage-check && npm test"
|
|
11
11
|
},
|
|
12
12
|
"license": "UNLICENSED",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
|
|
3
|
+
let AccuracySuppressionSchema = new mongoose.Schema({
|
|
4
|
+
accuracySuppressionEnabled : {type: Boolean, required: true},
|
|
5
|
+
accuracySuppressionMaxAccuracy : {type: Number, required: true},
|
|
6
|
+
accuracySuppressionMaxAccuracyTimeInterval: {type: Number, required: true},
|
|
7
|
+
accuracySuppressionMinAccuracy : {type: Number, required: true},
|
|
8
|
+
accuracySuppressionMinAccuracyTimeInterval : {type: Number, required: true},
|
|
9
|
+
accuracySuppressionGracePeriod : {type: Number, required: true}
|
|
10
|
+
}, {
|
|
11
|
+
_id: false
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
module.exports = AccuracySuppressionSchema
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
let validators = require('../utils/validators')
|
|
3
|
+
let telemetrySchema = require('./Telemetry')
|
|
4
|
+
|
|
5
|
+
let useCaseTypeEnum = {
|
|
6
|
+
values: ['Default', 'Retail', 'Automotive'],
|
|
7
|
+
message: 'enum validator failed for path `{PATH}` with value `{VALUE}`'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let triggerEngineEnum = {
|
|
11
|
+
values: ['BD', 'Hybrid', 'Native'],
|
|
12
|
+
message: 'enum validator failed for path `{PATH}` with value `{VALUE}`'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let AndroidSchema = new mongoose.Schema({
|
|
16
|
+
triggeringOnWifiAccuracyThreshold: {type: Number, required: true},
|
|
17
|
+
triggeringOnGpsAccuracyThreshold: {type: Number, required: true},
|
|
18
|
+
trackingOnGpsAccuracyThreshold: {type: Number, required: true},
|
|
19
|
+
checkoutTimeAccuracy: {type: Number, required: true},
|
|
20
|
+
checkoutDistanceAccuracy: {type: Number, required: true},
|
|
21
|
+
beaconReevaluationDistance: {type: Number, required: true},
|
|
22
|
+
beaconActivationCoefficient: {type: Number, required: true},
|
|
23
|
+
beaconActivationDistance: {type: Number, required: true},
|
|
24
|
+
endpointUrl: {type: String, required: true, validate: {validator: validators.validateUrl, msg: 'endpoint Url is required'}},
|
|
25
|
+
filteringEnabled: {type: Boolean, required: true},
|
|
26
|
+
applicationLoggingEnabled: {type: Boolean, required: true}, //Local logging on the device
|
|
27
|
+
telemetry : telemetrySchema,
|
|
28
|
+
useCaseType : {type: String, enum: useCaseTypeEnum, required: true},
|
|
29
|
+
maximumPageSize: {type: Number, required: true, max: 256},
|
|
30
|
+
triggerEngine: {type: String, enum: triggerEngineEnum, required: true}
|
|
31
|
+
}, {
|
|
32
|
+
_id: false
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
module.exports = AndroidSchema
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
let validators = require('../utils/validators')
|
|
3
|
+
let telemetrySchema = require('./Telemetry')
|
|
4
|
+
let accuracySuppressionSchema = require('./AccuracySuppression')
|
|
5
|
+
let starvationDetectionSchema = require('./StarvationDetection')
|
|
6
|
+
|
|
7
|
+
let useCaseTypeEnum = {
|
|
8
|
+
values: ['Default', 'Retail', 'Automotive'],
|
|
9
|
+
message: 'enum validator failed for path `{PATH}` with value `{VALUE}`'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let IosSchema = new mongoose.Schema({
|
|
13
|
+
triggeringOnWifiAccuracyThreshold : {type: Number, required: true},
|
|
14
|
+
triggeringOnGpsAccuracyThreshold : {type: Number, required: true},
|
|
15
|
+
trackingOnGpsAccuracyThreshold : {type: Number, required: true},
|
|
16
|
+
checkoutTimeAccuracy : {type: Number, required: true},
|
|
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
|
+
periodicPollingEnabled : {type: Boolean, required: true},
|
|
22
|
+
triggeringOnPollingLocationBasicThreshold : {type: Number, required: true},
|
|
23
|
+
triggeringOnPollingLocationFurtherThreshold : {type: Number, required: true},
|
|
24
|
+
triggeringOnPollingLocationFarthestThreshold : {type: Number, required: true},
|
|
25
|
+
focalDistanceAccuracyCoefficient : {type: Number, required: true},
|
|
26
|
+
accelerometerEnablementThreshold : {type: Number, required: true},
|
|
27
|
+
endpointUrl : {type: String, required: true, validate: {validator: validators.validateUrl, msg: 'endpoint Url is required'}},
|
|
28
|
+
filteringEnabled : {type: Boolean, required: true},
|
|
29
|
+
applicationLoggingEnabled : {type: Boolean, required: true},
|
|
30
|
+
useCaseType : {type: String, enum: useCaseTypeEnum, required: true},
|
|
31
|
+
telemetry: telemetrySchema,
|
|
32
|
+
accuracySuppression: accuracySuppressionSchema,
|
|
33
|
+
starvationDetector: starvationDetectionSchema
|
|
34
|
+
}, {
|
|
35
|
+
_id: false
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
module.exports = IosSchema
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
let mongoose = require('mongoose')
|
|
2
|
+
|
|
3
|
+
let StarvationDetectionSchema = new mongoose.Schema({
|
|
4
|
+
starvationDetectorEnabled : {type: Boolean, required: true},
|
|
5
|
+
starvationDetectorSecsAllowedPerMetre : {type: Number, required: true},
|
|
6
|
+
starvationDetectorMinAllowedStarvationTimeInterval : {type: Number, required: true}
|
|
7
|
+
}, {
|
|
8
|
+
_id: false
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
module.exports = StarvationDetectionSchema
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
message: 'enum validator failed for path `{PATH}` with value `{VALUE}`'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let TelemetrySchema = new mongoose.Schema({
|
|
28
|
+
telemetryLoggingEnabled : {type: Boolean, required: true},
|
|
29
|
+
telemetryBatchSize : {type: Number, required: true},
|
|
30
|
+
telemetryTimeOut: {type: Number, required: true},
|
|
31
|
+
telemetryEventsBlacklist : [{type: String, enum: telemetryBlacklistEnum, required: true}]
|
|
32
|
+
}, {
|
|
33
|
+
_id: false
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
module.exports = TelemetrySchema
|
package/schemas/Webhook.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
let mongoose = require('mongoose')
|
|
2
|
+
let validators = require('../utils/validators')
|
|
2
3
|
|
|
3
4
|
let typeEnum = {
|
|
4
5
|
values: ['trigger', 'configurationChanged'],
|
|
@@ -7,18 +8,12 @@ let typeEnum = {
|
|
|
7
8
|
|
|
8
9
|
let WebhookSchema = new mongoose.Schema({
|
|
9
10
|
type: {type: String, enum: typeEnum, required: [true, 'webhook type is required']}, // configurationChanged, trigger
|
|
10
|
-
url: {type: String, required: [true, 'URL is required'], validate: {isAsync: false, validator: validateUrl, msg: 'Please enter a valid URL'}},
|
|
11
|
+
url: {type: String, required: [true, 'URL is required'], validate: {isAsync: false, validator: validators.validateUrl, msg: 'Please enter a valid URL'}},
|
|
11
12
|
headers: {type: mongoose.Schema.Types.Mixed, validate: { isAsync: false, validator: validateHeaderlength, msg: 'Header object can only have 1 key <-> value pair' }}
|
|
12
13
|
}, {
|
|
13
14
|
_id: false
|
|
14
15
|
})
|
|
15
16
|
|
|
16
|
-
function validateUrl (url) {
|
|
17
|
-
const expression = 'https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,4}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)'
|
|
18
|
-
const regex = new RegExp(expression, 'i')
|
|
19
|
-
return regex.test(url)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
17
|
// https://bluedotinnovation.atlassian.net/browse/BP-1500 -- Limiting headers to 1
|
|
23
18
|
function validateHeaderlength (headers) {
|
|
24
19
|
return Object.keys(headers).length <= 1
|