@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/408</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/408</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>
|
|
@@ -466,812 +466,827 @@
|
|
|
466
466
|
<a name='L401'></a><a href='#L401'>401</a>
|
|
467
467
|
<a name='L402'></a><a href='#L402'>402</a>
|
|
468
468
|
<a name='L403'></a><a href='#L403'>403</a>
|
|
469
|
-
<a name='L404'></a><a href='#L404'>404</a
|
|
470
|
-
<
|
|
471
|
-
<
|
|
472
|
-
<
|
|
473
|
-
<
|
|
474
|
-
<span class="cline-any cline-
|
|
475
|
-
<span class="cline-any cline-
|
|
476
|
-
<span class="cline-any cline-
|
|
477
|
-
<span class="cline-any cline-
|
|
478
|
-
<span class="cline-any cline-
|
|
479
|
-
<span class="cline-any cline-
|
|
480
|
-
<span class="cline-any cline-
|
|
481
|
-
<span class="cline-any cline-
|
|
482
|
-
<span class="cline-any cline-
|
|
483
|
-
<span class="cline-any cline-
|
|
484
|
-
<span class="cline-any cline-
|
|
485
|
-
<span class="cline-any cline-
|
|
486
|
-
<span class="cline-any cline-
|
|
487
|
-
<span class="cline-any cline-
|
|
488
|
-
<span class="cline-any cline-
|
|
489
|
-
<span class="cline-any cline-
|
|
490
|
-
<span class="cline-any cline-
|
|
491
|
-
<span class="cline-any cline-
|
|
492
|
-
<span class="cline-any cline-
|
|
493
|
-
<span class="cline-any cline-
|
|
494
|
-
<span class="cline-any cline-
|
|
495
|
-
<span class="cline-any cline-
|
|
496
|
-
<span class="cline-any cline-
|
|
497
|
-
<span class="cline-any cline-
|
|
498
|
-
<span class="cline-any cline-
|
|
499
|
-
<span class="cline-any cline-
|
|
500
|
-
<span class="cline-any cline-
|
|
501
|
-
<span class="cline-any cline-
|
|
502
|
-
<span class="cline-any cline-
|
|
503
|
-
<span class="cline-any cline-
|
|
504
|
-
<span class="cline-any cline-
|
|
505
|
-
<span class="cline-any cline-
|
|
506
|
-
<span class="cline-any cline-
|
|
507
|
-
<span class="cline-any cline-
|
|
508
|
-
<span class="cline-any cline-
|
|
509
|
-
<span class="cline-any cline-
|
|
510
|
-
<span class="cline-any cline-
|
|
511
|
-
<span class="cline-any cline-
|
|
512
|
-
<span class="cline-any cline-
|
|
513
|
-
<span class="cline-any cline-
|
|
514
|
-
<span class="cline-any cline-
|
|
515
|
-
<span class="cline-any cline-
|
|
516
|
-
<span class="cline-any cline-
|
|
517
|
-
<span class="cline-any cline-
|
|
518
|
-
<span class="cline-any cline-
|
|
519
|
-
<span class="cline-any cline-
|
|
520
|
-
<span class="cline-any cline-
|
|
521
|
-
<span class="cline-any cline-
|
|
522
|
-
<span class="cline-any cline-
|
|
523
|
-
<span class="cline-any cline-
|
|
524
|
-
<span class="cline-any cline-
|
|
525
|
-
<span class="cline-any cline-
|
|
526
|
-
<span class="cline-any cline-
|
|
527
|
-
<span class="cline-any cline-
|
|
528
|
-
<span class="cline-any cline-
|
|
529
|
-
<span class="cline-any cline-
|
|
530
|
-
<span class="cline-any cline-no"> </span>
|
|
531
|
-
<span class="cline-any cline-no"> </span>
|
|
532
|
-
<span class="cline-any cline-no"> </span>
|
|
533
|
-
<span class="cline-any cline-no"> </span>
|
|
534
|
-
<span class="cline-any cline-no"> </span>
|
|
535
|
-
<span class="cline-any cline-no"> </span>
|
|
536
|
-
<span class="cline-any cline-
|
|
537
|
-
<span class="cline-any cline-
|
|
538
|
-
<span class="cline-any cline-
|
|
539
|
-
<span class="cline-any cline-
|
|
540
|
-
<span class="cline-any cline-
|
|
541
|
-
<span class="cline-any cline-
|
|
542
|
-
<span class="cline-any cline-
|
|
543
|
-
<span class="cline-any cline-
|
|
544
|
-
<span class="cline-any cline-
|
|
545
|
-
<span class="cline-any cline-
|
|
546
|
-
<span class="cline-any cline-
|
|
547
|
-
<span class="cline-any cline-
|
|
548
|
-
<span class="cline-any cline-
|
|
549
|
-
<span class="cline-any cline-
|
|
550
|
-
<span class="cline-any cline-
|
|
551
|
-
<span class="cline-any cline-
|
|
552
|
-
<span class="cline-any cline-
|
|
553
|
-
<span class="cline-any cline-
|
|
554
|
-
<span class="cline-any cline-
|
|
555
|
-
<span class="cline-any cline-
|
|
556
|
-
<span class="cline-any cline-
|
|
557
|
-
<span class="cline-any cline-
|
|
558
|
-
<span class="cline-any cline-
|
|
559
|
-
<span class="cline-any cline-
|
|
560
|
-
<span class="cline-any cline-
|
|
561
|
-
<span class="cline-any cline-
|
|
562
|
-
<span class="cline-any cline-
|
|
563
|
-
<span class="cline-any cline-
|
|
564
|
-
<span class="cline-any cline-
|
|
565
|
-
<span class="cline-any cline-
|
|
566
|
-
<span class="cline-any cline-
|
|
567
|
-
<span class="cline-any cline-
|
|
568
|
-
<span class="cline-any cline-
|
|
569
|
-
<span class="cline-any cline-
|
|
570
|
-
<span class="cline-any cline-
|
|
571
|
-
<span class="cline-any cline-
|
|
572
|
-
<span class="cline-any cline-
|
|
573
|
-
<span class="cline-any cline-
|
|
574
|
-
<span class="cline-any cline-
|
|
575
|
-
<span class="cline-any cline-
|
|
576
|
-
<span class="cline-any cline-
|
|
577
|
-
<span class="cline-any cline-
|
|
578
|
-
<span class="cline-any cline-
|
|
579
|
-
<span class="cline-any cline-
|
|
580
|
-
<span class="cline-any cline-
|
|
581
|
-
<span class="cline-any cline-
|
|
582
|
-
<span class="cline-any cline-
|
|
583
|
-
<span class="cline-any cline-
|
|
584
|
-
<span class="cline-any cline-
|
|
585
|
-
<span class="cline-any cline-
|
|
586
|
-
<span class="cline-any cline-
|
|
587
|
-
<span class="cline-any cline-
|
|
588
|
-
<span class="cline-any cline-
|
|
589
|
-
<span class="cline-any cline-
|
|
590
|
-
<span class="cline-any cline-
|
|
591
|
-
<span class="cline-any cline-
|
|
592
|
-
<span class="cline-any cline-
|
|
593
|
-
<span class="cline-any cline-
|
|
594
|
-
<span class="cline-any cline-
|
|
595
|
-
<span class="cline-any cline-
|
|
596
|
-
<span class="cline-any cline-
|
|
597
|
-
<span class="cline-any cline-
|
|
598
|
-
<span class="cline-any cline-
|
|
599
|
-
<span class="cline-any cline-
|
|
600
|
-
<span class="cline-any cline-
|
|
601
|
-
<span class="cline-any cline-
|
|
602
|
-
<span class="cline-any cline-
|
|
603
|
-
<span class="cline-any cline-
|
|
604
|
-
<span class="cline-any cline-
|
|
605
|
-
<span class="cline-any cline-
|
|
606
|
-
<span class="cline-any cline-
|
|
607
|
-
<span class="cline-any cline-
|
|
608
|
-
<span class="cline-any cline-
|
|
609
|
-
<span class="cline-any cline-
|
|
610
|
-
<span class="cline-any cline-
|
|
611
|
-
<span class="cline-any cline-
|
|
612
|
-
<span class="cline-any cline-
|
|
613
|
-
<span class="cline-any cline-
|
|
614
|
-
<span class="cline-any cline-
|
|
615
|
-
<span class="cline-any cline-
|
|
616
|
-
<span class="cline-any cline-
|
|
617
|
-
<span class="cline-any cline-
|
|
618
|
-
<span class="cline-any cline-
|
|
619
|
-
<span class="cline-any cline-
|
|
620
|
-
<span class="cline-any cline-
|
|
621
|
-
<span class="cline-any cline-
|
|
622
|
-
<span class="cline-any cline-
|
|
623
|
-
<span class="cline-any cline-
|
|
624
|
-
<span class="cline-any cline-
|
|
625
|
-
<span class="cline-any cline-
|
|
626
|
-
<span class="cline-any cline-
|
|
627
|
-
<span class="cline-any cline-
|
|
628
|
-
<span class="cline-any cline-
|
|
629
|
-
<span class="cline-any cline-
|
|
630
|
-
<span class="cline-any cline-
|
|
631
|
-
<span class="cline-any cline-
|
|
632
|
-
<span class="cline-any cline-
|
|
633
|
-
<span class="cline-any cline-
|
|
634
|
-
<span class="cline-any cline-
|
|
635
|
-
<span class="cline-any cline-
|
|
636
|
-
<span class="cline-any cline-
|
|
637
|
-
<span class="cline-any cline-
|
|
638
|
-
<span class="cline-any cline-
|
|
639
|
-
<span class="cline-any cline-
|
|
640
|
-
<span class="cline-any cline-
|
|
641
|
-
<span class="cline-any cline-no"> </span>
|
|
642
|
-
<span class="cline-any cline-no"> </span>
|
|
643
|
-
<span class="cline-any cline-
|
|
644
|
-
<span class="cline-any cline-
|
|
645
|
-
<span class="cline-any cline-
|
|
646
|
-
<span class="cline-any cline-
|
|
647
|
-
<span class="cline-any cline-
|
|
648
|
-
<span class="cline-any cline-
|
|
649
|
-
<span class="cline-any cline-
|
|
650
|
-
<span class="cline-any cline-
|
|
651
|
-
<span class="cline-any cline-
|
|
652
|
-
<span class="cline-any cline-
|
|
653
|
-
<span class="cline-any cline-
|
|
654
|
-
<span class="cline-any cline-
|
|
655
|
-
<span class="cline-any cline-
|
|
656
|
-
<span class="cline-any cline-
|
|
657
|
-
<span class="cline-any cline-
|
|
658
|
-
<span class="cline-any cline-
|
|
659
|
-
<span class="cline-any cline-
|
|
660
|
-
<span class="cline-any cline-
|
|
661
|
-
<span class="cline-any cline-
|
|
662
|
-
<span class="cline-any cline-
|
|
663
|
-
<span class="cline-any cline-
|
|
664
|
-
<span class="cline-any cline-
|
|
665
|
-
<span class="cline-any cline-
|
|
666
|
-
<span class="cline-any cline-
|
|
667
|
-
<span class="cline-any cline-
|
|
668
|
-
<span class="cline-any cline-
|
|
669
|
-
<span class="cline-any cline-
|
|
670
|
-
<span class="cline-any cline-
|
|
671
|
-
<span class="cline-any cline-
|
|
672
|
-
<span class="cline-any cline-
|
|
673
|
-
<span class="cline-any cline-
|
|
674
|
-
<span class="cline-any cline-
|
|
675
|
-
<span class="cline-any cline-
|
|
676
|
-
<span class="cline-any cline-
|
|
677
|
-
<span class="cline-any cline-
|
|
678
|
-
<span class="cline-any cline-
|
|
679
|
-
<span class="cline-any cline-
|
|
680
|
-
<span class="cline-any cline-
|
|
681
|
-
<span class="cline-any cline-
|
|
682
|
-
<span class="cline-any cline-
|
|
683
|
-
<span class="cline-any cline-
|
|
684
|
-
<span class="cline-any cline-no"> </span>
|
|
685
|
-
<span class="cline-any cline-no"> </span>
|
|
686
|
-
<span class="cline-any cline-no"> </span>
|
|
687
|
-
<span class="cline-any cline-no"> </span>
|
|
688
|
-
<span class="cline-any cline-no"> </span>
|
|
689
|
-
<span class="cline-any cline-
|
|
690
|
-
<span class="cline-any cline-
|
|
691
|
-
<span class="cline-any cline-
|
|
692
|
-
<span class="cline-any cline-
|
|
693
|
-
<span class="cline-any cline-
|
|
694
|
-
<span class="cline-any cline-
|
|
695
|
-
<span class="cline-any cline-
|
|
696
|
-
<span class="cline-any cline-
|
|
697
|
-
<span class="cline-any cline-
|
|
698
|
-
<span class="cline-any cline-
|
|
699
|
-
<span class="cline-any cline-no"> </span>
|
|
700
|
-
<span class="cline-any cline-no"> </span>
|
|
701
|
-
<span class="cline-any cline-no"> </span>
|
|
702
|
-
<span class="cline-any cline-no"> </span>
|
|
703
|
-
<span class="cline-any cline-
|
|
704
|
-
<span class="cline-any cline-
|
|
705
|
-
<span class="cline-any cline-
|
|
706
|
-
<span class="cline-any cline-
|
|
707
|
-
<span class="cline-any cline-
|
|
708
|
-
<span class="cline-any cline-
|
|
709
|
-
<span class="cline-any cline-
|
|
710
|
-
<span class="cline-any cline-
|
|
711
|
-
<span class="cline-any cline-
|
|
712
|
-
<span class="cline-any cline-
|
|
713
|
-
<span class="cline-any cline-
|
|
714
|
-
<span class="cline-any cline-
|
|
715
|
-
<span class="cline-any cline-
|
|
716
|
-
<span class="cline-any cline-
|
|
717
|
-
<span class="cline-any cline-
|
|
718
|
-
<span class="cline-any cline-
|
|
719
|
-
<span class="cline-any cline-
|
|
720
|
-
<span class="cline-any cline-
|
|
721
|
-
<span class="cline-any cline-
|
|
722
|
-
<span class="cline-any cline-
|
|
723
|
-
<span class="cline-any cline-
|
|
724
|
-
<span class="cline-any cline-
|
|
725
|
-
<span class="cline-any cline-
|
|
726
|
-
<span class="cline-any cline-
|
|
727
|
-
<span class="cline-any cline-
|
|
728
|
-
<span class="cline-any cline-
|
|
729
|
-
<span class="cline-any cline-
|
|
730
|
-
<span class="cline-any cline-
|
|
731
|
-
<span class="cline-any cline-
|
|
732
|
-
<span class="cline-any cline-
|
|
733
|
-
<span class="cline-any cline-
|
|
734
|
-
<span class="cline-any cline-
|
|
735
|
-
<span class="cline-any cline-
|
|
736
|
-
<span class="cline-any cline-
|
|
737
|
-
<span class="cline-any cline-
|
|
738
|
-
<span class="cline-any cline-
|
|
739
|
-
<span class="cline-any cline-
|
|
740
|
-
<span class="cline-any cline-
|
|
741
|
-
<span class="cline-any cline-
|
|
742
|
-
<span class="cline-any cline-
|
|
743
|
-
<span class="cline-any cline-
|
|
744
|
-
<span class="cline-any cline-
|
|
745
|
-
<span class="cline-any cline-
|
|
746
|
-
<span class="cline-any cline-
|
|
747
|
-
<span class="cline-any cline-
|
|
748
|
-
<span class="cline-any cline-
|
|
749
|
-
<span class="cline-any cline-
|
|
750
|
-
<span class="cline-any cline-
|
|
751
|
-
<span class="cline-any cline-
|
|
752
|
-
<span class="cline-any cline-
|
|
753
|
-
<span class="cline-any cline-
|
|
754
|
-
<span class="cline-any cline-
|
|
755
|
-
<span class="cline-any cline-
|
|
756
|
-
<span class="cline-any cline-
|
|
757
|
-
<span class="cline-any cline-
|
|
758
|
-
<span class="cline-any cline-
|
|
759
|
-
<span class="cline-any cline-
|
|
760
|
-
<span class="cline-any cline-
|
|
761
|
-
<span class="cline-any cline-
|
|
762
|
-
<span class="cline-any cline-
|
|
763
|
-
<span class="cline-any cline-
|
|
764
|
-
<span class="cline-any cline-
|
|
765
|
-
<span class="cline-any cline-
|
|
766
|
-
<span class="cline-any cline-
|
|
767
|
-
<span class="cline-any cline-
|
|
768
|
-
<span class="cline-any cline-
|
|
769
|
-
<span class="cline-any cline-
|
|
770
|
-
<span class="cline-any cline-
|
|
771
|
-
<span class="cline-any cline-
|
|
772
|
-
<span class="cline-any cline-
|
|
773
|
-
<span class="cline-any cline-
|
|
774
|
-
<span class="cline-any cline-
|
|
775
|
-
<span class="cline-any cline-
|
|
776
|
-
<span class="cline-any cline-
|
|
777
|
-
<span class="cline-any cline-
|
|
778
|
-
<span class="cline-any cline-
|
|
779
|
-
<span class="cline-any cline-
|
|
780
|
-
<span class="cline-any cline-
|
|
781
|
-
<span class="cline-any cline-
|
|
782
|
-
<span class="cline-any cline-
|
|
783
|
-
<span class="cline-any cline-
|
|
784
|
-
<span class="cline-any cline-
|
|
785
|
-
<span class="cline-any cline-
|
|
786
|
-
<span class="cline-any cline-no"> </span>
|
|
787
|
-
<span class="cline-any cline-no"> </span>
|
|
788
|
-
<span class="cline-any cline-
|
|
789
|
-
<span class="cline-any cline-
|
|
790
|
-
<span class="cline-any cline-
|
|
791
|
-
<span class="cline-any cline-
|
|
792
|
-
<span class="cline-any cline-
|
|
793
|
-
<span class="cline-any cline-
|
|
794
|
-
<span class="cline-any cline-
|
|
795
|
-
<span class="cline-any cline-
|
|
796
|
-
<span class="cline-any cline-
|
|
797
|
-
<span class="cline-any cline-
|
|
798
|
-
<span class="cline-any cline-
|
|
799
|
-
<span class="cline-any cline-
|
|
800
|
-
<span class="cline-any cline-
|
|
801
|
-
<span class="cline-any cline-
|
|
802
|
-
<span class="cline-any cline-
|
|
803
|
-
<span class="cline-any cline-
|
|
804
|
-
<span class="cline-any cline-
|
|
805
|
-
<span class="cline-any cline-
|
|
806
|
-
<span class="cline-any cline-
|
|
807
|
-
<span class="cline-any cline-
|
|
808
|
-
<span class="cline-any cline-
|
|
809
|
-
<span class="cline-any cline-
|
|
810
|
-
<span class="cline-any cline-
|
|
811
|
-
<span class="cline-any cline-
|
|
812
|
-
<span class="cline-any cline-
|
|
813
|
-
<span class="cline-any cline-
|
|
814
|
-
<span class="cline-any cline-
|
|
815
|
-
<span class="cline-any cline-
|
|
816
|
-
<span class="cline-any cline-
|
|
817
|
-
<span class="cline-any cline-
|
|
818
|
-
<span class="cline-any cline-
|
|
819
|
-
<span class="cline-any cline-
|
|
820
|
-
<span class="cline-any cline-
|
|
821
|
-
<span class="cline-any cline-
|
|
822
|
-
<span class="cline-any cline-
|
|
823
|
-
<span class="cline-any cline-
|
|
824
|
-
<span class="cline-any cline-
|
|
825
|
-
<span class="cline-any cline-
|
|
826
|
-
<span class="cline-any cline-
|
|
827
|
-
<span class="cline-any cline-
|
|
828
|
-
<span class="cline-any cline-
|
|
829
|
-
<span class="cline-any cline-
|
|
830
|
-
<span class="cline-any cline-
|
|
831
|
-
<span class="cline-any cline-
|
|
832
|
-
<span class="cline-any cline-
|
|
833
|
-
<span class="cline-any cline-
|
|
834
|
-
<span class="cline-any cline-
|
|
835
|
-
<span class="cline-any cline-
|
|
836
|
-
<span class="cline-any cline-
|
|
837
|
-
<span class="cline-any cline-
|
|
838
|
-
<span class="cline-any cline-
|
|
839
|
-
<span class="cline-any cline-
|
|
840
|
-
<span class="cline-any cline-
|
|
841
|
-
<span class="cline-any cline-
|
|
842
|
-
<span class="cline-any cline-
|
|
843
|
-
<span class="cline-any cline-
|
|
844
|
-
<span class="cline-any cline-
|
|
845
|
-
<span class="cline-any cline-
|
|
846
|
-
<span class="cline-any cline-
|
|
847
|
-
<span class="cline-any cline-
|
|
848
|
-
<span class="cline-any cline-
|
|
849
|
-
<span class="cline-any cline-
|
|
850
|
-
<span class="cline-any cline-
|
|
851
|
-
<span class="cline-any cline-
|
|
852
|
-
<span class="cline-any cline-
|
|
853
|
-
<span class="cline-any cline-no"> </span>
|
|
854
|
-
<span class="cline-any cline-
|
|
855
|
-
<span class="cline-any cline-
|
|
856
|
-
<span class="cline-any cline-
|
|
857
|
-
<span class="cline-any cline-no"> </span>
|
|
858
|
-
<span class="cline-any cline-no"> </span>
|
|
859
|
-
<span class="cline-any cline-no"> </span>
|
|
860
|
-
<span class="cline-any cline-
|
|
861
|
-
<span class="cline-any cline-
|
|
862
|
-
<span class="cline-any cline-
|
|
863
|
-
<span class="cline-any cline-
|
|
864
|
-
<span class="cline-any cline-
|
|
865
|
-
<span class="cline-any cline-
|
|
866
|
-
<span class="cline-any cline-
|
|
867
|
-
<span class="cline-any cline-
|
|
868
|
-
<span class="cline-any cline-
|
|
869
|
-
<span class="cline-any cline-
|
|
870
|
-
<span class="cline-any cline-
|
|
871
|
-
<span class="cline-any cline-
|
|
872
|
-
<span class="cline-any cline-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
export function
|
|
916
|
-
const query = hook.params.query
|
|
917
|
-
if (query) {
|
|
918
|
-
if (
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
469
|
+
<a name='L404'></a><a href='#L404'>404</a>
|
|
470
|
+
<a name='L405'></a><a href='#L405'>405</a>
|
|
471
|
+
<a name='L406'></a><a href='#L406'>406</a>
|
|
472
|
+
<a name='L407'></a><a href='#L407'>407</a>
|
|
473
|
+
<a name='L408'></a><a href='#L408'>408</a>
|
|
474
|
+
<a name='L409'></a><a href='#L409'>409</a></td><td class="line-coverage quiet"><span class="cline-any cline-no"> </span>
|
|
475
|
+
<span class="cline-any cline-no"> </span>
|
|
476
|
+
<span class="cline-any cline-no"> </span>
|
|
477
|
+
<span class="cline-any cline-no"> </span>
|
|
478
|
+
<span class="cline-any cline-no"> </span>
|
|
479
|
+
<span class="cline-any cline-no"> </span>
|
|
480
|
+
<span class="cline-any cline-no"> </span>
|
|
481
|
+
<span class="cline-any cline-no"> </span>
|
|
482
|
+
<span class="cline-any cline-no"> </span>
|
|
483
|
+
<span class="cline-any cline-no"> </span>
|
|
484
|
+
<span class="cline-any cline-no"> </span>
|
|
485
|
+
<span class="cline-any cline-no"> </span>
|
|
486
|
+
<span class="cline-any cline-no"> </span>
|
|
487
|
+
<span class="cline-any cline-no"> </span>
|
|
488
|
+
<span class="cline-any cline-no"> </span>
|
|
489
|
+
<span class="cline-any cline-no"> </span>
|
|
490
|
+
<span class="cline-any cline-no"> </span>
|
|
491
|
+
<span class="cline-any cline-no"> </span>
|
|
492
|
+
<span class="cline-any cline-no"> </span>
|
|
493
|
+
<span class="cline-any cline-no"> </span>
|
|
494
|
+
<span class="cline-any cline-no"> </span>
|
|
495
|
+
<span class="cline-any cline-no"> </span>
|
|
496
|
+
<span class="cline-any cline-no"> </span>
|
|
497
|
+
<span class="cline-any cline-no"> </span>
|
|
498
|
+
<span class="cline-any cline-no"> </span>
|
|
499
|
+
<span class="cline-any cline-no"> </span>
|
|
500
|
+
<span class="cline-any cline-no"> </span>
|
|
501
|
+
<span class="cline-any cline-no"> </span>
|
|
502
|
+
<span class="cline-any cline-no"> </span>
|
|
503
|
+
<span class="cline-any cline-no"> </span>
|
|
504
|
+
<span class="cline-any cline-no"> </span>
|
|
505
|
+
<span class="cline-any cline-no"> </span>
|
|
506
|
+
<span class="cline-any cline-no"> </span>
|
|
507
|
+
<span class="cline-any cline-no"> </span>
|
|
508
|
+
<span class="cline-any cline-no"> </span>
|
|
509
|
+
<span class="cline-any cline-no"> </span>
|
|
510
|
+
<span class="cline-any cline-no"> </span>
|
|
511
|
+
<span class="cline-any cline-no"> </span>
|
|
512
|
+
<span class="cline-any cline-no"> </span>
|
|
513
|
+
<span class="cline-any cline-no"> </span>
|
|
514
|
+
<span class="cline-any cline-no"> </span>
|
|
515
|
+
<span class="cline-any cline-no"> </span>
|
|
516
|
+
<span class="cline-any cline-no"> </span>
|
|
517
|
+
<span class="cline-any cline-no"> </span>
|
|
518
|
+
<span class="cline-any cline-no"> </span>
|
|
519
|
+
<span class="cline-any cline-no"> </span>
|
|
520
|
+
<span class="cline-any cline-no"> </span>
|
|
521
|
+
<span class="cline-any cline-no"> </span>
|
|
522
|
+
<span class="cline-any cline-no"> </span>
|
|
523
|
+
<span class="cline-any cline-no"> </span>
|
|
524
|
+
<span class="cline-any cline-no"> </span>
|
|
525
|
+
<span class="cline-any cline-no"> </span>
|
|
526
|
+
<span class="cline-any cline-no"> </span>
|
|
527
|
+
<span class="cline-any cline-no"> </span>
|
|
528
|
+
<span class="cline-any cline-no"> </span>
|
|
529
|
+
<span class="cline-any cline-no"> </span>
|
|
530
|
+
<span class="cline-any cline-no"> </span>
|
|
531
|
+
<span class="cline-any cline-no"> </span>
|
|
532
|
+
<span class="cline-any cline-no"> </span>
|
|
533
|
+
<span class="cline-any cline-no"> </span>
|
|
534
|
+
<span class="cline-any cline-no"> </span>
|
|
535
|
+
<span class="cline-any cline-no"> </span>
|
|
536
|
+
<span class="cline-any cline-no"> </span>
|
|
537
|
+
<span class="cline-any cline-no"> </span>
|
|
538
|
+
<span class="cline-any cline-no"> </span>
|
|
539
|
+
<span class="cline-any cline-no"> </span>
|
|
540
|
+
<span class="cline-any cline-no"> </span>
|
|
541
|
+
<span class="cline-any cline-no"> </span>
|
|
542
|
+
<span class="cline-any cline-no"> </span>
|
|
543
|
+
<span class="cline-any cline-no"> </span>
|
|
544
|
+
<span class="cline-any cline-no"> </span>
|
|
545
|
+
<span class="cline-any cline-no"> </span>
|
|
546
|
+
<span class="cline-any cline-no"> </span>
|
|
547
|
+
<span class="cline-any cline-no"> </span>
|
|
548
|
+
<span class="cline-any cline-no"> </span>
|
|
549
|
+
<span class="cline-any cline-no"> </span>
|
|
550
|
+
<span class="cline-any cline-no"> </span>
|
|
551
|
+
<span class="cline-any cline-no"> </span>
|
|
552
|
+
<span class="cline-any cline-no"> </span>
|
|
553
|
+
<span class="cline-any cline-no"> </span>
|
|
554
|
+
<span class="cline-any cline-no"> </span>
|
|
555
|
+
<span class="cline-any cline-no"> </span>
|
|
556
|
+
<span class="cline-any cline-no"> </span>
|
|
557
|
+
<span class="cline-any cline-no"> </span>
|
|
558
|
+
<span class="cline-any cline-no"> </span>
|
|
559
|
+
<span class="cline-any cline-no"> </span>
|
|
560
|
+
<span class="cline-any cline-no"> </span>
|
|
561
|
+
<span class="cline-any cline-no"> </span>
|
|
562
|
+
<span class="cline-any cline-no"> </span>
|
|
563
|
+
<span class="cline-any cline-no"> </span>
|
|
564
|
+
<span class="cline-any cline-no"> </span>
|
|
565
|
+
<span class="cline-any cline-no"> </span>
|
|
566
|
+
<span class="cline-any cline-no"> </span>
|
|
567
|
+
<span class="cline-any cline-no"> </span>
|
|
568
|
+
<span class="cline-any cline-no"> </span>
|
|
569
|
+
<span class="cline-any cline-no"> </span>
|
|
570
|
+
<span class="cline-any cline-no"> </span>
|
|
571
|
+
<span class="cline-any cline-no"> </span>
|
|
572
|
+
<span class="cline-any cline-no"> </span>
|
|
573
|
+
<span class="cline-any cline-no"> </span>
|
|
574
|
+
<span class="cline-any cline-no"> </span>
|
|
575
|
+
<span class="cline-any cline-no"> </span>
|
|
576
|
+
<span class="cline-any cline-no"> </span>
|
|
577
|
+
<span class="cline-any cline-no"> </span>
|
|
578
|
+
<span class="cline-any cline-no"> </span>
|
|
579
|
+
<span class="cline-any cline-no"> </span>
|
|
580
|
+
<span class="cline-any cline-no"> </span>
|
|
581
|
+
<span class="cline-any cline-no"> </span>
|
|
582
|
+
<span class="cline-any cline-no"> </span>
|
|
583
|
+
<span class="cline-any cline-no"> </span>
|
|
584
|
+
<span class="cline-any cline-no"> </span>
|
|
585
|
+
<span class="cline-any cline-no"> </span>
|
|
586
|
+
<span class="cline-any cline-no"> </span>
|
|
587
|
+
<span class="cline-any cline-no"> </span>
|
|
588
|
+
<span class="cline-any cline-no"> </span>
|
|
589
|
+
<span class="cline-any cline-no"> </span>
|
|
590
|
+
<span class="cline-any cline-no"> </span>
|
|
591
|
+
<span class="cline-any cline-no"> </span>
|
|
592
|
+
<span class="cline-any cline-no"> </span>
|
|
593
|
+
<span class="cline-any cline-no"> </span>
|
|
594
|
+
<span class="cline-any cline-no"> </span>
|
|
595
|
+
<span class="cline-any cline-no"> </span>
|
|
596
|
+
<span class="cline-any cline-no"> </span>
|
|
597
|
+
<span class="cline-any cline-no"> </span>
|
|
598
|
+
<span class="cline-any cline-no"> </span>
|
|
599
|
+
<span class="cline-any cline-no"> </span>
|
|
600
|
+
<span class="cline-any cline-no"> </span>
|
|
601
|
+
<span class="cline-any cline-no"> </span>
|
|
602
|
+
<span class="cline-any cline-no"> </span>
|
|
603
|
+
<span class="cline-any cline-no"> </span>
|
|
604
|
+
<span class="cline-any cline-no"> </span>
|
|
605
|
+
<span class="cline-any cline-no"> </span>
|
|
606
|
+
<span class="cline-any cline-no"> </span>
|
|
607
|
+
<span class="cline-any cline-no"> </span>
|
|
608
|
+
<span class="cline-any cline-no"> </span>
|
|
609
|
+
<span class="cline-any cline-no"> </span>
|
|
610
|
+
<span class="cline-any cline-no"> </span>
|
|
611
|
+
<span class="cline-any cline-no"> </span>
|
|
612
|
+
<span class="cline-any cline-no"> </span>
|
|
613
|
+
<span class="cline-any cline-no"> </span>
|
|
614
|
+
<span class="cline-any cline-no"> </span>
|
|
615
|
+
<span class="cline-any cline-no"> </span>
|
|
616
|
+
<span class="cline-any cline-no"> </span>
|
|
617
|
+
<span class="cline-any cline-no"> </span>
|
|
618
|
+
<span class="cline-any cline-no"> </span>
|
|
619
|
+
<span class="cline-any cline-no"> </span>
|
|
620
|
+
<span class="cline-any cline-no"> </span>
|
|
621
|
+
<span class="cline-any cline-no"> </span>
|
|
622
|
+
<span class="cline-any cline-no"> </span>
|
|
623
|
+
<span class="cline-any cline-no"> </span>
|
|
624
|
+
<span class="cline-any cline-no"> </span>
|
|
625
|
+
<span class="cline-any cline-no"> </span>
|
|
626
|
+
<span class="cline-any cline-no"> </span>
|
|
627
|
+
<span class="cline-any cline-no"> </span>
|
|
628
|
+
<span class="cline-any cline-no"> </span>
|
|
629
|
+
<span class="cline-any cline-no"> </span>
|
|
630
|
+
<span class="cline-any cline-no"> </span>
|
|
631
|
+
<span class="cline-any cline-no"> </span>
|
|
632
|
+
<span class="cline-any cline-no"> </span>
|
|
633
|
+
<span class="cline-any cline-no"> </span>
|
|
634
|
+
<span class="cline-any cline-no"> </span>
|
|
635
|
+
<span class="cline-any cline-no"> </span>
|
|
636
|
+
<span class="cline-any cline-no"> </span>
|
|
637
|
+
<span class="cline-any cline-no"> </span>
|
|
638
|
+
<span class="cline-any cline-no"> </span>
|
|
639
|
+
<span class="cline-any cline-no"> </span>
|
|
640
|
+
<span class="cline-any cline-no"> </span>
|
|
641
|
+
<span class="cline-any cline-no"> </span>
|
|
642
|
+
<span class="cline-any cline-no"> </span>
|
|
643
|
+
<span class="cline-any cline-no"> </span>
|
|
644
|
+
<span class="cline-any cline-no"> </span>
|
|
645
|
+
<span class="cline-any cline-no"> </span>
|
|
646
|
+
<span class="cline-any cline-no"> </span>
|
|
647
|
+
<span class="cline-any cline-no"> </span>
|
|
648
|
+
<span class="cline-any cline-no"> </span>
|
|
649
|
+
<span class="cline-any cline-no"> </span>
|
|
650
|
+
<span class="cline-any cline-no"> </span>
|
|
651
|
+
<span class="cline-any cline-no"> </span>
|
|
652
|
+
<span class="cline-any cline-no"> </span>
|
|
653
|
+
<span class="cline-any cline-no"> </span>
|
|
654
|
+
<span class="cline-any cline-no"> </span>
|
|
655
|
+
<span class="cline-any cline-no"> </span>
|
|
656
|
+
<span class="cline-any cline-no"> </span>
|
|
657
|
+
<span class="cline-any cline-no"> </span>
|
|
658
|
+
<span class="cline-any cline-no"> </span>
|
|
659
|
+
<span class="cline-any cline-no"> </span>
|
|
660
|
+
<span class="cline-any cline-no"> </span>
|
|
661
|
+
<span class="cline-any cline-no"> </span>
|
|
662
|
+
<span class="cline-any cline-no"> </span>
|
|
663
|
+
<span class="cline-any cline-no"> </span>
|
|
664
|
+
<span class="cline-any cline-no"> </span>
|
|
665
|
+
<span class="cline-any cline-no"> </span>
|
|
666
|
+
<span class="cline-any cline-no"> </span>
|
|
667
|
+
<span class="cline-any cline-no"> </span>
|
|
668
|
+
<span class="cline-any cline-no"> </span>
|
|
669
|
+
<span class="cline-any cline-no"> </span>
|
|
670
|
+
<span class="cline-any cline-no"> </span>
|
|
671
|
+
<span class="cline-any cline-no"> </span>
|
|
672
|
+
<span class="cline-any cline-no"> </span>
|
|
673
|
+
<span class="cline-any cline-no"> </span>
|
|
674
|
+
<span class="cline-any cline-no"> </span>
|
|
675
|
+
<span class="cline-any cline-no"> </span>
|
|
676
|
+
<span class="cline-any cline-no"> </span>
|
|
677
|
+
<span class="cline-any cline-no"> </span>
|
|
678
|
+
<span class="cline-any cline-no"> </span>
|
|
679
|
+
<span class="cline-any cline-no"> </span>
|
|
680
|
+
<span class="cline-any cline-no"> </span>
|
|
681
|
+
<span class="cline-any cline-no"> </span>
|
|
682
|
+
<span class="cline-any cline-no"> </span>
|
|
683
|
+
<span class="cline-any cline-no"> </span>
|
|
684
|
+
<span class="cline-any cline-no"> </span>
|
|
685
|
+
<span class="cline-any cline-no"> </span>
|
|
686
|
+
<span class="cline-any cline-no"> </span>
|
|
687
|
+
<span class="cline-any cline-no"> </span>
|
|
688
|
+
<span class="cline-any cline-no"> </span>
|
|
689
|
+
<span class="cline-any cline-no"> </span>
|
|
690
|
+
<span class="cline-any cline-no"> </span>
|
|
691
|
+
<span class="cline-any cline-no"> </span>
|
|
692
|
+
<span class="cline-any cline-no"> </span>
|
|
693
|
+
<span class="cline-any cline-no"> </span>
|
|
694
|
+
<span class="cline-any cline-no"> </span>
|
|
695
|
+
<span class="cline-any cline-no"> </span>
|
|
696
|
+
<span class="cline-any cline-no"> </span>
|
|
697
|
+
<span class="cline-any cline-no"> </span>
|
|
698
|
+
<span class="cline-any cline-no"> </span>
|
|
699
|
+
<span class="cline-any cline-no"> </span>
|
|
700
|
+
<span class="cline-any cline-no"> </span>
|
|
701
|
+
<span class="cline-any cline-no"> </span>
|
|
702
|
+
<span class="cline-any cline-no"> </span>
|
|
703
|
+
<span class="cline-any cline-no"> </span>
|
|
704
|
+
<span class="cline-any cline-no"> </span>
|
|
705
|
+
<span class="cline-any cline-no"> </span>
|
|
706
|
+
<span class="cline-any cline-no"> </span>
|
|
707
|
+
<span class="cline-any cline-no"> </span>
|
|
708
|
+
<span class="cline-any cline-no"> </span>
|
|
709
|
+
<span class="cline-any cline-no"> </span>
|
|
710
|
+
<span class="cline-any cline-no"> </span>
|
|
711
|
+
<span class="cline-any cline-no"> </span>
|
|
712
|
+
<span class="cline-any cline-no"> </span>
|
|
713
|
+
<span class="cline-any cline-no"> </span>
|
|
714
|
+
<span class="cline-any cline-no"> </span>
|
|
715
|
+
<span class="cline-any cline-no"> </span>
|
|
716
|
+
<span class="cline-any cline-no"> </span>
|
|
717
|
+
<span class="cline-any cline-no"> </span>
|
|
718
|
+
<span class="cline-any cline-no"> </span>
|
|
719
|
+
<span class="cline-any cline-no"> </span>
|
|
720
|
+
<span class="cline-any cline-no"> </span>
|
|
721
|
+
<span class="cline-any cline-no"> </span>
|
|
722
|
+
<span class="cline-any cline-no"> </span>
|
|
723
|
+
<span class="cline-any cline-no"> </span>
|
|
724
|
+
<span class="cline-any cline-no"> </span>
|
|
725
|
+
<span class="cline-any cline-no"> </span>
|
|
726
|
+
<span class="cline-any cline-no"> </span>
|
|
727
|
+
<span class="cline-any cline-no"> </span>
|
|
728
|
+
<span class="cline-any cline-no"> </span>
|
|
729
|
+
<span class="cline-any cline-no"> </span>
|
|
730
|
+
<span class="cline-any cline-no"> </span>
|
|
731
|
+
<span class="cline-any cline-no"> </span>
|
|
732
|
+
<span class="cline-any cline-no"> </span>
|
|
733
|
+
<span class="cline-any cline-no"> </span>
|
|
734
|
+
<span class="cline-any cline-no"> </span>
|
|
735
|
+
<span class="cline-any cline-no"> </span>
|
|
736
|
+
<span class="cline-any cline-no"> </span>
|
|
737
|
+
<span class="cline-any cline-no"> </span>
|
|
738
|
+
<span class="cline-any cline-no"> </span>
|
|
739
|
+
<span class="cline-any cline-no"> </span>
|
|
740
|
+
<span class="cline-any cline-no"> </span>
|
|
741
|
+
<span class="cline-any cline-no"> </span>
|
|
742
|
+
<span class="cline-any cline-no"> </span>
|
|
743
|
+
<span class="cline-any cline-no"> </span>
|
|
744
|
+
<span class="cline-any cline-no"> </span>
|
|
745
|
+
<span class="cline-any cline-no"> </span>
|
|
746
|
+
<span class="cline-any cline-no"> </span>
|
|
747
|
+
<span class="cline-any cline-no"> </span>
|
|
748
|
+
<span class="cline-any cline-no"> </span>
|
|
749
|
+
<span class="cline-any cline-no"> </span>
|
|
750
|
+
<span class="cline-any cline-no"> </span>
|
|
751
|
+
<span class="cline-any cline-no"> </span>
|
|
752
|
+
<span class="cline-any cline-no"> </span>
|
|
753
|
+
<span class="cline-any cline-no"> </span>
|
|
754
|
+
<span class="cline-any cline-no"> </span>
|
|
755
|
+
<span class="cline-any cline-no"> </span>
|
|
756
|
+
<span class="cline-any cline-no"> </span>
|
|
757
|
+
<span class="cline-any cline-no"> </span>
|
|
758
|
+
<span class="cline-any cline-no"> </span>
|
|
759
|
+
<span class="cline-any cline-no"> </span>
|
|
760
|
+
<span class="cline-any cline-no"> </span>
|
|
761
|
+
<span class="cline-any cline-no"> </span>
|
|
762
|
+
<span class="cline-any cline-no"> </span>
|
|
763
|
+
<span class="cline-any cline-no"> </span>
|
|
764
|
+
<span class="cline-any cline-no"> </span>
|
|
765
|
+
<span class="cline-any cline-no"> </span>
|
|
766
|
+
<span class="cline-any cline-no"> </span>
|
|
767
|
+
<span class="cline-any cline-no"> </span>
|
|
768
|
+
<span class="cline-any cline-no"> </span>
|
|
769
|
+
<span class="cline-any cline-no"> </span>
|
|
770
|
+
<span class="cline-any cline-no"> </span>
|
|
771
|
+
<span class="cline-any cline-no"> </span>
|
|
772
|
+
<span class="cline-any cline-no"> </span>
|
|
773
|
+
<span class="cline-any cline-no"> </span>
|
|
774
|
+
<span class="cline-any cline-no"> </span>
|
|
775
|
+
<span class="cline-any cline-no"> </span>
|
|
776
|
+
<span class="cline-any cline-no"> </span>
|
|
777
|
+
<span class="cline-any cline-no"> </span>
|
|
778
|
+
<span class="cline-any cline-no"> </span>
|
|
779
|
+
<span class="cline-any cline-no"> </span>
|
|
780
|
+
<span class="cline-any cline-no"> </span>
|
|
781
|
+
<span class="cline-any cline-no"> </span>
|
|
782
|
+
<span class="cline-any cline-no"> </span>
|
|
783
|
+
<span class="cline-any cline-no"> </span>
|
|
784
|
+
<span class="cline-any cline-no"> </span>
|
|
785
|
+
<span class="cline-any cline-no"> </span>
|
|
786
|
+
<span class="cline-any cline-no"> </span>
|
|
787
|
+
<span class="cline-any cline-no"> </span>
|
|
788
|
+
<span class="cline-any cline-no"> </span>
|
|
789
|
+
<span class="cline-any cline-no"> </span>
|
|
790
|
+
<span class="cline-any cline-no"> </span>
|
|
791
|
+
<span class="cline-any cline-no"> </span>
|
|
792
|
+
<span class="cline-any cline-no"> </span>
|
|
793
|
+
<span class="cline-any cline-no"> </span>
|
|
794
|
+
<span class="cline-any cline-no"> </span>
|
|
795
|
+
<span class="cline-any cline-no"> </span>
|
|
796
|
+
<span class="cline-any cline-no"> </span>
|
|
797
|
+
<span class="cline-any cline-no"> </span>
|
|
798
|
+
<span class="cline-any cline-no"> </span>
|
|
799
|
+
<span class="cline-any cline-no"> </span>
|
|
800
|
+
<span class="cline-any cline-no"> </span>
|
|
801
|
+
<span class="cline-any cline-no"> </span>
|
|
802
|
+
<span class="cline-any cline-no"> </span>
|
|
803
|
+
<span class="cline-any cline-no"> </span>
|
|
804
|
+
<span class="cline-any cline-no"> </span>
|
|
805
|
+
<span class="cline-any cline-no"> </span>
|
|
806
|
+
<span class="cline-any cline-no"> </span>
|
|
807
|
+
<span class="cline-any cline-no"> </span>
|
|
808
|
+
<span class="cline-any cline-no"> </span>
|
|
809
|
+
<span class="cline-any cline-no"> </span>
|
|
810
|
+
<span class="cline-any cline-no"> </span>
|
|
811
|
+
<span class="cline-any cline-no"> </span>
|
|
812
|
+
<span class="cline-any cline-no"> </span>
|
|
813
|
+
<span class="cline-any cline-no"> </span>
|
|
814
|
+
<span class="cline-any cline-no"> </span>
|
|
815
|
+
<span class="cline-any cline-no"> </span>
|
|
816
|
+
<span class="cline-any cline-no"> </span>
|
|
817
|
+
<span class="cline-any cline-no"> </span>
|
|
818
|
+
<span class="cline-any cline-no"> </span>
|
|
819
|
+
<span class="cline-any cline-no"> </span>
|
|
820
|
+
<span class="cline-any cline-no"> </span>
|
|
821
|
+
<span class="cline-any cline-no"> </span>
|
|
822
|
+
<span class="cline-any cline-no"> </span>
|
|
823
|
+
<span class="cline-any cline-no"> </span>
|
|
824
|
+
<span class="cline-any cline-no"> </span>
|
|
825
|
+
<span class="cline-any cline-no"> </span>
|
|
826
|
+
<span class="cline-any cline-no"> </span>
|
|
827
|
+
<span class="cline-any cline-no"> </span>
|
|
828
|
+
<span class="cline-any cline-no"> </span>
|
|
829
|
+
<span class="cline-any cline-no"> </span>
|
|
830
|
+
<span class="cline-any cline-no"> </span>
|
|
831
|
+
<span class="cline-any cline-no"> </span>
|
|
832
|
+
<span class="cline-any cline-no"> </span>
|
|
833
|
+
<span class="cline-any cline-no"> </span>
|
|
834
|
+
<span class="cline-any cline-no"> </span>
|
|
835
|
+
<span class="cline-any cline-no"> </span>
|
|
836
|
+
<span class="cline-any cline-no"> </span>
|
|
837
|
+
<span class="cline-any cline-no"> </span>
|
|
838
|
+
<span class="cline-any cline-no"> </span>
|
|
839
|
+
<span class="cline-any cline-no"> </span>
|
|
840
|
+
<span class="cline-any cline-no"> </span>
|
|
841
|
+
<span class="cline-any cline-no"> </span>
|
|
842
|
+
<span class="cline-any cline-no"> </span>
|
|
843
|
+
<span class="cline-any cline-no"> </span>
|
|
844
|
+
<span class="cline-any cline-no"> </span>
|
|
845
|
+
<span class="cline-any cline-no"> </span>
|
|
846
|
+
<span class="cline-any cline-no"> </span>
|
|
847
|
+
<span class="cline-any cline-no"> </span>
|
|
848
|
+
<span class="cline-any cline-no"> </span>
|
|
849
|
+
<span class="cline-any cline-no"> </span>
|
|
850
|
+
<span class="cline-any cline-no"> </span>
|
|
851
|
+
<span class="cline-any cline-no"> </span>
|
|
852
|
+
<span class="cline-any cline-no"> </span>
|
|
853
|
+
<span class="cline-any cline-no"> </span>
|
|
854
|
+
<span class="cline-any cline-no"> </span>
|
|
855
|
+
<span class="cline-any cline-no"> </span>
|
|
856
|
+
<span class="cline-any cline-no"> </span>
|
|
857
|
+
<span class="cline-any cline-no"> </span>
|
|
858
|
+
<span class="cline-any cline-no"> </span>
|
|
859
|
+
<span class="cline-any cline-no"> </span>
|
|
860
|
+
<span class="cline-any cline-no"> </span>
|
|
861
|
+
<span class="cline-any cline-no"> </span>
|
|
862
|
+
<span class="cline-any cline-no"> </span>
|
|
863
|
+
<span class="cline-any cline-no"> </span>
|
|
864
|
+
<span class="cline-any cline-no"> </span>
|
|
865
|
+
<span class="cline-any cline-no"> </span>
|
|
866
|
+
<span class="cline-any cline-no"> </span>
|
|
867
|
+
<span class="cline-any cline-no"> </span>
|
|
868
|
+
<span class="cline-any cline-no"> </span>
|
|
869
|
+
<span class="cline-any cline-no"> </span>
|
|
870
|
+
<span class="cline-any cline-no"> </span>
|
|
871
|
+
<span class="cline-any cline-no"> </span>
|
|
872
|
+
<span class="cline-any cline-no"> </span>
|
|
873
|
+
<span class="cline-any cline-no"> </span>
|
|
874
|
+
<span class="cline-any cline-no"> </span>
|
|
875
|
+
<span class="cline-any cline-no"> </span>
|
|
876
|
+
<span class="cline-any cline-no"> </span>
|
|
877
|
+
<span class="cline-any cline-no"> </span>
|
|
878
|
+
<span class="cline-any cline-no"> </span>
|
|
879
|
+
<span class="cline-any cline-no"> </span>
|
|
880
|
+
<span class="cline-any cline-no"> </span>
|
|
881
|
+
<span class="cline-any cline-no"> </span>
|
|
882
|
+
<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>
|
|
883
|
+
<span class="cstat-no" title="statement not covered" >import { marshallGeometry } from '../marshall.js'</span>
|
|
884
|
+
<span class="cstat-no" title="statement not covered" >import makeDebug from 'debug'</span>
|
|
885
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
886
|
+
<span class="cstat-no" title="statement not covered" >const debug = makeDebug('kdk:map:query:hooks')</span>
|
|
887
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
888
|
+
<span class="cstat-no" title="statement not covered" >export function marshallGeometryQuery (hook) {</span>
|
|
889
|
+
<span class="cstat-no" title="statement not covered" > const query = hook.params.query</span>
|
|
890
|
+
<span class="cstat-no" title="statement not covered" > if (_.isNil(query)) return</span>
|
|
891
|
+
<span class="cstat-no" title="statement not covered" > const geometry = query.geometry</span>
|
|
892
|
+
<span class="cstat-no" title="statement not covered" > if (_.isNil(geometry)) return</span>
|
|
893
|
+
<span class="cstat-no" title="statement not covered" > marshallGeometry(geometry)</span>
|
|
894
|
+
<span class="cstat-no" title="statement not covered" >}</span>
|
|
895
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
896
|
+
<span class="cstat-no" title="statement not covered" >function getGeometryQueryForBBox (bbox) {</span>
|
|
897
|
+
<span class="cstat-no" title="statement not covered" > // Here we use the custom MongoDB CRS that enforces counter-clockwise winding order</span>
|
|
898
|
+
<span class="cstat-no" title="statement not covered" > // and allows to support queries with a single-ringed GeoJSON polygon</span>
|
|
899
|
+
<span class="cstat-no" title="statement not covered" > // whose area is greater than or equal to a single hemisphere.</span>
|
|
900
|
+
<span class="cstat-no" title="statement not covered" > // Otherwise $geoIntersects queries for the complementary geometry.</span>
|
|
901
|
+
<span class="cstat-no" title="statement not covered" > return {</span>
|
|
902
|
+
<span class="cstat-no" title="statement not covered" > $geoIntersects: {</span>
|
|
903
|
+
<span class="cstat-no" title="statement not covered" > $geometry: {</span>
|
|
904
|
+
<span class="cstat-no" title="statement not covered" > type: 'Polygon',</span>
|
|
905
|
+
<span class="cstat-no" title="statement not covered" > coordinates: [bbox],</span>
|
|
906
|
+
<span class="cstat-no" title="statement not covered" > crs: {</span>
|
|
907
|
+
<span class="cstat-no" title="statement not covered" > type: 'name',</span>
|
|
908
|
+
<span class="cstat-no" title="statement not covered" > properties: { name: 'urn:x-mongodb:crs:strictwinding:EPSG:4326' }</span>
|
|
909
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
910
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
911
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
912
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
913
|
+
<span class="cstat-no" title="statement not covered" >}</span>
|
|
914
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
915
|
+
<span class="cstat-no" title="statement not covered" >export function marshallGeoJsonQuery (hook) {</span>
|
|
916
|
+
<span class="cstat-no" title="statement not covered" > const query = hook.params.query</span>
|
|
917
|
+
<span class="cstat-no" title="statement not covered" > if (query) {</span>
|
|
918
|
+
<span class="cstat-no" title="statement not covered" > if (query.geoJson) {</span>
|
|
919
|
+
<span class="cstat-no" title="statement not covered" > delete query.geoJson</span>
|
|
920
|
+
<span class="cstat-no" title="statement not covered" > hook.params.asGeoJson = true</span>
|
|
921
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
922
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
923
|
+
<span class="cstat-no" title="statement not covered" >}</span>
|
|
924
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
925
|
+
<span class="cstat-no" title="statement not covered" >export function marshallSpatialQuery (hook) {</span>
|
|
926
|
+
<span class="cstat-no" title="statement not covered" > const query = hook.params.query</span>
|
|
927
|
+
<span class="cstat-no" title="statement not covered" > if (query) {</span>
|
|
928
|
+
<span class="cstat-no" title="statement not covered" > if (!_.isNil(query.geometry)) marshallGeometry(query.geometry)</span>
|
|
929
|
+
<span class="cstat-no" title="statement not covered" > // Shortcut for proximity query</span>
|
|
930
|
+
<span class="cstat-no" title="statement not covered" > if ((!_.isNil(query.centerLon) || !_.isNil(query.longitude)) &&</span>
|
|
931
|
+
<span class="cstat-no" title="statement not covered" > (!_.isNil(query.centerLat) || !_.isNil(query.latitude)) && !_.isNil(query.distance)) {</span>
|
|
932
|
+
<span class="cstat-no" title="statement not covered" > const longitude = (_.isNil(query.centerLon) ? _.toNumber(query.longitude) : _.toNumber(query.centerLon))</span>
|
|
933
|
+
<span class="cstat-no" title="statement not covered" > const latitude = (_.isNil(query.centerLat) ? _.toNumber(query.latitude) : _.toNumber(query.centerLat))</span>
|
|
934
|
+
<span class="cstat-no" title="statement not covered" > const distance = _.toNumber(query.distance)</span>
|
|
935
|
+
<span class="cstat-no" title="statement not covered" > // Transform to MongoDB spatial request</span>
|
|
936
|
+
<span class="cstat-no" title="statement not covered" > delete query.centerLon</span>
|
|
937
|
+
<span class="cstat-no" title="statement not covered" > delete query.longitude</span>
|
|
938
|
+
<span class="cstat-no" title="statement not covered" > delete query.centerLat</span>
|
|
939
|
+
<span class="cstat-no" title="statement not covered" > delete query.latitude</span>
|
|
940
|
+
<span class="cstat-no" title="statement not covered" > delete query.distance</span>
|
|
941
|
+
<span class="cstat-no" title="statement not covered" > // Aggregation requires a specific operator</span>
|
|
942
|
+
<span class="cstat-no" title="statement not covered" > if (query.$aggregate) {</span>
|
|
933
943
|
<span class="cstat-no" title="statement not covered" > query.$geoNear = {</span>
|
|
934
944
|
<span class="cstat-no" title="statement not covered" > near: { type: 'Point', coordinates: [longitude, latitude] },</span>
|
|
935
945
|
<span class="cstat-no" title="statement not covered" > maxDistance: distance,</span>
|
|
936
946
|
<span class="cstat-no" title="statement not covered" > distanceField: 'distance',</span>
|
|
937
947
|
<span class="cstat-no" title="statement not covered" > spherical: true</span>
|
|
938
948
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
939
|
-
} else {
|
|
940
|
-
/* We switched from $near to $geoWithin due to https://github.com/kalisio/kdk/issues/345
|
|
941
|
-
query.geometry = {
|
|
942
|
-
$near: {
|
|
943
|
-
$geometry: {
|
|
944
|
-
type: 'Point'
|
|
945
|
-
coordinates: [longitude, latitude]
|
|
946
|
-
}
|
|
947
|
-
$maxDistance: distance
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
query.geometry = {
|
|
952
|
-
$geoWithin: {
|
|
953
|
-
$centerSphere: [[longitude, latitude], distance / 6378137.0] // Earth radius as in radians
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
// Shortcut for bbox query
|
|
959
|
-
if (!_.isNil(query.south) && !_.isNil(query.north) && !_.isNil(query.west) && !_.isNil(query.east)) {
|
|
960
|
-
const south = _.toNumber(query.south)
|
|
961
|
-
const north = _.toNumber(query.north)
|
|
962
|
-
const west = _.toNumber(query.west)
|
|
963
|
-
const east = _.toNumber(query.east)
|
|
964
|
-
// Transform to MongoDB spatial request
|
|
965
|
-
delete query.south
|
|
966
|
-
delete query.north
|
|
967
|
-
delete query.west
|
|
968
|
-
delete query.east
|
|
969
|
-
|
|
970
|
-
// FIXME: MongoDB should allow to support queries with a single-ringed GeoJSON polygon
|
|
971
|
-
// whose area is greater than or equal to a single hemisphere
|
|
972
|
-
// However, we did not succeeed in making it work as expected, for now on we split large polygon into two halfs
|
|
973
|
-
if ((east-west) <= 180) {
|
|
974
|
-
// BBox as a polygon also requires the closing point
|
|
975
|
-
const bbox = [[west, south], [east, south], [east, north], [west, north], [west, south]]
|
|
976
|
-
query.geometry = getGeometryQueryForBBox(bbox)
|
|
977
|
-
} else {
|
|
978
|
-
// BBox as a polygon also requires the closing point
|
|
979
|
-
const leftHalfBbox = [[west, south], [0.5*(west+east), south], [0.5*(west+east), north], [west, north], [west, south]]
|
|
980
|
-
const rightHalfBbox = [[0.5*(west+east), south], [east, south], [east, north], [0.5*(west+east), north], [0.5*(west+east), south]]
|
|
981
|
-
query.$or = [{ geometry: getGeometryQueryForBBox(leftHalfBbox) }, { geometry: getGeometryQueryForBBox(rightHalfBbox) }]
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
// Shortcut for location query
|
|
985
|
-
if (!_.isNil(query.longitude) && !_.isNil(query.latitude)) {
|
|
986
|
-
const longitude = _.toNumber(query.longitude)
|
|
987
|
-
const latitude = _.toNumber(query.latitude)
|
|
988
|
-
// Transform to MongoDB spatial request
|
|
989
|
-
delete query.longitude
|
|
990
|
-
delete query.latitude
|
|
991
|
-
const geometryQuery = {
|
|
992
|
-
$geoIntersects: {
|
|
993
|
-
$geometry: {
|
|
994
|
-
type: 'Point'
|
|
995
|
-
coordinates: [longitude, latitude]
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
query.geometry = geometryQuery
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
// Include GeoJson query by default
|
|
1003
|
-
marshallGeoJsonQuery(hook)
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
export function asGeoJson (options = {}) {
|
|
1007
|
-
return function (hook) {
|
|
1008
|
-
const params = hook.params
|
|
1009
|
-
const query = params.query
|
|
1010
|
-
if (!options.force && !params.asGeoJson)
|
|
1011
|
-
if (
|
|
1012
|
-
const longitudeProperty = (options.longitudeProperty || 'longitude')
|
|
1013
|
-
const latitudeProperty = (options.latitudeProperty || 'latitude')
|
|
1014
|
-
const altitudeProperty = (options.altitudeProperty || 'altitude')
|
|
1015
|
-
const geometryProperty = (options.geometryProperty || 'geometry')
|
|
1016
|
-
const allowNullGeometries = _.get(options, 'allowNullGeometries', false)
|
|
1017
|
-
let results = _.get(hook, options.dataPath || 'result')
|
|
1018
|
-
// Already as GeoJson
|
|
1019
|
-
|
|
1020
|
-
const isPaginated = !_.isNil(results.data)
|
|
1021
|
-
const pagination = (isPaginated ? _.pick(results, ['total', 'skip', 'limit']) : {})
|
|
1022
|
-
results = (isPaginated ? results.data : results)
|
|
1023
|
-
// Single item case, i.e. GET
|
|
1024
|
-
const isFeatureCollection = Array.isArray(results)
|
|
1025
|
-
|
|
1026
|
-
results = results
|
|
1027
|
-
.filter(item => {
|
|
1028
|
-
// Check if item is not already in GeoJson feature format and we can convert if required
|
|
1029
|
-
return (_.has(item, longitudeProperty) && _.has(item, latitudeProperty))
|
|
1030
|
-
// When performing feature aggregation on geometries the result can be an array
|
|
1031
|
-
Array.isArray(_.get(item, geometryProperty))
|
|
1032
|
-
// Check for a geometry property (previously provided or already transformed item)
|
|
1033
|
-
(_.has(item, geometryProperty + '.type') && _.has(item, geometryProperty + '.coordinates'))
|
|
1034
|
-
(_.has(item, geometryProperty + '.geometry.type')
|
|
1035
|
-
// Check for null geometries when allowed
|
|
1036
|
-
allowNullGeometries
|
|
1037
|
-
})
|
|
1038
|
-
.map(item => {
|
|
1039
|
-
let coordinates
|
|
1040
|
-
// Keep track of coordinates before picking properties
|
|
1041
|
-
if (_.has(item, longitudeProperty) && _.has(item, latitudeProperty)) {
|
|
1042
|
-
coordinates = [_.get(item, longitudeProperty), _.get(item, latitudeProperty)]
|
|
1043
|
-
|
|
949
|
+
<span class="cstat-no" title="statement not covered" > } else {</span>
|
|
950
|
+
<span class="cstat-no" title="statement not covered" > /* We switched from $near to $geoWithin due to https://github.com/kalisio/kdk/issues/345</span>
|
|
951
|
+
<span class="cstat-no" title="statement not covered" > query.geometry = {</span>
|
|
952
|
+
<span class="cstat-no" title="statement not covered" > $near: {</span>
|
|
953
|
+
<span class="cstat-no" title="statement not covered" > $geometry: {</span>
|
|
954
|
+
<span class="cstat-no" title="statement not covered" > type: 'Point',</span>
|
|
955
|
+
<span class="cstat-no" title="statement not covered" > coordinates: [longitude, latitude]</span>
|
|
956
|
+
<span class="cstat-no" title="statement not covered" > },</span>
|
|
957
|
+
<span class="cstat-no" title="statement not covered" > $maxDistance: distance</span>
|
|
958
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
959
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
960
|
+
<span class="cstat-no" title="statement not covered" > */</span>
|
|
961
|
+
<span class="cstat-no" title="statement not covered" > query.geometry = {</span>
|
|
962
|
+
<span class="cstat-no" title="statement not covered" > $geoWithin: {</span>
|
|
963
|
+
<span class="cstat-no" title="statement not covered" > $centerSphere: [[longitude, latitude], distance / 6378137.0] // Earth radius as in radians</span>
|
|
964
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
965
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
966
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
967
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
968
|
+
<span class="cstat-no" title="statement not covered" > // Shortcut for bbox query</span>
|
|
969
|
+
<span class="cstat-no" title="statement not covered" > if (!_.isNil(query.south) && !_.isNil(query.north) && !_.isNil(query.west) && !_.isNil(query.east)) {</span>
|
|
970
|
+
<span class="cstat-no" title="statement not covered" > const south = _.toNumber(query.south)</span>
|
|
971
|
+
<span class="cstat-no" title="statement not covered" > const north = _.toNumber(query.north)</span>
|
|
972
|
+
<span class="cstat-no" title="statement not covered" > const west = _.toNumber(query.west)</span>
|
|
973
|
+
<span class="cstat-no" title="statement not covered" > const east = _.toNumber(query.east)</span>
|
|
974
|
+
<span class="cstat-no" title="statement not covered" > // Transform to MongoDB spatial request</span>
|
|
975
|
+
<span class="cstat-no" title="statement not covered" > delete query.south</span>
|
|
976
|
+
<span class="cstat-no" title="statement not covered" > delete query.north</span>
|
|
977
|
+
<span class="cstat-no" title="statement not covered" > delete query.west</span>
|
|
978
|
+
<span class="cstat-no" title="statement not covered" > delete query.east</span>
|
|
979
|
+
<span class="cstat-no" title="statement not covered" > </span>
|
|
980
|
+
<span class="cstat-no" title="statement not covered" > // FIXME: MongoDB should allow to support queries with a single-ringed GeoJSON polygon</span>
|
|
981
|
+
<span class="cstat-no" title="statement not covered" > // whose area is greater than or equal to a single hemisphere.</span>
|
|
982
|
+
<span class="cstat-no" title="statement not covered" > // However, we did not succeeed in making it work as expected, for now on we split large polygon into two halfs.</span>
|
|
983
|
+
<span class="cstat-no" title="statement not covered" > if ((east-west) <= 180) {</span>
|
|
984
|
+
<span class="cstat-no" title="statement not covered" > // BBox as a polygon also requires the closing point.</span>
|
|
985
|
+
<span class="cstat-no" title="statement not covered" > const bbox = [[west, south], [east, south], [east, north], [west, north], [west, south]]</span>
|
|
986
|
+
<span class="cstat-no" title="statement not covered" > query.geometry = getGeometryQueryForBBox(bbox)</span>
|
|
987
|
+
<span class="cstat-no" title="statement not covered" > } else {</span>
|
|
988
|
+
<span class="cstat-no" title="statement not covered" > // BBox as a polygon also requires the closing point.</span>
|
|
989
|
+
<span class="cstat-no" title="statement not covered" > const leftHalfBbox = [[west, south], [0.5*(west+east), south], [0.5*(west+east), north], [west, north], [west, south]]</span>
|
|
990
|
+
<span class="cstat-no" title="statement not covered" > const rightHalfBbox = [[0.5*(west+east), south], [east, south], [east, north], [0.5*(west+east), north], [0.5*(west+east), south]]</span>
|
|
991
|
+
<span class="cstat-no" title="statement not covered" > query.$or = [{ geometry: getGeometryQueryForBBox(leftHalfBbox) }, { geometry: getGeometryQueryForBBox(rightHalfBbox) }]</span>
|
|
992
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
993
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
994
|
+
<span class="cstat-no" title="statement not covered" > // Shortcut for location query</span>
|
|
995
|
+
<span class="cstat-no" title="statement not covered" > if (!_.isNil(query.longitude) && !_.isNil(query.latitude)) {</span>
|
|
996
|
+
<span class="cstat-no" title="statement not covered" > const longitude = _.toNumber(query.longitude)</span>
|
|
997
|
+
<span class="cstat-no" title="statement not covered" > const latitude = _.toNumber(query.latitude)</span>
|
|
998
|
+
<span class="cstat-no" title="statement not covered" > // Transform to MongoDB spatial request</span>
|
|
999
|
+
<span class="cstat-no" title="statement not covered" > delete query.longitude</span>
|
|
1000
|
+
<span class="cstat-no" title="statement not covered" > delete query.latitude</span>
|
|
1001
|
+
<span class="cstat-no" title="statement not covered" > const geometryQuery = {</span>
|
|
1002
|
+
<span class="cstat-no" title="statement not covered" > $geoIntersects: {</span>
|
|
1003
|
+
<span class="cstat-no" title="statement not covered" > $geometry: {</span>
|
|
1004
|
+
<span class="cstat-no" title="statement not covered" > type: 'Point',</span>
|
|
1005
|
+
<span class="cstat-no" title="statement not covered" > coordinates: [longitude, latitude]</span>
|
|
1006
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1007
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1008
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1009
|
+
<span class="cstat-no" title="statement not covered" > query.geometry = geometryQuery</span>
|
|
1010
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1011
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1012
|
+
<span class="cstat-no" title="statement not covered" > // Include GeoJson query by default</span>
|
|
1013
|
+
<span class="cstat-no" title="statement not covered" > marshallGeoJsonQuery(hook)</span>
|
|
1014
|
+
<span class="cstat-no" title="statement not covered" >}</span>
|
|
1015
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
1016
|
+
<span class="cstat-no" title="statement not covered" >export function asGeoJson (options = {}) {</span>
|
|
1017
|
+
<span class="cstat-no" title="statement not covered" > return function (hook) {</span>
|
|
1018
|
+
<span class="cstat-no" title="statement not covered" > const params = hook.params</span>
|
|
1019
|
+
<span class="cstat-no" title="statement not covered" > const query = params.query</span>
|
|
1020
|
+
<span class="cstat-no" title="statement not covered" > if (!options.force && !params.asGeoJson) return</span>
|
|
1021
|
+
<span class="cstat-no" title="statement not covered" > if (query.$distinct || query.$aggregation) return // Not applicable in this case</span>
|
|
1022
|
+
<span class="cstat-no" title="statement not covered" > const longitudeProperty = (options.longitudeProperty || 'longitude')</span>
|
|
1023
|
+
<span class="cstat-no" title="statement not covered" > const latitudeProperty = (options.latitudeProperty || 'latitude')</span>
|
|
1024
|
+
<span class="cstat-no" title="statement not covered" > const altitudeProperty = (options.altitudeProperty || 'altitude')</span>
|
|
1025
|
+
<span class="cstat-no" title="statement not covered" > const geometryProperty = (options.geometryProperty || 'geometry')</span>
|
|
1026
|
+
<span class="cstat-no" title="statement not covered" > const allowNullGeometries = _.get(options, 'allowNullGeometries', false)</span>
|
|
1027
|
+
<span class="cstat-no" title="statement not covered" > let results = _.get(hook, options.dataPath || 'result')</span>
|
|
1028
|
+
<span class="cstat-no" title="statement not covered" > // Already as GeoJson ?</span>
|
|
1029
|
+
<span class="cstat-no" title="statement not covered" > if (results.type === 'FeatureCollection') return</span>
|
|
1030
|
+
<span class="cstat-no" title="statement not covered" > const isPaginated = !_.isNil(results.data)</span>
|
|
1031
|
+
<span class="cstat-no" title="statement not covered" > const pagination = (isPaginated ? _.pick(results, ['total', 'skip', 'limit']) : {})</span>
|
|
1032
|
+
<span class="cstat-no" title="statement not covered" > results = (isPaginated ? results.data : results)</span>
|
|
1033
|
+
<span class="cstat-no" title="statement not covered" > // Single item case, i.e. GET ?</span>
|
|
1034
|
+
<span class="cstat-no" title="statement not covered" > const isFeatureCollection = Array.isArray(results)</span>
|
|
1035
|
+
<span class="cstat-no" title="statement not covered" > if (!isFeatureCollection) results = [results]</span>
|
|
1036
|
+
<span class="cstat-no" title="statement not covered" > results = results</span>
|
|
1037
|
+
<span class="cstat-no" title="statement not covered" > .filter(item => {</span>
|
|
1038
|
+
<span class="cstat-no" title="statement not covered" > // Check if item is not already in GeoJson feature format and we can convert if required</span>
|
|
1039
|
+
<span class="cstat-no" title="statement not covered" > return (_.has(item, longitudeProperty) && _.has(item, latitudeProperty)) ||</span>
|
|
1040
|
+
<span class="cstat-no" title="statement not covered" > // When performing feature aggregation on geometries the result can be an array</span>
|
|
1041
|
+
<span class="cstat-no" title="statement not covered" > Array.isArray(_.get(item, geometryProperty)) ||</span>
|
|
1042
|
+
<span class="cstat-no" title="statement not covered" > // Check for a geometry property (previously provided or already transformed item)</span>
|
|
1043
|
+
<span class="cstat-no" title="statement not covered" > (_.has(item, geometryProperty + '.type') && _.has(item, geometryProperty + '.coordinates')) ||</span>
|
|
1044
|
+
<span class="cstat-no" title="statement not covered" > (_.has(item, geometryProperty + '.geometry.type') && _.has(item, geometryProperty + '.geometry.coordinates')) ||</span>
|
|
1045
|
+
<span class="cstat-no" title="statement not covered" > // Check for null geometries when allowed</span>
|
|
1046
|
+
<span class="cstat-no" title="statement not covered" > allowNullGeometries</span>
|
|
1047
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1048
|
+
<span class="cstat-no" title="statement not covered" > .map(item => {</span>
|
|
1049
|
+
<span class="cstat-no" title="statement not covered" > let coordinates</span>
|
|
1050
|
+
<span class="cstat-no" title="statement not covered" > // Keep track of coordinates before picking properties</span>
|
|
1051
|
+
<span class="cstat-no" title="statement not covered" > if (_.has(item, longitudeProperty) && _.has(item, latitudeProperty)) {</span>
|
|
1052
|
+
<span class="cstat-no" title="statement not covered" > coordinates = [_.get(item, longitudeProperty), _.get(item, latitudeProperty)]</span>
|
|
1053
|
+
<span class="cstat-no" title="statement not covered" > if (_.has(item, altitudeProperty)) {</span>
|
|
1044
1054
|
<span class="cstat-no" title="statement not covered" > coordinates.push(_.get(item, altitudeProperty))</span>
|
|
1045
1055
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1046
|
-
}
|
|
1047
|
-
if (options.pick) {
|
|
1048
|
-
item = _.pick(item, options.pick)
|
|
1049
|
-
}
|
|
1050
|
-
if (options.omit) {
|
|
1051
|
-
item = _.omit(item, options.omit)
|
|
1052
|
-
}
|
|
1053
|
-
// Item locations are already in GeoJson format
|
|
1054
|
-
if ((_.has(item, geometryProperty + '.type') && _.has(item, geometryProperty + '.coordinates'))
|
|
1055
|
-
(_.has(item, geometryProperty + '.geometry.type')
|
|
1056
|
-
return Object.assign({
|
|
1057
|
-
type: 'Feature'
|
|
1058
|
-
geometry: _.get(item, geometryProperty + '.geometry', _.get(item, geometryProperty))
|
|
1059
|
-
properties: {}
|
|
1060
|
-
}, _.omit(item, [geometryProperty]))
|
|
1061
|
-
} else if (Array.isArray(_.get(item, geometryProperty))) {
|
|
1062
|
-
return Object.assign({
|
|
1063
|
-
type: 'Feature'
|
|
1064
|
-
geometry: { type: 'GeometryCollection', geometries: _.get(item, geometryProperty) }
|
|
1065
|
-
properties: {}
|
|
1066
|
-
}, _.omit(item, [geometryProperty]))
|
|
1067
|
-
} else {
|
|
1068
|
-
// Item locations are not already in GeoJson feature format so we need to convert
|
|
1069
|
-
return Object.assign({
|
|
1070
|
-
type: 'Feature'
|
|
1071
|
-
geometry: (coordinates ? { type: 'Point', coordinates } : null)
|
|
1072
|
-
properties: {}
|
|
1073
|
-
}, _.omit(item, [longitudeProperty, latitudeProperty]))
|
|
1074
|
-
}
|
|
1075
|
-
})
|
|
1076
|
-
// Move some data to properties
|
|
1077
|
-
if (options.properties) {
|
|
1078
|
-
results.forEach(item => {
|
|
1079
|
-
// True indicates to move all fields to properties
|
|
1080
|
-
if (options.properties === true) {
|
|
1081
|
-
_.forOwn(item, (value, key) => {
|
|
1082
|
-
if ((key === 'geometry') || (key === 'type') || (key === '_id')) return
|
|
1083
|
-
_.set(item, `properties.${key}`, _.get(item, key))
|
|
1084
|
-
_.unset(item, key)
|
|
1085
|
-
})
|
|
1086
|
-
|
|
1056
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1057
|
+
<span class="cstat-no" title="statement not covered" > if (options.pick) {</span>
|
|
1058
|
+
<span class="cstat-no" title="statement not covered" > item = _.pick(item, options.pick)</span>
|
|
1059
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1060
|
+
<span class="cstat-no" title="statement not covered" > if (options.omit) {</span>
|
|
1061
|
+
<span class="cstat-no" title="statement not covered" > item = _.omit(item, options.omit)</span>
|
|
1062
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1063
|
+
<span class="cstat-no" title="statement not covered" > // Item locations are already in GeoJson format</span>
|
|
1064
|
+
<span class="cstat-no" title="statement not covered" > if ((_.has(item, geometryProperty + '.type') && _.has(item, geometryProperty + '.coordinates')) ||</span>
|
|
1065
|
+
<span class="cstat-no" title="statement not covered" > (_.has(item, geometryProperty + '.geometry.type') && _.has(item, geometryProperty + '.geometry.coordinates'))) {</span>
|
|
1066
|
+
<span class="cstat-no" title="statement not covered" > return Object.assign({</span>
|
|
1067
|
+
<span class="cstat-no" title="statement not covered" > type: 'Feature',</span>
|
|
1068
|
+
<span class="cstat-no" title="statement not covered" > geometry: _.get(item, geometryProperty + '.geometry', _.get(item, geometryProperty)),</span>
|
|
1069
|
+
<span class="cstat-no" title="statement not covered" > properties: {}</span>
|
|
1070
|
+
<span class="cstat-no" title="statement not covered" > }, _.omit(item, [geometryProperty]))</span>
|
|
1071
|
+
<span class="cstat-no" title="statement not covered" > } else if (Array.isArray(_.get(item, geometryProperty))) {</span>
|
|
1072
|
+
<span class="cstat-no" title="statement not covered" > return Object.assign({</span>
|
|
1073
|
+
<span class="cstat-no" title="statement not covered" > type: 'Feature',</span>
|
|
1074
|
+
<span class="cstat-no" title="statement not covered" > geometry: { type: 'GeometryCollection', geometries: _.get(item, geometryProperty) },</span>
|
|
1075
|
+
<span class="cstat-no" title="statement not covered" > properties: {}</span>
|
|
1076
|
+
<span class="cstat-no" title="statement not covered" > }, _.omit(item, [geometryProperty]))</span>
|
|
1077
|
+
<span class="cstat-no" title="statement not covered" > } else {</span>
|
|
1078
|
+
<span class="cstat-no" title="statement not covered" > // Item locations are not already in GeoJson feature format so we need to convert</span>
|
|
1079
|
+
<span class="cstat-no" title="statement not covered" > return Object.assign({</span>
|
|
1080
|
+
<span class="cstat-no" title="statement not covered" > type: 'Feature',</span>
|
|
1081
|
+
<span class="cstat-no" title="statement not covered" > geometry: (coordinates ? { type: 'Point', coordinates } : null),</span>
|
|
1082
|
+
<span class="cstat-no" title="statement not covered" > properties: {}</span>
|
|
1083
|
+
<span class="cstat-no" title="statement not covered" > }, _.omit(item, [longitudeProperty, latitudeProperty]))</span>
|
|
1084
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1085
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1086
|
+
<span class="cstat-no" title="statement not covered" > // Move some data to properties ?</span>
|
|
1087
|
+
<span class="cstat-no" title="statement not covered" > if (options.properties) {</span>
|
|
1088
|
+
<span class="cstat-no" title="statement not covered" > results.forEach(item => {</span>
|
|
1089
|
+
<span class="cstat-no" title="statement not covered" > // True indicates to move all fields to properties</span>
|
|
1090
|
+
<span class="cstat-no" title="statement not covered" > if (options.properties === true) {</span>
|
|
1091
|
+
<span class="cstat-no" title="statement not covered" > _.forOwn(item, (value, key) => {</span>
|
|
1092
|
+
<span class="cstat-no" title="statement not covered" > if ((key === 'geometry') || (key === 'type') || (key === '_id')) return</span>
|
|
1093
|
+
<span class="cstat-no" title="statement not covered" > _.set(item, `properties.${key}`, _.get(item, key))</span>
|
|
1094
|
+
<span class="cstat-no" title="statement not covered" > _.unset(item, key)</span>
|
|
1095
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1096
|
+
<span class="cstat-no" title="statement not covered" > } else { // Else we expect a specific mapping</span>
|
|
1087
1097
|
<span class="cstat-no" title="statement not covered" > options.properties.forEach(mapping => {</span>
|
|
1088
1098
|
<span class="cstat-no" title="statement not covered" > if (mapping.from) _.set(item, `properties.${mapping.to || mapping.from}`, _.get(item, `${mapping.from}`))</span>
|
|
1089
1099
|
<span class="cstat-no" title="statement not covered" > if (mapping.delete) _.unset(item, `${mapping.from}`)</span>
|
|
1090
1100
|
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1091
1101
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1092
|
-
})
|
|
1093
|
-
}
|
|
1094
|
-
// If we should make it available as a GeoJson feature collection create it
|
|
1095
|
-
if (isFeatureCollection && _.get(options, 'asFeatureCollection', true)) {
|
|
1096
|
-
// Copy pagination information if any so that client can use it anyway
|
|
1097
|
-
_.set(hook, options.dataPath || 'result', Object.assign({
|
|
1098
|
-
type: 'FeatureCollection'
|
|
1099
|
-
features: results
|
|
1100
|
-
}, pagination)) // If no pagination this merged object will be empty
|
|
1101
|
-
|
|
1102
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1103
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1104
|
+
<span class="cstat-no" title="statement not covered" > // If we should make it available as a GeoJson feature collection create it</span>
|
|
1105
|
+
<span class="cstat-no" title="statement not covered" > if (isFeatureCollection && _.get(options, 'asFeatureCollection', true)) {</span>
|
|
1106
|
+
<span class="cstat-no" title="statement not covered" > // Copy pagination information if any so that client can use it anyway</span>
|
|
1107
|
+
<span class="cstat-no" title="statement not covered" > _.set(hook, options.dataPath || 'result', Object.assign({</span>
|
|
1108
|
+
<span class="cstat-no" title="statement not covered" > type: 'FeatureCollection',</span>
|
|
1109
|
+
<span class="cstat-no" title="statement not covered" > features: results</span>
|
|
1110
|
+
<span class="cstat-no" title="statement not covered" > }, pagination)) // If no pagination this merged object will be empty</span>
|
|
1111
|
+
<span class="cstat-no" title="statement not covered" > } else if (isPaginated) {</span>
|
|
1102
1112
|
<span class="cstat-no" title="statement not covered" > // Copy pagination information if any so that client can use it anyway</span>
|
|
1103
1113
|
<span class="cstat-no" title="statement not covered" > _.set(hook, options.dataPath || 'result', Object.assign({</span>
|
|
1104
1114
|
<span class="cstat-no" title="statement not covered" > data: results</span>
|
|
1105
1115
|
<span class="cstat-no" title="statement not covered" > }, pagination))</span>
|
|
1106
|
-
} else {
|
|
1107
|
-
_.set(hook, options.dataPath || 'result', isFeatureCollection ? results
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
export async function aggregateFeaturesQuery (hook) {
|
|
1113
|
-
const query = hook.params.query
|
|
1114
|
-
const service = hook.service
|
|
1115
|
-
|
|
1116
|
-
// Perform aggregation
|
|
1117
|
-
if (query.$aggregate) {
|
|
1118
|
-
const collection = service.Model
|
|
1119
|
-
const indexes = await collection.indexes()
|
|
1120
|
-
let featureId = (service.options ? service.options.featureId
|
|
1121
|
-
// Support compound ID
|
|
1122
|
-
|
|
1123
|
-
let featureIdType = (service.options ? service.options.featureIdType
|
|
1124
|
-
|
|
1125
|
-
const ids = typeof query.$groupBy === 'string' // Group by matching ID(s), ie single ID or array of field to create a compound ID
|
|
1126
|
-
? { [query.$groupBy]: '$properties.' + query.$groupBy }
|
|
1127
|
-
// Aggregated in an accumulator to avoid conflict with feature properties
|
|
1128
|
-
<span class="
|
|
1129
|
-
const groupBy = { _id: ids }
|
|
1130
|
-
let keys = _.keys(ids)
|
|
1131
|
-
// Do we only keep first or last available time
|
|
1132
|
-
const singleTime = (_.toNumber(query.$limit) === 1)
|
|
1133
|
-
if (singleTime) {
|
|
1134
|
-
// When single time no aggregation is performed at all so we only have raw features
|
|
1135
|
-
keys = keys.map(key => 'properties.' + key)
|
|
1136
|
-
// In this case no need to aggregate on each element we simply keep the first feature
|
|
1137
|
-
// BUG: according to https://jira.mongodb.org/browse/SERVER-9507 MongoDB is not yet
|
|
1138
|
-
// able to optimize this kind of operations to avoid full index scan
|
|
1139
|
-
// For now we should restrict it to short time range
|
|
1140
|
-
Object.assign(groupBy, { feature: { $first: '$$ROOT' } })
|
|
1141
|
-
} else {
|
|
1142
|
-
Object.assign(groupBy, {
|
|
1143
|
-
time: { $push: '$time' }, // Keep track of all times
|
|
1144
|
-
runTime: { $push: '$runTime' }, // Keep track of all run times
|
|
1145
|
-
type: { $last: '$type' }, // type is assumed similar for all results, keep last
|
|
1146
|
-
properties: { $last: '$properties' } // non-aggregated properties are assumed similar for all results, keep last
|
|
1147
|
-
})
|
|
1148
|
-
// Keep track of all levels as well if not targetting a specific one
|
|
1149
|
-
if (!_.has(query, 'level')) {
|
|
1150
|
-
Object.assign(groupBy, {
|
|
1151
|
-
level: { $push: '$level' }
|
|
1152
|
-
})
|
|
1153
|
-
}
|
|
1154
|
-
// Check if we aggregate geometry or simply properties
|
|
1155
|
-
if (!query.$aggregate.includes('geometry')) {
|
|
1156
|
-
Object.assign(groupBy, {
|
|
1157
|
-
geometry: { $last: '$geometry' } // geometry is assumed similar for all results, keep last
|
|
1158
|
-
})
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
// Merge with any additional group expression
|
|
1162
|
-
const group = _.get(query, '$group', {})
|
|
1163
|
-
Object.assign(groupBy, group)
|
|
1164
|
-
// The query contains the match stage except options relevent to the aggregation pipeline
|
|
1165
|
-
const match = _.omit(query, ['$group', '$groupBy', '$aggregate', '$geoNear', '$sort', '$limit', '$skip'])
|
|
1166
|
-
// Check for any required type conversion (eg HTTP requests)
|
|
1167
|
-
for (let i = 0; i < featureId.length; i++) {
|
|
1168
|
-
const id = featureId[i]
|
|
1169
|
-
const idType = featureIdType[i]
|
|
1170
|
-
if (_.has(match, 'properties.' + id)) {
|
|
1171
|
-
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
// Ensure we do not mix results with/without relevant element values
|
|
1175
|
-
// by separately querying each element then merging
|
|
1176
|
-
let aggregatedResults
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
// Check for geometry stage
|
|
1188
|
-
if (query.$geoNear) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
|
|
1116
|
+
<span class="cstat-no" title="statement not covered" > } else {</span>
|
|
1117
|
+
<span class="cstat-no" title="statement not covered" > _.set(hook, options.dataPath || 'result', isFeatureCollection ? results : results[0])</span>
|
|
1118
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1119
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1120
|
+
<span class="cstat-no" title="statement not covered" >}</span>
|
|
1121
|
+
<span class="cstat-no" title="statement not covered" ></span>
|
|
1122
|
+
<span class="cstat-no" title="statement not covered" >export async function aggregateFeaturesQuery (hook) {</span>
|
|
1123
|
+
<span class="cstat-no" title="statement not covered" > const query = hook.params.query</span>
|
|
1124
|
+
<span class="cstat-no" title="statement not covered" > const service = hook.service</span>
|
|
1125
|
+
<span class="cstat-no" title="statement not covered" > if (!query) return</span>
|
|
1126
|
+
<span class="cstat-no" title="statement not covered" > // Perform aggregation</span>
|
|
1127
|
+
<span class="cstat-no" title="statement not covered" > if (query.$aggregate) {</span>
|
|
1128
|
+
<span class="cstat-no" title="statement not covered" > const collection = service.Model</span>
|
|
1129
|
+
<span class="cstat-no" title="statement not covered" > const indexes = await collection.indexes()</span>
|
|
1130
|
+
<span class="cstat-no" title="statement not covered" > let featureId = (service.options ? service.options.featureId : [])</span>
|
|
1131
|
+
<span class="cstat-no" title="statement not covered" > // Support compound ID</span>
|
|
1132
|
+
<span class="cstat-no" title="statement not covered" > featureId = (Array.isArray(featureId) ? featureId : [featureId])</span>
|
|
1133
|
+
<span class="cstat-no" title="statement not covered" > let featureIdType = (service.options ? service.options.featureIdType : [])</span>
|
|
1134
|
+
<span class="cstat-no" title="statement not covered" > featureIdType = (Array.isArray(featureIdType) ? featureIdType : [featureIdType])</span>
|
|
1135
|
+
<span class="cstat-no" title="statement not covered" > const ids = typeof query.$groupBy === 'string' // Group by matching ID(s), ie single ID or array of field to create a compound ID</span>
|
|
1136
|
+
<span class="cstat-no" title="statement not covered" > ? { [query.$groupBy]: '$properties.' + query.$groupBy }</span>
|
|
1137
|
+
<span class="cstat-no" title="statement not covered" > // Aggregated in an accumulator to avoid conflict with feature properties</span>
|
|
1138
|
+
<span class="cstat-no" title="statement not covered" > : query.$groupBy.reduce((object, id) => Object.assign(object, { [id]: '$properties.' + id }), {})</span>
|
|
1139
|
+
<span class="cstat-no" title="statement not covered" > const groupBy = { _id: ids }</span>
|
|
1140
|
+
<span class="cstat-no" title="statement not covered" > let keys = _.keys(ids)</span>
|
|
1141
|
+
<span class="cstat-no" title="statement not covered" > // Do we only keep first or last available time ?</span>
|
|
1142
|
+
<span class="cstat-no" title="statement not covered" > const singleTime = (_.toNumber(query.$limit) === 1)</span>
|
|
1143
|
+
<span class="cstat-no" title="statement not covered" > if (singleTime) {</span>
|
|
1144
|
+
<span class="cstat-no" title="statement not covered" > // When single time no aggregation is performed at all so we only have raw features</span>
|
|
1145
|
+
<span class="cstat-no" title="statement not covered" > keys = keys.map(key => 'properties.' + key)</span>
|
|
1146
|
+
<span class="cstat-no" title="statement not covered" > // In this case no need to aggregate on each element we simply keep the first feature</span>
|
|
1147
|
+
<span class="cstat-no" title="statement not covered" > // BUG: according to https://jira.mongodb.org/browse/SERVER-9507 MongoDB is not yet</span>
|
|
1148
|
+
<span class="cstat-no" title="statement not covered" > // able to optimize this kind of operations to avoid full index scan</span>
|
|
1149
|
+
<span class="cstat-no" title="statement not covered" > // For now we should restrict it to short time range</span>
|
|
1150
|
+
<span class="cstat-no" title="statement not covered" > Object.assign(groupBy, { feature: { $first: '$$ROOT' } })</span>
|
|
1151
|
+
<span class="cstat-no" title="statement not covered" > } else {</span>
|
|
1152
|
+
<span class="cstat-no" title="statement not covered" > Object.assign(groupBy, {</span>
|
|
1153
|
+
<span class="cstat-no" title="statement not covered" > time: { $push: '$time' }, // Keep track of all times</span>
|
|
1154
|
+
<span class="cstat-no" title="statement not covered" > runTime: { $push: '$runTime' }, // Keep track of all run times</span>
|
|
1155
|
+
<span class="cstat-no" title="statement not covered" > type: { $last: '$type' }, // type is assumed similar for all results, keep last</span>
|
|
1156
|
+
<span class="cstat-no" title="statement not covered" > properties: { $last: '$properties' } // non-aggregated properties are assumed similar for all results, keep last</span>
|
|
1157
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1158
|
+
<span class="cstat-no" title="statement not covered" > // Keep track of all levels as well if not targetting a specific one</span>
|
|
1159
|
+
<span class="cstat-no" title="statement not covered" > if (!_.has(query, 'level')) {</span>
|
|
1160
|
+
<span class="cstat-no" title="statement not covered" > Object.assign(groupBy, {</span>
|
|
1161
|
+
<span class="cstat-no" title="statement not covered" > level: { $push: '$level' }</span>
|
|
1162
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1163
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1164
|
+
<span class="cstat-no" title="statement not covered" > // Check if we aggregate geometry or simply properties</span>
|
|
1165
|
+
<span class="cstat-no" title="statement not covered" > if (!query.$aggregate.includes('geometry')) {</span>
|
|
1166
|
+
<span class="cstat-no" title="statement not covered" > Object.assign(groupBy, {</span>
|
|
1167
|
+
<span class="cstat-no" title="statement not covered" > geometry: { $last: '$geometry' } // geometry is assumed similar for all results, keep last</span>
|
|
1168
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1169
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1170
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1171
|
+
<span class="cstat-no" title="statement not covered" > // Merge with any additional group expression</span>
|
|
1172
|
+
<span class="cstat-no" title="statement not covered" > const group = _.get(query, '$group', {})</span>
|
|
1173
|
+
<span class="cstat-no" title="statement not covered" > Object.assign(groupBy, group)</span>
|
|
1174
|
+
<span class="cstat-no" title="statement not covered" > // The query contains the match stage except options relevent to the aggregation pipeline</span>
|
|
1175
|
+
<span class="cstat-no" title="statement not covered" > const match = _.omit(query, ['$group', '$groupBy', '$aggregate', '$geoNear', '$sort', '$limit', '$skip'])</span>
|
|
1176
|
+
<span class="cstat-no" title="statement not covered" > // Check for any required type conversion (eg HTTP requests)</span>
|
|
1177
|
+
<span class="cstat-no" title="statement not covered" > for (let i = 0; i < featureId.length; i++) {</span>
|
|
1178
|
+
<span class="cstat-no" title="statement not covered" > const id = featureId[i]</span>
|
|
1179
|
+
<span class="cstat-no" title="statement not covered" > const idType = featureIdType[i]</span>
|
|
1180
|
+
<span class="cstat-no" title="statement not covered" > if (_.has(match, 'properties.' + id)) {</span>
|
|
1181
|
+
<span class="cstat-no" title="statement not covered" > if (idType === 'number') _.set(match, 'properties.' + id, _.toNumber(_.get(match, 'properties.' + id)))</span>
|
|
1182
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1183
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1184
|
+
<span class="cstat-no" title="statement not covered" > // Ensure we do not mix results with/without relevant element values</span>
|
|
1185
|
+
<span class="cstat-no" title="statement not covered" > // by separately querying each element then merging</span>
|
|
1186
|
+
<span class="cstat-no" title="statement not covered" > let aggregatedResults</span>
|
|
1187
|
+
<span class="cstat-no" title="statement not covered" > const aggregateOptions = {</span>
|
|
1188
|
+
<span class="cstat-no" title="statement not covered" > allowDiskUse: true</span>
|
|
1189
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1190
|
+
<span class="cstat-no" title="statement not covered" > await Promise.all(query.$aggregate.map(async element => {</span>
|
|
1191
|
+
<span class="cstat-no" title="statement not covered" > const isGeometry = (element === 'geometry')</span>
|
|
1192
|
+
<span class="cstat-no" title="statement not covered" > // Geometry is a root property while others are feature properties</span>
|
|
1193
|
+
<span class="cstat-no" title="statement not covered" > const prefix = (isGeometry ? '' : 'properties.')</span>
|
|
1194
|
+
<span class="cstat-no" title="statement not covered" > const pipeline = []</span>
|
|
1195
|
+
<span class="cstat-no" title="statement not covered" > // Check for geometry stage</span>
|
|
1196
|
+
<span class="cstat-no" title="statement not covered" > if (query.$geoNear) {</span>
|
|
1189
1197
|
<span class="cstat-no" title="statement not covered" > pipeline.push({ $geoNear: query.$geoNear })</span>
|
|
1190
1198
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1191
|
-
// Find matching features only
|
|
1192
|
-
pipeline.push({ $match: Object.assign({ [prefix + element]: { $exists: true } }, match) })
|
|
1193
|
-
// Ensure they are ordered by increasing time by default
|
|
1194
|
-
// most recent forecast and lower level first
|
|
1195
|
-
pipeline.push({ $sort: Object.assign({ time: 1, runTime: -1, level: 1 }, query.$sort) })
|
|
1196
|
-
// Keep track of all feature values
|
|
1197
|
-
if (singleTime) {
|
|
1198
|
-
pipeline.push({ $group: groupBy })
|
|
1199
|
-
// As we replace the root document with the feature in this case keep track of any accumlated element before
|
|
1200
|
-
// If the accumulated properties is name maxProperty then we copy it in the feature as feature.properties.maxProperty
|
|
1201
|
-
if (!_.isEmpty(group)) {
|
|
1202
|
-
pipeline.push({
|
|
1203
|
-
$set: _.mapKeys(_.mapValues(group, (value, key) => `$${key}`), (value, key) => `feature.properties.${key}`)
|
|
1204
|
-
})
|
|
1205
|
-
}
|
|
1206
|
-
pipeline.push({ $replaceRoot: { newRoot: '$feature' } })
|
|
1207
|
-
} else {
|
|
1208
|
-
pipeline.push({ $group: Object.assign({ [element]: { $push: '$' + prefix + element } }, groupBy) })
|
|
1209
|
-
}
|
|
1210
|
-
debug(`Aggregating ${element} element for features`)
|
|
1211
|
-
pipeline.forEach(stage => {
|
|
1212
|
-
_.forOwn(stage, (value, key) => debug('Stage', key, value))
|
|
1213
|
-
})
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
//
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
})
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
<span class="cstat-no" title="statement not covered"
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1199
|
+
<span class="cstat-no" title="statement not covered" > // Find matching features only</span>
|
|
1200
|
+
<span class="cstat-no" title="statement not covered" > pipeline.push({ $match: Object.assign({ [prefix + element]: { $exists: true } }, match) })</span>
|
|
1201
|
+
<span class="cstat-no" title="statement not covered" > // Ensure they are ordered by increasing time by default,</span>
|
|
1202
|
+
<span class="cstat-no" title="statement not covered" > // most recent forecast and lower level first</span>
|
|
1203
|
+
<span class="cstat-no" title="statement not covered" > pipeline.push({ $sort: Object.assign({ time: 1, runTime: -1, level: 1 }, query.$sort) })</span>
|
|
1204
|
+
<span class="cstat-no" title="statement not covered" > // Keep track of all feature values</span>
|
|
1205
|
+
<span class="cstat-no" title="statement not covered" > if (singleTime) {</span>
|
|
1206
|
+
<span class="cstat-no" title="statement not covered" > pipeline.push({ $group: groupBy })</span>
|
|
1207
|
+
<span class="cstat-no" title="statement not covered" > // As we replace the root document with the feature in this case keep track of any accumlated element before</span>
|
|
1208
|
+
<span class="cstat-no" title="statement not covered" > // If the accumulated properties is name maxProperty then we copy it in the feature as feature.properties.maxProperty</span>
|
|
1209
|
+
<span class="cstat-no" title="statement not covered" > if (!_.isEmpty(group)) {</span>
|
|
1210
|
+
<span class="cstat-no" title="statement not covered" > pipeline.push({</span>
|
|
1211
|
+
<span class="cstat-no" title="statement not covered" > $set: _.mapKeys(_.mapValues(group, (value, key) => `$${key}`), (value, key) => `feature.properties.${key}`)</span>
|
|
1212
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1213
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1214
|
+
<span class="cstat-no" title="statement not covered" > pipeline.push({ $replaceRoot: { newRoot: '$feature' } })</span>
|
|
1215
|
+
<span class="cstat-no" title="statement not covered" > } else {</span>
|
|
1216
|
+
<span class="cstat-no" title="statement not covered" > pipeline.push({ $group: Object.assign({ [element]: { $push: '$' + prefix + element } }, groupBy) })</span>
|
|
1217
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1218
|
+
<span class="cstat-no" title="statement not covered" > debug(`Aggregating ${element} element for features`)</span>
|
|
1219
|
+
<span class="cstat-no" title="statement not covered" > pipeline.forEach(stage => {</span>
|
|
1220
|
+
<span class="cstat-no" title="statement not covered" > _.forOwn(stage, (value, key) => debug('Stage', key, value))</span>
|
|
1221
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1222
|
+
<span class="cstat-no" title="statement not covered" > // Provide a hint to the aggregation targeting feature ID and aggregation elements.</span>
|
|
1223
|
+
<span class="cstat-no" title="statement not covered" > // The problem with the aggregation hint option is that it should correspond</span>
|
|
1224
|
+
<span class="cstat-no" title="statement not covered" > // exactly to an existing index otherwise it raises an error.</span>
|
|
1225
|
+
<span class="cstat-no" title="statement not covered" > // We use a convention to get the order right: geometry => feature ID => aggregated element => time.</span>
|
|
1226
|
+
<span class="cstat-no" title="statement not covered" > // We check anyway if the index does exist to avoid any error</span>
|
|
1227
|
+
<span class="cstat-no" title="statement not covered" > // FIXME: Instead of assuming the appropriate index is defined in the right order,</span>
|
|
1228
|
+
<span class="cstat-no" title="statement not covered" > // we might select the "best" available index (ie having the most similarities with the required one).</span>
|
|
1229
|
+
<span class="cstat-no" title="statement not covered" > const hint = {}</span>
|
|
1230
|
+
<span class="cstat-no" title="statement not covered" > if (isGeometry || query.$geoNear || match.geometry) Object.assign(hint, { geometry: '2dsphere' })</span>
|
|
1231
|
+
<span class="cstat-no" title="statement not covered" > featureId.forEach(id => {</span>
|
|
1232
|
+
<span class="cstat-no" title="statement not covered" > hint['properties.' + id] = 1</span>
|
|
1233
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1234
|
+
<span class="cstat-no" title="statement not covered" > Object.assign(hint, { ['properties.' + element]: 1 })</span>
|
|
1235
|
+
<span class="cstat-no" title="statement not covered" > // Use provided sort time option if any</span>
|
|
1236
|
+
<span class="cstat-no" title="statement not covered" > hint.time = _.get(query, '$sort.time', 1)</span>
|
|
1237
|
+
<span class="cstat-no" title="statement not covered" > const hintIndexName = _.reduce(hint, (name, value, key) => name ? `${name}_${key}_${value}` : `${key}_${value}`, '')</span>
|
|
1238
|
+
<span class="cstat-no" title="statement not covered" > debug('Best aggregation hint index found', hintIndexName)</span>
|
|
1239
|
+
<span class="cstat-no" title="statement not covered" > const hintIndex = _.find(indexes, { name: hintIndexName })</span>
|
|
1240
|
+
<span class="cstat-no" title="statement not covered" > const aggregateElementOptions = Object.assign({}, aggregateOptions)</span>
|
|
1241
|
+
<span class="cstat-no" title="statement not covered" > if (hintIndex) aggregateElementOptions.hint = hintIndexName</span>
|
|
1242
|
+
<span class="cstat-no" title="statement not covered" > debug('Aggregation options', aggregateElementOptions)</span>
|
|
1243
|
+
<span class="cstat-no" title="statement not covered" > const elementResults = await collection.aggregate(pipeline, aggregateElementOptions).toArray()</span>
|
|
1244
|
+
<span class="cstat-no" title="statement not covered" > debug(`Generated ${elementResults.length} feature(s) for ${element} element`, elementResults)</span>
|
|
1245
|
+
<span class="cstat-no" title="statement not covered" > // Rearrange data so that we get ordered arrays indexed by element</span>
|
|
1246
|
+
<span class="cstat-no" title="statement not covered" > elementResults.forEach(result => {</span>
|
|
1247
|
+
<span class="cstat-no" title="statement not covered" > result.time = { [element]: result.time }</span>
|
|
1248
|
+
<span class="cstat-no" title="statement not covered" > if (result.runTime) result.runTime = { [element]: result.runTime }</span>
|
|
1249
|
+
<span class="cstat-no" title="statement not covered" > if (!singleTime && !isGeometry) {</span>
|
|
1250
|
+
<span class="cstat-no" title="statement not covered" > // Set back the element values as properties because we aggregated in an accumulator</span>
|
|
1251
|
+
<span class="cstat-no" title="statement not covered" > // to avoid conflict with non-aggregated feature properties</span>
|
|
1252
|
+
<span class="cstat-no" title="statement not covered" > _.set(result, prefix + element, _.get(result, element))</span>
|
|
1253
|
+
<span class="cstat-no" title="statement not covered" > // Delete accumulator</span>
|
|
1254
|
+
<span class="cstat-no" title="statement not covered" > _.unset(result, element)</span>
|
|
1255
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1256
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1257
|
+
<span class="cstat-no" title="statement not covered" > // Now merge with previous element results</span>
|
|
1258
|
+
<span class="cstat-no" title="statement not covered" > if (!aggregatedResults) {</span>
|
|
1259
|
+
<span class="cstat-no" title="statement not covered" > aggregatedResults = elementResults</span>
|
|
1260
|
+
<span class="cstat-no" title="statement not covered" > } else {</span>
|
|
1261
|
+
<span class="cstat-no" title="statement not covered" > elementResults.forEach(result => {</span>
|
|
1262
|
+
<span class="cstat-no" title="statement not covered" > const resultKeys = _.pick(result, keys)</span>
|
|
1263
|
+
<span class="cstat-no" title="statement not covered" > const previousResult = aggregatedResults.find(aggregatedResult => {</span>
|
|
1264
|
+
<span class="cstat-no" title="statement not covered" > const aggregatedResultKeys = _.pick(aggregatedResult, keys)</span>
|
|
1265
|
+
<span class="cstat-no" title="statement not covered" > return _.isEqual(aggregatedResultKeys, resultKeys)</span>
|
|
1266
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1267
|
+
<span class="cstat-no" title="statement not covered" > // Merge with previous matching feature if any</span>
|
|
1268
|
+
<span class="cstat-no" title="statement not covered" > if (previousResult) {</span>
|
|
1269
|
+
<span class="cstat-no" title="statement not covered" > Object.assign(previousResult.time, result.time)</span>
|
|
1270
|
+
<span class="cstat-no" title="statement not covered" > if (result.runTime) {</span>
|
|
1271
|
+
<span class="cstat-no" title="statement not covered" > if (previousResult.runTime) Object.assign(previousResult.runTime, result.runTime)</span>
|
|
1272
|
+
<span class="cstat-no" title="statement not covered" > else previousResult.runTime = { [element]: result.runTime }</span>
|
|
1273
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1274
|
+
<span class="cstat-no" title="statement not covered" > _.set(previousResult, prefix + element, _.get(result, prefix + element))</span>
|
|
1275
|
+
<span class="cstat-no" title="statement not covered" > } else {</span>
|
|
1260
1276
|
<span class="cstat-no" title="statement not covered" > aggregatedResults.push(result)</span>
|
|
1261
|
-
<span class="cstat-no" title="statement not covered" > aggregatedResultsMap.set(resultKey, result)</span>
|
|
1262
1277
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1263
|
-
})
|
|
1264
|
-
}
|
|
1265
|
-
}))
|
|
1266
|
-
delete query.$groupBy
|
|
1267
|
-
delete query.$group
|
|
1268
|
-
delete query.$aggregate
|
|
1269
|
-
delete query.$geoNear
|
|
1270
|
-
// Set result to avoid service DB call
|
|
1271
|
-
|
|
1272
|
-
}
|
|
1273
|
-
return hook
|
|
1274
|
-
}
|
|
1278
|
+
<span class="cstat-no" title="statement not covered" > })</span>
|
|
1279
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1280
|
+
<span class="cstat-no" title="statement not covered" > }))</span>
|
|
1281
|
+
<span class="cstat-no" title="statement not covered" > delete query.$groupBy</span>
|
|
1282
|
+
<span class="cstat-no" title="statement not covered" > delete query.$group</span>
|
|
1283
|
+
<span class="cstat-no" title="statement not covered" > delete query.$aggregate</span>
|
|
1284
|
+
<span class="cstat-no" title="statement not covered" > delete query.$geoNear</span>
|
|
1285
|
+
<span class="cstat-no" title="statement not covered" > // Set result to avoid service DB call</span>
|
|
1286
|
+
<span class="cstat-no" title="statement not covered" > hook.result = aggregatedResults</span>
|
|
1287
|
+
<span class="cstat-no" title="statement not covered" > }</span>
|
|
1288
|
+
<span class="cstat-no" title="statement not covered" > return hook</span>
|
|
1289
|
+
<span class="cstat-no" title="statement not covered" >}</span>
|
|
1275
1290
|
</pre></td></tr></table></pre>
|
|
1276
1291
|
|
|
1277
1292
|
<div class='push'></div><!-- for sticky footer -->
|
|
@@ -1279,7 +1294,7 @@ export async function aggregateFeaturesQuery (hook) {
|
|
|
1279
1294
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1280
1295
|
Code coverage generated by
|
|
1281
1296
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1282
|
-
at
|
|
1297
|
+
at 2024-08-13T10:02:04.872Z
|
|
1283
1298
|
</div>
|
|
1284
1299
|
<script src="../../../prettify.js"></script>
|
|
1285
1300
|
<script>
|