@bluedot-innovation/models 3.1.0 → 4.0.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.
Files changed (160) hide show
  1. package/Models.js +10 -55
  2. package/models/AdminPortalUser.js +11 -10
  3. package/models/AdminUser.js +10 -0
  4. package/models/Application.js +38 -0
  5. package/models/ApplicationNotificationAction.js +30 -0
  6. package/models/ApplicationUsage.js +11 -0
  7. package/models/Beacon.js +32 -84
  8. package/models/BeaconFilter.js +23 -0
  9. package/models/BearingFilter.js +19 -0
  10. package/models/BoundingBox.js +17 -0
  11. package/models/Circle.js +21 -0
  12. package/models/ConfigurationParameters.js +20 -0
  13. package/models/Contract.js +38 -37
  14. package/models/Customer.js +38 -0
  15. package/models/CustomerLogin.js +10 -9
  16. package/models/DBEvent.js +14 -13
  17. package/models/DailyStats.js +7 -7
  18. package/models/DateRangeFilter.js +20 -0
  19. package/models/DeviceRulesRequest.js +28 -27
  20. package/models/Fence.js +21 -0
  21. package/models/FormattedBeacon.js +16 -0
  22. package/models/FormattedCircle.js +12 -0
  23. package/models/FormattedConditions.js +11 -0
  24. package/models/FormattedDateRange.js +11 -0
  25. package/models/FormattedPercentageCrossed.js +12 -0
  26. package/models/FormattedPoint.js +10 -0
  27. package/models/FormattedPolygon.js +11 -0
  28. package/models/FormattedPolyline.js +11 -0
  29. package/models/FormattedRectangle.js +12 -0
  30. package/models/FormattedTimeActive.js +17 -0
  31. package/models/FormattedZone.js +28 -0
  32. package/models/GeoFence.js +23 -0
  33. package/models/Geofeature.js +26 -0
  34. package/models/MessageAction.js +26 -28
  35. package/models/MonthlyStats.js +19 -35
  36. package/models/NotificationLogEntry.js +8 -7
  37. package/models/POILocation.js +7 -6
  38. package/models/POILookup.js +9 -8
  39. package/models/POIResult.js +8 -7
  40. package/models/PartnerCustomer.js +13 -12
  41. package/models/PartnerPasswordReset.js +9 -8
  42. package/models/PartnerUser.js +11 -10
  43. package/models/Partners.js +12 -11
  44. package/models/PercentageCrossedFilter.js +19 -0
  45. package/models/Point.js +20 -0
  46. package/models/Polygon.js +18 -0
  47. package/models/Polyline.js +18 -0
  48. package/models/PropertyMapping.js +17 -0
  49. package/models/Reference.js +19 -0
  50. package/models/RuleRequestAggregation.js +17 -33
  51. package/models/SequenceFilter.js +18 -0
  52. package/models/SimpleCheckInZone.js +29 -0
  53. package/models/SingleUseToken.js +8 -7
  54. package/models/SoundAction.js +28 -0
  55. package/models/SpeedFilter.js +19 -0
  56. package/models/TestDevice.js +12 -11
  57. package/models/TestDeviceCluster.js +10 -9
  58. package/models/TestInstance.js +10 -9
  59. package/models/TestScenario.js +10 -9
  60. package/models/TimeOfDayRange.js +16 -16
  61. package/models/TimeOfDayRangeFilter.js +19 -0
  62. package/models/URLAction.js +31 -0
  63. package/models/VibrationAction.js +28 -0
  64. package/models/ZoneUIState.js +18 -18
  65. package/models/property.js +25 -0
  66. package/package-lock.json.bak +170 -0
  67. package/package.json +6 -30
  68. package/.eslintrc.js +0 -42
  69. package/.gitlab-ci.yml +0 -43
  70. package/CHANGELOG.md +0 -148
  71. package/README.MD +0 -36
  72. package/__tests__/account/account.data.json +0 -12
  73. package/__tests__/account/account.rules.js +0 -8
  74. package/__tests__/account/account.spec.js +0 -83
  75. package/__tests__/action/message/messageAction.data.json +0 -5
  76. package/__tests__/action/message/messageAction.rules.json +0 -3
  77. package/__tests__/action/message/messageAction.spec.js +0 -61
  78. package/__tests__/action/url/urlAction.data.json +0 -4
  79. package/__tests__/action/url/urlAction.rules.json +0 -3
  80. package/__tests__/action/url/urlAction.spec.js +0 -74
  81. package/__tests__/beacon/beacon.data.json +0 -15
  82. package/__tests__/beacon/beacon.rules.json +0 -13
  83. package/__tests__/beacon/beacon.spec.js +0 -104
  84. package/__tests__/condition/beacon/beaconFilter.data.json +0 -1
  85. package/__tests__/condition/beacon/beaconFilter.rules.json +0 -3
  86. package/__tests__/condition/beacon/beaconFilter.spec.js +0 -1
  87. package/__tests__/condition/dayRange/dayRange.data.json +0 -5
  88. package/__tests__/condition/dayRange/dayRange.rules.json +0 -3
  89. package/__tests__/condition/dayRange/dayRange.spec.js +0 -74
  90. package/__tests__/condition/percentageCrossed/travelPath.data.json +0 -5
  91. package/__tests__/condition/percentageCrossed/travelPath.rules.json +0 -3
  92. package/__tests__/condition/percentageCrossed/travelPath.spec.js +0 -62
  93. package/__tests__/condition/speed/speed.data.json +0 -5
  94. package/__tests__/condition/speed/speed.rules.json +0 -3
  95. package/__tests__/condition/speed/speed.spec.js +0 -73
  96. package/__tests__/condition/timeActive/timeActive.data.json +0 -5
  97. package/__tests__/condition/timeActive/timeActive.rules.json +0 -7
  98. package/__tests__/condition/timeActive/timeActive.spec.js +0 -94
  99. package/__tests__/condition/travelDirection/travelDirection.data.json +0 -5
  100. package/__tests__/condition/travelDirection/travelDirection.rules.json +0 -3
  101. package/__tests__/condition/travelDirection/travelDirection.spec.js +0 -132
  102. package/__tests__/dailyStats/checkDailyStats.js +0 -31
  103. package/__tests__/geofeature/boundingBox/boundingBox.data.json +0 -12
  104. package/__tests__/geofeature/boundingBox/boundingBox.rules.json +0 -3
  105. package/__tests__/geofeature/boundingBox/boundingBox.spec.js +0 -78
  106. package/__tests__/geofeature/circle/circle.data.json +0 -9
  107. package/__tests__/geofeature/circle/circle.rules.json +0 -3
  108. package/__tests__/geofeature/circle/circle.spec.js +0 -71
  109. package/__tests__/geofeature/polygon/polygon.data.json +0 -46
  110. package/__tests__/geofeature/polygon/polygon.rules.json +0 -3
  111. package/__tests__/geofeature/polygon/polygon.spec.js +0 -127
  112. package/__tests__/geofeature/polyline/polyline.data.json +0 -46
  113. package/__tests__/geofeature/polyline/polyline.rules.json +0 -3
  114. package/__tests__/geofeature/polyline/polyline.spec.js +0 -70
  115. package/__tests__/geofeature/zoneBeacon/zoneBeacon.data.json +0 -16
  116. package/__tests__/geofeature/zoneBeacon/zoneBeacon.rules.json +0 -13
  117. package/__tests__/geofeature/zoneBeacon/zoneBeacon.spec.js +0 -62
  118. package/__tests__/monthlyStats/monthlyStats.data.json +0 -29
  119. package/__tests__/monthlyStats/monthlyStats.spec.js +0 -66
  120. package/__tests__/project/project.data.json +0 -18
  121. package/__tests__/project/project.rules.json +0 -9
  122. package/__tests__/project/project.spec.js +0 -81
  123. package/__tests__/ruleRequestAggregation/ruleRequestAggregation.data.json +0 -8
  124. package/__tests__/ruleRequestAggregation/ruleRequestAggregation.spec.js +0 -69
  125. package/__tests__/setup.js +0 -7
  126. package/__tests__/user/user.data.js +0 -19
  127. package/__tests__/user/user.rules.js +0 -8
  128. package/__tests__/user/user.spec.js +0 -130
  129. package/__tests__/utils/utils.spec.js +0 -24
  130. package/__tests__/zone/zone.action.spec.js +0 -50
  131. package/__tests__/zone/zone.condition.spec.js +0 -76
  132. package/__tests__/zone/zone.data.json +0 -157
  133. package/__tests__/zone/zone.geofeatures.spec.js +0 -75
  134. package/__tests__/zone/zone.spec.js +0 -134
  135. package/constants/errorMessages.js +0 -2
  136. package/helpers.js +0 -102
  137. package/models/Account.js +0 -50
  138. package/models/Project.js +0 -55
  139. package/models/UrlAction.js +0 -46
  140. package/models/User.js +0 -61
  141. package/models/Zone.js +0 -123
  142. package/models/conditions/DayRange.js +0 -52
  143. package/models/conditions/Speed.js +0 -42
  144. package/models/conditions/TimeActive.js +0 -50
  145. package/models/conditions/TravelDirection.js +0 -67
  146. package/models/conditions/TravelPath.js +0 -36
  147. package/models/geofeatures/BoundingBox.js +0 -44
  148. package/models/geofeatures/Circle.js +0 -39
  149. package/models/geofeatures/Polygon.js +0 -45
  150. package/models/geofeatures/Polyline.js +0 -34
  151. package/models/geofeatures/ZoneBeacon.js +0 -28
  152. package/schemas/MultiLineStringGeometry.js +0 -14
  153. package/schemas/Point.js +0 -13
  154. package/schemas/PointGeometry.js +0 -14
  155. package/schemas/PolygonGeometry.js +0 -14
  156. package/schemas/ProjectPermission.js +0 -21
  157. package/schemas/Webhook.js +0 -22
  158. package/utils/index.js +0 -39
  159. package/validators/checkDistanceBetweenVertices.js +0 -21
  160. package/yarn.lock +0 -2796
