@bluedot-innovation/models 3.1.1 → 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.
- package/Models.js +10 -55
- package/models/AdminPortalUser.js +11 -10
- package/models/AdminUser.js +10 -0
- package/models/Application.js +38 -0
- package/models/ApplicationNotificationAction.js +30 -0
- package/models/ApplicationUsage.js +11 -0
- package/models/Beacon.js +32 -84
- package/models/BeaconFilter.js +23 -0
- package/models/BearingFilter.js +19 -0
- package/models/BoundingBox.js +17 -0
- package/models/Circle.js +21 -0
- package/models/ConfigurationParameters.js +20 -0
- package/models/Contract.js +38 -37
- package/models/Customer.js +38 -0
- package/models/CustomerLogin.js +10 -9
- package/models/DBEvent.js +14 -13
- package/models/DailyStats.js +7 -7
- package/models/DateRangeFilter.js +20 -0
- package/models/DeviceRulesRequest.js +28 -27
- package/models/Fence.js +21 -0
- package/models/FormattedBeacon.js +16 -0
- package/models/FormattedCircle.js +12 -0
- package/models/FormattedConditions.js +11 -0
- package/models/FormattedDateRange.js +11 -0
- package/models/FormattedPercentageCrossed.js +12 -0
- package/models/FormattedPoint.js +10 -0
- package/models/FormattedPolygon.js +11 -0
- package/models/FormattedPolyline.js +11 -0
- package/models/FormattedRectangle.js +12 -0
- package/models/FormattedTimeActive.js +17 -0
- package/models/FormattedZone.js +28 -0
- package/models/GeoFence.js +23 -0
- package/models/Geofeature.js +26 -0
- package/models/MessageAction.js +26 -28
- package/models/MonthlyStats.js +19 -35
- package/models/NotificationLogEntry.js +8 -7
- package/models/POILocation.js +7 -6
- package/models/POILookup.js +9 -8
- package/models/POIResult.js +8 -7
- package/models/PartnerCustomer.js +13 -12
- package/models/PartnerPasswordReset.js +9 -8
- package/models/PartnerUser.js +11 -10
- package/models/Partners.js +12 -11
- package/models/PercentageCrossedFilter.js +19 -0
- package/models/Point.js +20 -0
- package/models/Polygon.js +18 -0
- package/models/Polyline.js +18 -0
- package/models/PropertyMapping.js +17 -0
- package/models/Reference.js +19 -0
- package/models/RuleRequestAggregation.js +17 -33
- package/models/SequenceFilter.js +18 -0
- package/models/SimpleCheckInZone.js +29 -0
- package/models/SingleUseToken.js +8 -7
- package/models/SoundAction.js +28 -0
- package/models/SpeedFilter.js +19 -0
- package/models/TestDevice.js +12 -11
- package/models/TestDeviceCluster.js +10 -9
- package/models/TestInstance.js +10 -9
- package/models/TestScenario.js +10 -9
- package/models/TimeOfDayRange.js +16 -16
- package/models/TimeOfDayRangeFilter.js +19 -0
- package/models/URLAction.js +31 -0
- package/models/VibrationAction.js +28 -0
- package/models/ZoneUIState.js +18 -18
- package/models/property.js +25 -0
- package/package-lock.json.bak +170 -0
- package/package.json +6 -30
- package/.eslintrc.js +0 -42
- package/.gitlab-ci.yml +0 -43
- package/CHANGELOG.md +0 -152
- package/README.MD +0 -36
- package/__tests__/account/account.data.json +0 -12
- package/__tests__/account/account.rules.js +0 -8
- package/__tests__/account/account.spec.js +0 -83
- package/__tests__/action/message/messageAction.data.json +0 -5
- package/__tests__/action/message/messageAction.rules.json +0 -3
- package/__tests__/action/message/messageAction.spec.js +0 -61
- package/__tests__/action/url/urlAction.data.json +0 -4
- package/__tests__/action/url/urlAction.rules.json +0 -3
- package/__tests__/action/url/urlAction.spec.js +0 -74
- package/__tests__/beacon/beacon.data.json +0 -15
- package/__tests__/beacon/beacon.rules.json +0 -13
- package/__tests__/beacon/beacon.spec.js +0 -104
- package/__tests__/condition/beacon/beaconFilter.data.json +0 -1
- package/__tests__/condition/beacon/beaconFilter.rules.json +0 -3
- package/__tests__/condition/beacon/beaconFilter.spec.js +0 -1
- package/__tests__/condition/dayRange/dayRange.data.json +0 -5
- package/__tests__/condition/dayRange/dayRange.rules.json +0 -3
- package/__tests__/condition/dayRange/dayRange.spec.js +0 -74
- package/__tests__/condition/percentageCrossed/travelPath.data.json +0 -5
- package/__tests__/condition/percentageCrossed/travelPath.rules.json +0 -3
- package/__tests__/condition/percentageCrossed/travelPath.spec.js +0 -62
- package/__tests__/condition/speed/speed.data.json +0 -5
- package/__tests__/condition/speed/speed.rules.json +0 -3
- package/__tests__/condition/speed/speed.spec.js +0 -73
- package/__tests__/condition/timeActive/timeActive.data.json +0 -5
- package/__tests__/condition/timeActive/timeActive.rules.json +0 -7
- package/__tests__/condition/timeActive/timeActive.spec.js +0 -94
- package/__tests__/condition/travelDirection/travelDirection.data.json +0 -5
- package/__tests__/condition/travelDirection/travelDirection.rules.json +0 -3
- package/__tests__/condition/travelDirection/travelDirection.spec.js +0 -132
- package/__tests__/dailyStats/checkDailyStats.js +0 -31
- package/__tests__/geofeature/boundingBox/boundingBox.data.json +0 -12
- package/__tests__/geofeature/boundingBox/boundingBox.rules.json +0 -3
- package/__tests__/geofeature/boundingBox/boundingBox.spec.js +0 -78
- package/__tests__/geofeature/circle/circle.data.json +0 -9
- package/__tests__/geofeature/circle/circle.rules.json +0 -3
- package/__tests__/geofeature/circle/circle.spec.js +0 -71
- package/__tests__/geofeature/geoline/geoline.data.json +0 -46
- package/__tests__/geofeature/geoline/geoline.rules.json +0 -3
- package/__tests__/geofeature/geoline/geoline.spec.js +0 -70
- package/__tests__/geofeature/polygon/polygon.data.json +0 -46
- package/__tests__/geofeature/polygon/polygon.rules.json +0 -3
- package/__tests__/geofeature/polygon/polygon.spec.js +0 -127
- package/__tests__/geofeature/zoneBeacon/zoneBeacon.data.json +0 -16
- package/__tests__/geofeature/zoneBeacon/zoneBeacon.rules.json +0 -13
- package/__tests__/geofeature/zoneBeacon/zoneBeacon.spec.js +0 -62
- package/__tests__/monthlyStats/monthlyStats.data.json +0 -29
- package/__tests__/monthlyStats/monthlyStats.spec.js +0 -66
- package/__tests__/project/project.data.json +0 -18
- package/__tests__/project/project.rules.json +0 -9
- package/__tests__/project/project.spec.js +0 -81
- package/__tests__/ruleRequestAggregation/ruleRequestAggregation.data.json +0 -8
- package/__tests__/ruleRequestAggregation/ruleRequestAggregation.spec.js +0 -69
- package/__tests__/setup.js +0 -7
- package/__tests__/user/user.data.js +0 -19
- package/__tests__/user/user.rules.js +0 -8
- package/__tests__/user/user.spec.js +0 -130
- package/__tests__/utils/utils.spec.js +0 -24
- package/__tests__/zone/zone.action.spec.js +0 -50
- package/__tests__/zone/zone.condition.spec.js +0 -76
- package/__tests__/zone/zone.data.json +0 -157
- package/__tests__/zone/zone.geofeatures.spec.js +0 -75
- package/__tests__/zone/zone.spec.js +0 -134
- package/constants/errorMessages.js +0 -2
- package/helpers.js +0 -102
- package/models/Account.js +0 -50
- package/models/Project.js +0 -55
- package/models/UrlAction.js +0 -46
- package/models/User.js +0 -61
- package/models/Zone.js +0 -123
- package/models/conditions/DayRange.js +0 -52
- package/models/conditions/Speed.js +0 -42
- package/models/conditions/TimeActive.js +0 -50
- package/models/conditions/TravelDirection.js +0 -67
- package/models/conditions/TravelPath.js +0 -36
- package/models/geofeatures/BoundingBox.js +0 -44
- package/models/geofeatures/Circle.js +0 -39
- package/models/geofeatures/Geoline.js +0 -34
- package/models/geofeatures/Polygon.js +0 -45
- package/models/geofeatures/ZoneBeacon.js +0 -28
- package/schemas/MultiLineStringGeometry.js +0 -14
- package/schemas/Point.js +0 -13
- package/schemas/PointGeometry.js +0 -14
- package/schemas/PolygonGeometry.js +0 -14
- package/schemas/ProjectPermission.js +0 -21
- package/schemas/Webhook.js +0 -22
- package/utils/index.js +0 -39
- package/validators/checkDistanceBetweenVertices.js +0 -21
- package/yarn.lock +0 -2796
package/models/ZoneUIState.js
CHANGED
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
* Copyright : Bluedot Innovations.
|
|
4
4
|
* Owner :
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
var mongoose = require('mongoose'),
|
|
7
|
+
Schema = mongoose.Schema;
|
|
8
|
+
var StateEnum = require('@bluedot-innovation/enums').StateEnum;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
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
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "",
|
|
4
5
|
"main": "Models.js",
|
|
5
6
|
"scripts": {
|
|
6
|
-
"
|
|
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
|
-
"
|
|
32
|
-
"
|
|
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,152 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
## 3.1.1
|
|
3
|
-
- Rename `Polyline` to `Geoline`
|
|
4
|
-
|
|
5
|
-
## 3.1.0
|
|
6
|
-
- Rename `filters` to `conditions`
|
|
7
|
-
|
|
8
|
-
## 3.0.16
|
|
9
|
-
- `timeActive` - Changed validations order
|
|
10
|
-
|
|
11
|
-
## 3.0.15
|
|
12
|
-
- `webhooks` - Fixed webhooks validations
|
|
13
|
-
|
|
14
|
-
## 3.0.13
|
|
15
|
-
- `Polygon` and `Polyline` "same vertices" check measures accurate to 6 decimal places only.
|
|
16
|
-
|
|
17
|
-
## 3.0.12
|
|
18
|
-
- Enforce `beaconType` capitalization on `Beacon` model
|
|
19
|
-
|
|
20
|
-
## 3.0.11
|
|
21
|
-
- Added `lastSyncTime` to the `project` model
|
|
22
|
-
|
|
23
|
-
## 3.0.10
|
|
24
|
-
- Remove validations on `geometry`'s
|
|
25
|
-
- Geofeatures moved to own separate folder
|
|
26
|
-
|
|
27
|
-
## 3.0.9
|
|
28
|
-
- `dayRange` fixed validation issue
|
|
29
|
-
|
|
30
|
-
## 3.0.7
|
|
31
|
-
- `proximityUUID` is now mandatory
|
|
32
|
-
|
|
33
|
-
## 3.0.6
|
|
34
|
-
- `txPower` no longer mandatory
|
|
35
|
-
|
|
36
|
-
## 3.0.5
|
|
37
|
-
- `User` - Remove password field
|
|
38
|
-
|
|
39
|
-
## 3.0.4
|
|
40
|
-
- `Polygon` - disallow a vertices next 2 being the same
|
|
41
|
-
|
|
42
|
-
## 3.0.3
|
|
43
|
-
- `BoundingBox` - disallow same values for `northEast` and `southWest`
|
|
44
|
-
- `Polygon` - disallow a vertices next vertice being the same
|
|
45
|
-
|
|
46
|
-
## 3.0.2
|
|
47
|
-
- Remove `_id`'s on the actions and filters (for real this time)
|
|
48
|
-
|
|
49
|
-
## 3.0.1
|
|
50
|
-
- `DayRange` must have at least startTime or endTime or both
|
|
51
|
-
|
|
52
|
-
## 3.0.0
|
|
53
|
-
|
|
54
|
-
- Breaking changes:
|
|
55
|
-
- `bearing` -> `travelDirection`
|
|
56
|
-
- `percentageCrossed` -> `travelPath`
|
|
57
|
-
- `percentage.percentage` -> `travelPath.minimumGeofeaturesCrossed`
|
|
58
|
-
- `timeOfDayRange` -> `timeActive`
|
|
59
|
-
- `calendarDateRange` -> `dayRange`
|
|
60
|
-
- Remove `state` from all subdocuments
|
|
61
|
-
- Remove `creationTime` from all subdocuments
|
|
62
|
-
- Remove `lastUpdateTime` from all subdocuments
|
|
63
|
-
- Remove `_id` from all subdocuments EXCEPT geofeatures
|
|
64
|
-
- Remove `description` from all subdocuments
|
|
65
|
-
- Remove `__v` from all subdocuments
|
|
66
|
-
|
|
67
|
-
## 2.0.22
|
|
68
|
-
|
|
69
|
-
- Allow 0 Major and Minor
|
|
70
|
-
|
|
71
|
-
## 2.0.21
|
|
72
|
-
|
|
73
|
-
- Validation: Polygon needs 3 or more vertices
|
|
74
|
-
|
|
75
|
-
## 2.0.20
|
|
76
|
-
- Added customData validation in helpers so that it can be imported in the UI
|
|
77
|
-
|
|
78
|
-
## 2.0.19
|
|
79
|
-
- Added validations for keys in customData
|
|
80
|
-
|
|
81
|
-
## 2.0.18
|
|
82
|
-
- `password` on `user` model no longer required. We will rely on cognito to throw an error
|
|
83
|
-
|
|
84
|
-
## 2.0.17
|
|
85
|
-
- Tag model added
|
|
86
|
-
|
|
87
|
-
## 2.0.16
|
|
88
|
-
- Don't enforce in `CalendarDateRangeFilter` that `endDate` is later than current date.
|
|
89
|
-
|
|
90
|
-
## 2.0.15
|
|
91
|
-
- Update `bearingFilter` with new business logic.
|
|
92
|
-
|
|
93
|
-
## 2.0.14
|
|
94
|
-
- Remove `password` from user model
|
|
95
|
-
|
|
96
|
-
## 2.0.13
|
|
97
|
-
- Republish to bring changes from 2.0.11
|
|
98
|
-
|
|
99
|
-
## 2.0.12
|
|
100
|
-
- Update `bearingFilter` to allow wrap around angles (e.g. 315deg & 45deg)
|
|
101
|
-
|
|
102
|
-
## 2.0.11
|
|
103
|
-
- Added uuid as `_id` for user
|
|
104
|
-
|
|
105
|
-
## 2.0.10
|
|
106
|
-
- Added indexes on beacons model
|
|
107
|
-
- Added `apiKey` to project model (for backwards compatibility)
|
|
108
|
-
- Added `customerApiKey` to account model (for backwards compatibility)
|
|
109
|
-
|
|
110
|
-
## 2.0.9
|
|
111
|
-
- Validation on `projectPermissions` in user model
|
|
112
|
-
|
|
113
|
-
## 2.0.8
|
|
114
|
-
- Removed `description` from `zone` model.
|
|
115
|
-
- Added `triggerOnExit` to `zone` model.
|
|
116
|
-
|
|
117
|
-
## 2.0.7
|
|
118
|
-
- All `guid`'s changed to `_id`'s
|
|
119
|
-
|
|
120
|
-
## 2.0.6
|
|
121
|
-
- Added `geometry` to geofeature models
|
|
122
|
-
|
|
123
|
-
## 2.0.5
|
|
124
|
-
- Beacon using a `location` property instead of `latitude` and `longitude` on the root
|
|
125
|
-
- ZoneBeacon model inheriting from Beacon, adds `proximity` and `type`
|
|
126
|
-
- Zone will use ZoneBeacon instead of Beacon model
|
|
127
|
-
- Removed `proximity` from Beacon
|
|
128
|
-
|
|
129
|
-
## 2.0.4
|
|
130
|
-
- customData no longer an array
|
|
131
|
-
- add accountId to zones
|
|
132
|
-
|
|
133
|
-
## 2.0.3-alpha.1
|
|
134
|
-
- Moved beacon back into geofeatures
|
|
135
|
-
- Changed all geofeatures guids to id's
|
|
136
|
-
- Updated creationTime/lastUpdateTime code on all models
|
|
137
|
-
|
|
138
|
-
## 2.0.2
|
|
139
|
-
- Added patcher to beacon model
|
|
140
|
-
|
|
141
|
-
## 2.0.1
|
|
142
|
-
- Beacon model: guid -> id
|
|
143
|
-
|
|
144
|
-
## 2.0.0-beta.14
|
|
145
|
-
- Beacon model: Removed console.debug breaking lambda execution
|
|
146
|
-
|
|
147
|
-
## 2.0.0-beta.13
|
|
148
|
-
- Beacon model: Added accountId
|
|
149
|
-
- Zone model: Added beacons
|
|
150
|
-
|
|
151
|
-
## 2.0.0-beta.12
|
|
152
|
-
- 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
|
-
})
|