@bluedot-innovation/models 7.7.1 → 7.8.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/.gitlab-ci.yml CHANGED
@@ -1,6 +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:14
3
+ image: node:16
4
4
 
5
5
  # This folder is cached between builds
6
6
  # http://docs.gitlab.com/ce/ci/yaml/README.html#cache
@@ -11,7 +11,7 @@ cache:
11
11
  before_script:
12
12
  - whoami
13
13
  - node --version
14
- - npm install
14
+ - npm ci
15
15
 
16
16
 
17
17
 
@@ -20,7 +20,7 @@ stages:
20
20
  - deploy
21
21
  - release
22
22
 
23
- test:lint:
23
+ lint:
24
24
  stage: test
25
25
  tags:
26
26
  - infrastructure
@@ -31,7 +31,7 @@ test:lint:
31
31
  # https://github.com/nodejs/LTS#lts_schedule
32
32
  # jest does not support node < 4
33
33
  # https://facebook.github.io/jest/docs/troubleshooting.html#compatibility-issues
34
- test:node:12:
34
+ test:
35
35
  stage: test
36
36
  tags:
37
37
  - infrastructure
package/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 7.8.0
2
+ - Add oneSignal integration to project
3
+
1
4
  ## 7.7.1
2
5
  - Add Hyrbid-mode configurations to IosConfig
3
6
 
@@ -57,6 +57,12 @@
57
57
  },
58
58
  "segment": {
59
59
  "enabled": true
60
+ },
61
+ "oneSignal": {
62
+ "appId": "86be6886-9e27-4af8-87e5-2aac913066ca",
63
+ "wave": true,
64
+ "trigger": true,
65
+ "tempo": false
60
66
  }
61
67
  },
62
68
  "tempo": {
@@ -565,6 +565,28 @@ describe('Project', () => {
565
565
  })
566
566
  })
567
567
  })
568
+
569
+ describe("oneSignal integration validation", () => {
570
+ it('should throw an error when appId is missing', (done) => {
571
+ delete project.integrations.oneSignal.appId
572
+ let Project = new ProjectModel(project)
573
+ Project.validate((err, res) => {
574
+ assert.exists(err)
575
+ assert.match(err.message, /`appId` is required/)
576
+ done()
577
+ })
578
+ })
579
+
580
+ it('should throw an error when wave is non boolean', (done) => {
581
+ project.integrations.oneSignal.wave = "invalid"
582
+ let Project = new ProjectModel(project)
583
+ Project.validate((err, res) => {
584
+ assert.exists(err)
585
+ assert.match(err.message, /Cast to Boolean failed for value "invalid" .* at path "wave"/)
586
+ done()
587
+ })
588
+ })
589
+ })
568
590
  })
569
591
 
570
592
  describe('should throw an error when any of the values of the array contains a falsy value', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "7.7.1",
3
+ "version": "7.8.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",
@@ -1,6 +1,7 @@
1
1
  let mongoose = require("mongoose");
2
2
  const oloIntegrationSchema = require('./OloIntegration')
3
3
  const segmentIntegrationSchema = require('./SegmentIntegration')
4
+ const oneSignalIntegrationSchema = require('./OneSignalIntegration')
4
5
 
5
6
 
6
7
  const MParticleSchema = new mongoose.Schema({
@@ -50,7 +51,8 @@ const IntegrationSchema = new mongoose.Schema({
50
51
  ]
51
52
  },
52
53
  olo: { type: oloIntegrationSchema },
53
- segment: { type: segmentIntegrationSchema }
54
+ segment: { type: segmentIntegrationSchema },
55
+ oneSignal: { type: oneSignalIntegrationSchema }
54
56
  },{ _id : false });
55
57
  function apiKeyValidator(value){
56
58
  // check if the value is a non-empty string
@@ -0,0 +1,12 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ let OneSignalIntegrationSchema = new mongoose.Schema({
4
+ appId: {type: String, required: true},
5
+ trigger: {type: Boolean, required: true},
6
+ tempo: {type: Boolean, required: true},
7
+ wave: {type: Boolean, required: true},
8
+ }, {
9
+ _id: false
10
+ })
11
+
12
+ module.exports = OneSignalIntegrationSchema