@@ -3,23 +3,23 @@
3
3
  * Copyright : Bluedot Innovations.
4
4
  * Owner :
5
5
  */
6
- let mongoose = require('mongoose')
7
- let Schema = mongoose.Schema
8
- let StateEnum = require('@bluedot-innovation/enums').StateEnum
6
+ var mongoose = require('mongoose'),
7
+ Schema = mongoose.Schema;
8
+ var StateEnum = require('@bluedot-innovation/enums').StateEnum;
9
9
 
10
- let ZoneUIStateSchema = new mongoose.Schema({
11
- _id: {type: String},
12
- signature: {type: String},
13
- center: Schema.Types.Mixed,
14
- dataSource: {type: String, select: false, default: 'openApi'},
15
- zoom: {type: Number, default: 4},
16
- lastUpdateTime: {type: Date, default: Date.now},
17
- creationTime: {type: Date, default: Date.now},
18
- state: {type: String, default: StateEnum.active, select: false},
19
- zoneId: String
20
- },
21
- {collection: 'zoneUIState'}
22
- )
10
+ var ZoneUIStateSchema = new mongoose.Schema({
11
+ _id : {type: String},
12
+ signature : {type: String},
13
+ center : Schema.Types.Mixed,
14
+ dataSource: {type:String, select: false, default : 'openApi'},
15
+ zoom : {type: Number, default : 4},
16
+ lastUpdateTime : {type: Date, default: Date.now},
17
+ creationTime : {type: Date, default: Date.now},
18
+ state: {type: String, default : StateEnum.active, select: false},
19
+ zoneId: String
20
+ },
21
+ { collection : 'zoneUIState' }
22
+ );
23
23
 
