@bluedot-innovation/models 10.0.0 → 10.2.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.2.0
2
+ - Adds Rezolve Chat integration to project
3
+
4
+ ## 10.1.0
5
+ - Adds revised UberEats integration back to project
6
+
1
7
  ## 10.0.0
2
8
  - BREAKING CHANGE - Upgrade to Mongoose 8
3
9
 
@@ -108,7 +108,15 @@
108
108
  },
109
109
  "doordash": {
110
110
  "authorizationToken": "1986d1de-85ea-4339-93a2-6442d44a31f6"
111
- }
111
+ },
112
+ "uberEats": {
113
+ "enabled": true,
114
+ "lastSyncedTime": "2022-10-21T04:12:02.103Z"
115
+ },
116
+ "rezolveChat": {
117
+ "apiKey": "9a690452-78de-465d-a484-053b1448e5f5",
118
+ "url": "https://rezolve.chat.api"
119
+ }
112
120
  },
113
121
  "tempo": {
114
122
  "isochroneBracketInterval": [60, 120, 300]
@@ -1034,6 +1034,43 @@ describe('Project', () => {
1034
1034
  }
1035
1035
  })
1036
1036
  })
1037
+
1038
+ describe("Ubereats integration validation", () => {
1039
+ it('should throw an error when enabled is not boolean', async () => {
1040
+ project.integrations.uberEats.enabled = 'test'
1041
+ let Project = new ProjectModel(project)
1042
+ try {
1043
+ await Project.validate()
1044
+ } catch (err) {
1045
+ assert.exists(err, 'err object should exist')
1046
+ assert.match(err.message, /Cast to Boolean failed for value .*enabled/)
1047
+ }
1048
+ })
1049
+ })
1050
+
1051
+ describe("Rezolve Chat integration validation", () => {
1052
+ it('should throw an error when apiKey is missing', async () => {
1053
+ delete project.integrations.rezolveChat.apiKey
1054
+ let Project = new ProjectModel(project)
1055
+ try {
1056
+ await Project.validate()
1057
+ } catch (err) {
1058
+ assert.exists(err, 'err object should exist')
1059
+ assert.match(err.message, /`apiKey` is required/)
1060
+ }
1061
+ })
1062
+
1063
+ it('should throw an error when Rezolve Chat URL is missing', async () => {
1064
+ delete project.integrations.rezolveChat.url
1065
+ let Project = new ProjectModel(project)
1066
+ try {
1067
+ await Project.validate()
1068
+ } catch (err) {
1069
+ assert.exists(err, 'err object should exist')
1070
+ assert.match(err.message, /`url` is required/)
1071
+ }
1072
+ })
1073
+ })
1037
1074
  })
1038
1075
 
1039
1076
  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": "10.0.0",
3
+ "version": "10.2.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",
@@ -9,6 +9,8 @@ const incentivioIntegrationSchema = require('./IncentivioIntegration')
9
9
  const mparticleIntegrationSchema = require('./MparticleIntegration')
10
10
  const klaviyoIntegrationSchema = require('./KlaviyoIntegration')
11
11
  const doordashIntegrationSchema = require('./DoordashIntegration')
12
+ const ubereatsIntegrationSchema = require('./UberEatsIntegration')
13
+ const rezolveChatIntegrationSchema = require('./RezolveChatIntegration')
12
14
 
13
15
  function mParticleValidator(value) {
14
16
  const { androidApiKey, iosApiKey, webApiKey } = value;
@@ -25,7 +27,9 @@ const IntegrationSchema = new mongoose.Schema({
25
27
  attentive: { type: projectAttentiveIntegrationSchema },
26
28
  incentivio: { type: incentivioIntegrationSchema },
27
29
  klaviyo: { type: klaviyoIntegrationSchema },
28
- doordash: { type: doordashIntegrationSchema }
30
+ doordash: { type: doordashIntegrationSchema },
31
+ uberEats: { type: ubereatsIntegrationSchema },
32
+ rezolveChat: { type: rezolveChatIntegrationSchema }
29
33
  },{ _id : false });
30
34
 
31
35
  module.exports = IntegrationSchema
@@ -0,0 +1,10 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ let RezolveChatIntegrationSchema = new mongoose.Schema({
4
+ apiKey: {type: String, required: true},
5
+ url: {type: String, required: true}
6
+ }, {
7
+ _id: false
8
+ })
9
+
10
+ module.exports = RezolveChatIntegrationSchema
@@ -0,0 +1,10 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ let UberEatsIntegrationSchema = new mongoose.Schema({
4
+ enabled: {type: Boolean, required: true, default: false},
5
+ lastSyncedTime: {type: Date, default: Date.now, required: true}
6
+ }, {
7
+ _id: false
8
+ })
9
+
10
+ module.exports = UberEatsIntegrationSchema