@bluedot-innovation/models 7.6.0 → 7.7.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/.gitlab-ci.yml CHANGED
@@ -1,9 +1,6 @@
1
1
  # Official framework image. Look for the different tagged releases at:
2
2
  # https://hub.docker.com/r/library/node/tags/
3
- image: node:12
4
-
5
- before_script:
6
- - npm install
3
+ image: node:14
7
4
 
8
5
  # This folder is cached between builds
9
6
  # http://docs.gitlab.com/ce/ci/yaml/README.html#cache
@@ -11,6 +8,13 @@ cache:
11
8
  paths:
12
9
  - node_modules/
13
10
 
11
+ before_script:
12
+ - whoami
13
+ - node --version
14
+ - npm install
15
+
16
+
17
+
14
18
  stages:
15
19
  - test
16
20
  - deploy
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 7.7.1
2
+ - Add Hyrbid-mode configurations to IosConfig
3
+
4
+ ## 7.7.0
5
+ - Add Segment Integration to project
6
+
1
7
  ## 7.6.0
2
8
  - Add Attentive Integration to account and webhook
3
9
 
@@ -54,6 +54,9 @@
54
54
  "olo": {
55
55
  "sharedSecret": "jhFGJHKJhkHIjklJ",
56
56
  "nowReadyEnabled": true
57
+ },
58
+ "segment": {
59
+ "enabled": true
57
60
  }
58
61
  },
59
62
  "tempo": {
@@ -116,7 +116,11 @@
116
116
  "rulesDownloadEnd" ]
117
117
  },
118
118
  "maximumPageSize": 256,
119
- "triggerEngine": "BD"
119
+ "triggerEngine": "BD",
120
+ "nativeCheckinAccuracyThreshold" : 101,
121
+ "nativeCheckoutDistanceAccuracy" : 151,
122
+ "nativeMinLocationUpdateInterval" : 0.6,
123
+ "nativeMaxMonitoringRegions" : 19
120
124
  }
121
125
  }
122
126
  }
@@ -50,6 +50,40 @@ describe('Project', () => {
50
50
  })
51
51
  })
52
52
 
53
+ assertions('should parse new IosConfig native mode fields successfully', (done) => {
54
+ let projectJson = JSON.parse(JSON.stringify(require('./project.remote.config.json')))
55
+ let project = new ProjectModel(projectJson)
56
+ let iosConfig = project.configurationParameters.iosConfig
57
+ assert.equal(iosConfig.nativeCheckinAccuracyThreshold, 101)
58
+ assert.equal(iosConfig.nativeCheckoutDistanceAccuracy, 151)
59
+ assert.equal(iosConfig.nativeMinLocationUpdateInterval, 0.6)
60
+ assert.equal(iosConfig.nativeMaxMonitoringRegions, 19)
61
+ project.validate((err, res) => {
62
+ assert.notExists(err)
63
+ done()
64
+ })
65
+ })
66
+
67
+ assertions('should fallback to default values for new IosConfig native mode fields if not available', (done) => {
68
+ let projectJson = JSON.parse(JSON.stringify(require('./project.remote.config.json')))
69
+ // delete native mode json fields
70
+ delete projectJson.configurationParameters.iosConfig.nativeCheckinAccuracyThreshold
71
+ delete projectJson.configurationParameters.iosConfig.nativeCheckoutDistanceAccuracy
72
+ delete projectJson.configurationParameters.iosConfig.nativeMinLocationUpdateInterval
73
+ delete projectJson.configurationParameters.iosConfig.nativeMaxMonitoringRegions
74
+
75
+ let project = new ProjectModel(projectJson)
76
+ let iosConfig = project.configurationParameters.iosConfig
77
+ assert.equal(iosConfig.nativeCheckinAccuracyThreshold, 100, "nativeCheckinAccuracyThreshold should be set to default value 100")
78
+ assert.equal(iosConfig.nativeCheckoutDistanceAccuracy, 150, "nativeCheckoutDistanceAccuracy should be set to default value 150")
79
+ assert.equal(iosConfig.nativeMinLocationUpdateInterval, 0.5, "nativeMinLocationUpdateInterval should be set to default value 0.5")
80
+ assert.equal(iosConfig.nativeMaxMonitoringRegions, 18, "nativeMaxMonitoringRegions should be set to default value 18")
81
+ project.validate((err, res) => {
82
+ assert.notExists(err)
83
+ done()
84
+ })
85
+ })
86
+
53
87
  it('should validate a valid project with a webhook with empty header and body object', (done) => {
54
88
  project.webhooks = [{url: "https://mirror.com", type: "tempo", structure: "standard", body: {}, headers: {}}]
55
89
  let Project = new ProjectModel(project)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "7.6.0",
3
+ "version": "7.7.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",
@@ -1,5 +1,6 @@
1
1
  let mongoose = require("mongoose");
2
2
  const oloIntegrationSchema = require('./OloIntegration')
3
+ const segmentIntegrationSchema = require('./SegmentIntegration')
3
4
 
4
5
 
5
6
  const MParticleSchema = new mongoose.Schema({
@@ -48,7 +49,8 @@ const IntegrationSchema = new mongoose.Schema({
48
49
  }
49
50
  ]
50
51
  },
51
- olo: { type: oloIntegrationSchema }
52
+ olo: { type: oloIntegrationSchema },
53
+ segment: { type: segmentIntegrationSchema }
52
54
  },{ _id : false });
53
55
  function apiKeyValidator(value){
54
56
  // check if the value is a non-empty string
@@ -39,7 +39,11 @@ let IosSchema = new mongoose.Schema({
39
39
  maximumPageSize: {type: Number},
40
40
  tempo: TempoConfigSchema,
41
41
  heartbeat: heartbeatSchema,
42
- remoteConfigUpdateInterval: {type: Number, default: 86400}
42
+ remoteConfigUpdateInterval: {type: Number, default: 86400},
43
+ nativeCheckinAccuracyThreshold: {type: Number, default: 100},
44
+ nativeCheckoutDistanceAccuracy: {type: Number, default: 150},
45
+ nativeMinLocationUpdateInterval: {type: Number, default: 0.5},
46
+ nativeMaxMonitoringRegions: {type: Number, default: 18}
43
47
  }, {
44
48
  _id: false
45
49
  })
@@ -0,0 +1,9 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ let SegmentIntegrationSchema = new mongoose.Schema({
4
+ enabled: {type: Boolean}
5
+ }, {
6
+ _id: false
7
+ })
8
+
9
+ module.exports = SegmentIntegrationSchema