24
- let ZoneUIState = mongoose.model('ZoneUIState', ZoneUIStateSchema)
25
- module.exports = ZoneUIState
24
+ var ZoneUIState = mongoose.model('ZoneUIState', ZoneUIStateSchema);
25
+ module.exports = ZoneUIState;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Created by Arun on 10/09/2014.
3
+ * Copyright : Bluedot Innovations.
4
+ * Owner :
5
+ */
6
+ var mongoose = require('mongoose');
7
+ var property = new mongoose.Schema({
8
+ _id : String,
9
+ Agent : String,
10
+ StreetNumber : Number,
11
+ Address : String,
12
+ Suburb : String,
13
+ NumberOfBedrooms: Number,
14
+ GarageCount: Number,
15
+ CarportCount: Number,
16
+ NumberBathrooms: Number,
17
+ OpenForInspection: String,
18
+ Latitude: Number,
19
+ Longitude: Number,
20
+ filename: String
21
+ }, { collection : 'property' });
22
+
23
+ var property = mongoose.model('property', property);
24
+
25
+ module.exports = property;
@@ -0,0 +1,170 @@
1
+ {
2
+ "name": "@bluedot-innovation/models",
3
+ "version": "1.0.25",
4
+ "lockfileVersion": 1,
5
+ "requires": true,
6
+ "dependencies": {
7
+ "@bluedot-innovation/enums": {
8
+ "version": "1.0.2",
9
+ "resolved": "https://registry.npmjs.org/@bluedot-innovation/enums/-/enums-1.0.2.tgz",
10
+ "integrity": "sha512-cZL8FUgkk+HFPwsKxuxzjX/sLIJPbuRi9gy8w5769Hn7Ah3bCyDgD3zEVo07X8JZ30w3ts2rh7hUuso+R2RMAA==",
11
+ "requires": {
12
+ "enum": "0.2.6"
13
+ }
14
+ },
15
+ "bluebird": {
16
+ "version": "3.5.1",
17
+ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
18
+ "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA=="
19
+ },
20
+ "bson": {
21
+ "version": "1.1.3",
22
+ "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.3.tgz",
23
+ "integrity": "sha512-TdiJxMVnodVS7r0BdL42y/pqC9cL2iKynVwA0Ho3qbsQYr428veL3l7BQyuqiw+Q5SqqoT0m4srSY/BlZ9AxXg=="
24
+ },
25
+ "debug": {
26
+ "version": "3.1.0",
27
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
28
+ "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
29
+ "requires": {
30
+ "ms": "2.0.0"
31
+ },
32
+ "dependencies": {
33
+ "ms": {
34
+ "version": "2.0.0",
35
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
36
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
37
+ }
38
+ }
39
+ },
40
+ "enum": {
41
+ "version": "0.2.6",
42
+ "resolved": "https://registry.npmjs.org/enum/-/enum-0.2.6.tgz",
43
+ "integrity": "sha1-M5uFDY17rZ/CC2yMcdMB70PMjLk="
44
+ },
45
+ "kareem": {
46
+ "version": "2.3.1",
47
+ "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.1.tgz",
48
+ "integrity": "sha512-l3hLhffs9zqoDe8zjmb/mAN4B8VT3L56EUvKNqLFVs9YlFA+zx7ke1DO8STAdDyYNkeSo1nKmjuvQeI12So8Xw=="
49
+ },
50
+ "memory-pager": {
51
+ "version": "1.5.0",
52
+ "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
53
+ "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
54
+ "optional": true
55
+ },
56
+ "mongodb": {
57
+ "version": "3.3.5",
58
+ "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.3.5.tgz",
59
+ "integrity": "sha512-6NAv5gTFdwRyVfCz+O+KDszvjpyxmZw+VlmqmqKR2GmpkeKrKFRv/ZslgTtZba2dc9JYixIf99T5Gih7TIWv7Q==",
60
+ "requires": {
61
+ "bson": "^1.1.1",
62
+ "require_optional": "^1.0.1",
63
+ "safe-buffer": "^5.1.2",
64
+ "saslprep": "^1.0.0"
65
+ }
66
+ },
67
+ "mongoose": {
68
+ "version": "5.7.13",
69
+ "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.7.13.tgz",
70
+ "integrity": "sha512-MoTCETTIfXU1PqIYc+YAkhSB3uzK5xseh6ysAUnoOowkqS66OjBJtsL/bcgAKi6XfMYkFU6M1abKyuL7k//xeg==",
71
+ "requires": {
72
+ "bson": "~1.1.1",
73
+ "kareem": "2.3.1",
74
+ "mongodb": "3.3.5",
75
+ "mongoose-legacy-pluralize": "1.0.2",
76
+ "mpath": "0.6.0",
77
+ "mquery": "3.2.2",
78
+ "ms": "2.1.2",
79
+ "regexp-clone": "1.0.0",
80
+ "safe-buffer": "5.1.2",
81
+ "sift": "7.0.1",
82
+ "sliced": "1.0.1"
83
+ }
84
+ },
85
+ "mongoose-legacy-pluralize": {
86
+ "version": "1.0.2",
87
+ "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz",
88
+ "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ=="
89
+ },
90
+ "mpath": {
91
+ "version": "0.6.0",
92
+ "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.6.0.tgz",
93
+ "integrity": "sha512-i75qh79MJ5Xo/sbhxrDrPSEG0H/mr1kcZXJ8dH6URU5jD/knFxCVqVC/gVSW7GIXL/9hHWlT9haLbCXWOll3qw=="
94
+ },
95
+ "mquery": {
96
+ "version": "3.2.2",
97
+ "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.2.tgz",
98
+ "integrity": "sha512-XB52992COp0KP230I3qloVUbkLUxJIu328HBP2t2EsxSFtf4W1HPSOBWOXf1bqxK4Xbb66lfMJ+Bpfd9/yZE1Q==",
99
+ "requires": {
100
+ "bluebird": "3.5.1",
101
+ "debug": "3.1.0",
102
+ "regexp-clone": "^1.0.0",
103
+ "safe-buffer": "5.1.2",
104
+ "sliced": "1.0.1"
105
+ }
106
+ },
107
+ "ms": {
108
+ "version": "2.1.2",
109
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
110
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
111
+ },
112
+ "regexp-clone": {
113
+ "version": "1.0.0",
114
+ "resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-1.0.0.tgz",
115
+ "integrity": "sha512-TuAasHQNamyyJ2hb97IuBEif4qBHGjPHBS64sZwytpLEqtBQ1gPJTnOaQ6qmpET16cK14kkjbazl6+p0RRv0yw=="
116
+ },
117
+ "require_optional": {
118
+ "version": "1.0.1",
119
+ "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz",
120
+ "integrity": "sha1-TPNaQkf2TKPfjC7yCMxJSxyo/C4=",
121
+ "requires": {
122
+ "resolve-from": "^2.0.0",
123
+ "semver": "^5.1.0"
124
+ }
125
+ },
126
+ "resolve-from": {
127
+ "version": "2.0.0",
128
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz",
129
+ "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c="
130
+ },
131
+ "safe-buffer": {
132
+ "version": "5.1.2",
133
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
134
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
135
+ },
136
+ "saslprep": {
137
+ "version": "1.0.3",
138
+ "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
139
+ "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
140
+ "optional": true,
141
+ "requires": {
142
+ "sparse-bitfield": "^3.0.3"
143
+ }
144
+ },
145
+ "semver": {
146
+ "version": "5.7.1",
147
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
148
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
149
+ },
150
+ "sift": {
151
+ "version": "7.0.1",
152
+ "resolved": "https://registry.npmjs.org/sift/-/sift-7.0.1.tgz",
153
+ "integrity": "sha512-oqD7PMJ+uO6jV9EQCl0LrRw1OwsiPsiFQR5AR30heR+4Dl7jBBbDLnNvWiak20tzZlSE1H7RB30SX/1j/YYT7g=="
154
+ },
155
+ "sliced": {
156
+ "version": "1.0.1",
157
+ "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz",
158
+ "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E="
159
+ },
160
+ "sparse-bitfield": {
161
+ "version": "3.0.3",
162
+ "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
163
+ "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=",
164
+ "optional": true,
165
+ "requires": {
166
+ "memory-pager": "^1.0.2"
167
+ }
168
+ }
169
+ }
170
+ }
package/package.json CHANGED
@@ -1,39 +1,15 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "3.1.0",
3
+ "version": "4.0.0",
4
+ "description": "",
4
5
  "main": "Models.js",
