@bluedot-innovation/models 7.0.1 → 7.0.3
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,12 @@
|
|
|
1
|
+
## 7.0.3
|
|
2
|
+
- Reverted changes on 7.0.2 for renaming of doorbell premigration
|
|
3
|
+
- Renamed doorbell trigger type to wave
|
|
4
|
+
|
|
5
|
+
## 7.0.2
|
|
6
|
+
- Removed tempo webhooks array for post doorbell migration deployment
|
|
7
|
+
- Removed tempo destinationId for post doorbell migration deployment
|
|
8
|
+
- Removed geoTrigger type from webhooks
|
|
9
|
+
|
|
1
10
|
## 7.0.1
|
|
2
11
|
- Added tempo webhooks array back for migration
|
|
3
12
|
- Added tempo destinationId back for migration
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"accountId":"b0824b76-ce73-4fcf-81f8-1b63edb1114e",
|
|
8
8
|
"webhooks": [
|
|
9
9
|
{
|
|
10
|
-
"type": "
|
|
10
|
+
"type": "trigger",
|
|
11
11
|
"url": "https://webhooklistener.bluedotinnovation.com",
|
|
12
12
|
"headers" : {
|
|
13
13
|
"securityToken" : "value"
|
|
@@ -21,14 +21,7 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"type": "
|
|
25
|
-
"url": "https://webhooklistener.bluedotinnovation.com",
|
|
26
|
-
"headers" : {
|
|
27
|
-
"securityToken" : "value"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"type": "trigger",
|
|
24
|
+
"type": "wave",
|
|
32
25
|
"url": "https://webhooklistener.bluedotinnovation.com",
|
|
33
26
|
"headers" : {
|
|
34
27
|
"securityToken" : "value"
|
|
@@ -92,7 +92,7 @@ testCase('Project', () => {
|
|
|
92
92
|
})
|
|
93
93
|
|
|
94
94
|
// TODO: Remove trigger type after migration
|
|
95
|
-
assertions(`should not validate if one of webhooks have a type other than '
|
|
95
|
+
assertions(`should not validate if one of webhooks have a type other than 'tempo', 'wave' or 'trigger'`, (done) => {
|
|
96
96
|
project.webhooks.push({
|
|
97
97
|
"type": "sandwich",
|
|
98
98
|
"url": "https://webhooklistener.bluedotinnovation.com",
|
|
@@ -280,8 +280,7 @@ testCase('Project', () => {
|
|
|
280
280
|
})
|
|
281
281
|
|
|
282
282
|
testCase('should not validate if webhooks contains two webhooks of the same type', () => {
|
|
283
|
-
|
|
284
|
-
const webhookTypes = ['geoTrigger', 'tempo', 'doorbell', 'trigger']
|
|
283
|
+
const webhookTypes = ['tempo', 'wave', 'trigger']
|
|
285
284
|
|
|
286
285
|
webhookTypes.map(webhookType => {
|
|
287
286
|
assertions(`should not validate if there are duplicate ${webhookType} webhooks`, (done) => {
|
package/helpers.js
CHANGED
|
@@ -267,12 +267,12 @@ helpers.validateDestinationIdGeofeatureType = function(destinationId) {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
helpers.validateNoDuplicateWebhookTypes = function(webhookArray) {
|
|
270
|
-
|
|
271
|
-
const webhookTypes = ['geoTrigger', 'tempo', 'doorbell', 'trigger']
|
|
272
|
-
const webhookCounts = {};
|
|
273
|
-
webhookTypes.forEach(webhookType => webhookCounts[webhookType] = 0);
|
|
270
|
+
const webhookCounts = {}
|
|
274
271
|
let duplicateFound = false
|
|
275
272
|
webhookArray.forEach(webhook => {
|
|
273
|
+
if(webhookCounts[webhook.type] === undefined){
|
|
274
|
+
webhookCounts[webhook.type] = 0
|
|
275
|
+
}
|
|
276
276
|
if(webhookCounts[webhook.type] > 0){
|
|
277
277
|
duplicateFound = true
|
|
278
278
|
}
|
package/package.json
CHANGED
package/schemas/Webhook.js
CHANGED
|
@@ -2,8 +2,7 @@ let mongoose = require('mongoose')
|
|
|
2
2
|
let validators = require('../utils/validators')
|
|
3
3
|
|
|
4
4
|
let WebhookSchema = new mongoose.Schema({
|
|
5
|
-
|
|
6
|
-
type: {type: String, enum: ['geoTrigger', 'tempo', 'doorbell', 'trigger'], required: [true, 'webhook type is required']},
|
|
5
|
+
type: {type: String, enum: ['tempo', 'wave', 'trigger'], required: [true, 'webhook type is required']},
|
|
7
6
|
url: {type: String, required: [true, 'URL is required'], validate: {validator: validators.validateUrl, msg: 'Please enter a valid URL'}},
|
|
8
7
|
headers: {type: mongoose.Schema.Types.Mixed, validate: { validator: validateHeaderlength, msg: 'Header object can only have 1 key <-> value pair' }}
|
|
9
8
|
}, {
|