@kalisio/kdk 2.5.3 → 2.6.1
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/.github/workflows/main.yaml +35 -6
- package/.vscode/settings.json +5 -0
- package/client.globe.js +8 -0
- package/client.js +8 -0
- package/client.map.js +8 -0
- package/core/api/hooks/hooks.push.js +3 -2
- package/core/api/hooks/hooks.tags.js +56 -0
- package/core/api/models/tags.model.mongodb.js +8 -0
- package/core/api/services/index.js +33 -2
- package/core/api/services/tags/tags.hooks.js +47 -0
- package/core/client/api.js +5 -5
- package/core/client/components/KActivity.vue +3 -2
- package/core/client/components/KChip.vue +2 -2
- package/core/client/components/KEditor.vue +3 -1
- package/core/client/components/KFollower.vue +4 -4
- package/core/client/components/KStore.vue +1 -1
- package/core/client/components/KTab.vue +20 -7
- package/core/client/components/account/KProfile.vue +9 -25
- package/core/client/components/action/KAction.vue +10 -10
- package/core/client/components/action/KToggleFullscreenAction.vue +2 -11
- package/core/client/components/app/KHome.vue +3 -2
- package/core/client/components/collection/KFilter.vue +5 -4
- package/core/client/components/collection/KGrid.vue +5 -1
- package/core/client/components/collection/KItemsFilter.vue +47 -0
- package/core/client/components/collection/KItemsSorter.vue +42 -0
- package/core/client/components/collection/KScrollDown.vue +2 -2
- package/core/client/components/collection/KSearchFilterControl.vue +3 -2
- package/core/client/components/collection/KSorter.vue +33 -37
- package/core/client/components/collection/KTagsFilterControl.vue +14 -40
- package/core/client/components/collection/KTagsFilterView.vue +10 -45
- package/core/client/components/collection/KTimeFilterControl.vue +6 -7
- package/core/client/components/collection/KTimeFilterView.vue +13 -22
- package/core/client/components/collection/KTimeLine.vue +18 -9
- package/core/client/components/form/KColorField.vue +13 -6
- package/core/client/components/form/KColorScaleField.vue +7 -12
- package/core/client/components/form/KFileField.vue +118 -89
- package/core/client/components/form/KForm.vue +30 -18
- package/core/client/components/form/KIconField.vue +4 -1
- package/core/client/components/form/KNumberField.vue +9 -2
- package/core/client/components/form/KSelectField.vue +1 -4
- package/core/client/components/form/KTagField.vue +229 -0
- package/core/client/components/form/KTextField.vue +4 -0
- package/core/client/components/form/KTextareaField.vue +3 -1
- package/core/client/components/input/KShapePicker.vue +3 -3
- package/core/client/components/layout/KFab.vue +32 -20
- package/core/client/components/layout/KPage.vue +11 -6
- package/core/client/components/layout/KWindow.vue +6 -1
- package/core/client/components/media/index.js +2 -6
- package/core/client/components/menu/KMenu.vue +12 -10
- package/core/client/components/menu/KSubMenu.vue +12 -12
- package/core/client/components/messages/KMessageCard.vue +13 -12
- package/core/client/components/messages/KMessageComposer.vue +13 -9
- package/core/client/components/messages/KMessagesTimeLine.vue +16 -8
- package/core/client/components/tags/KTagFilter.vue +99 -0
- package/core/client/components/tags/KTagItem.vue +65 -0
- package/core/client/components/tags/KTagManager.vue +198 -0
- package/core/client/components/tags/KTagSelection.vue +82 -0
- package/core/client/components/time/KDate.vue +3 -17
- package/core/client/components/time/KDateTime.vue +1 -1
- package/core/client/components/time/KTime.vue +0 -4
- package/core/client/composables/collection-filter.js +41 -2
- package/core/client/composables/collection.js +3 -3
- package/core/client/composables/index.js +1 -0
- package/core/client/composables/pwa.js +13 -0
- package/core/client/composables/session.js +7 -8
- package/core/client/composables/user.js +36 -0
- package/core/client/directives/index.js +1 -0
- package/core/client/directives/v-drop-file.js +174 -0
- package/core/client/document.js +2 -1
- package/core/client/exporter.js +17 -3
- package/core/client/i18n/core_en.json +34 -7
- package/core/client/i18n/core_fr.json +36 -9
- package/core/client/i18n.js +26 -11
- package/core/client/layout.js +5 -5
- package/core/client/mixins/mixin.base-activity.js +8 -5
- package/core/client/mixins/mixin.base-editor.js +2 -1
- package/core/client/mixins/mixin.base-field.js +3 -2
- package/core/client/mixins/mixin.base-item.js +12 -10
- package/core/client/mixins/mixin.service.js +3 -1
- package/core/client/platform.js +0 -3
- package/core/client/readers/reader.json.js +2 -2
- package/core/client/utils/index.js +2 -0
- package/core/client/utils/utils.collection.js +6 -6
- package/core/client/utils/utils.colors.js +473 -173
- package/core/client/utils/utils.files.js +19 -0
- package/core/client/utils/utils.locale.js +13 -17
- package/core/client/utils/utils.services.js +27 -0
- package/core/client/utils/utils.shapes.js +2 -2
- package/core/client/utils/utils.tags.js +17 -0
- package/core/client/utils/utils.tours.js +31 -0
- package/core/common/permissions.js +3 -0
- package/core/common/schemas/tags.update.json +35 -0
- package/core/common/schemas/users.update-profile.json +1 -1
- package/core/common/utils.js +5 -5
- package/coverage/core/api/application.js.html +464 -464
- package/coverage/core/api/authentication.js.html +219 -351
- package/coverage/core/api/db.js.html +194 -209
- package/coverage/core/api/hooks/hooks.authentication.js.html +208 -34
- package/coverage/core/api/hooks/hooks.authorisations.js.html +717 -432
- package/coverage/core/api/hooks/hooks.groups.js.html +52 -52
- package/coverage/core/api/hooks/hooks.logger.js.html +43 -43
- package/coverage/core/api/hooks/hooks.model.js.html +300 -312
- package/coverage/core/api/hooks/hooks.organisations.js.html +264 -264
- package/coverage/core/api/hooks/hooks.push.js.html +107 -119
- package/coverage/core/api/hooks/hooks.query.js.html +279 -279
- package/coverage/core/api/hooks/hooks.schemas.js.html +135 -135
- 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 +478 -205
- package/coverage/core/api/hooks/index.html +132 -102
- package/coverage/core/api/hooks/index.js.html +19 -13
- package/coverage/core/api/index.html +69 -54
- package/coverage/core/api/index.js.html +25 -25
- package/coverage/core/api/marshall.js.html +127 -127
- package/coverage/core/api/models/groups.model.mongodb.js.html +26 -26
- package/coverage/core/api/models/index.html +66 -21
- package/coverage/core/api/models/messages.model.mongodb.js.html +27 -39
- package/coverage/core/api/models/organisations.model.mongodb.js.html +16 -16
- package/coverage/core/api/models/tags.model.mongodb.js.html +30 -30
- package/coverage/core/api/models/users.model.mongodb.js.html +11 -11
- package/coverage/core/api/services/account/account.hooks.js.html +46 -46
- package/coverage/core/api/services/account/account.service.js.html +139 -139
- package/coverage/core/api/services/account/index.html +22 -22
- package/coverage/core/api/services/authorisations/authorisations.hooks.js.html +34 -34
- package/coverage/core/api/services/authorisations/authorisations.service.js.html +230 -221
- package/coverage/core/api/services/authorisations/index.html +20 -20
- 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 +72 -72
- package/coverage/core/api/services/groups/index.html +21 -21
- package/coverage/core/api/services/import-export/import-export.hooks.js.html +76 -76
- package/coverage/core/api/services/import-export/import-export.service.js.html +32 -32
- package/coverage/core/api/services/import-export/index.html +32 -32
- package/coverage/core/api/services/index.html +21 -21
- package/coverage/core/api/services/index.js.html +195 -171
- package/coverage/core/api/services/mailer/index.html +32 -32
- package/coverage/core/api/services/mailer/mailer.hooks.js.html +80 -80
- package/coverage/core/api/services/mailer/mailer.service.js.html +32 -32
- package/coverage/core/api/services/messages/index.html +21 -21
- package/coverage/core/api/services/messages/messages.hooks.js.html +76 -94
- package/coverage/core/api/services/organisations/index.html +32 -32
- package/coverage/core/api/services/organisations/organisations.hooks.js.html +72 -72
- package/coverage/core/api/services/organisations/organisations.service.js.html +163 -163
- package/coverage/core/api/services/push/index.html +32 -32
- package/coverage/core/api/services/push/push.hooks.js.html +80 -80
- package/coverage/core/api/services/push/push.service.js.html +34 -34
- package/coverage/core/api/services/storage/index.html +29 -29
- package/coverage/core/api/services/storage/storage.hooks.js.html +80 -80
- package/coverage/core/api/services/storage/storage.service.js.html +37 -37
- package/coverage/core/api/services/tags/index.html +21 -21
- package/coverage/core/api/services/tags/tags.hooks.js.html +72 -72
- package/coverage/core/api/services/users/index.html +12 -27
- package/coverage/core/api/services/users/users.hooks.js.html +84 -87
- package/coverage/core/api/utils.js.html +1 -1
- package/coverage/core/common/errors.js.html +2 -2
- package/coverage/core/common/index.html +32 -47
- package/coverage/core/common/index.js.html +11 -11
- package/coverage/core/common/permissions.js.html +579 -264
- package/coverage/core/common/schema.js.html +26 -26
- package/coverage/core/common/utils.js.html +59 -65
- package/coverage/index.html +286 -256
- package/coverage/lcov-report/core/api/application.js.html +464 -464
- package/coverage/lcov-report/core/api/authentication.js.html +219 -351
- package/coverage/lcov-report/core/api/db.js.html +194 -209
- package/coverage/lcov-report/core/api/hooks/hooks.authentication.js.html +208 -34
- package/coverage/lcov-report/core/api/hooks/hooks.authorisations.js.html +717 -432
- package/coverage/lcov-report/core/api/hooks/hooks.groups.js.html +52 -52
- package/coverage/lcov-report/core/api/hooks/hooks.logger.js.html +43 -43
- package/coverage/lcov-report/core/api/hooks/hooks.model.js.html +300 -312
- package/coverage/lcov-report/core/api/hooks/hooks.organisations.js.html +264 -264
- package/coverage/lcov-report/core/api/hooks/hooks.push.js.html +107 -119
- package/coverage/lcov-report/core/api/hooks/hooks.query.js.html +279 -279
- package/coverage/lcov-report/core/api/hooks/hooks.schemas.js.html +135 -135
- 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 +478 -205
- package/coverage/lcov-report/core/api/hooks/index.html +132 -102
- package/coverage/lcov-report/core/api/hooks/index.js.html +19 -13
- package/coverage/lcov-report/core/api/index.html +69 -54
- package/coverage/lcov-report/core/api/index.js.html +25 -25
- package/coverage/lcov-report/core/api/marshall.js.html +127 -127
- package/coverage/lcov-report/core/api/models/groups.model.mongodb.js.html +26 -26
- package/coverage/lcov-report/core/api/models/index.html +66 -21
- package/coverage/lcov-report/core/api/models/messages.model.mongodb.js.html +27 -39
- package/coverage/lcov-report/core/api/models/organisations.model.mongodb.js.html +16 -16
- package/coverage/lcov-report/core/api/models/tags.model.mongodb.js.html +30 -30
- 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 +46 -46
- package/coverage/lcov-report/core/api/services/account/account.service.js.html +139 -139
- package/coverage/lcov-report/core/api/services/account/index.html +22 -22
- 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 +230 -221
- package/coverage/lcov-report/core/api/services/authorisations/index.html +20 -20
- 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 +72 -72
- package/coverage/lcov-report/core/api/services/groups/index.html +21 -21
- package/coverage/lcov-report/core/api/services/import-export/import-export.hooks.js.html +76 -76
- package/coverage/lcov-report/core/api/services/import-export/import-export.service.js.html +32 -32
- package/coverage/lcov-report/core/api/services/import-export/index.html +32 -32
- package/coverage/lcov-report/core/api/services/index.html +21 -21
- package/coverage/lcov-report/core/api/services/index.js.html +195 -171
- package/coverage/lcov-report/core/api/services/mailer/index.html +32 -32
- package/coverage/lcov-report/core/api/services/mailer/mailer.hooks.js.html +80 -80
- package/coverage/lcov-report/core/api/services/mailer/mailer.service.js.html +32 -32
- package/coverage/lcov-report/core/api/services/messages/index.html +21 -21
- package/coverage/lcov-report/core/api/services/messages/messages.hooks.js.html +76 -94
- package/coverage/lcov-report/core/api/services/organisations/index.html +32 -32
- package/coverage/lcov-report/core/api/services/organisations/organisations.hooks.js.html +72 -72
- package/coverage/lcov-report/core/api/services/organisations/organisations.service.js.html +163 -163
- package/coverage/lcov-report/core/api/services/push/index.html +32 -32
- package/coverage/lcov-report/core/api/services/push/push.hooks.js.html +80 -80
- package/coverage/lcov-report/core/api/services/push/push.service.js.html +34 -34
- package/coverage/lcov-report/core/api/services/storage/index.html +29 -29
- package/coverage/lcov-report/core/api/services/storage/storage.hooks.js.html +80 -80
- package/coverage/lcov-report/core/api/services/storage/storage.service.js.html +37 -37
- package/coverage/lcov-report/core/api/services/tags/index.html +21 -21
- package/coverage/lcov-report/core/api/services/tags/tags.hooks.js.html +72 -72
- package/coverage/lcov-report/core/api/services/users/index.html +12 -27
- package/coverage/lcov-report/core/api/services/users/users.hooks.js.html +84 -87
- 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 +32 -47
- package/coverage/lcov-report/core/common/index.js.html +11 -11
- package/coverage/lcov-report/core/common/permissions.js.html +579 -264
- package/coverage/lcov-report/core/common/schema.js.html +26 -26
- package/coverage/lcov-report/core/common/utils.js.html +59 -65
- package/coverage/lcov-report/index.html +286 -256
- package/coverage/lcov-report/map/api/hooks/hooks.catalog.js.html +257 -353
- package/coverage/lcov-report/map/api/hooks/hooks.features.js.html +218 -218
- package/coverage/lcov-report/map/api/hooks/hooks.query.js.html +810 -795
- 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 +27 -69
- package/coverage/lcov-report/map/api/models/features.model.mongodb.js.html +80 -80
- package/coverage/lcov-report/map/api/models/index.html +54 -69
- package/coverage/lcov-report/map/api/models/projects.model.mongodb.js.html +26 -26
- 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 +160 -178
- 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 +114 -183
- package/coverage/lcov-report/map/api/services/features/features.service.js.html +56 -359
- 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 +258 -495
- 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/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 -270
- 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 +36 -42
- 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 +7793 -8564
- package/coverage/map/api/hooks/hooks.catalog.js.html +257 -353
- package/coverage/map/api/hooks/hooks.features.js.html +218 -218
- package/coverage/map/api/hooks/hooks.query.js.html +810 -795
- 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 +27 -69
- package/coverage/map/api/models/features.model.mongodb.js.html +80 -80
- package/coverage/map/api/models/index.html +54 -69
- package/coverage/map/api/models/projects.model.mongodb.js.html +26 -26
- 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 +160 -178
- 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 +114 -183
- package/coverage/map/api/services/features/features.service.js.html +56 -359
- 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 +258 -495
- 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/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 -270
- 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 +36 -42
- 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-151166-1723543324307-0.json +1 -0
- package/coverage/tmp/coverage-151178-1723543324283-0.json +1 -0
- package/coverage/tmp/coverage-151189-1723543324271-0.json +1 -0
- package/coverage/tmp/coverage-151201-1723543324248-0.json +1 -0
- package/coverage/tmp/coverage-151208-1723543324227-0.json +1 -0
- package/extras/configs/panes.top.js +33 -11
- package/extras/configs/stickies.js +26 -16
- package/extras/configs/widgets.left.js +13 -1
- package/extras/libs/jsts.min.js +8 -0
- package/{test/client/core/account.js → extras/tests/core/account.mjs} +4 -4
- package/extras/tests/core/api.mjs +114 -0
- package/{test/client/core/collection.js → extras/tests/core/collection.mjs} +8 -8
- package/{test/client/core/dialogs.js → extras/tests/core/dialogs.mjs} +1 -1
- package/extras/tests/core/index.mjs +9 -0
- package/{test/client/core/layout.js → extras/tests/core/layout.mjs} +7 -3
- package/{test/client/core/runner.js → extras/tests/core/runner.mjs} +3 -3
- package/{test/client/core/screens.js → extras/tests/core/screens.mjs} +1 -1
- package/{test/client/core/utils.js → extras/tests/core/utils.mjs} +79 -26
- package/extras/tests/index.mjs +4 -0
- package/{test/client/map/api.js → extras/tests/map/api.mjs} +1 -1
- package/{test/client/map/catalog.js → extras/tests/map/catalog.mjs} +18 -18
- package/{test/client/map/controls.js → extras/tests/map/controls.mjs} +3 -3
- package/extras/tests/map/index.mjs +5 -0
- package/{test/client/map/time.js → extras/tests/map/time.mjs} +3 -3
- package/{test/client/map/utils.js → extras/tests/map/utils.mjs} +6 -5
- package/extras/tours/fab.js +36 -0
- package/extras/tours/layout.js +49 -0
- package/extras/tours/pane.left.js +78 -0
- package/extras/tours/pane.right.js +145 -0
- package/extras/tours/pane.top.js +239 -0
- package/map/api/config/layers.cjs +28 -13
- package/map/api/hooks/hooks.query.js +12 -7
- package/map/api/models/catalog.model.mongodb.js +17 -6
- package/map/api/services/catalog/catalog.hooks.js +1 -1
- package/map/api/services/index.js +18 -1
- package/map/client/cesium/utils/utils.cesium.js +25 -65
- package/map/client/cesium/utils/utils.features.js +1 -0
- package/map/client/cesium/utils/utils.geojson.js +1 -0
- package/map/client/cesium/utils/utils.style.js +7 -6
- package/map/client/components/KFeatureEditor.vue +3 -3
- package/map/client/components/KFeaturesChart.vue +4 -4
- package/map/client/components/KFeaturesFilterEditor.vue +19 -13
- package/map/client/components/KFeaturesFilterManager.vue +7 -4
- package/map/client/components/KFeaturesTable.vue +2 -2
- package/map/client/components/KLayerEditor.vue +6 -6
- package/map/client/components/KMeasureTool.vue +2 -1
- package/map/client/components/catalog/KBaseLayersSelector.vue +1 -1
- package/map/client/components/catalog/KCategoryItem.vue +15 -1
- package/map/client/components/catalog/KConnectLayer.vue +2 -2
- package/map/client/components/catalog/KCreateView.vue +3 -2
- package/map/client/components/catalog/KFilteredLayerItem.vue +26 -6
- package/map/client/components/catalog/KImportLayer.vue +6 -3
- package/map/client/components/catalog/KLayerCategories.vue +6 -6
- package/map/client/components/catalog/KLayerItem.vue +12 -2
- package/map/client/components/catalog/KLayersList.vue +180 -0
- package/map/client/components/catalog/KLayersPanel.vue +146 -36
- package/map/client/components/catalog/KLayersSelector.vue +96 -48
- package/map/client/components/catalog/KProjectEditor.vue +0 -9
- package/map/client/components/catalog/KProjectSelector.vue +3 -2
- package/map/client/components/catalog/KProjectsPanel.vue +23 -8
- package/map/client/components/catalog/KViewsPanel.vue +18 -8
- package/map/client/components/catalog/KWeatherLayersSelector.vue +3 -3
- package/map/client/components/form/KDirectionField.vue +3 -6
- package/map/client/components/form/KLayerCategoryField.vue +2 -2
- package/map/client/components/form/KOwsServiceField.vue +25 -24
- package/map/client/components/form/KSelectLayersField.vue +4 -4
- package/map/client/components/form/KSelectViewsField.vue +4 -4
- package/map/client/components/legend/KLayerLegend.vue +11 -2
- package/map/client/components/legend/KLegend.vue +44 -51
- package/map/client/components/location/KLocationCardSection.vue +6 -7
- package/map/client/components/location/KLocationMap.vue +23 -13
- package/map/client/components/stickies/KPosition.vue +5 -0
- package/map/client/components/stickies/KZoomControl.vue +70 -0
- package/map/client/components/styles/KLayerStyleAction.vue +59 -12
- package/map/client/components/styles/KStyleEditor.vue +71 -8
- package/map/client/components/styles/KStyleEditorSection.vue +82 -33
- package/map/client/components/styles/KStyleManager.vue +119 -59
- package/map/client/components/styles/KStylePreview.vue +9 -25
- package/map/client/components/styles/KStylePreviewItem.vue +22 -1
- package/map/client/components/tools/KSearchTool.vue +1 -1
- package/map/client/components/widget/KElevationProfile.vue +20 -17
- package/map/client/components/widget/KInformationBox.vue +5 -5
- package/map/client/components/widget/KMapillaryViewer.vue +2 -1
- package/map/client/components/widget/KTimeSeries.vue +11 -9
- package/map/client/globe.js +2 -0
- package/map/client/i18n/map_en.json +30 -7
- package/map/client/i18n/map_fr.json +30 -7
- package/map/client/leaflet/GradientPath.js +61 -24
- package/map/client/leaflet/ShapeMarker.js +12 -5
- package/map/client/leaflet/TiledMeshLayer.js +3 -3
- package/map/client/leaflet/utils/utils.geojson.js +66 -8
- package/map/client/leaflet/utils/utils.style.js +14 -15
- package/map/client/mixins/globe/mixin.base-globe.js +190 -34
- package/map/client/mixins/globe/mixin.file-layers.js +3 -0
- package/map/client/mixins/globe/mixin.geojson-layers.js +179 -31
- package/map/client/mixins/globe/mixin.opendap-layers.js +2 -1
- package/map/client/mixins/globe/mixin.style.js +23 -1
- package/map/client/mixins/globe/mixin.tooltip.js +14 -2
- package/map/client/mixins/map/mixin.base-map.js +156 -58
- package/map/client/mixins/map/mixin.edit-layers.js +18 -15
- package/map/client/mixins/map/mixin.geojson-layers.js +181 -106
- package/map/client/mixins/map/mixin.heatmap-layers.js +3 -2
- package/map/client/mixins/map/mixin.map-activity.js +6 -1
- package/map/client/mixins/map/mixin.mapillary-layers.js +2 -1
- package/map/client/mixins/map/mixin.pmtiles-layers.js +3 -3
- package/map/client/mixins/map/mixin.tiled-mesh-layers.js +3 -2
- package/map/client/mixins/map/mixin.tiled-wind-layers.js +3 -2
- package/map/client/mixins/mixin.activity.js +199 -55
- package/map/client/mixins/mixin.context.js +11 -11
- package/map/client/mixins/mixin.feature-service.js +11 -9
- package/map/client/mixins/mixin.weacast.js +5 -3
- package/map/client/readers/reader.geojson.js +3 -1
- package/map/client/utils/utils.capture.js +3 -3
- package/map/client/utils/utils.catalog.js +9 -5
- package/map/client/utils/utils.features.js +120 -54
- package/map/client/utils/utils.js +25 -10
- package/map/client/utils/utils.layers.js +148 -24
- package/map/client/utils/utils.location.js +26 -9
- package/map/client/utils/utils.schema.js +2 -1
- package/map/client/utils/utils.style.js +53 -9
- package/map/common/geotiff-grid-source.js +1 -3
- package/map/common/opendap-utils.js +0 -1
- package/map/common/tms-utils.js +0 -1
- package/map/common/wcs-utils.js +0 -1
- package/map/common/wfs-utils.js +0 -1
- package/map/common/wms-utils.js +7 -1
- package/map/common/wmts-utils.js +0 -1
- package/package.json +12 -12
- package/scripts/init_runner.sh +3 -3
- package/scripts/kash/CHANGELOG.md +27 -0
- package/scripts/kash/kash.sh +556 -237
- package/scripts/kash/scripts/run_tests.sh +44 -5
- package/scripts/setup_workspace.sh +23 -13
- package/test/api/core/config/default.cjs +2 -1
- package/test/api/core/tags.test.js +62 -0
- package/test/api/core/test-log-2024-04-22.log +84 -0
- package/test/api/core/{test-log-2025-02-05.log → test-log-2024-04-23.log} +3 -3
- package/test/api/core/test-log-2024-08-13.log +3 -0
- package/test/api/map/config/default.cjs +2 -1
- package/test/api/map/config/layers.json +9 -0
- package/test/api/map/data/openradiation.json +13811 -0
- package/test/api/map/grid-sources.test.js +1 -3
- package/test/api/map/index.test.js +60 -1
- package/test/api/map/style.test.js +30 -1
- package/test/api/map/test-log-2025-03-08.log +0 -0
- package/test.api.js +1 -1
- package/vite/App.vue +18 -0
- package/vite/AppWithGlobe.vue +84 -0
- package/vite/GlobeActivity.vue +58 -0
- package/vite/MapActivity.vue +63 -0
- package/vite/MapActivityWithGlobe.vue +63 -0
- package/vite/README.md +169 -0
- package/vite/config.js +221 -0
- package/vite/index_with_globe.html +50 -0
- package/vite/index_with_map.html +50 -0
- package/vite/package.json +173 -0
- package/vite/quasar.variables.scss +17 -0
- package/vite/vite.config.js +166 -0
- package/vite/yarn.lock +11641 -0
- package/core/client/components/media/KImageViewer.vue +0 -68
- package/core/client/components/media/KMarkdownViewer.vue +0 -55
- package/core/client/components/media/KMediaBrowser.vue +0 -301
- package/coverage/core/api/services/users/users.service.js.html +0 -100
- package/coverage/core/common/utils.offline.js.html +0 -199
- package/coverage/lcov-report/core/api/services/users/users.service.js.html +0 -100
- package/coverage/lcov-report/core/common/utils.offline.js.html +0 -199
- package/coverage/lcov-report/map/api/models/styles.model.mongodb.js.html +0 -112
- package/coverage/lcov-report/map/api/services/styles/index.html +0 -116
- package/coverage/lcov-report/map/api/services/styles/styles.hooks.js.html +0 -196
- package/coverage/map/api/models/styles.model.mongodb.js.html +0 -112
- package/coverage/map/api/services/styles/index.html +0 -116
- package/coverage/map/api/services/styles/styles.hooks.js.html +0 -196
- package/coverage/tmp/coverage-151198-1753351220086-0.json +0 -1
- package/coverage/tmp/coverage-151210-1753351220070-0.json +0 -1
- package/coverage/tmp/coverage-151221-1753351129816-0.json +0 -1
- package/coverage/tmp/coverage-151233-1753351129803-0.json +0 -1
- package/coverage/tmp/coverage-151240-1753351129770-0.json +0 -1
- package/coverage/tmp/coverage-151307-1753351220058-0.json +0 -1
- package/coverage/tmp/coverage-151319-1753351220044-0.json +0 -1
- package/coverage/tmp/coverage-151326-1753351220010-0.json +0 -1
- package/extras/tours/core/account-profile.js +0 -32
- package/extras/tours/core/account.js +0 -143
- package/extras/tours/core/add-member.js +0 -75
- package/extras/tours/core/add-tag.js +0 -13
- package/extras/tours/core/create-group.js +0 -19
- package/extras/tours/core/create-organisation.js +0 -19
- package/extras/tours/core/create-tag.js +0 -26
- package/extras/tours/core/edit-member-role.js +0 -13
- package/extras/tours/core/groups.js +0 -65
- package/extras/tours/core/join-group.js +0 -13
- package/extras/tours/core/login.js +0 -41
- package/extras/tours/core/members.js +0 -108
- package/extras/tours/core/register.js +0 -61
- package/extras/tours/core/send-reset-password.js +0 -14
- package/extras/tours/core/tags.js +0 -65
- package/extras/tours/map/catalog-panel.js +0 -112
- package/extras/tours/map/fab.js +0 -26
- package/extras/tours/map/navigation-bar.js +0 -187
- package/extras/tours/map/side-nav.js +0 -36
- package/test/api/core/test-log-2025-05-21.log +0 -15
- package/test/api/core/test-log-2025-06-25.log +0 -9
- package/test/api/core/test-log-2025-07-24.log +0 -44
- package/test/api/map/test-log-2025-05-27.log +0 -13
- package/test/api/map/test-log-2025-06-23.log +0 -7
- package/test/api/map/test-log-2025-07-24.log +0 -11
- package/test/client/core/api.js +0 -361
- package/test/client/core/index.js +0 -9
- package/test/client/index.js +0 -4
- package/test/client/map/index.js +0 -5
- package/test.client.js +0 -1
- /package/{test/client/core/time.js → extras/tests/core/time.mjs} +0 -0
- /package/extras/tours/{map/add-layer.js → add-layer.js} +0 -0
- /package/extras/tours/{map/catalog-categories.js → catalog-categories.js} +0 -0
- /package/extras/tours/{map/connect-layer.js → connect-layer.js} +0 -0
- /package/extras/tours/{map/create-layer.js → create-layer.js} +0 -0
- /package/extras/tours/{map/create-view.js → create-view.js} +0 -0
- /package/extras/tours/{map/import-layer.js → import-layer.js} +0 -0
- /package/extras/tours/{map/timeline.js → pane.bottom.js} +0 -0
|
@@ -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">0% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>0/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">0% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>0/1</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">0% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>0/1</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">0% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>0/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 low'></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">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
|
-
|
|
430
|
-
const alerts = {}
|
|
431
|
-
|
|
432
|
-
export default {
|
|
433
|
-
async registerAlert (alert, check = true) {
|
|
434
|
-
|
|
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
|
|
444
|
-
const cronJob = alerts[id.toString()]
|
|
445
|
-
|
|
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
|
-
|
|
241
|
+
<a name='L176'></a><a href='#L176'>176</a></td><td class="line-coverage quiet"><span class="cline-any cline-no"> </span>
|
|
242
|
+
<span class="cline-any cline-no"> </span>
|
|
243
|
+
<span class="cline-any cline-no"> </span>
|
|
244
|
+
<span class="cline-any cline-no"> </span>
|
|
245
|
+
<span class="cline-any cline-no"> </span>
|
|
246
|
+
<span class="cline-any cline-no"> </span>
|
|
247
|
+
<span class="cline-any cline-no"> </span>
|
|
248
|
+
<span class="cline-any cline-no"> </span>
|
|
249
|
+
<span class="cline-any cline-no"> </span>
|
|
250
|
+
<span class="cline-any cline-no"> </span>
|
|
251
|
+
<span class="cline-any cline-no"> </span>
|
|
252
|
+
<span class="cline-any cline-no"> </span>
|
|
253
|
+
<span class="cline-any cline-no"> </span>
|
|
254
|
+
<span class="cline-any cline-no"> </span>
|
|
255
|
+
<span class="cline-any cline-no"> </span>
|
|
256
|
+
<span class="cline-any cline-no"> </span>
|
|
257
|
+
<span class="cline-any cline-no"> </span>
|
|
258
|
+
<span class="cline-any cline-no"> </span>
|
|
259
|
+
<span class="cline-any cline-no"> </span>
|
|
260
|
+
<span class="cline-any cline-no"> </span>
|
|
261
|
+
<span class="cline-any cline-no"> </span>
|
|
262
|
+
<span class="cline-any cline-no"> </span>
|
|
263
|
+
<span class="cline-any cline-no"> </span>
|
|
264
|
+
<span class="cline-any cline-no"> </span>
|
|
265
|
+
<span class="cline-any cline-no"> </span>
|
|
266
|
+
<span class="cline-any cline-no"> </span>
|
|
267
|
+
<span class="cline-any cline-no"> </span>
|
|
268
|
+
<span class="cline-any cline-no"> </span>
|
|
269
|
+
<span class="cline-any cline-no"> </span>
|
|
270
|
+
<span class="cline-any cline-no"> </span>
|
|
271
|
+
<span class="cline-any cline-no"> </span>
|
|
272
|
+
<span class="cline-any cline-no"> </span>
|
|
273
|
+
<span class="cline-any cline-no"> </span>
|
|
274
|
+
<span class="cline-any cline-no"> </span>
|
|
275
|
+
<span class="cline-any cline-no"> </span>
|
|
276
|
+
<span class="cline-any cline-no"> </span>
|
|
277
|
+
<span class="cline-any cline-no"> </span>
|
|
278
|
+
<span class="cline-any cline-no"> </span>
|
|
279
|
+
<span class="cline-any cline-no"> </span>
|
|
280
|
+
<span class="cline-any cline-no"> </span>
|
|
281
|
+
<span class="cline-any cline-no"> </span>
|
|
282
|
+
<span class="cline-any cline-no"> </span>
|
|
283
|
+
<span class="cline-any cline-no"> </span>
|
|
284
|
+
<span class="cline-any cline-no"> </span>
|
|
285
|
+
<span class="cline-any cline-no"> </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-no"> </span>
|
|
293
|
+
<span class="cline-any cline-no"> </span>
|
|
294
|
+
<span class="cline-any cline-no"> </span>
|
|
295
|
+
<span class="cline-any cline-no"> </span>
|
|
296
|
+
<span class="cline-any cline-no"> </span>
|
|
297
|
+
<span class="cline-any cline-no"> </span>
|
|
298
|
+
<span class="cline-any cline-no"> </span>
|
|
299
|
+
<span class="cline-any cline-no"> </span>
|
|
300
|
+
<span class="cline-any cline-no"> </span>
|
|
301
|
+
<span class="cline-any cline-no"> </span>
|
|
302
|
+
<span class="cline-any cline-no"> </span>
|
|
303
|
+
<span class="cline-any cline-no"> </span>
|
|
304
|
+
<span class="cline-any cline-no"> </span>
|
|
305
|
+
<span class="cline-any cline-no"> </span>
|
|
306
|
+
<span class="cline-any cline-no"> </span>
|
|
307
|
+
<span class="cline-any cline-no"> </span>
|
|
308
|
+
<span class="cline-any cline-no"> </span>
|
|
309
|
+
<span class="cline-any cline-no"> </span>
|
|
310
|
+
<span class="cline-any cline-no"> </span>
|
|
311
|
+
<span class="cline-any cline-no"> </span>
|
|
312
|
+
<span class="cline-any cline-no"> </span>
|
|
313
|
+
<span class="cline-any cline-no"> </span>
|
|
314
|
+
<span class="cline-any cline-no"> </span>
|
|
315
|
+
<span class="cline-any cline-no"> </span>
|
|
316
|
+
<span class="cline-any cline-no"> </span>
|
|
317
|
+
<span class="cline-any cline-no"> </span>
|
|
318
|
+
<span class="cline-any cline-no"> </span>
|
|
319
|
+
<span class="cline-any cline-no"> </span>
|
|
320
|
+
<span class="cline-any cline-no"> </span>
|
|
321
|
+
<span class="cline-any cline-no"> </span>
|
|
322
|
+
<span class="cline-any cline-no"> </span>
|
|
323
|
+
<span class="cline-any cline-no"> </span>
|
|
324
|
+
<span class="cline-any cline-no"> </span>
|
|
325
|
+
<span class="cline-any cline-no"> </span>
|
|
326
|
+
<span class="cline-any cline-no"> </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-no"> </span>
|
|
334
|
+
<span class="cline-any cline-no"> </span>
|
|
335
|
+
<span class="cline-any cline-no"> </span>
|
|
336
|
+
<span class="cline-any cline-no"> </span>
|
|
337
|
+
<span class="cline-any cline-no"> </span>
|
|
338
|
+
<span class="cline-any cline-no"> </span>
|
|
339
|
+
<span class="cline-any cline-no"> </span>
|
|
340
|
+
<span class="cline-any cline-no"> </span>
|
|
341
|
+
<span class="cline-any cline-no"> </span>
|
|
342
|
+
<span class="cline-any cline-no"> </span>
|
|
343
|
+
<span class="cline-any cline-no"> </span>
|
|
344
|
+
<span class="cline-any cline-no"> </span>
|
|
345
|
+
<span class="cline-any cline-no"> </span>
|
|
346
|
+
<span class="cline-any cline-no"> </span>
|
|
347
|
+
<span class="cline-any cline-no"> </span>
|
|
348
|
+
<span class="cline-any cline-no"> </span>
|
|
349
|
+
<span class="cline-any cline-no"> </span>
|
|
350
|
+
<span class="cline-any cline-no"> </span>
|
|
351
|
+
<span class="cline-any cline-no"> </span>
|
|
352
|
+
<span class="cline-any cline-no"> </span>
|
|
353
|
+
<span class="cline-any cline-no"> </span>
|
|
354
|
+
<span class="cline-any cline-no"> </span>
|
|
355
|
+
<span class="cline-any cline-no"> </span>
|
|
356
|
+
<span class="cline-any cline-no"> </span>
|
|
357
|
+
<span class="cline-any cline-no"> </span>
|
|
358
|
+
<span class="cline-any cline-no"> </span>
|
|
359
|
+
<span class="cline-any cline-no"> </span>
|
|
360
|
+
<span class="cline-any cline-no"> </span>
|
|
361
|
+
<span class="cline-any cline-no"> </span>
|
|
362
|
+
<span class="cline-any cline-no"> </span>
|
|
363
|
+
<span class="cline-any cline-no"> </span>
|
|
364
|
+
<span class="cline-any cline-no"> </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-no"> </span>
|
|
369
|
+
<span class="cline-any cline-no"> </span>
|
|
370
|
+
<span class="cline-any cline-no"> </span>
|
|
371
|
+
<span class="cline-any cline-no"> </span>
|
|
372
|
+
<span class="cline-any cline-no"> </span>
|
|
373
|
+
<span class="cline-any cline-no"> </span>
|
|
374
|
+
<span class="cline-any cline-no"> </span>
|
|
375
|
+
<span class="cline-any cline-no"> </span>
|
|
376
|
+
<span class="cline-any cline-no"> </span>
|
|
377
|
+
<span class="cline-any cline-no"> </span>
|
|
378
|
+
<span class="cline-any cline-no"> </span>
|
|
379
|
+
<span class="cline-any cline-no"> </span>
|
|
380
|
+
<span class="cline-any cline-no"> </span>
|
|
381
|
+
<span class="cline-any cline-no"> </span>
|
|
382
|
+
<span class="cline-any cline-no"> </span>
|
|
383
|
+
<span class="cline-any cline-no"> </span>
|
|
384
|
+
<span class="cline-any cline-no"> </span>
|
|
385
|
+
<span class="cline-any cline-no"> </span>
|
|
386
|
+
<span class="cline-any cline-no"> </span>
|
|
387
|
+
<span class="cline-any cline-no"> </span>
|
|
388
|
+
<span class="cline-any cline-no"> </span>
|
|
389
|
+
<span class="cline-any cline-no"> </span>
|
|
390
|
+
<span class="cline-any cline-no"> </span>
|
|
391
|
+
<span class="cline-any cline-no"> </span>
|
|
392
|
+
<span class="cline-any cline-no"> </span>
|
|
393
|
+
<span class="cline-any cline-no"> </span>
|
|
394
|
+
<span class="cline-any cline-no"> </span>
|
|
395
|
+
<span class="cline-any cline-no"> </span>
|
|
396
|
+
<span class="cline-any cline-no"> </span>
|
|
397
|
+
<span class="cline-any cline-no"> </span>
|
|
398
|
+
<span class="cline-any cline-no"> </span>
|
|
399
|
+
<span class="cline-any cline-no"> </span>
|
|
400
|
+
<span class="cline-any cline-no"> </span>
|
|
401
|
+
<span class="cline-any cline-no"> </span>
|
|
402
|
+
<span class="cline-any cline-no"> </span>
|
|
403
|
+
<span class="cline-any cline-no"> </span>
|
|
404
|
+
<span class="cline-any cline-no"> </span>
|
|
405
|
+
<span class="cline-any cline-no"> </span>
|
|
406
|
+
<span class="cline-any cline-no"> </span>
|
|
407
|
+
<span class="cline-any cline-no"> </span>
|
|
408
|
+
<span class="cline-any cline-no"> </span>
|
|
409
|
+
<span class="cline-any cline-no"> </span>
|
|
410
|
+
<span class="cline-any cline-no"> </span>
|
|
411
|
+
<span class="cline-any cline-no"> </span>
|
|
412
|
+
<span class="cline-any cline-no"> </span>
|
|
413
|
+
<span class="cline-any cline-no"> </span>
|
|
414
|
+
<span class="cline-any cline-no"> </span>
|
|
415
|
+
<span class="cline-any cline-no"> </span>
|
|
416
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js"><span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" ><span class="branch-0 cbranch-no" title="branch not covered" >import _ from 'lodash'</span></span></span>
|
|
417
|
+
<span class="cstat-no" title="statement not covered" >import moment from 'moment'</span>
|
|
418
|
+
<span class="cstat-no" title="statement not covered" >import siftModule from 'sift'</span>
|
|
419
|
+
<span class="cstat-no" title="statement not covered" >import request from 'superagent'</span>
|
|
420
|
+
<span class="cstat-no" title="statement not covered" >import cron from 'cron'</span>
|
|
421
|
+
<span class="cstat-no" title="statement not covered" >import errors from '@feathersjs/errors'</span>
|
|
422
|
+
<span class="cstat-no" title="statement not covered" >import makeDebug from 'debug'</span>
|
|
423
|
+
<span class="cstat-no" title="statement not covered" >const debug = makeDebug('kdk:map:alerts:service')</span>
|
|
424
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
425
|
+
<span class="cstat-no" title="statement not covered" >const { CronJob } = cron</span>
|
|
426
|
+
<span class="cstat-no" title="statement not covered" >const { Unprocessable } = errors</span>
|
|
427
|
+
<span class="cstat-no" title="statement not covered" >const sift = siftModule.default</span>
|
|
428
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
429
|
+
<span class="cstat-no" title="statement not covered" >// Alert map</span>
|
|
430
|
+
<span class="cstat-no" title="statement not covered" >const alerts = {}</span>
|
|
431
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
432
|
+
<span class="cstat-no" title="statement not covered" >export default {</span>
|
|
433
|
+
<span class="cstat-no" title="statement not covered" > async registerAlert (alert, check = true) {</span>
|
|
434
|
+
<span class="cstat-no" title="statement not covered" > if (alerts[alert._id.toString()]) return</span>
|
|
435
|
+
<span class="cstat-no" title="statement not covered" > debug('Registering new alert ', alert)</span>
|
|
436
|
+
<span class="cstat-no" title="statement not covered" > const cronJob = new CronJob(alert.cron, () => this.checkAlert(alert))</span>
|
|
437
|
+
<span class="cstat-no" title="statement not covered" > alerts[alert._id.toString()] = cronJob</span>
|
|
438
|
+
<span class="cstat-no" title="statement not covered" > if (check) await this.checkAlert(alert)</span>
|
|
439
|
+
<span class="cstat-no" title="statement not covered" > cronJob.start()</span>
|
|
440
|
+
<span class="cstat-no" title="statement not covered" > },</span>
|
|
441
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
442
|
+
<span class="cstat-no" title="statement not covered" > async unregisterAlert (alert) {</span>
|
|
443
|
+
<span class="cstat-no" title="statement not covered" > const id = (typeof alert === 'string' ? alert : alert._id)</span>
|
|
444
|
+
<span class="cstat-no" title="statement not covered" > const cronJob = alerts[id.toString()]</span>
|
|
445
|
+
<span class="cstat-no" title="statement not covered" > if (!cronJob) return</span>
|
|
446
|
+
<span class="cstat-no" title="statement not covered" > debug('Unregistering alert ', alert)</span>
|
|
447
|
+
<span class="cstat-no" title="statement not covered" > cronJob.stop()</span>
|
|
448
|
+
<span class="cstat-no" title="statement not covered" > delete alerts[id.toString()]</span>
|
|
449
|
+
<span class="cstat-no" title="statement not covered" > },</span>
|
|
450
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
451
|
+
<span class="cstat-no" title="statement not covered" > getConditions (alert) {</span>
|
|
452
|
+
<span class="cstat-no" title="statement not covered" > return _.mapKeys(alert.conditions, (value, key) => 'properties.' + key)</span>
|
|
453
|
+
<span class="cstat-no" title="statement not covered" > },</span>
|
|
454
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
455
|
+
<span class="cstat-no" title="statement not covered" > async checkWeatherAlert (alert) {</span>
|
|
456
|
+
<span class="cstat-no" title="statement not covered" > const now = moment.utc()</span>
|
|
457
|
+
<span class="cstat-no" title="statement not covered" > // Convert conditions to internal data model</span>
|
|
458
|
+
<span class="cstat-no" title="statement not covered" > const conditions = this.getConditions(alert)</span>
|
|
459
|
+
<span class="cstat-no" title="statement not covered" > const probesService = this.app.getService('probes')</span>
|
|
460
|
+
<span class="cstat-no" title="statement not covered" > if (!probesService) {</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
|
-
// 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
|
-
|
|
467
|
+
<span class="cstat-no" title="statement not covered" > // Perform aggregation over time range</span>
|
|
468
|
+
<span class="cstat-no" title="statement not covered" > const query = Object.assign({</span>
|
|
469
|
+
<span class="cstat-no" title="statement not covered" > forecastTime: {</span>
|
|
470
|
+
<span class="cstat-no" title="statement not covered" > $gte: now.clone().add(_.get(alert, 'period.start', { seconds: 0 })).toDate(),</span>
|
|
471
|
+
<span class="cstat-no" title="statement not covered" > $lte: now.clone().add(_.get(alert, 'period.end', { seconds: 24 * 3600 })).toDate()</span>
|
|
472
|
+
<span class="cstat-no" title="statement not covered" > },</span>
|
|
473
|
+
<span class="cstat-no" title="statement not covered" > geometry: {</span>
|
|
474
|
+
<span class="cstat-no" title="statement not covered" > $geoIntersects: {</span>
|
|
475
|
+
<span class="cstat-no" title="statement not covered" > $geometry: _.get(alert, 'geometry')</span>
|
|
476
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
477
|
+
<span class="cstat-no" title="statement not covered" > },</span>
|
|
478
|
+
<span class="cstat-no" title="statement not covered" > aggregate: false</span>
|
|
479
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
480
|
+
<span class="cstat-no" title="statement not covered" > const result = await probesService.create({</span>
|
|
481
|
+
<span class="cstat-no" title="statement not covered" > forecast: alert.forecast,</span>
|
|
482
|
+
<span class="cstat-no" title="statement not covered" > elements: alert.elements</span>
|
|
483
|
+
<span class="cstat-no" title="statement not covered" > }, { query })</span>
|
|
484
|
+
<span class="cstat-no" title="statement not covered" > // Check for available data so that we will not close an alert because data is missing</span>
|
|
485
|
+
<span class="cstat-no" title="statement not covered" > if (result.features.length === 0) {</span>
|
|
486
|
+
<span class="cstat-no" title="statement not covered" > throw new Unprocessable('Cannot check alert ' + alert._id.toString() + ' as no data is available for ' + alert.forecast, {</span>
|
|
487
|
+
<span class="cstat-no" title="statement not covered" > translation: {</span>
|
|
488
|
+
<span class="cstat-no" title="statement not covered" > key: 'CANNOT_CHECK_ALERT_MISSING_DATA'</span>
|
|
489
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
490
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
491
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
492
|
+
<span class="cstat-no" title="statement not covered" > // Let sift performs condition matching as in this case MongoDB cannot</span>
|
|
493
|
+
<span class="cstat-no" title="statement not covered" > return result.features.filter(sift(conditions))</span>
|
|
494
|
+
<span class="cstat-no" title="statement not covered" > },</span>
|
|
495
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
496
|
+
<span class="cstat-no" title="statement not covered" > async checkMeasureAlert (alert) {</span>
|
|
497
|
+
<span class="cstat-no" title="statement not covered" > const now = moment.utc()</span>
|
|
498
|
+
<span class="cstat-no" title="statement not covered" > // Convert conditions to internal data model</span>
|
|
499
|
+
<span class="cstat-no" title="statement not covered" > const conditions = this.getConditions(alert)</span>
|
|
500
|
+
<span class="cstat-no" title="statement not covered" > const featureService = this.app.getService(_.get(alert, 'layer.service'))</span>
|
|
501
|
+
<span class="cstat-no" title="statement not covered" > if (!featureService) {</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
|
-
// 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
|
-
|
|
508
|
+
<span class="cstat-no" title="statement not covered" > // Build base query for time range and target feature</span>
|
|
509
|
+
<span class="cstat-no" title="statement not covered" > const query = {</span>
|
|
510
|
+
<span class="cstat-no" title="statement not covered" > time: {</span>
|
|
511
|
+
<span class="cstat-no" title="statement not covered" > $gte: now.clone().add(_.get(alert, 'period.start', { seconds: 0 })).toDate(),</span>
|
|
512
|
+
<span class="cstat-no" title="statement not covered" > $lte: now.clone().add(_.get(alert, 'period.end', { seconds: 24 * 3600 })).toDate()</span>
|
|
513
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
514
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
515
|
+
<span class="cstat-no" title="statement not covered" > if (_.has(alert, 'layer.featureId')) {</span>
|
|
516
|
+
<span class="cstat-no" title="statement not covered" > query['properties.' + _.get(alert, 'layer.featureId')] = alert.feature</span>
|
|
517
|
+
<span class="cstat-no" title="statement 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
|
-
// 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
|
-
|
|
520
|
+
<span class="cstat-no" title="statement not covered" > // Check for available data so that we will not close an alert because data is missing</span>
|
|
521
|
+
<span class="cstat-no" title="statement not covered" > // $limit = 0 performs a simple count query</span>
|
|
522
|
+
<span class="cstat-no" title="statement not covered" > let result = await featureService.find({ query: Object.assign({ $limit: 0 }, query) })</span>
|
|
523
|
+
<span class="cstat-no" title="statement not covered" > if (result.total === 0) {</span>
|
|
524
|
+
<span class="cstat-no" title="statement not covered" > throw new Unprocessable('Cannot check alert ' + alert._id.toString() + ' as no data is available for features service ' + _.get(alert, 'layer.service'), {</span>
|
|
525
|
+
<span class="cstat-no" title="statement not covered" > translation: {</span>
|
|
526
|
+
<span class="cstat-no" title="statement not covered" > key: 'CANNOT_CHECK_ALERT_MISSING_DATA'</span>
|
|
527
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
528
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
529
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
530
|
+
<span class="cstat-no" title="statement not covered" > // Perform aggregation over time range</span>
|
|
531
|
+
<span class="cstat-no" title="statement not covered" > result = await featureService.find({ query: Object.assign(query, conditions) })</span>
|
|
532
|
+
<span class="cstat-no" title="statement not covered" > return result.features</span>
|
|
533
|
+
<span class="cstat-no" title="statement not covered" > },</span>
|
|
534
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
535
|
+
<span class="cstat-no" title="statement not covered" > async checkAlert (alert, options = { patch: true, callWebhook: true }) {</span>
|
|
536
|
+
<span class="cstat-no" title="statement not covered" > const now = moment.utc()</span>
|
|
537
|
+
<span class="cstat-no" title="statement not covered" > debug('Checking alert at ' + now.format(), _.omit(alert, ['status', 'webhook']))</span>
|
|
538
|
+
<span class="cstat-no" title="statement not covered" > // First check if still valid</span>
|
|
539
|
+
<span class="cstat-no" title="statement not covered" > if (now.isAfter(alert.expireAt)) {</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
|
-
// 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
|
-
}
|
|
543
|
+
<span class="cstat-no" title="statement not covered" > // Then update alert status starting from previous one (i.e. trigger time stamp, etc.)</span>
|
|
544
|
+
<span class="cstat-no" title="statement not covered" > const status = _.get(alert, 'status', {})</span>
|
|
545
|
+
<span class="cstat-no" title="statement not covered" > status.checkedAt = now.clone()</span>
|
|
546
|
+
<span class="cstat-no" title="statement not covered" > // Clean any error state</span>
|
|
547
|
+
<span class="cstat-no" title="statement not covered" > delete status.error</span>
|
|
548
|
+
<span class="cstat-no" title="statement not covered" > try {</span>
|
|
549
|
+
<span class="cstat-no" title="statement not covered" > const results = (alert.feature ? await this.checkMeasureAlert(alert) : await this.checkWeatherAlert(alert))</span>
|
|
550
|
+
<span class="cstat-no" title="statement not covered" > // FIXME: check for a specific duration where conditions are met</span>
|
|
551
|
+
<span class="cstat-no" title="statement not covered" > const isActive = (results.length > 0)</span>
|
|
552
|
+
<span class="cstat-no" title="statement not covered" > const wasActive = status.active</span>
|
|
553
|
+
<span class="cstat-no" title="statement not covered" > status.active = isActive</span>
|
|
554
|
+
<span class="cstat-no" title="statement not covered" > if (isActive) {</span>
|
|
555
|
+
<span class="cstat-no" title="statement not covered" > // If not previously active and it is now add first time stamp</span>
|
|
556
|
+
<span class="cstat-no" title="statement not covered" > if (!wasActive) {</span>
|
|
557
|
+
<span class="cstat-no" title="statement not covered" > status.triggeredAt = now.clone()</span>
|
|
558
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
559
|
+
<span class="cstat-no" title="statement not covered" > // Update triggers</span>
|
|
560
|
+
<span class="cstat-no" title="statement not covered" > status.triggers = results</span>
|
|
561
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
562
|
+
<span class="cstat-no" title="statement not covered" > debug('Alert ' + alert._id.toString() + ' status', status, ' with ' + results.length + ' triggers')</span>
|
|
563
|
+
<span class="cstat-no" title="statement not covered" > } catch (error) { // Possible if no data</span>
|
|
564
|
+
<span class="cstat-no" title="statement not covered" > this.app.logger.error(error.message)</span>
|
|
565
|
+
<span class="cstat-no" title="statement not covered" > status.error = error.toJSON()</span>
|
|
566
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
567
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
568
|
+
<span class="cstat-no" title="statement not covered" > // As we keep in-memory objects avoid them being mutated by hooks processing operation payload</span>
|
|
569
|
+
<span class="cstat-no" title="statement not covered" > if (options.patch) {</span>
|
|
570
|
+
<span class="cstat-no" title="statement not covered" > await this.patch(alert._id.toString(), { status: Object.assign({}, status) })</span>
|
|
571
|
+
<span class="cstat-no" title="statement not covered" > // DEBUG code to simulate alert closing</span>
|
|
572
|
+
<span class="cstat-no" title="statement not covered" > /*</span>
|
|
573
|
+
<span class="cstat-no" title="statement not covered" > setTimeout(async () => {</span>
|
|
574
|
+
<span class="cstat-no" title="statement not covered" > await this.patch(alert._id.toString(), {</span>
|
|
575
|
+
<span class="cstat-no" title="statement not covered" > status: { active: false, checkedAt: now.clone() }</span>
|
|
576
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
577
|
+
<span class="cstat-no" title="statement not covered" > }, 10000)</span>
|
|
578
|
+
<span class="cstat-no" title="statement not covered" > */</span>
|
|
579
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
580
|
+
<span class="cstat-no" title="statement not covered" > // Keep track of changes in memory as well</span>
|
|
581
|
+
<span class="cstat-no" title="statement not covered" > Object.assign(alert, { status })</span>
|
|
582
|
+
<span class="cstat-no" title="statement not covered" > // If a webhook is configured call it</span>
|
|
583
|
+
<span class="cstat-no" title="statement not covered" > const webhook = alert.webhook</span>
|
|
584
|
+
<span class="cstat-no" title="statement not covered" > if (options.callWebhook && webhook) {</span>
|
|
585
|
+
<span class="cstat-no" title="statement not covered" > const body = Object.assign({ alert: _.omit(alert, ['webhook']) }, _.omit(webhook, ['url']))</span>
|
|
586
|
+
<span class="cstat-no" title="statement not covered" > await request.post(webhook.url, body)</span>
|
|
587
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
588
|
+
<span class="cstat-no" title="statement not covered" > return alert</span>
|
|
589
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
590
|
+
<span class="cstat-no" title="statement not covered" >}</span>
|
|
591
591
|
</pre></td></tr></table></pre>
|
|
592
592
|
|
|
593
593
|
<div class='push'></div><!-- for sticky footer -->
|
|
@@ -595,7 +595,7 @@ export default {
|
|
|
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
|
|
598
|
+
at 2024-08-13T10:02:04.872Z
|
|
599
599
|
</div>
|
|
600
600
|
<script src="../../../../prettify.js"></script>
|
|
601
601
|
<script>
|