@kalisio/kdk 2.5.2 → 2.5.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/core/client/components/input/KShapePicker.vue +4 -4
- package/coverage/core/api/application.js.html +344 -344
- package/coverage/core/api/authentication.js.html +79 -79
- package/coverage/core/api/db.js.html +167 -167
- package/coverage/core/api/hooks/hooks.authentication.js.html +12 -12
- package/coverage/core/api/hooks/hooks.authorisations.js.html +166 -163
- package/coverage/core/api/hooks/hooks.groups.js.html +1 -1
- package/coverage/core/api/hooks/hooks.logger.js.html +18 -18
- package/coverage/core/api/hooks/hooks.model.js.html +280 -268
- package/coverage/core/api/hooks/hooks.organisations.js.html +1 -1
- package/coverage/core/api/hooks/hooks.push.js.html +12 -12
- package/coverage/core/api/hooks/hooks.query.js.html +92 -92
- package/coverage/core/api/hooks/hooks.schemas.js.html +13 -13
- package/coverage/core/api/hooks/hooks.service.js.html +28 -28
- package/coverage/core/api/hooks/hooks.storage.js.html +7 -7
- package/coverage/core/api/hooks/hooks.users.js.html +48 -48
- package/coverage/core/api/hooks/index.html +49 -49
- package/coverage/core/api/hooks/index.js.html +11 -11
- package/coverage/core/api/index.html +42 -42
- package/coverage/core/api/index.js.html +22 -22
- package/coverage/core/api/marshall.js.html +127 -127
- package/coverage/core/api/models/groups.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/index.html +1 -1
- package/coverage/core/api/models/messages.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/organisations.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/tags.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/users.model.mongodb.js.html +11 -11
- package/coverage/core/api/services/account/account.hooks.js.html +42 -42
- package/coverage/core/api/services/account/account.service.js.html +34 -34
- package/coverage/core/api/services/account/index.html +1 -1
- package/coverage/core/api/services/authorisations/authorisations.hooks.js.html +34 -34
- package/coverage/core/api/services/authorisations/authorisations.service.js.html +108 -120
- package/coverage/core/api/services/authorisations/index.html +19 -19
- package/coverage/core/api/services/databases/databases.hooks.js.html +1 -1
- package/coverage/core/api/services/databases/databases.service.js.html +1 -1
- package/coverage/core/api/services/databases/index.html +1 -1
- package/coverage/core/api/services/groups/groups.hooks.js.html +1 -1
- package/coverage/core/api/services/groups/index.html +1 -1
- package/coverage/core/api/services/import-export/import-export.hooks.js.html +1 -1
- package/coverage/core/api/services/import-export/import-export.service.js.html +1 -1
- package/coverage/core/api/services/import-export/index.html +1 -1
- package/coverage/core/api/services/index.html +15 -15
- package/coverage/core/api/services/index.js.html +97 -85
- package/coverage/core/api/services/mailer/index.html +1 -1
- package/coverage/core/api/services/mailer/mailer.hooks.js.html +1 -1
- package/coverage/core/api/services/mailer/mailer.service.js.html +1 -1
- package/coverage/core/api/services/messages/index.html +5 -5
- package/coverage/core/api/services/messages/messages.hooks.js.html +11 -8
- package/coverage/core/api/services/organisations/index.html +1 -1
- package/coverage/core/api/services/organisations/organisations.hooks.js.html +1 -1
- package/coverage/core/api/services/organisations/organisations.service.js.html +1 -1
- package/coverage/core/api/services/push/index.html +1 -1
- package/coverage/core/api/services/push/push.hooks.js.html +1 -1
- package/coverage/core/api/services/push/push.service.js.html +1 -1
- package/coverage/core/api/services/storage/index.html +1 -1
- package/coverage/core/api/services/storage/storage.hooks.js.html +36 -36
- package/coverage/core/api/services/storage/storage.service.js.html +30 -30
- package/coverage/core/api/services/tags/index.html +1 -1
- package/coverage/core/api/services/tags/tags.hooks.js.html +1 -1
- package/coverage/core/api/services/users/index.html +7 -7
- package/coverage/core/api/services/users/users.hooks.js.html +83 -80
- package/coverage/core/api/services/users/users.service.js.html +4 -4
- package/coverage/core/api/utils.js.html +1 -1
- package/coverage/core/common/errors.js.html +2 -2
- package/coverage/core/common/index.html +30 -30
- package/coverage/core/common/index.js.html +11 -11
- package/coverage/core/common/permissions.js.html +187 -187
- package/coverage/core/common/schema.js.html +26 -26
- package/coverage/core/common/utils.js.html +61 -61
- package/coverage/core/common/utils.offline.js.html +6 -6
- package/coverage/index.html +179 -164
- package/coverage/lcov-report/core/api/application.js.html +344 -344
- package/coverage/lcov-report/core/api/authentication.js.html +79 -79
- package/coverage/lcov-report/core/api/db.js.html +167 -167
- package/coverage/lcov-report/core/api/hooks/hooks.authentication.js.html +12 -12
- package/coverage/lcov-report/core/api/hooks/hooks.authorisations.js.html +166 -163
- package/coverage/lcov-report/core/api/hooks/hooks.groups.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.logger.js.html +18 -18
- package/coverage/lcov-report/core/api/hooks/hooks.model.js.html +280 -268
- package/coverage/lcov-report/core/api/hooks/hooks.organisations.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.push.js.html +12 -12
- package/coverage/lcov-report/core/api/hooks/hooks.query.js.html +92 -92
- package/coverage/lcov-report/core/api/hooks/hooks.schemas.js.html +13 -13
- package/coverage/lcov-report/core/api/hooks/hooks.service.js.html +28 -28
- package/coverage/lcov-report/core/api/hooks/hooks.storage.js.html +7 -7
- package/coverage/lcov-report/core/api/hooks/hooks.users.js.html +48 -48
- package/coverage/lcov-report/core/api/hooks/index.html +49 -49
- package/coverage/lcov-report/core/api/hooks/index.js.html +11 -11
- package/coverage/lcov-report/core/api/index.html +42 -42
- package/coverage/lcov-report/core/api/index.js.html +22 -22
- package/coverage/lcov-report/core/api/marshall.js.html +127 -127
- package/coverage/lcov-report/core/api/models/groups.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/index.html +1 -1
- package/coverage/lcov-report/core/api/models/messages.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/organisations.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/tags.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/users.model.mongodb.js.html +11 -11
- package/coverage/lcov-report/core/api/services/account/account.hooks.js.html +42 -42
- package/coverage/lcov-report/core/api/services/account/account.service.js.html +34 -34
- package/coverage/lcov-report/core/api/services/account/index.html +1 -1
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.hooks.js.html +34 -34
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.service.js.html +108 -120
- package/coverage/lcov-report/core/api/services/authorisations/index.html +19 -19
- package/coverage/lcov-report/core/api/services/databases/databases.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/databases/databases.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/databases/index.html +1 -1
- package/coverage/lcov-report/core/api/services/groups/groups.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/groups/index.html +1 -1
- package/coverage/lcov-report/core/api/services/import-export/import-export.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/import-export/import-export.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/import-export/index.html +1 -1
- package/coverage/lcov-report/core/api/services/index.html +15 -15
- package/coverage/lcov-report/core/api/services/index.js.html +97 -85
- package/coverage/lcov-report/core/api/services/mailer/index.html +1 -1
- package/coverage/lcov-report/core/api/services/mailer/mailer.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/mailer/mailer.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/messages/index.html +5 -5
- package/coverage/lcov-report/core/api/services/messages/messages.hooks.js.html +11 -8
- package/coverage/lcov-report/core/api/services/organisations/index.html +1 -1
- package/coverage/lcov-report/core/api/services/organisations/organisations.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/organisations/organisations.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/push/index.html +1 -1
- package/coverage/lcov-report/core/api/services/push/push.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/push/push.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/storage/index.html +1 -1
- package/coverage/lcov-report/core/api/services/storage/storage.hooks.js.html +36 -36
- package/coverage/lcov-report/core/api/services/storage/storage.service.js.html +30 -30
- package/coverage/lcov-report/core/api/services/tags/index.html +1 -1
- package/coverage/lcov-report/core/api/services/tags/tags.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/users/index.html +7 -7
- package/coverage/lcov-report/core/api/services/users/users.hooks.js.html +83 -80
- package/coverage/lcov-report/core/api/services/users/users.service.js.html +4 -4
- package/coverage/lcov-report/core/api/utils.js.html +1 -1
- package/coverage/lcov-report/core/common/errors.js.html +2 -2
- package/coverage/lcov-report/core/common/index.html +30 -30
- package/coverage/lcov-report/core/common/index.js.html +11 -11
- package/coverage/lcov-report/core/common/permissions.js.html +187 -187
- package/coverage/lcov-report/core/common/schema.js.html +26 -26
- package/coverage/lcov-report/core/common/utils.js.html +61 -61
- package/coverage/lcov-report/core/common/utils.offline.js.html +6 -6
- package/coverage/lcov-report/index.html +179 -164
- package/coverage/lcov-report/map/api/hooks/hooks.catalog.js.html +348 -258
- package/coverage/lcov-report/map/api/hooks/hooks.features.js.html +218 -218
- package/coverage/lcov-report/map/api/hooks/hooks.query.js.html +795 -810
- package/coverage/lcov-report/map/api/hooks/index.html +54 -54
- package/coverage/lcov-report/map/api/hooks/index.js.html +16 -16
- package/coverage/lcov-report/map/api/index.html +32 -32
- package/coverage/lcov-report/map/api/index.js.html +46 -46
- package/coverage/lcov-report/map/api/marshall.js.html +72 -72
- package/coverage/lcov-report/map/api/models/alerts.model.mongodb.js.html +24 -24
- package/coverage/lcov-report/map/api/models/catalog.model.mongodb.js.html +69 -27
- package/coverage/lcov-report/map/api/models/features.model.mongodb.js.html +80 -80
- package/coverage/lcov-report/map/api/models/index.html +69 -54
- package/coverage/lcov-report/map/api/models/projects.model.mongodb.js.html +26 -26
- package/coverage/lcov-report/map/api/models/styles.model.mongodb.js.html +112 -0
- package/coverage/lcov-report/map/api/services/alerts/alerts.hooks.js.html +136 -136
- package/coverage/lcov-report/map/api/services/alerts/alerts.service.js.html +343 -343
- package/coverage/lcov-report/map/api/services/alerts/index.html +32 -32
- package/coverage/lcov-report/map/api/services/catalog/catalog.hooks.js.html +177 -162
- package/coverage/lcov-report/map/api/services/catalog/index.html +21 -21
- package/coverage/lcov-report/map/api/services/daptiles/daptiles.service.js.html +1 -1
- package/coverage/lcov-report/map/api/services/daptiles/index.html +1 -1
- package/coverage/lcov-report/map/api/services/features/features.hooks.js.html +160 -160
- package/coverage/lcov-report/map/api/services/features/features.service.js.html +117 -117
- package/coverage/lcov-report/map/api/services/features/index.html +31 -31
- package/coverage/lcov-report/map/api/services/index.html +21 -21
- package/coverage/lcov-report/map/api/services/index.js.html +404 -296
- package/coverage/lcov-report/map/api/services/projects/index.html +21 -21
- package/coverage/lcov-report/map/api/services/projects/projects.hooks.js.html +237 -237
- package/coverage/lcov-report/map/api/services/styles/index.html +116 -0
- package/coverage/lcov-report/map/api/services/styles/styles.hooks.js.html +196 -0
- package/coverage/lcov-report/map/common/dynamic-grid-source.js.html +68 -68
- package/coverage/lcov-report/map/common/errors.js.html +16 -16
- package/coverage/lcov-report/map/common/geotiff-grid-source.js.html +267 -267
- package/coverage/lcov-report/map/common/grid.js.html +554 -554
- package/coverage/lcov-report/map/common/index.html +158 -158
- package/coverage/lcov-report/map/common/index.js.html +68 -68
- package/coverage/lcov-report/map/common/meteo-model-grid-source.js.html +73 -73
- package/coverage/lcov-report/map/common/moment-utils.js.html +18 -18
- package/coverage/lcov-report/map/common/opendap-grid-source.js.html +484 -484
- package/coverage/lcov-report/map/common/opendap-utils.js.html +353 -353
- package/coverage/lcov-report/map/common/permissions.js.html +42 -36
- package/coverage/lcov-report/map/common/time-based-grid-source.js.html +59 -59
- package/coverage/lcov-report/map/common/tms-utils.js.html +6 -6
- package/coverage/lcov-report/map/common/wcs-grid-source.js.html +190 -190
- package/coverage/lcov-report/map/common/wcs-utils.js.html +339 -339
- package/coverage/lcov-report/map/common/weacast-grid-source.js.html +345 -345
- package/coverage/lcov-report/map/common/wfs-utils.js.html +11 -11
- package/coverage/lcov-report/map/common/wms-utils.js.html +8 -8
- package/coverage/lcov-report/map/common/wmts-utils.js.html +7 -7
- package/coverage/lcov.info +7022 -5894
- package/coverage/map/api/hooks/hooks.catalog.js.html +348 -258
- package/coverage/map/api/hooks/hooks.features.js.html +218 -218
- package/coverage/map/api/hooks/hooks.query.js.html +795 -810
- package/coverage/map/api/hooks/index.html +54 -54
- package/coverage/map/api/hooks/index.js.html +16 -16
- package/coverage/map/api/index.html +32 -32
- package/coverage/map/api/index.js.html +46 -46
- package/coverage/map/api/marshall.js.html +72 -72
- package/coverage/map/api/models/alerts.model.mongodb.js.html +24 -24
- package/coverage/map/api/models/catalog.model.mongodb.js.html +69 -27
- package/coverage/map/api/models/features.model.mongodb.js.html +80 -80
- package/coverage/map/api/models/index.html +69 -54
- package/coverage/map/api/models/projects.model.mongodb.js.html +26 -26
- package/coverage/map/api/models/styles.model.mongodb.js.html +112 -0
- package/coverage/map/api/services/alerts/alerts.hooks.js.html +136 -136
- package/coverage/map/api/services/alerts/alerts.service.js.html +343 -343
- package/coverage/map/api/services/alerts/index.html +32 -32
- package/coverage/map/api/services/catalog/catalog.hooks.js.html +177 -162
- package/coverage/map/api/services/catalog/index.html +21 -21
- package/coverage/map/api/services/daptiles/daptiles.service.js.html +1 -1
- package/coverage/map/api/services/daptiles/index.html +1 -1
- package/coverage/map/api/services/features/features.hooks.js.html +160 -160
- package/coverage/map/api/services/features/features.service.js.html +117 -117
- package/coverage/map/api/services/features/index.html +31 -31
- package/coverage/map/api/services/index.html +21 -21
- package/coverage/map/api/services/index.js.html +404 -296
- package/coverage/map/api/services/projects/index.html +21 -21
- package/coverage/map/api/services/projects/projects.hooks.js.html +237 -237
- package/coverage/map/api/services/styles/index.html +116 -0
- package/coverage/map/api/services/styles/styles.hooks.js.html +196 -0
- package/coverage/map/common/dynamic-grid-source.js.html +68 -68
- package/coverage/map/common/errors.js.html +16 -16
- package/coverage/map/common/geotiff-grid-source.js.html +267 -267
- package/coverage/map/common/grid.js.html +554 -554
- package/coverage/map/common/index.html +158 -158
- package/coverage/map/common/index.js.html +68 -68
- package/coverage/map/common/meteo-model-grid-source.js.html +73 -73
- package/coverage/map/common/moment-utils.js.html +18 -18
- package/coverage/map/common/opendap-grid-source.js.html +484 -484
- package/coverage/map/common/opendap-utils.js.html +353 -353
- package/coverage/map/common/permissions.js.html +42 -36
- package/coverage/map/common/time-based-grid-source.js.html +59 -59
- package/coverage/map/common/tms-utils.js.html +6 -6
- package/coverage/map/common/wcs-grid-source.js.html +190 -190
- package/coverage/map/common/wcs-utils.js.html +339 -339
- package/coverage/map/common/weacast-grid-source.js.html +345 -345
- package/coverage/map/common/wfs-utils.js.html +11 -11
- package/coverage/map/common/wms-utils.js.html +8 -8
- package/coverage/map/common/wmts-utils.js.html +7 -7
- package/coverage/tmp/coverage-151198-1753351220086-0.json +1 -0
- package/coverage/tmp/coverage-151210-1753351220070-0.json +1 -0
- package/coverage/tmp/coverage-151221-1753351129816-0.json +1 -0
- package/coverage/tmp/coverage-151233-1753351129803-0.json +1 -0
- package/coverage/tmp/coverage-151240-1753351129770-0.json +1 -0
- package/coverage/tmp/coverage-151307-1753351220058-0.json +1 -0
- package/coverage/tmp/coverage-151319-1753351220044-0.json +1 -0
- package/coverage/tmp/coverage-151326-1753351220010-0.json +1 -0
- package/map/api/services/styles/styles.hooks.js +1 -1
- package/map/client/components/KLayerEditor.vue +4 -0
- package/map/client/components/catalog/KLayerCategories.vue +2 -0
- package/map/client/components/stickies/KLevelSlider.vue +10 -8
- package/map/client/components/styles/KStyleEditor.vue +1 -1
- package/map/client/components/styles/KStyleManager.vue +7 -1
- package/map/client/composables/highlight.js +5 -1
- package/map/client/i18n/map_en.json +4 -1
- package/map/client/i18n/map_fr.json +4 -1
- package/map/client/mixins/globe/mixin.geojson-layers.js +11 -5
- package/map/client/mixins/mixin.activity.js +9 -0
- package/map/client/utils/utils.layers.js +0 -2
- package/package.json +1 -1
- package/test/api/core/push.test.js +1 -1
- package/test/api/core/test-log-2025-02-05.log +23 -0
- package/test/api/core/test-log-2025-05-21.log +15 -0
- package/test/api/core/test-log-2025-06-25.log +9 -0
- package/test/api/core/test-log-2025-07-24.log +44 -0
- package/test/api/map/test-log-2025-05-27.log +13 -0
- package/test/api/map/test-log-2025-06-23.log +7 -0
- package/test/api/map/{test-log-2025-05-26.log → test-log-2025-07-24.log} +3 -4
- package/coverage/tmp/coverage-122123-1739872365211-0.json +0 -1
- package/coverage/tmp/coverage-122135-1739872365196-0.json +0 -1
- package/coverage/tmp/coverage-122146-1739872365184-0.json +0 -1
- package/coverage/tmp/coverage-122158-1739872365169-0.json +0 -1
- package/coverage/tmp/coverage-122165-1739872365141-0.json +0 -1
- package/test/api/core/test-log-2025-05-26.log +0 -22
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">90.28% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>158/175</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">74.07% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>20/27</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">100% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>6/6</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">90.28% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>158/175</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
</template>
|
|
63
63
|
</div>
|
|
64
|
-
<div class='status-line
|
|
64
|
+
<div class='status-line high'></div>
|
|
65
65
|
<pre><table class="coverage">
|
|
66
66
|
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
67
67
|
<a name='L2'></a><a href='#L2'>2</a>
|
|
@@ -238,356 +238,356 @@
|
|
|
238
238
|
<a name='L173'></a><a href='#L173'>173</a>
|
|
239
239
|
<a name='L174'></a><a href='#L174'>174</a>
|
|
240
240
|
<a name='L175'></a><a href='#L175'>175</a>
|
|
241
|
-
<a name='L176'></a><a href='#L176'>176</a></td><td class="line-coverage quiet"><span class="cline-any cline-
|
|
242
|
-
<span class="cline-any cline-
|
|
243
|
-
<span class="cline-any cline-
|
|
244
|
-
<span class="cline-any cline-
|
|
245
|
-
<span class="cline-any cline-
|
|
246
|
-
<span class="cline-any cline-
|
|
247
|
-
<span class="cline-any cline-
|
|
248
|
-
<span class="cline-any cline-
|
|
249
|
-
<span class="cline-any cline-
|
|
250
|
-
<span class="cline-any cline-
|
|
251
|
-
<span class="cline-any cline-
|
|
252
|
-
<span class="cline-any cline-
|
|
253
|
-
<span class="cline-any cline-
|
|
254
|
-
<span class="cline-any cline-
|
|
255
|
-
<span class="cline-any cline-
|
|
256
|
-
<span class="cline-any cline-
|
|
257
|
-
<span class="cline-any cline-
|
|
258
|
-
<span class="cline-any cline-
|
|
259
|
-
<span class="cline-any cline-
|
|
260
|
-
<span class="cline-any cline-
|
|
261
|
-
<span class="cline-any cline-
|
|
262
|
-
<span class="cline-any cline-
|
|
263
|
-
<span class="cline-any cline-
|
|
264
|
-
<span class="cline-any cline-
|
|
265
|
-
<span class="cline-any cline-
|
|
266
|
-
<span class="cline-any cline-
|
|
267
|
-
<span class="cline-any cline-
|
|
268
|
-
<span class="cline-any cline-
|
|
269
|
-
<span class="cline-any cline-
|
|
270
|
-
<span class="cline-any cline-
|
|
271
|
-
<span class="cline-any cline-
|
|
272
|
-
<span class="cline-any cline-
|
|
273
|
-
<span class="cline-any cline-
|
|
274
|
-
<span class="cline-any cline-
|
|
275
|
-
<span class="cline-any cline-
|
|
276
|
-
<span class="cline-any cline-
|
|
277
|
-
<span class="cline-any cline-
|
|
278
|
-
<span class="cline-any cline-
|
|
279
|
-
<span class="cline-any cline-
|
|
280
|
-
<span class="cline-any cline-
|
|
281
|
-
<span class="cline-any cline-
|
|
282
|
-
<span class="cline-any cline-
|
|
283
|
-
<span class="cline-any cline-
|
|
284
|
-
<span class="cline-any cline-
|
|
285
|
-
<span class="cline-any cline-
|
|
286
|
-
<span class="cline-any cline-no"> </span>
|
|
287
|
-
<span class="cline-any cline-no"> </span>
|
|
288
|
-
<span class="cline-any cline-no"> </span>
|
|
289
|
-
<span class="cline-any cline-no"> </span>
|
|
290
|
-
<span class="cline-any cline-no"> </span>
|
|
291
|
-
<span class="cline-any cline-no"> </span>
|
|
292
|
-
<span class="cline-any cline-
|
|
293
|
-
<span class="cline-any cline-
|
|
294
|
-
<span class="cline-any cline-
|
|
295
|
-
<span class="cline-any cline-
|
|
296
|
-
<span class="cline-any cline-
|
|
297
|
-
<span class="cline-any cline-
|
|
298
|
-
<span class="cline-any cline-
|
|
299
|
-
<span class="cline-any cline-
|
|
300
|
-
<span class="cline-any cline-
|
|
301
|
-
<span class="cline-any cline-
|
|
302
|
-
<span class="cline-any cline-
|
|
303
|
-
<span class="cline-any cline-
|
|
304
|
-
<span class="cline-any cline-
|
|
305
|
-
<span class="cline-any cline-
|
|
306
|
-
<span class="cline-any cline-
|
|
307
|
-
<span class="cline-any cline-
|
|
308
|
-
<span class="cline-any cline-
|
|
309
|
-
<span class="cline-any cline-
|
|
310
|
-
<span class="cline-any cline-
|
|
311
|
-
<span class="cline-any cline-
|
|
312
|
-
<span class="cline-any cline-
|
|
313
|
-
<span class="cline-any cline-
|
|
314
|
-
<span class="cline-any cline-
|
|
315
|
-
<span class="cline-any cline-
|
|
316
|
-
<span class="cline-any cline-
|
|
317
|
-
<span class="cline-any cline-
|
|
318
|
-
<span class="cline-any cline-
|
|
319
|
-
<span class="cline-any cline-
|
|
320
|
-
<span class="cline-any cline-
|
|
321
|
-
<span class="cline-any cline-
|
|
322
|
-
<span class="cline-any cline-
|
|
323
|
-
<span class="cline-any cline-
|
|
324
|
-
<span class="cline-any cline-
|
|
325
|
-
<span class="cline-any cline-
|
|
326
|
-
<span class="cline-any cline-
|
|
327
|
-
<span class="cline-any cline-no"> </span>
|
|
328
|
-
<span class="cline-any cline-no"> </span>
|
|
329
|
-
<span class="cline-any cline-no"> </span>
|
|
330
|
-
<span class="cline-any cline-no"> </span>
|
|
331
|
-
<span class="cline-any cline-no"> </span>
|
|
332
|
-
<span class="cline-any cline-no"> </span>
|
|
333
|
-
<span class="cline-any cline-
|
|
334
|
-
<span class="cline-any cline-
|
|
335
|
-
<span class="cline-any cline-
|
|
336
|
-
<span class="cline-any cline-
|
|
337
|
-
<span class="cline-any cline-
|
|
338
|
-
<span class="cline-any cline-
|
|
339
|
-
<span class="cline-any cline-
|
|
340
|
-
<span class="cline-any cline-
|
|
341
|
-
<span class="cline-any cline-
|
|
342
|
-
<span class="cline-any cline-
|
|
343
|
-
<span class="cline-any cline-no"> </span>
|
|
344
|
-
<span class="cline-any cline-no"> </span>
|
|
345
|
-
<span class="cline-any cline-
|
|
346
|
-
<span class="cline-any cline-
|
|
347
|
-
<span class="cline-any cline-
|
|
348
|
-
<span class="cline-any cline-
|
|
349
|
-
<span class="cline-any cline-
|
|
350
|
-
<span class="cline-any cline-
|
|
351
|
-
<span class="cline-any cline-
|
|
352
|
-
<span class="cline-any cline-
|
|
353
|
-
<span class="cline-any cline-
|
|
354
|
-
<span class="cline-any cline-
|
|
355
|
-
<span class="cline-any cline-
|
|
356
|
-
<span class="cline-any cline-
|
|
357
|
-
<span class="cline-any cline-
|
|
358
|
-
<span class="cline-any cline-
|
|
359
|
-
<span class="cline-any cline-
|
|
360
|
-
<span class="cline-any cline-
|
|
361
|
-
<span class="cline-any cline-
|
|
362
|
-
<span class="cline-any cline-
|
|
363
|
-
<span class="cline-any cline-
|
|
364
|
-
<span class="cline-any cline-
|
|
365
|
-
<span class="cline-any cline-no"> </span>
|
|
366
|
-
<span class="cline-any cline-no"> </span>
|
|
367
|
-
<span class="cline-any cline-no"> </span>
|
|
368
|
-
<span class="cline-any cline-
|
|
369
|
-
<span class="cline-any cline-
|
|
370
|
-
<span class="cline-any cline-
|
|
371
|
-
<span class="cline-any cline-
|
|
372
|
-
<span class="cline-any cline-
|
|
373
|
-
<span class="cline-any cline-
|
|
374
|
-
<span class="cline-any cline-
|
|
375
|
-
<span class="cline-any cline-
|
|
376
|
-
<span class="cline-any cline-
|
|
377
|
-
<span class="cline-any cline-
|
|
378
|
-
<span class="cline-any cline-
|
|
379
|
-
<span class="cline-any cline-
|
|
380
|
-
<span class="cline-any cline-
|
|
381
|
-
<span class="cline-any cline-
|
|
382
|
-
<span class="cline-any cline-
|
|
383
|
-
<span class="cline-any cline-
|
|
384
|
-
<span class="cline-any cline-
|
|
385
|
-
<span class="cline-any cline-
|
|
386
|
-
<span class="cline-any cline-
|
|
387
|
-
<span class="cline-any cline-
|
|
388
|
-
<span class="cline-any cline-
|
|
389
|
-
<span class="cline-any cline-
|
|
390
|
-
<span class="cline-any cline-
|
|
391
|
-
<span class="cline-any cline-
|
|
392
|
-
<span class="cline-any cline-
|
|
393
|
-
<span class="cline-any cline-
|
|
394
|
-
<span class="cline-any cline-
|
|
395
|
-
<span class="cline-any cline-
|
|
396
|
-
<span class="cline-any cline-
|
|
397
|
-
<span class="cline-any cline-
|
|
398
|
-
<span class="cline-any cline-
|
|
399
|
-
<span class="cline-any cline-
|
|
400
|
-
<span class="cline-any cline-
|
|
401
|
-
<span class="cline-any cline-
|
|
402
|
-
<span class="cline-any cline-
|
|
403
|
-
<span class="cline-any cline-
|
|
404
|
-
<span class="cline-any cline-
|
|
405
|
-
<span class="cline-any cline-
|
|
406
|
-
<span class="cline-any cline-
|
|
407
|
-
<span class="cline-any cline-
|
|
408
|
-
<span class="cline-any cline-
|
|
409
|
-
<span class="cline-any cline-
|
|
410
|
-
<span class="cline-any cline-
|
|
411
|
-
<span class="cline-any cline-
|
|
412
|
-
<span class="cline-any cline-
|
|
413
|
-
<span class="cline-any cline-
|
|
414
|
-
<span class="cline-any cline-
|
|
415
|
-
<span class="cline-any cline-
|
|
416
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js"
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
<span class="
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
<span class="
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
<span class="
|
|
241
|
+
<a name='L176'></a><a href='#L176'>176</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
242
|
+
<span class="cline-any cline-yes">1x</span>
|
|
243
|
+
<span class="cline-any cline-yes">1x</span>
|
|
244
|
+
<span class="cline-any cline-yes">1x</span>
|
|
245
|
+
<span class="cline-any cline-yes">1x</span>
|
|
246
|
+
<span class="cline-any cline-yes">1x</span>
|
|
247
|
+
<span class="cline-any cline-yes">1x</span>
|
|
248
|
+
<span class="cline-any cline-yes">1x</span>
|
|
249
|
+
<span class="cline-any cline-yes">1x</span>
|
|
250
|
+
<span class="cline-any cline-yes">1x</span>
|
|
251
|
+
<span class="cline-any cline-yes">1x</span>
|
|
252
|
+
<span class="cline-any cline-yes">1x</span>
|
|
253
|
+
<span class="cline-any cline-yes">1x</span>
|
|
254
|
+
<span class="cline-any cline-yes">1x</span>
|
|
255
|
+
<span class="cline-any cline-yes">1x</span>
|
|
256
|
+
<span class="cline-any cline-yes">1x</span>
|
|
257
|
+
<span class="cline-any cline-yes">1x</span>
|
|
258
|
+
<span class="cline-any cline-yes">1x</span>
|
|
259
|
+
<span class="cline-any cline-yes">6x</span>
|
|
260
|
+
<span class="cline-any cline-yes">6x</span>
|
|
261
|
+
<span class="cline-any cline-yes">6x</span>
|
|
262
|
+
<span class="cline-any cline-yes">6x</span>
|
|
263
|
+
<span class="cline-any cline-yes">6x</span>
|
|
264
|
+
<span class="cline-any cline-yes">6x</span>
|
|
265
|
+
<span class="cline-any cline-yes">1x</span>
|
|
266
|
+
<span class="cline-any cline-yes">1x</span>
|
|
267
|
+
<span class="cline-any cline-yes">1x</span>
|
|
268
|
+
<span class="cline-any cline-yes">6x</span>
|
|
269
|
+
<span class="cline-any cline-yes">6x</span>
|
|
270
|
+
<span class="cline-any cline-yes">6x</span>
|
|
271
|
+
<span class="cline-any cline-yes">6x</span>
|
|
272
|
+
<span class="cline-any cline-yes">6x</span>
|
|
273
|
+
<span class="cline-any cline-yes">6x</span>
|
|
274
|
+
<span class="cline-any cline-yes">1x</span>
|
|
275
|
+
<span class="cline-any cline-yes">1x</span>
|
|
276
|
+
<span class="cline-any cline-yes">1x</span>
|
|
277
|
+
<span class="cline-any cline-yes">14x</span>
|
|
278
|
+
<span class="cline-any cline-yes">1x</span>
|
|
279
|
+
<span class="cline-any cline-yes">1x</span>
|
|
280
|
+
<span class="cline-any cline-yes">1x</span>
|
|
281
|
+
<span class="cline-any cline-yes">7x</span>
|
|
282
|
+
<span class="cline-any cline-yes">7x</span>
|
|
283
|
+
<span class="cline-any cline-yes">7x</span>
|
|
284
|
+
<span class="cline-any cline-yes">7x</span>
|
|
285
|
+
<span class="cline-any cline-yes">7x</span>
|
|
286
|
+
<span class="cline-any cline-no"> </span>
|
|
287
|
+
<span class="cline-any cline-no"> </span>
|
|
288
|
+
<span class="cline-any cline-no"> </span>
|
|
289
|
+
<span class="cline-any cline-no"> </span>
|
|
290
|
+
<span class="cline-any cline-no"> </span>
|
|
291
|
+
<span class="cline-any cline-no"> </span>
|
|
292
|
+
<span class="cline-any cline-yes">7x</span>
|
|
293
|
+
<span class="cline-any cline-yes">7x</span>
|
|
294
|
+
<span class="cline-any cline-yes">7x</span>
|
|
295
|
+
<span class="cline-any cline-yes">7x</span>
|
|
296
|
+
<span class="cline-any cline-yes">7x</span>
|
|
297
|
+
<span class="cline-any cline-yes">7x</span>
|
|
298
|
+
<span class="cline-any cline-yes">7x</span>
|
|
299
|
+
<span class="cline-any cline-yes">7x</span>
|
|
300
|
+
<span class="cline-any cline-yes">7x</span>
|
|
301
|
+
<span class="cline-any cline-yes">7x</span>
|
|
302
|
+
<span class="cline-any cline-yes">7x</span>
|
|
303
|
+
<span class="cline-any cline-yes">7x</span>
|
|
304
|
+
<span class="cline-any cline-yes">7x</span>
|
|
305
|
+
<span class="cline-any cline-yes">7x</span>
|
|
306
|
+
<span class="cline-any cline-yes">7x</span>
|
|
307
|
+
<span class="cline-any cline-yes">7x</span>
|
|
308
|
+
<span class="cline-any cline-yes">7x</span>
|
|
309
|
+
<span class="cline-any cline-yes">7x</span>
|
|
310
|
+
<span class="cline-any cline-yes">7x</span>
|
|
311
|
+
<span class="cline-any cline-yes">1x</span>
|
|
312
|
+
<span class="cline-any cline-yes">1x</span>
|
|
313
|
+
<span class="cline-any cline-yes">1x</span>
|
|
314
|
+
<span class="cline-any cline-yes">1x</span>
|
|
315
|
+
<span class="cline-any cline-yes">1x</span>
|
|
316
|
+
<span class="cline-any cline-yes">1x</span>
|
|
317
|
+
<span class="cline-any cline-yes">6x</span>
|
|
318
|
+
<span class="cline-any cline-yes">6x</span>
|
|
319
|
+
<span class="cline-any cline-yes">1x</span>
|
|
320
|
+
<span class="cline-any cline-yes">1x</span>
|
|
321
|
+
<span class="cline-any cline-yes">1x</span>
|
|
322
|
+
<span class="cline-any cline-yes">7x</span>
|
|
323
|
+
<span class="cline-any cline-yes">7x</span>
|
|
324
|
+
<span class="cline-any cline-yes">7x</span>
|
|
325
|
+
<span class="cline-any cline-yes">7x</span>
|
|
326
|
+
<span class="cline-any cline-yes">7x</span>
|
|
327
|
+
<span class="cline-any cline-no"> </span>
|
|
328
|
+
<span class="cline-any cline-no"> </span>
|
|
329
|
+
<span class="cline-any cline-no"> </span>
|
|
330
|
+
<span class="cline-any cline-no"> </span>
|
|
331
|
+
<span class="cline-any cline-no"> </span>
|
|
332
|
+
<span class="cline-any cline-no"> </span>
|
|
333
|
+
<span class="cline-any cline-yes">7x</span>
|
|
334
|
+
<span class="cline-any cline-yes">7x</span>
|
|
335
|
+
<span class="cline-any cline-yes">7x</span>
|
|
336
|
+
<span class="cline-any cline-yes">7x</span>
|
|
337
|
+
<span class="cline-any cline-yes">7x</span>
|
|
338
|
+
<span class="cline-any cline-yes">7x</span>
|
|
339
|
+
<span class="cline-any cline-yes">7x</span>
|
|
340
|
+
<span class="cline-any cline-yes">7x</span>
|
|
341
|
+
<span class="cline-any cline-yes">7x</span>
|
|
342
|
+
<span class="cline-any cline-yes">7x</span>
|
|
343
|
+
<span class="cline-any cline-no"> </span>
|
|
344
|
+
<span class="cline-any cline-no"> </span>
|
|
345
|
+
<span class="cline-any cline-yes">7x</span>
|
|
346
|
+
<span class="cline-any cline-yes">7x</span>
|
|
347
|
+
<span class="cline-any cline-yes">7x</span>
|
|
348
|
+
<span class="cline-any cline-yes">7x</span>
|
|
349
|
+
<span class="cline-any cline-yes">1x</span>
|
|
350
|
+
<span class="cline-any cline-yes">1x</span>
|
|
351
|
+
<span class="cline-any cline-yes">1x</span>
|
|
352
|
+
<span class="cline-any cline-yes">1x</span>
|
|
353
|
+
<span class="cline-any cline-yes">1x</span>
|
|
354
|
+
<span class="cline-any cline-yes">1x</span>
|
|
355
|
+
<span class="cline-any cline-yes">6x</span>
|
|
356
|
+
<span class="cline-any cline-yes">6x</span>
|
|
357
|
+
<span class="cline-any cline-yes">6x</span>
|
|
358
|
+
<span class="cline-any cline-yes">1x</span>
|
|
359
|
+
<span class="cline-any cline-yes">1x</span>
|
|
360
|
+
<span class="cline-any cline-yes">1x</span>
|
|
361
|
+
<span class="cline-any cline-yes">14x</span>
|
|
362
|
+
<span class="cline-any cline-yes">14x</span>
|
|
363
|
+
<span class="cline-any cline-yes">14x</span>
|
|
364
|
+
<span class="cline-any cline-yes">14x</span>
|
|
365
|
+
<span class="cline-any cline-no"> </span>
|
|
366
|
+
<span class="cline-any cline-no"> </span>
|
|
367
|
+
<span class="cline-any cline-no"> </span>
|
|
368
|
+
<span class="cline-any cline-yes">14x</span>
|
|
369
|
+
<span class="cline-any cline-yes">14x</span>
|
|
370
|
+
<span class="cline-any cline-yes">14x</span>
|
|
371
|
+
<span class="cline-any cline-yes">14x</span>
|
|
372
|
+
<span class="cline-any cline-yes">14x</span>
|
|
373
|
+
<span class="cline-any cline-yes">14x</span>
|
|
374
|
+
<span class="cline-any cline-yes">14x</span>
|
|
375
|
+
<span class="cline-any cline-yes">6x</span>
|
|
376
|
+
<span class="cline-any cline-yes">6x</span>
|
|
377
|
+
<span class="cline-any cline-yes">6x</span>
|
|
378
|
+
<span class="cline-any cline-yes">6x</span>
|
|
379
|
+
<span class="cline-any cline-yes">6x</span>
|
|
380
|
+
<span class="cline-any cline-yes">6x</span>
|
|
381
|
+
<span class="cline-any cline-yes">6x</span>
|
|
382
|
+
<span class="cline-any cline-yes">2x</span>
|
|
383
|
+
<span class="cline-any cline-yes">2x</span>
|
|
384
|
+
<span class="cline-any cline-yes">6x</span>
|
|
385
|
+
<span class="cline-any cline-yes">6x</span>
|
|
386
|
+
<span class="cline-any cline-yes">6x</span>
|
|
387
|
+
<span class="cline-any cline-yes">12x</span>
|
|
388
|
+
<span class="cline-any cline-yes">14x</span>
|
|
389
|
+
<span class="cline-any cline-yes">2x</span>
|
|
390
|
+
<span class="cline-any cline-yes">2x</span>
|
|
391
|
+
<span class="cline-any cline-yes">2x</span>
|
|
392
|
+
<span class="cline-any cline-yes">14x</span>
|
|
393
|
+
<span class="cline-any cline-yes">14x</span>
|
|
394
|
+
<span class="cline-any cline-yes">14x</span>
|
|
395
|
+
<span class="cline-any cline-yes">14x</span>
|
|
396
|
+
<span class="cline-any cline-yes">14x</span>
|
|
397
|
+
<span class="cline-any cline-yes">14x</span>
|
|
398
|
+
<span class="cline-any cline-yes">14x</span>
|
|
399
|
+
<span class="cline-any cline-yes">14x</span>
|
|
400
|
+
<span class="cline-any cline-yes">14x</span>
|
|
401
|
+
<span class="cline-any cline-yes">14x</span>
|
|
402
|
+
<span class="cline-any cline-yes">14x</span>
|
|
403
|
+
<span class="cline-any cline-yes">14x</span>
|
|
404
|
+
<span class="cline-any cline-yes">14x</span>
|
|
405
|
+
<span class="cline-any cline-yes">14x</span>
|
|
406
|
+
<span class="cline-any cline-yes">14x</span>
|
|
407
|
+
<span class="cline-any cline-yes">14x</span>
|
|
408
|
+
<span class="cline-any cline-yes">14x</span>
|
|
409
|
+
<span class="cline-any cline-yes">14x</span>
|
|
410
|
+
<span class="cline-any cline-yes">14x</span>
|
|
411
|
+
<span class="cline-any cline-yes">14x</span>
|
|
412
|
+
<span class="cline-any cline-yes">14x</span>
|
|
413
|
+
<span class="cline-any cline-yes">14x</span>
|
|
414
|
+
<span class="cline-any cline-yes">14x</span>
|
|
415
|
+
<span class="cline-any cline-yes">1x</span>
|
|
416
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import _ from 'lodash'
|
|
417
|
+
import moment from 'moment'
|
|
418
|
+
import siftModule from 'sift'
|
|
419
|
+
import request from 'superagent'
|
|
420
|
+
import cron from 'cron'
|
|
421
|
+
import errors from '@feathersjs/errors'
|
|
422
|
+
import makeDebug from 'debug'
|
|
423
|
+
const debug = makeDebug('kdk:map:alerts:service')
|
|
424
|
+
|
|
425
|
+
const { CronJob } = cron
|
|
426
|
+
const { Unprocessable } = errors
|
|
427
|
+
const sift = siftModule.default
|
|
428
|
+
|
|
429
|
+
// Alert map
|
|
430
|
+
const alerts = {}
|
|
431
|
+
|
|
432
|
+
export default {
|
|
433
|
+
async registerAlert (alert, check = true) {
|
|
434
|
+
if (alerts[alert._id.toString()]) <span class="branch-0 cbranch-no" title="branch not covered" >return</span>
|
|
435
|
+
debug('Registering new alert ', alert)
|
|
436
|
+
const cronJob = new CronJob(alert.cron, () => this.checkAlert(alert))
|
|
437
|
+
alerts[alert._id.toString()] = cronJob
|
|
438
|
+
if (check) await this.checkAlert(alert)
|
|
439
|
+
cronJob.start()
|
|
440
|
+
},
|
|
441
|
+
|
|
442
|
+
async unregisterAlert (alert) {
|
|
443
|
+
const id = (typeof alert === 'string' ? alert <span class="branch-0 cbranch-no" title="branch not covered" >: alert._id)</span>
|
|
444
|
+
const cronJob = alerts[id.toString()]
|
|
445
|
+
if (!cronJob) <span class="branch-0 cbranch-no" title="branch not covered" >return</span>
|
|
446
|
+
debug('Unregistering alert ', alert)
|
|
447
|
+
cronJob.stop()
|
|
448
|
+
delete alerts[id.toString()]
|
|
449
|
+
},
|
|
450
|
+
|
|
451
|
+
getConditions (alert) {
|
|
452
|
+
return _.mapKeys(alert.conditions, (value, key) => 'properties.' + key)
|
|
453
|
+
},
|
|
454
|
+
|
|
455
|
+
async checkWeatherAlert (alert) {
|
|
456
|
+
const now = moment.utc()
|
|
457
|
+
// Convert conditions to internal data model
|
|
458
|
+
const conditions = this.getConditions(alert)
|
|
459
|
+
const probesService = this.app.getService('probes')
|
|
460
|
+
if (!probesService) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
|
|
461
461
|
<span class="cstat-no" title="statement not covered" > throw new Unprocessable('Cannot check alert ' + alert._id.toString() + ' as target probes service is not available', {</span>
|
|
462
462
|
<span class="cstat-no" title="statement not covered" > translation: {</span>
|
|
463
463
|
<span class="cstat-no" title="statement not covered" > key: 'CANNOT_CHECK_ALERT_MISSING_SERVICE'</span>
|
|
464
464
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
465
465
|
<span class="cstat-no" title="statement not covered" > })</span>
|
|
466
466
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
<span class="
|
|
467
|
+
// Perform aggregation over time range
|
|
468
|
+
const query = Object.assign({
|
|
469
|
+
forecastTime: {
|
|
470
|
+
$gte: now.clone().add(_.get(alert, 'period.start', { seconds: 0 })).toDate(),
|
|
471
|
+
$lte: now.clone().add(_.get(alert, 'period.end', { seconds: 24 * 3600 })).toDate()
|
|
472
|
+
},
|
|
473
|
+
geometry: {
|
|
474
|
+
$geoIntersects: {
|
|
475
|
+
$geometry: _.get(alert, 'geometry')
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
aggregate: false
|
|
479
|
+
})
|
|
480
|
+
const result = await probesService.create({
|
|
481
|
+
forecast: alert.forecast,
|
|
482
|
+
elements: alert.elements
|
|
483
|
+
}, { query })
|
|
484
|
+
// Check for available data so that we will not close an alert because data is missing
|
|
485
|
+
if (result.features.length === 0) {
|
|
486
|
+
throw new Unprocessable('Cannot check alert ' + alert._id.toString() + ' as no data is available for ' + alert.forecast, {
|
|
487
|
+
translation: {
|
|
488
|
+
key: 'CANNOT_CHECK_ALERT_MISSING_DATA'
|
|
489
|
+
}
|
|
490
|
+
})
|
|
491
|
+
}
|
|
492
|
+
// Let sift performs condition matching as in this case MongoDB cannot
|
|
493
|
+
return result.features.filter(sift(conditions))
|
|
494
|
+
},
|
|
495
|
+
|
|
496
|
+
async checkMeasureAlert (alert) {
|
|
497
|
+
const now = moment.utc()
|
|
498
|
+
// Convert conditions to internal data model
|
|
499
|
+
const conditions = this.getConditions(alert)
|
|
500
|
+
const featureService = this.app.getService(_.get(alert, 'layer.service'))
|
|
501
|
+
if (!featureService) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
|
|
502
502
|
<span class="cstat-no" title="statement not covered" > throw new Unprocessable('Cannot check alert ' + alert._id.toString() + ' as target features service ' + _.get(alert, 'layer.service') + ' is not available', {</span>
|
|
503
503
|
<span class="cstat-no" title="statement not covered" > translation: {</span>
|
|
504
504
|
<span class="cstat-no" title="statement not covered" > key: 'CANNOT_CHECK_ALERT_MISSING_SERVICE'</span>
|
|
505
505
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
506
506
|
<span class="cstat-no" title="statement not covered" > })</span>
|
|
507
507
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
<span class="
|
|
508
|
+
// Build base query for time range and target feature
|
|
509
|
+
const query = {
|
|
510
|
+
time: {
|
|
511
|
+
$gte: now.clone().add(_.get(alert, 'period.start', { seconds: 0 })).toDate(),
|
|
512
|
+
$lte: now.clone().add(_.get(alert, 'period.end', { seconds: 24 * 3600 })).toDate()
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
if (_.has(alert, 'layer.featureId')) {
|
|
516
|
+
query['properties.' + _.get(alert, 'layer.featureId')] = alert.feature
|
|
517
|
+
}<span class="branch-0 cbranch-no" title="branch not covered" > else {</span>
|
|
518
518
|
<span class="cstat-no" title="statement not covered" > query._id = alert.feature</span>
|
|
519
519
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
<span class="
|
|
520
|
+
// Check for available data so that we will not close an alert because data is missing
|
|
521
|
+
// $limit = 0 performs a simple count query
|
|
522
|
+
let result = await featureService.find({ query: Object.assign({ $limit: 0 }, query) })
|
|
523
|
+
if (result.total === 0) {
|
|
524
|
+
throw new Unprocessable('Cannot check alert ' + alert._id.toString() + ' as no data is available for features service ' + _.get(alert, 'layer.service'), {
|
|
525
|
+
translation: {
|
|
526
|
+
key: 'CANNOT_CHECK_ALERT_MISSING_DATA'
|
|
527
|
+
}
|
|
528
|
+
})
|
|
529
|
+
}
|
|
530
|
+
// Perform aggregation over time range
|
|
531
|
+
result = await featureService.find({ query: Object.assign(query, conditions) })
|
|
532
|
+
return result.features
|
|
533
|
+
},
|
|
534
|
+
|
|
535
|
+
async checkAlert (alert, options = { patch: true, callWebhook: true }) {
|
|
536
|
+
const now = moment.utc()
|
|
537
|
+
debug('Checking alert at ' + now.format(), _.omit(alert, ['status', 'webhook']))
|
|
538
|
+
// First check if still valid
|
|
539
|
+
if (now.isAfter(alert.expireAt)) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
|
|
540
540
|
<span class="cstat-no" title="statement not covered" > await this.unregisterAlert(alert)</span>
|
|
541
541
|
<span class="cstat-no" title="statement not covered" > return</span>
|
|
542
542
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
543
|
+
// Then update alert status starting from previous one (i.e. trigger time stamp, etc.)
|
|
544
|
+
const status = _.get(alert, 'status', {})
|
|
545
|
+
status.checkedAt = now.clone()
|
|
546
|
+
// Clean any error state
|
|
547
|
+
delete status.error
|
|
548
|
+
try {
|
|
549
|
+
const results = (alert.feature ? await this.checkMeasureAlert(alert) : await this.checkWeatherAlert(alert))
|
|
550
|
+
// FIXME: check for a specific duration where conditions are met
|
|
551
|
+
const isActive = (results.length > 0)
|
|
552
|
+
const wasActive = status.active
|
|
553
|
+
status.active = isActive
|
|
554
|
+
if (isActive) {
|
|
555
|
+
// If not previously active and it is now add first time stamp
|
|
556
|
+
if (!wasActive) {
|
|
557
|
+
status.triggeredAt = now.clone()
|
|
558
|
+
}
|
|
559
|
+
// Update triggers
|
|
560
|
+
status.triggers = results
|
|
561
|
+
}
|
|
562
|
+
debug('Alert ' + alert._id.toString() + ' status', status, ' with ' + results.length + ' triggers')
|
|
563
|
+
} catch (error) { // Possible if no data
|
|
564
|
+
this.app.logger.error(error.message)
|
|
565
|
+
status.error = error.toJSON()
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// As we keep in-memory objects avoid them being mutated by hooks processing operation payload
|
|
569
|
+
if (options.patch) {
|
|
570
|
+
await this.patch(alert._id.toString(), { status: Object.assign({}, status) })
|
|
571
|
+
// DEBUG code to simulate alert closing
|
|
572
|
+
/*
|
|
573
|
+
setTimeout(async () => {
|
|
574
|
+
await this.patch(alert._id.toString(), {
|
|
575
|
+
status: { active: false, checkedAt: now.clone() }
|
|
576
|
+
})
|
|
577
|
+
}, 10000)
|
|
578
|
+
*/
|
|
579
|
+
}
|
|
580
|
+
// Keep track of changes in memory as well
|
|
581
|
+
Object.assign(alert, { status })
|
|
582
|
+
// If a webhook is configured call it
|
|
583
|
+
const webhook = alert.webhook
|
|
584
|
+
if (options.callWebhook && webhook) {
|
|
585
|
+
const body = Object.assign({ alert: _.omit(alert, ['webhook']) }, _.omit(webhook, ['url']))
|
|
586
|
+
await request.post(webhook.url, body)
|
|
587
|
+
}
|
|
588
|
+
return alert
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
591
|
</pre></td></tr></table></pre>
|
|
592
592
|
|
|
593
593
|
<div class='push'></div><!-- for sticky footer -->
|
|
@@ -595,7 +595,7 @@
|
|
|
595
595
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
596
596
|
Code coverage generated by
|
|
597
597
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
598
|
-
at 2025-
|
|
598
|
+
at 2025-07-24T10:00:20.476Z
|
|
599
599
|
</div>
|
|
600
600
|
<script src="../../../../prettify.js"></script>
|
|
601
601
|
<script>
|