@bluedot-innovation/models 6.2.3 → 6.2.5
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 +8 -0
- package/__tests__/project/project.remote.config.json +1 -2
- package/__tests__/project/project.spec.js +10 -0
- package/package.json +1 -1
- package/schemas/AndroidConfig.js +4 -1
- package/schemas/Heartbeat.js +9 -0
- package/schemas/IosConfig.js +4 -7
- package/schemas/ProjectTempo.js +10 -1
- package/yarn.lock +2796 -0
package/CHANGELOG.md
CHANGED
|
@@ -271,6 +271,16 @@ testCase('Project', () => {
|
|
|
271
271
|
helpers.testNullValue(project, ProjectModel, done)
|
|
272
272
|
})
|
|
273
273
|
|
|
274
|
+
it('should not validate if tempo.isochroneBracketInterval contains items other than integer', (done) => {
|
|
275
|
+
project.tempo.isochroneBracketInterval = [900, 600, 1.5, 120]
|
|
276
|
+
let Project = new ProjectModel(project)
|
|
277
|
+
Project.validate((err, res) => {
|
|
278
|
+
assert.exists(err)
|
|
279
|
+
assert.match(err.message, /tempo.isochroneBracketInterval should contain integer numbers only/)
|
|
280
|
+
done()
|
|
281
|
+
})
|
|
282
|
+
})
|
|
283
|
+
|
|
274
284
|
describe('should throw an error when any of the values of the array contains a falsy value', () => {
|
|
275
285
|
let arrayTypeFields = rules.arrayTypeFields
|
|
276
286
|
|
package/package.json
CHANGED
package/schemas/AndroidConfig.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
let mongoose = require('mongoose')
|
|
2
2
|
let TempoConfigSchema = require('./TempoConfig')
|
|
3
|
+
let heartbeatSchema = require('./Heartbeat')
|
|
3
4
|
|
|
4
5
|
let useCaseTypeEnum = {
|
|
5
6
|
values: ['Default', 'Retail', 'Automotive'],
|
|
@@ -24,7 +25,9 @@ let AndroidSchema = new mongoose.Schema({
|
|
|
24
25
|
useCaseType : {type: String, enum: useCaseTypeEnum, default: "Default"},
|
|
25
26
|
maximumPageSize: {type: Number},
|
|
26
27
|
enableAlarmClock: {type: Boolean, default: false},
|
|
27
|
-
tempo: TempoConfigSchema
|
|
28
|
+
tempo: TempoConfigSchema,
|
|
29
|
+
heartbeat: heartbeatSchema,
|
|
30
|
+
remoteConfigUpdateInterval: {type: Number, default: 86400}
|
|
28
31
|
}, {
|
|
29
32
|
_id: false
|
|
30
33
|
})
|
package/schemas/IosConfig.js
CHANGED
|
@@ -4,6 +4,7 @@ let telemetrySchema = require('./Telemetry')
|
|
|
4
4
|
let accuracySuppressionSchema = require('./AccuracySuppression')
|
|
5
5
|
let starvationDetectionSchema = require('./StarvationDetection')
|
|
6
6
|
let TempoConfigSchema = require('./TempoConfig')
|
|
7
|
+
let heartbeatSchema = require('./Heartbeat')
|
|
7
8
|
|
|
8
9
|
let useCaseTypeEnum = {
|
|
9
10
|
values: ['Default', 'Retail', 'Automotive'],
|
|
@@ -15,11 +16,6 @@ let triggerEngineEnum = {
|
|
|
15
16
|
message: 'enum validator failed for path `{PATH}` with value `{VALUE}`'
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
let disableBackgroundLocationEnum = {
|
|
19
|
-
values: ['None', 'BD'],
|
|
20
|
-
message: 'enum validator failed for path `{PATH}` with value `{VALUE}`'
|
|
21
|
-
}
|
|
22
|
-
|
|
23
19
|
let IosSchema = new mongoose.Schema({
|
|
24
20
|
triggeringOnWifiAccuracyThreshold : {type: Number, required: true},
|
|
25
21
|
triggeringOnGpsAccuracyThreshold : {type: Number, required: true},
|
|
@@ -40,9 +36,10 @@ let IosSchema = new mongoose.Schema({
|
|
|
40
36
|
accuracySuppression: accuracySuppressionSchema,
|
|
41
37
|
starvationDetector: starvationDetectionSchema,
|
|
42
38
|
triggerEngine: {type: String, enum: triggerEngineEnum, default: "BD"},
|
|
43
|
-
disableBackgroundLocation: {type: String, enum: disableBackgroundLocationEnum, default: "None"},
|
|
44
39
|
maximumPageSize: {type: Number},
|
|
45
|
-
tempo: TempoConfigSchema
|
|
40
|
+
tempo: TempoConfigSchema,
|
|
41
|
+
heartbeat: heartbeatSchema,
|
|
42
|
+
remoteConfigUpdateInterval: {type: Number, default: 86400}
|
|
46
43
|
}, {
|
|
47
44
|
_id: false
|
|
48
45
|
})
|
package/schemas/ProjectTempo.js
CHANGED
|
@@ -2,13 +2,22 @@ let mongoose = require('mongoose')
|
|
|
2
2
|
let WebhookSchema = require('./Webhook')
|
|
3
3
|
let helpers = require('../helpers')
|
|
4
4
|
|
|
5
|
+
function validateIsochroneBracketInterval (brackets) {
|
|
6
|
+
const isInteger = brackets.every((bracket) => {
|
|
7
|
+
return Number.isInteger(bracket)
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
return isInteger
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
let webhooksValidators = [
|
|
6
14
|
{validator: helpers.validateNotNull},
|
|
7
15
|
{validator: helpers.validateTempoWebhooks, msg: 'tempo.webhooks should contain tempo webhooks only'}
|
|
8
16
|
];
|
|
9
17
|
|
|
10
18
|
let ProjectTempoSchema = new mongoose.Schema({
|
|
11
|
-
webhooks: {type:[WebhookSchema], validate: webhooksValidators}
|
|
19
|
+
webhooks: {type:[WebhookSchema], validate: webhooksValidators},
|
|
20
|
+
isochroneBracketInterval: {type: [Number], validate: { validator: validateIsochroneBracketInterval, msg: 'tempo.isochroneBracketInterval should contain integer numbers only' }}
|
|
12
21
|
}, {
|
|
13
22
|
_id: false
|
|
14
23
|
})
|