5
6
  "scripts": {
6
- "lint": "./node_modules/.bin/eslint -c .eslintrc.js ./models/*.js ./__tests__/**/*.js ./__tests__/**/**/*.js ./schemas/*.js",
7
- "test": "mocha --require __tests__/setup __tests__/**/*.spec.js __tests__/**/**/*.spec.js",
8
- "test:coverage": "nyc mocha --require __tests__/setup __tests__/**/*.spec.js __tests__/**/**/*.spec.js",
9
- "test:coverage-check": "nyc check-coverage --lines 90 --functions 90 --branches 70",
10
- "test:ci": "npm run lint && npm run test:coverage-check && npm test"
7
+ "test": "echo \"Error: no test specified\" && exit 1"
11
8
  },
9
+ "author": "",
12
10
  "license": "UNLICENSED",
13
- "devDependencies": {
14
- "babel-eslint": "^8.2.3",
15
- "chai": "^4.1.2",
16
- "describe": "*",
17
- "eslint": "^4.12.0",
18
- "eslint-config-prettier": "^2.9.0",
19
- "eslint-config-standard": "^10.2.1",
20
- "eslint-plugin-import": "^2.8.0",
21
- "eslint-plugin-node": "^5.2.1",
22
- "eslint-plugin-prettier": "^2.6.0",
23
- "eslint-plugin-promise": "^3.6.0",
24
- "eslint-plugin-standard": "^3.0.1",
25
- "mocha": "^4.0.1",
26
- "nyc": "^11.3.0",
27
- "prettier": "^1.13.5",
28
- "sinon": "^4.1.2"
29
- },
30
11
  "dependencies": {
31
- "@bluedot-innovation/enums": "2.1.1",
32
- "deep-equal": "^1.0.1",
33
- "fast-deep-equal": "^2.0.1",
34
- "lodash.clonedeep": "4.5.0",
35
- "mongoose": "^4.13.9",
36
- "mongoose-json-patch": "^1.1.1",
37
- "uuid": "^3.1.0"
12
+ "mongoose": "^5.7.13",
13
+ "@bluedot-innovation/enums": "^1.0.2"
38
14
  }
