@bluedot-innovation/models 8.3.6 → 8.4.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,6 @@
1
+ ## 8.4.0
2
+ - Add stateTemplateId to Destination model and helloStateTemplates feature to Account
3
+
1
4
  ## 8.3.6
2
5
  - Add type property to Account model
3
6
 
@@ -45,6 +45,9 @@
45
45
  "enabled": true,
46
46
  "identityProvider": "test-azure-idp-dev1",
47
47
  "domain": "bluedot.io"
48
+ },
49
+ "helloStateTemplates": {
50
+ "enabled": true
48
51
  }
49
52
  },
50
53
  "integrations": {
@@ -14,5 +14,6 @@
14
14
  "waitTime": {
15
15
  "goal": 300,
16
16
  "alert": 240
17
- }
17
+ },
18
+ "stateTemplateId": "b0824b76-ce73-4fcf-81f8-1b63edb1114e"
18
19
  }
@@ -58,6 +58,16 @@ describe('Valid Destination ', () => {
58
58
  done()
59
59
  })
60
60
  })
61
+
62
+ it('should validate a valid destination without stateTemplateId', (done) => {
63
+ delete destination.stateTemplateId
64
+ let Destination = new DestinationModel(destination)
65
+ Destination.validate((err, res) => {
66
+ assert.notExists(res)
67
+ assert(err === null, 'err equals null')
68
+ done()
69
+ })
70
+ })
61
71
  })
62
72
 
63
73
  describe('Invalid Destination ', () => {
@@ -188,4 +198,16 @@ describe('Invalid Destination ', () => {
188
198
  done()
189
199
  })
190
200
  })
201
+
202
+ it("should throw an error if stateTemplateId is not a uuid", (done) => {
203
+ destination.stateTemplateId = "something"
204
+ let Destination = new DestinationModel(destination)
205
+ Destination.validate((err, res) => {
206
+ assert.notExists(res)
207
+ assert.exists(err)
208
+ console.log(err.message)
209
+ assert.match(err.message, /Invalid state template id/)
210
+ done()
211
+ })
212
+ })
191
213
  })
@@ -17,7 +17,8 @@ const DestinationSchema = new mongoose.Schema({
17
17
  projectId: {type: String, required: true, validate: {validator: helpers.validateUUIDv4, msg: 'Invalid projectId'}},
18
18
  creationTime: {type: Date, default: Date.now},
19
19
  lastUpdateTime: {type: Date, default: Date.now},
20
- waitTime: { type: WaitTime }
20
+ waitTime: { type: WaitTime },
21
+ stateTemplateId: {type: String, validate: {validator: helpers.validateUUIDv4, msg: 'Invalid state template id'}}
21
22
  }, {collection: 'destination'})
22
23
 
23
24
  DestinationSchema.plugin(patcher)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "8.3.6",
3
+ "version": "8.4.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",
@@ -16,7 +16,8 @@ let AccountFeaturesSchema = new mongoose.Schema({
16
16
  automaticDestinationCreation: AccountBasicFeatureSchema,
17
17
  nowReadyConfiguration: AccountBasicFeatureSchema,
18
18
  helloSso: HelloSsoSchema,
19
- canvasSso: CanvasSsoSchema
19
+ canvasSso: CanvasSsoSchema,
20
+ helloStateTemplates: AccountBasicFeatureSchema,
20
21
  }, {
21
22
  _id: false
22
23
  })