39
15
  }
package/.eslintrc.js DELETED
@@ -1,42 +0,0 @@
1
- module.exports = {
2
- "extends" : [
3
- "prettier"
4
- ],
5
- "plugins": [
6
- "prettier"
7
- ],
8
- "parser": "babel-eslint",
9
- "parserOptions": {
10
- "ecmaVersion": 2015,
11
- "sourceType": "module",
12
- "ecmaFeatures": {
13
- "jsx": true
14
- }
15
- },
16
- "rules": {
17
- "indent": [
18
- 2,
19
- 4,
20
- {"SwitchCase": 1}
21
- ],
22
- "no-underscore-dangle": 0,
23
- "import/prefer-default-export": false,
24
- "arrow-body-style": 0
25
- },
26
- "env": {
27
- "es6": true,
28
- "browser": true,
29
- "node": true,
30
- "jest": true
31
- },
32
- "settings": {
33
- "import/resolver": {
34
- "webpack": {
35
- "config": "./webpack.config.js"
36
- }
37
- }
38
- },
39
- "globals": {
40
- "google": true
41
- }
42
- }
package/.gitlab-ci.yml DELETED
@@ -1,43 +0,0 @@
1
- # Official framework image. Look for the different tagged releases at:
2
- # https://hub.docker.com/r/library/node/tags/
3
- image: node:8
4
-
5
- before_script:
6
- - npm install
7
-
8
- # This folder is cached between builds
9
- # http://docs.gitlab.com/ce/ci/yaml/README.html#cache
10
- cache:
11
- paths:
12
- - node_modules/
13
-
14
- test:lint:
15
- tags:
16
- - infrastructure
17
- script:
18
- - npm run lint
19
-
20
- # Supported node versions can be found here:
21
- # https://github.com/nodejs/LTS#lts_schedule
22
- # jest does not support node < 4
23
- # https://facebook.github.io/jest/docs/troubleshooting.html#compatibility-issues
24
- test:node:8:
25
- tags:
26
- - infrastructure
27
- script:
28
- - npm run test:coverage
29
-
30
- # Publish tagged versions to npm
31
- publish:
32
- stage: deploy
33
- tags:
34
- - xcode9
35
- only:
36
- - tags
37
- - triggers
38
- #gitlab open issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/27818
39
- except:
40
- - /^(?!.*(master)$).*$/
41
- script:
42
- - echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'>.npmrc
43
- - npm publish
package/CHANGELOG.md DELETED
@@ -1,148 +0,0 @@
1
- ## 3.1.0
2
- - Rename `filters` to `conditions`
3
-
4
- ## 3.0.16
5
- - `timeActive` - Changed validations order
6
-
7
- ## 3.0.15
8
- - `webhooks` - Fixed webhooks validations
9
-
10
- ## 3.0.13
11
- - `Polygon` and `Polyline` "same vertices" check measures accurate to 6 decimal places only.
12
-
13
- ## 3.0.12
14
- - Enforce `beaconType` capitalization on `Beacon` model
15
-
16
- ## 3.0.11
17
- - Added `lastSyncTime` to the `project` model
18
-
19
- ## 3.0.10
20
- - Remove validations on `geometry`'s
21
- - Geofeatures moved to own separate folder
22
-
23
- ## 3.0.9
24
- - `dayRange` fixed validation issue
25
-
26
- ## 3.0.7
27
- - `proximityUUID` is now mandatory
28
-
29
- ## 3.0.6
30
- - `txPower` no longer mandatory
31
-
32
- ## 3.0.5
33
- - `User` - Remove password field
34
-
35
- ## 3.0.4
36
- - `Polygon` - disallow a vertices next 2 being the same
37
-
38
- ## 3.0.3
39
- - `BoundingBox` - disallow same values for `northEast` and `southWest`
40
- - `Polygon` - disallow a vertices next vertice being the same
41
-
42
- ## 3.0.2
43
- - Remove `_id`'s on the actions and filters (for real this time)
44
-
45
- ## 3.0.1
46
- - `DayRange` must have at least startTime or endTime or both
47
-
48
- ## 3.0.0
49
-
50
- - Breaking changes:
51
- - `bearing` -> `travelDirection`
52
- - `percentageCrossed` -> `travelPath`
53
- - `percentage.percentage` -> `travelPath.minimumGeofeaturesCrossed`
54
- - `timeOfDayRange` -> `timeActive`
55
- - `calendarDateRange` -> `dayRange`
56
- - Remove `state` from all subdocuments
57
- - Remove `creationTime` from all subdocuments
58
- - Remove `lastUpdateTime` from all subdocuments
59
- - Remove `_id` from all subdocuments EXCEPT geofeatures
60
- - Remove `description` from all subdocuments
61
- - Remove `__v` from all subdocuments
62
-
63
- ## 2.0.22
64
-
65
- - Allow 0 Major and Minor
66
-
67
- ## 2.0.21
68
-
69
- - Validation: Polygon needs 3 or more vertices
70
-
71
- ## 2.0.20
72
- - Added customData validation in helpers so that it can be imported in the UI
73
-
74
- ## 2.0.19
75
- - Added validations for keys in customData
76
-
77
- ## 2.0.18
78
- - `password` on `user` model no longer required. We will rely on cognito to throw an error
79
-
80
- ## 2.0.17
81
- - Tag model added
82
-
83
- ## 2.0.16
84
- - Don't enforce in `CalendarDateRangeFilter` that `endDate` is later than current date.
85
-
86
- ## 2.0.15
87
- - Update `bearingFilter` with new business logic.
88
-
89
- ## 2.0.14
90
- - Remove `password` from user model
91
-
92
- ## 2.0.13
93
- - Republish to bring changes from 2.0.11
94
-
95
- ## 2.0.12
96
- - Update `bearingFilter` to allow wrap around angles (e.g. 315deg & 45deg)
97
-
98
- ## 2.0.11
99
- - Added uuid as `_id` for user
100
-
101
- ## 2.0.10
102
- - Added indexes on beacons model
103
- - Added `apiKey` to project model (for backwards compatibility)
104
- - Added `customerApiKey` to account model (for backwards compatibility)
105
-
106
- ## 2.0.9
107
- - Validation on `projectPermissions` in user model
108
-
109
- ## 2.0.8
110
- - Removed `description` from `zone` model.
111
- - Added `triggerOnExit` to `zone` model.
112
-
113
- ## 2.0.7
114
- - All `guid`'s changed to `_id`'s
115
-
116
- ## 2.0.6
117
- - Added `geometry` to geofeature models
118
-
119
- ## 2.0.5
120
- - Beacon using a `location` property instead of `latitude` and `longitude` on the root
121
- - ZoneBeacon model inheriting from Beacon, adds `proximity` and `type`
122
- - Zone will use ZoneBeacon instead of Beacon model
123
- - Removed `proximity` from Beacon
124
-
125
- ## 2.0.4
126
- - customData no longer an array
127
- - add accountId to zones
128
-
129
- ## 2.0.3-alpha.1
130
- - Moved beacon back into geofeatures
131
- - Changed all geofeatures guids to id's
132
- - Updated creationTime/lastUpdateTime code on all models
133
-
134
- ## 2.0.2
135
- - Added patcher to beacon model
136
-
137
- ## 2.0.1
138
- - Beacon model: guid -> id
139
-
140
- ## 2.0.0-beta.14
141
- - Beacon model: Removed console.debug breaking lambda execution
142
-
143
- ## 2.0.0-beta.13
144
- - Beacon model: Added accountId
145
- - Zone model: Added beacons
146
-
147
- ## 2.0.0-beta.12
148
- - User model: `emailAddress` changed to `email`
package/README.MD DELETED
@@ -1,36 +0,0 @@
1
- #### Bluedot Innovation Public API
2
- ```
3
- Created by: Andrew Stirling
4
- Last update by: Ryan Kan / 0421772600 / ryan@bluedotinnovation.com
5
- Last updated: 4th December 2017
6
- ```
7
-
8
- Styleguide link [JSS Standard Javascript](https://standardjs.com/),
9
- implemented with [ESLint](https://github.com/standard/eslint-config-standard)
10
-
11
-
12
- Minimum test coverage enforced:
13
-
14
- ````--lines 90 --functions 90 --branches 70````
15
-
16
- To check test coverage:
17
-
18
- run `npm test:coverage`
19
-
20
- To lint:
21
-
22
- run `npm run lint`
23
-
24
- To check if your code will pass CI pipeline:
25
-
26
- run `npm run test:ci`
27
- aws apigateway put-integration \
28
- --rest-api-id api-id \
29
- --resource-id resource-id \
30
- --http-method POST \
31
- --type AWS \
32
- --integration-http-method POST \
33
- --uri arn:aws:apigateway:aws-region:lambda:path/2015-03-31/functions/arn:aws:lambda:aws-region:aws-acct-id:function:your-lambda-function-name/invocations
34
- To publish:
35
-
36
- run `npm version x.x.x`
@@ -1,12 +0,0 @@
1
- {
2
- "state": "ACTIVE",
3
- "lastUpdateTime": "2018-02-14T04:12:02.103Z",
4
- "creationTime": "2018-02-14T04:12:02.103Z",
5
- "name": "ABC Company",
6
- "createdBy": "b0824b76-ce73-4fcf-81f8-1b63edb1114e",
7
- "poiCredits": 23,
8
- "features": {
9
- "tags": true,
10
- "beacons": false
11
- }
12
- }
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- requiredFields: ['name'],
3
- customValidators: [
4
- {name: 'poiCredits', invalidInputs: ['a string']},
5
- {name: 'creationTime', invalidInputs: ['21/07/2017', 'thursday']},
6
- {name: 'lastUpdateTime', invalidInputs: ['21/07/2017', 'saturday']}
7
- ]
8
- }
@@ -1,83 +0,0 @@
1
- let mongoose = require('mongoose')
2
-
3
- let AccountModel = require('../../Models').Account(mongoose)
4
- let AccountModelBuiltInMongoose = require('../../Models').Account()
5
- let testCase = require('mocha').describe
6
- let assertions = require('mocha').it
7
- let rules = require('./account.rules.js')
8
- let chai = require('chai')
9
- let assert = chai.assert
10
- let mocha = require('mocha')
11
- let beforeEach = mocha.beforeEach
12
-
13
- let account
14
-
15
- beforeEach(() => {
16
- account = JSON.parse(JSON.stringify(require('./account.data.json')))
17
- })
18
-
19
- testCase('Account', () => {
20
- testCase('Valid Account ', () => {
21
- assertions('should validate a valid account when initializing the model with an external mongoose instance', (done) => {
22
- let Account = new AccountModel(account)
23
-
24
- Account.validate((err, res) => {
25
- assert.notExists(res)
26
- assert(err === null, 'err equals null')
27
- done()
28
- })
29
- })
30
-
31
- assertions('should validate a valid account', (done) => {
32
- let Account = new AccountModelBuiltInMongoose(account)
33
-
34
- Account.validate((err, res) => {
35
- assert.notExists(res)
36
- assert(err === null, 'err equals null')
37
- done()
38
- })
39
- })
40
- })
41
-
42
- testCase('Invalid Account', () => {
43
- testCase('recursive property check', () => {
44
- let requiredFields = rules.requiredFields
45
- requiredFields.forEach((requiredField) => {
46
- assertions(`should throw an error with property '${requiredField}' if '${requiredField}' is not present`, (done) => {
47
- account = JSON.parse(JSON.stringify(account))
48
- delete account[requiredField]
49
- let Account = new AccountModel(account)
50
- Account.validate((err, res) => {
51
- assert.notExists(res)
52
- assert.exists(err, 'err object should exist')
53
- assert.isObject(err)
54
- assert.nestedProperty(err, `errors.${requiredField}`, `error should have a ${requiredField} property`)
55
- done()
56
- })
57
- })
58
- })
59
- })
60
- })
61
-
62
- testCase('recursive invalid entry check', () => {
63
- const { customValidators } = rules
64
-
65
- customValidators.forEach((customValidator) => {
66
- customValidator.invalidInputs.forEach((invalidInput) => {
67
- assertions(`should throw an error with property '${customValidator.name}' if '${customValidator.name}' is invalid => ${customValidator.name} = ${invalidInput}`, (done) => {
68
- account = JSON.parse(JSON.stringify(account))
69
- account[customValidator.name] = invalidInput
70
- let Account = new AccountModel(account)
71
-
72
- Account.validate((err, res) => {
73
- assert.notExists(res)
74
- assert.exists(err, 'err object should exist')
75
- assert.isObject(err)
76
- assert.nestedProperty(err, `errors.${customValidator.name}`, `error should have a ${customValidator.name} property`)
77
- done()
78
- })
79
- })
80
- })
81
- })
82
- })
83
- })
@@ -1,5 +0,0 @@
1
- {
2
- "type": "message",
3
- "message": "hello",
4
- "title": "hello"
5
- }
@@ -1,3 +0,0 @@
1
- {
2
- "requiredFields":["message", "title"]
3
- }