@kalisio/kdk 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nyc_output/02a7a308-a8d7-4cc6-8e61-6066a0055a96.json +1 -0
- package/.nyc_output/1900d596-5e87-433a-8fd6-fb7f7ded35ec.json +1 -0
- package/.nyc_output/{058fc679-d60a-4501-ac04-71171e5200b8.json → 27401f21-8ccf-42fa-8230-4232189d86b3.json} +0 -0
- package/.nyc_output/{8b1830fa-932e-4a61-9837-4a5b18f83ea9.json → 52278ef5-c337-4724-97be-e2e4416847c5.json} +0 -0
- package/.nyc_output/{afd2d144-3570-4858-b94a-b523dbd023dd.json → 5dd49b8a-4c84-42f9-a3d5-712247a84775.json} +0 -0
- package/.nyc_output/612b4859-9645-45c1-a41e-1fae420518c4.json +1 -0
- package/.nyc_output/bab87fe9-d99a-4759-99e6-3fc4622eeca0.json +1 -0
- package/.nyc_output/processinfo/02a7a308-a8d7-4cc6-8e61-6066a0055a96.json +1 -0
- package/.nyc_output/processinfo/1900d596-5e87-433a-8fd6-fb7f7ded35ec.json +1 -0
- package/.nyc_output/processinfo/27401f21-8ccf-42fa-8230-4232189d86b3.json +1 -0
- package/.nyc_output/processinfo/52278ef5-c337-4724-97be-e2e4416847c5.json +1 -0
- package/.nyc_output/processinfo/5dd49b8a-4c84-42f9-a3d5-712247a84775.json +1 -0
- package/.nyc_output/processinfo/612b4859-9645-45c1-a41e-1fae420518c4.json +1 -0
- package/.nyc_output/processinfo/bab87fe9-d99a-4759-99e6-3fc4622eeca0.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/CHANGELOG.md +18 -10
- package/coverage/core/api/application.js.html +323 -245
- package/coverage/core/api/authentication.js.html +1 -1
- package/coverage/core/api/db.js.html +108 -108
- package/coverage/core/api/hooks/hooks.account.js.html +1 -1
- package/coverage/core/api/hooks/hooks.authentication.js.html +1 -1
- package/coverage/core/api/hooks/hooks.authorisations.js.html +21 -6
- package/coverage/core/api/hooks/hooks.devices.js.html +1 -1
- package/coverage/core/api/hooks/hooks.groups.js.html +1 -1
- package/coverage/core/api/hooks/hooks.logger.js.html +1 -1
- package/coverage/core/api/hooks/hooks.model.js.html +1 -1
- package/coverage/core/api/hooks/hooks.organisations.js.html +1 -1
- package/coverage/core/api/hooks/hooks.pusher.js.html +1 -1
- package/coverage/core/api/hooks/hooks.query.js.html +114 -48
- package/coverage/core/api/hooks/hooks.service.js.html +1 -1
- package/coverage/core/api/hooks/hooks.storage.js.html +1 -1
- package/coverage/core/api/hooks/hooks.tags.js.html +1 -1
- package/coverage/core/api/hooks/hooks.users.js.html +1 -1
- package/coverage/core/api/hooks/index.html +12 -12
- package/coverage/core/api/hooks/index.js.html +1 -1
- package/coverage/core/api/index.html +34 -34
- package/coverage/core/api/index.js.html +26 -26
- package/coverage/core/api/marshall.js.html +1 -1
- package/coverage/core/api/models/groups.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/index.html +1 -1
- package/coverage/core/api/models/organisations.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/tags.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/users.model.mongodb.js.html +1 -1
- package/coverage/core/api/oauth2-handler.js.html +1 -1
- package/coverage/core/api/oauth2-verifier.js.html +1 -1
- package/coverage/core/api/services/account/account.hooks.js.html +1 -1
- package/coverage/core/api/services/account/account.service.js.html +1 -1
- package/coverage/core/api/services/account/index.html +1 -1
- package/coverage/core/api/services/authorisations/authorisations.hooks.js.html +1 -1
- package/coverage/core/api/services/authorisations/authorisations.service.js.html +31 -7
- package/coverage/core/api/services/authorisations/index.html +9 -9
- 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/devices/devices.hooks.js.html +1 -1
- package/coverage/core/api/services/devices/devices.service.js.html +1 -1
- package/coverage/core/api/services/devices/index.html +1 -1
- package/coverage/core/api/services/groups/groups.hooks.js.html +1 -1
- package/coverage/core/api/services/groups/index.html +1 -1
- package/coverage/core/api/services/index.html +11 -11
- package/coverage/core/api/services/index.js.html +66 -66
- package/coverage/core/api/services/mailer/index.html +1 -1
- package/coverage/core/api/services/mailer/mailer.hooks.js.html +1 -1
- package/coverage/core/api/services/mailer/mailer.service.js.html +1 -1
- package/coverage/core/api/services/organisations/index.html +1 -1
- package/coverage/core/api/services/organisations/organisations.hooks.js.html +1 -1
- package/coverage/core/api/services/organisations/organisations.service.js.html +1 -1
- package/coverage/core/api/services/pusher/index.html +1 -1
- package/coverage/core/api/services/pusher/pusher.channels.js.html +1 -1
- package/coverage/core/api/services/pusher/pusher.hooks.js.html +1 -1
- package/coverage/core/api/services/pusher/pusher.service.js.html +1 -1
- package/coverage/core/api/services/storage/index.html +1 -1
- package/coverage/core/api/services/storage/storage.hooks.js.html +1 -1
- package/coverage/core/api/services/tags/index.html +1 -1
- package/coverage/core/api/services/tags/tags.hooks.js.html +1 -1
- package/coverage/core/api/services/users/index.html +1 -1
- package/coverage/core/api/services/users/users.hooks.js.html +1 -1
- package/coverage/core/common/errors.js.html +1 -1
- package/coverage/core/common/index.html +7 -7
- package/coverage/core/common/index.js.html +1 -1
- package/coverage/core/common/permissions.js.html +81 -51
- package/coverage/index.html +39 -39
- package/coverage/lcov-report/core/api/application.js.html +323 -245
- package/coverage/lcov-report/core/api/authentication.js.html +1 -1
- package/coverage/lcov-report/core/api/db.js.html +108 -108
- package/coverage/lcov-report/core/api/hooks/hooks.account.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.authentication.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.authorisations.js.html +21 -6
- package/coverage/lcov-report/core/api/hooks/hooks.devices.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.groups.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.logger.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.model.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.organisations.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.pusher.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.query.js.html +114 -48
- package/coverage/lcov-report/core/api/hooks/hooks.service.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.storage.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.tags.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.users.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/index.html +12 -12
- package/coverage/lcov-report/core/api/hooks/index.js.html +1 -1
- package/coverage/lcov-report/core/api/index.html +34 -34
- package/coverage/lcov-report/core/api/index.js.html +26 -26
- package/coverage/lcov-report/core/api/marshall.js.html +1 -1
- package/coverage/lcov-report/core/api/models/groups.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/index.html +1 -1
- package/coverage/lcov-report/core/api/models/organisations.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/tags.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/users.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/oauth2-handler.js.html +1 -1
- package/coverage/lcov-report/core/api/oauth2-verifier.js.html +1 -1
- package/coverage/lcov-report/core/api/services/account/account.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/account/account.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/account/index.html +1 -1
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.service.js.html +31 -7
- package/coverage/lcov-report/core/api/services/authorisations/index.html +9 -9
- 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/devices/devices.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/devices/devices.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/devices/index.html +1 -1
- package/coverage/lcov-report/core/api/services/groups/groups.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/groups/index.html +1 -1
- package/coverage/lcov-report/core/api/services/index.html +11 -11
- package/coverage/lcov-report/core/api/services/index.js.html +66 -66
- package/coverage/lcov-report/core/api/services/mailer/index.html +1 -1
- package/coverage/lcov-report/core/api/services/mailer/mailer.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/mailer/mailer.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/organisations/index.html +1 -1
- package/coverage/lcov-report/core/api/services/organisations/organisations.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/organisations/organisations.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/pusher/index.html +1 -1
- package/coverage/lcov-report/core/api/services/pusher/pusher.channels.js.html +1 -1
- package/coverage/lcov-report/core/api/services/pusher/pusher.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/pusher/pusher.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/storage/index.html +1 -1
- package/coverage/lcov-report/core/api/services/storage/storage.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/tags/index.html +1 -1
- package/coverage/lcov-report/core/api/services/tags/tags.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/users/index.html +1 -1
- package/coverage/lcov-report/core/api/services/users/users.hooks.js.html +1 -1
- package/coverage/lcov-report/core/common/errors.js.html +1 -1
- package/coverage/lcov-report/core/common/index.html +7 -7
- package/coverage/lcov-report/core/common/index.js.html +1 -1
- package/coverage/lcov-report/core/common/permissions.js.html +81 -51
- package/coverage/lcov-report/index.html +39 -39
- package/coverage/lcov-report/map/api/hooks/hooks.catalog.js.html +1 -1
- package/coverage/lcov-report/map/api/hooks/hooks.query.js.html +1 -1
- package/coverage/lcov-report/map/api/hooks/index.html +1 -1
- package/coverage/lcov-report/map/api/hooks/index.js.html +1 -1
- package/coverage/lcov-report/map/api/index.html +1 -1
- package/coverage/lcov-report/map/api/index.js.html +1 -1
- package/coverage/lcov-report/map/api/marshall.js.html +1 -1
- package/coverage/lcov-report/map/api/models/alerts.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/map/api/models/catalog.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/map/api/models/features.model.mongodb.js.html +14 -5
- package/coverage/lcov-report/map/api/models/index.html +7 -7
- package/coverage/lcov-report/map/api/services/alerts/alerts.hooks.js.html +1 -1
- package/coverage/lcov-report/map/api/services/alerts/alerts.service.js.html +1 -1
- package/coverage/lcov-report/map/api/services/alerts/index.html +1 -1
- package/coverage/lcov-report/map/api/services/catalog/catalog.hooks.js.html +1 -1
- package/coverage/lcov-report/map/api/services/catalog/index.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/map/api/services/features/index.html +1 -1
- package/coverage/lcov-report/map/api/services/geocoder/geocoder.hooks.js.html +1 -1
- package/coverage/lcov-report/map/api/services/geocoder/geocoder.service.js.html +1 -1
- package/coverage/lcov-report/map/api/services/geocoder/index.html +1 -1
- package/coverage/lcov-report/map/api/services/index.html +1 -1
- package/coverage/lcov-report/map/api/services/index.js.html +1 -1
- package/coverage/lcov-report/map/common/dynamic-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/errors.js.html +1 -1
- package/coverage/lcov-report/map/common/geotiff-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/grid.js.html +1 -1
- package/coverage/lcov-report/map/common/index.html +1 -1
- package/coverage/lcov-report/map/common/index.js.html +1 -1
- package/coverage/lcov-report/map/common/meteo-model-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/moment-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/opendap-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/opendap-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/permissions.js.html +1 -1
- package/coverage/lcov-report/map/common/time-based-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/tms-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/wcs-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/wcs-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/weacast-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/wfs-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/wms-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/wmts-utils.js.html +1 -1
- package/coverage/lcov.info +948 -769
- package/coverage/map/api/hooks/hooks.catalog.js.html +1 -1
- package/coverage/map/api/hooks/hooks.query.js.html +1 -1
- package/coverage/map/api/hooks/index.html +1 -1
- package/coverage/map/api/hooks/index.js.html +1 -1
- package/coverage/map/api/index.html +1 -1
- package/coverage/map/api/index.js.html +1 -1
- package/coverage/map/api/marshall.js.html +1 -1
- package/coverage/map/api/models/alerts.model.mongodb.js.html +1 -1
- package/coverage/map/api/models/catalog.model.mongodb.js.html +1 -1
- package/coverage/map/api/models/features.model.mongodb.js.html +14 -5
- package/coverage/map/api/models/index.html +7 -7
- package/coverage/map/api/services/alerts/alerts.hooks.js.html +1 -1
- package/coverage/map/api/services/alerts/alerts.service.js.html +1 -1
- package/coverage/map/api/services/alerts/index.html +1 -1
- package/coverage/map/api/services/catalog/catalog.hooks.js.html +1 -1
- package/coverage/map/api/services/catalog/index.html +1 -1
- 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 +1 -1
- package/coverage/map/api/services/features/index.html +1 -1
- package/coverage/map/api/services/geocoder/geocoder.hooks.js.html +1 -1
- package/coverage/map/api/services/geocoder/geocoder.service.js.html +1 -1
- package/coverage/map/api/services/geocoder/index.html +1 -1
- package/coverage/map/api/services/index.html +1 -1
- package/coverage/map/api/services/index.js.html +1 -1
- package/coverage/map/common/dynamic-grid-source.js.html +1 -1
- package/coverage/map/common/errors.js.html +1 -1
- package/coverage/map/common/geotiff-grid-source.js.html +1 -1
- package/coverage/map/common/grid.js.html +1 -1
- package/coverage/map/common/index.html +1 -1
- package/coverage/map/common/index.js.html +1 -1
- package/coverage/map/common/meteo-model-grid-source.js.html +1 -1
- package/coverage/map/common/moment-utils.js.html +1 -1
- package/coverage/map/common/opendap-grid-source.js.html +1 -1
- package/coverage/map/common/opendap-utils.js.html +1 -1
- package/coverage/map/common/permissions.js.html +1 -1
- package/coverage/map/common/time-based-grid-source.js.html +1 -1
- package/coverage/map/common/tms-utils.js.html +1 -1
- package/coverage/map/common/wcs-grid-source.js.html +1 -1
- package/coverage/map/common/wcs-utils.js.html +1 -1
- package/coverage/map/common/weacast-grid-source.js.html +1 -1
- package/coverage/map/common/wfs-utils.js.html +1 -1
- package/coverage/map/common/wms-utils.js.html +1 -1
- package/coverage/map/common/wmts-utils.js.html +1 -1
- package/extras/tours/map/navigation-bar.js +49 -1
- package/lib/core/api/application.js +35 -9
- package/lib/core/api/application.js.map +1 -1
- package/lib/core/api/hooks/hooks.authorisations.js +8 -1
- package/lib/core/api/hooks/hooks.authorisations.js.map +1 -1
- package/lib/core/api/hooks/hooks.query.js +135 -100
- package/lib/core/api/hooks/hooks.query.js.map +1 -1
- package/lib/core/api/services/authorisations/authorisations.service.js +13 -1
- package/lib/core/api/services/authorisations/authorisations.service.js.map +1 -1
- package/lib/core/api/services/pusher/pusher.service.js +40 -16
- package/lib/core/api/services/pusher/pusher.service.js.map +1 -1
- package/lib/core/client/components/collection/KColumn.vue +29 -28
- package/lib/core/client/components/collection/KFilter.vue +97 -72
- package/lib/core/client/components/editor/KModalEditor.vue +3 -4
- package/lib/core/client/components/editor/KSettingsEditor.vue +6 -2
- package/lib/core/client/components/form/KFileField.vue +13 -6
- package/lib/core/client/components/form/KRoleField.vue +5 -2
- package/lib/core/client/components/form/KTextField.vue +12 -2
- package/lib/core/client/components/form/KUnitField.vue +57 -0
- package/lib/core/client/components/form/KUrlField.vue +1 -1
- package/lib/core/client/components/frame/KAction.vue +1 -2
- package/lib/core/client/components/frame/KModal.vue +66 -20
- package/lib/core/client/components/frame/KScrollArea.vue +65 -0
- package/lib/core/client/components/frame/index.js +6 -1
- package/lib/core/client/components/frame/index.js.map +1 -1
- package/lib/core/client/components/input/KColorChooser.vue +3 -5
- package/lib/core/client/components/input/KIconChooser.vue +38 -40
- package/lib/core/client/components/layout/KAbout.vue +47 -49
- package/lib/core/client/components/team/KAddMember.vue +1 -1
- package/lib/core/client/components/team/KChangeRole.vue +11 -14
- package/lib/core/client/components/team/KGroupCard.vue +12 -5
- package/lib/core/client/components/team/KGroupsActivity.vue +1 -1
- package/lib/core/client/components/team/KJoinGroup.vue +22 -22
- package/lib/core/client/components/team/KMemberCard.vue +19 -4
- package/lib/core/client/components/viewer/KModalViewer.vue +10 -9
- package/lib/core/client/i18n/core_en.json +66 -7
- package/lib/core/client/i18n/core_fr.json +60 -7
- package/lib/core/client/index.js +15 -2
- package/lib/core/client/index.js.map +1 -1
- package/lib/core/client/mixins/mixin.base-widget.js +5 -3
- package/lib/core/client/mixins/mixin.base-widget.js.map +1 -1
- package/lib/core/client/reader.js +46 -15
- package/lib/core/client/reader.js.map +1 -1
- package/lib/core/client/readers/reader.csv.js +33 -22
- package/lib/core/client/readers/reader.csv.js.map +1 -1
- package/lib/core/client/readers/reader.json.js +31 -20
- package/lib/core/client/readers/reader.json.js.map +1 -1
- package/lib/core/client/services/index.js +14 -3
- package/lib/core/client/services/index.js.map +1 -1
- package/lib/core/client/services/local-settings.service.js +6 -4
- package/lib/core/client/services/local-settings.service.js.map +1 -1
- package/lib/core/client/time.js +4 -3
- package/lib/core/client/time.js.map +1 -1
- package/lib/core/client/units.js +195 -0
- package/lib/core/client/units.js.map +1 -0
- package/lib/core/common/permissions.js +44 -34
- package/lib/core/common/permissions.js.map +1 -1
- package/lib/core/common/schemas/settings.update.json +72 -0
- package/lib/map/api/models/features.model.mongodb.js +3 -0
- package/lib/map/api/models/features.model.mongodb.js.map +1 -1
- package/lib/map/client/components/KCaptureToolbar.vue +2 -7
- package/lib/map/client/components/KColorLegend.vue +16 -4
- package/lib/map/client/components/KFeaturesChart.vue +10 -11
- package/lib/map/client/components/KFeaturesFilter.vue +37 -38
- package/lib/map/client/components/KFeaturesTable.vue +15 -16
- package/lib/map/client/components/KLayerStyleEditor.vue +1 -1
- package/lib/map/client/components/KLayerStyleForm.vue +4 -4
- package/lib/map/client/components/KMeasureTool.vue +19 -22
- package/lib/map/client/components/KTimeline.vue +5 -8
- package/lib/map/client/components/catalog/KAddLayer.vue +3 -2
- package/lib/map/client/components/catalog/KCatalog.vue +26 -7
- package/lib/map/client/components/catalog/KLayerCategories.vue +3 -2
- package/lib/map/client/components/catalog/KLayersSelector.vue +3 -3
- package/lib/map/client/components/catalog/KWeatherLayersSelector.vue +1 -1
- package/lib/map/client/components/widget/KInformationBox.vue +8 -17
- package/lib/map/client/components/widget/KMapillaryViewer.vue +5 -1
- package/lib/map/client/components/widget/KTimeSeries.vue +18 -13
- package/lib/map/client/i18n/map_en.json +10 -16
- package/lib/map/client/i18n/map_fr.json +10 -16
- package/lib/map/client/init.js +4 -3
- package/lib/map/client/init.js.map +1 -1
- package/lib/map/client/mixins/globe/mixin.geojson-layers.js +16 -21
- package/lib/map/client/mixins/globe/mixin.geojson-layers.js.map +1 -1
- package/lib/map/client/mixins/globe/mixin.popup.js +3 -1
- package/lib/map/client/mixins/globe/mixin.popup.js.map +1 -1
- package/lib/map/client/mixins/globe/mixin.tooltip.js +3 -1
- package/lib/map/client/mixins/globe/mixin.tooltip.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.base-map.js +12 -6
- package/lib/map/client/mixins/map/mixin.base-map.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.file-layers.js +13 -5
- package/lib/map/client/mixins/map/mixin.file-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.geojson-layers.js +34 -10
- package/lib/map/client/mixins/map/mixin.geojson-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.popup.js +3 -1
- package/lib/map/client/mixins/map/mixin.popup.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.style.js +1 -1
- package/lib/map/client/mixins/map/mixin.style.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.tooltip.js +3 -1
- package/lib/map/client/mixins/map/mixin.tooltip.js.map +1 -1
- package/lib/map/client/mixins/mixin.feature-service.js +1 -1
- package/lib/map/client/mixins/mixin.feature-service.js.map +1 -1
- package/lib/map/client/mixins/mixin.weacast.js +7 -5
- package/lib/map/client/mixins/mixin.weacast.js.map +1 -1
- package/lib/map/client/readers/index.js +12 -0
- package/lib/map/client/readers/index.js.map +1 -1
- package/lib/map/client/readers/reader.geojson.js +62 -34
- package/lib/map/client/readers/reader.geojson.js.map +1 -1
- package/lib/map/client/readers/reader.gpx.js +32 -21
- package/lib/map/client/readers/reader.gpx.js.map +1 -1
- package/lib/map/client/readers/reader.kml.js +32 -21
- package/lib/map/client/readers/reader.kml.js.map +1 -1
- package/lib/map/client/readers/reader.shp.js +116 -0
- package/lib/map/client/readers/reader.shp.js.map +1 -0
- package/lib/map/client/utils.js +0 -8
- package/lib/map/client/utils.js.map +1 -1
- package/lib/test/client/core/account.js +1 -1
- package/lib/test/client/core/account.js.map +1 -1
- package/lib/test/client/core/screens.js +1 -1
- package/lib/test/client/core/screens.js.map +1 -1
- package/package.json +1 -1
- package/.nyc_output/2226bcce-9d22-4dad-b9fa-46564b5565c7.json +0 -1
- package/.nyc_output/6dc4b140-1a8a-4d69-b91c-89c557883d6e.json +0 -1
- package/.nyc_output/processinfo/058fc679-d60a-4501-ac04-71171e5200b8.json +0 -1
- package/.nyc_output/processinfo/2226bcce-9d22-4dad-b9fa-46564b5565c7.json +0 -1
- package/.nyc_output/processinfo/6dc4b140-1a8a-4d69-b91c-89c557883d6e.json +0 -1
- package/.nyc_output/processinfo/8b1830fa-932e-4a61-9837-4a5b18f83ea9.json +0 -1
- package/.nyc_output/processinfo/afd2d144-3570-4858-b94a-b523dbd023dd.json +0 -1
|
@@ -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">1.25% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>4/320</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
33
|
<span class="strong">0% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>0/
|
|
35
|
+
<span class='fraction'>0/143</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
40
|
<span class="strong">0% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>0/
|
|
42
|
+
<span class='fraction'>0/47</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">1.36% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>4/294</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -548,28 +548,54 @@
|
|
|
548
548
|
<a name='L489'></a><a href='#L489'>489</a>
|
|
549
549
|
<a name='L490'></a><a href='#L490'>490</a>
|
|
550
550
|
<a name='L491'></a><a href='#L491'>491</a>
|
|
551
|
-
<a name='L492'></a><a href='#L492'>492</a
|
|
552
|
-
<
|
|
553
|
-
<
|
|
554
|
-
<
|
|
555
|
-
<
|
|
556
|
-
<
|
|
557
|
-
<
|
|
558
|
-
<
|
|
559
|
-
<
|
|
560
|
-
<
|
|
561
|
-
<
|
|
562
|
-
<
|
|
563
|
-
<
|
|
564
|
-
<
|
|
565
|
-
<
|
|
566
|
-
<
|
|
567
|
-
<
|
|
568
|
-
<
|
|
569
|
-
<
|
|
570
|
-
<
|
|
571
|
-
<
|
|
572
|
-
<
|
|
551
|
+
<a name='L492'></a><a href='#L492'>492</a>
|
|
552
|
+
<a name='L493'></a><a href='#L493'>493</a>
|
|
553
|
+
<a name='L494'></a><a href='#L494'>494</a>
|
|
554
|
+
<a name='L495'></a><a href='#L495'>495</a>
|
|
555
|
+
<a name='L496'></a><a href='#L496'>496</a>
|
|
556
|
+
<a name='L497'></a><a href='#L497'>497</a>
|
|
557
|
+
<a name='L498'></a><a href='#L498'>498</a>
|
|
558
|
+
<a name='L499'></a><a href='#L499'>499</a>
|
|
559
|
+
<a name='L500'></a><a href='#L500'>500</a>
|
|
560
|
+
<a name='L501'></a><a href='#L501'>501</a>
|
|
561
|
+
<a name='L502'></a><a href='#L502'>502</a>
|
|
562
|
+
<a name='L503'></a><a href='#L503'>503</a>
|
|
563
|
+
<a name='L504'></a><a href='#L504'>504</a>
|
|
564
|
+
<a name='L505'></a><a href='#L505'>505</a>
|
|
565
|
+
<a name='L506'></a><a href='#L506'>506</a>
|
|
566
|
+
<a name='L507'></a><a href='#L507'>507</a>
|
|
567
|
+
<a name='L508'></a><a href='#L508'>508</a>
|
|
568
|
+
<a name='L509'></a><a href='#L509'>509</a>
|
|
569
|
+
<a name='L510'></a><a href='#L510'>510</a>
|
|
570
|
+
<a name='L511'></a><a href='#L511'>511</a>
|
|
571
|
+
<a name='L512'></a><a href='#L512'>512</a>
|
|
572
|
+
<a name='L513'></a><a href='#L513'>513</a>
|
|
573
|
+
<a name='L514'></a><a href='#L514'>514</a>
|
|
574
|
+
<a name='L515'></a><a href='#L515'>515</a>
|
|
575
|
+
<a name='L516'></a><a href='#L516'>516</a>
|
|
576
|
+
<a name='L517'></a><a href='#L517'>517</a>
|
|
577
|
+
<a name='L518'></a><a href='#L518'>518</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
578
|
+
<span class="cline-any cline-yes">1x</span>
|
|
579
|
+
<span class="cline-any cline-yes">1x</span>
|
|
580
|
+
<span class="cline-any cline-yes">1x</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>
|
|
573
599
|
<span class="cline-any cline-neutral"> </span>
|
|
574
600
|
<span class="cline-any cline-no"> </span>
|
|
575
601
|
<span class="cline-any cline-no"> </span>
|
|
@@ -785,32 +811,58 @@
|
|
|
785
811
|
<span class="cline-any cline-no"> </span>
|
|
786
812
|
<span class="cline-any cline-no"> </span>
|
|
787
813
|
<span class="cline-any cline-no"> </span>
|
|
814
|
+
<span class="cline-any cline-no"> </span>
|
|
815
|
+
<span class="cline-any cline-no"> </span>
|
|
788
816
|
<span class="cline-any cline-neutral"> </span>
|
|
817
|
+
<span class="cline-any cline-neutral"> </span>
|
|
818
|
+
<span class="cline-any cline-no"> </span>
|
|
789
819
|
<span class="cline-any cline-no"> </span>
|
|
820
|
+
<span class="cline-any cline-neutral"> </span>
|
|
790
821
|
<span class="cline-any cline-no"> </span>
|
|
822
|
+
<span class="cline-any cline-neutral"> </span>
|
|
791
823
|
<span class="cline-any cline-no"> </span>
|
|
824
|
+
<span class="cline-any cline-neutral"> </span>
|
|
792
825
|
<span class="cline-any cline-no"> </span>
|
|
793
826
|
<span class="cline-any cline-no"> </span>
|
|
827
|
+
<span class="cline-any cline-neutral"> </span>
|
|
794
828
|
<span class="cline-any cline-no"> </span>
|
|
795
829
|
<span class="cline-any cline-neutral"> </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>
|
|
796
833
|
<span class="cline-any cline-neutral"> </span>
|
|
797
834
|
<span class="cline-any cline-no"> </span>
|
|
798
835
|
<span class="cline-any cline-neutral"> </span>
|
|
799
836
|
<span class="cline-any cline-neutral"> </span>
|
|
800
837
|
<span class="cline-any cline-no"> </span>
|
|
801
838
|
<span class="cline-any cline-no"> </span>
|
|
839
|
+
<span class="cline-any cline-neutral"> </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>
|
|
802
843
|
<span class="cline-any cline-no"> </span>
|
|
803
844
|
<span class="cline-any cline-no"> </span>
|
|
804
845
|
<span class="cline-any cline-neutral"> </span>
|
|
805
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>
|
|
806
850
|
<span class="cline-any cline-neutral"> </span>
|
|
851
|
+
<span class="cline-any cline-neutral"> </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>
|
|
807
855
|
<span class="cline-any cline-no"> </span>
|
|
808
856
|
<span class="cline-any cline-neutral"> </span>
|
|
857
|
+
<span class="cline-any cline-neutral"> </span>
|
|
809
858
|
<span class="cline-any cline-no"> </span>
|
|
810
859
|
<span class="cline-any cline-no"> </span>
|
|
811
860
|
<span class="cline-any cline-no"> </span>
|
|
812
861
|
<span class="cline-any cline-neutral"> </span>
|
|
813
862
|
<span class="cline-any cline-no"> </span>
|
|
863
|
+
<span class="cline-any cline-no"> </span>
|
|
864
|
+
<span class="cline-any cline-neutral"> </span>
|
|
865
|
+
<span class="cline-any cline-no"> </span>
|
|
814
866
|
<span class="cline-any cline-neutral"> </span>
|
|
815
867
|
<span class="cline-any cline-no"> </span>
|
|
816
868
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -1043,146 +1095,146 @@
|
|
|
1043
1095
|
import url from 'url'
|
|
1044
1096
|
import makeDebug from 'debug'
|
|
1045
1097
|
import logger from 'winston'
|
|
1046
|
-
import _ from 'lodash'
|
|
1047
|
-
import sift from 'sift'
|
|
1048
|
-
import 'winston-daily-rotate-file'
|
|
1049
|
-
import compress from 'compression'
|
|
1050
|
-
import cors from 'cors'
|
|
1051
|
-
import helmet from 'helmet'
|
|
1052
|
-
import bodyParser from 'body-parser'
|
|
1053
|
-
import { RateLimiter as SocketLimiter } from 'limiter'
|
|
1054
|
-
import HttpLimiter from 'express-rate-limit'
|
|
1055
|
-
import feathers from '@feathersjs/feathers'
|
|
1056
|
-
import configuration from '@feathersjs/configuration'
|
|
1057
|
-
import { TooManyRequests, Forbidden, BadRequest } from '@feathersjs/errors'
|
|
1058
|
-
import express from '@feathersjs/express'
|
|
1059
|
-
import rest from '@feathersjs/express/rest'
|
|
1060
|
-
import socketio from '@feathersjs/socketio'
|
|
1061
|
-
import { ObjectID } from 'mongodb'
|
|
1062
|
-
import { Database, idToString } from './db'
|
|
1063
|
-
import auth, { authSocket } from './authentication'
|
|
1098
|
+
<span class="cstat-no" title="statement not covered" >import _ from 'lodash'</span>
|
|
1099
|
+
<span class="cstat-no" title="statement not covered" >import sift from 'sift'</span>
|
|
1100
|
+
<span class="cstat-no" title="statement not covered" >import 'winston-daily-rotate-file'</span>
|
|
1101
|
+
<span class="cstat-no" title="statement not covered" >import compress from 'compression'</span>
|
|
1102
|
+
<span class="cstat-no" title="statement not covered" >import cors from 'cors'</span>
|
|
1103
|
+
<span class="cstat-no" title="statement not covered" >import helmet from 'helmet'</span>
|
|
1104
|
+
<span class="cstat-no" title="statement not covered" >import bodyParser from 'body-parser'</span>
|
|
1105
|
+
<span class="cstat-no" title="statement not covered" >import { RateLimiter as SocketLimiter } from 'limiter'</span>
|
|
1106
|
+
<span class="cstat-no" title="statement not covered" >import HttpLimiter from 'express-rate-limit'</span>
|
|
1107
|
+
<span class="cstat-no" title="statement not covered" >import feathers from '@feathersjs/feathers'</span>
|
|
1108
|
+
<span class="cstat-no" title="statement not covered" >import configuration from '@feathersjs/configuration'</span>
|
|
1109
|
+
<span class="cstat-no" title="statement not covered" >import { TooManyRequests, Forbidden, BadRequest } from '@feathersjs/errors'</span>
|
|
1110
|
+
<span class="cstat-no" title="statement not covered" >import express from '@feathersjs/express'</span>
|
|
1111
|
+
<span class="cstat-no" title="statement not covered" >import rest from '@feathersjs/express/rest'</span>
|
|
1112
|
+
<span class="cstat-no" title="statement not covered" >import socketio from '@feathersjs/socketio'</span>
|
|
1113
|
+
<span class="cstat-no" title="statement not covered" >import { ObjectID } from 'mongodb'</span>
|
|
1114
|
+
<span class="cstat-no" title="statement not covered" >import { Database, idToString } from './db'</span>
|
|
1115
|
+
<span class="cstat-no" title="statement not covered" >import auth, { authSocket } from './authentication'</span>
|
|
1064
1116
|
|
|
1065
|
-
const debug = <span class="cstat-no" title="statement not covered" >makeDebug('kdk:core:application')
|
|
1066
|
-
const debugLimiter = <span class="cstat-no" title="statement not covered" >makeDebug('kdk:core:application:limiter')
|
|
1117
|
+
const debug = <span class="cstat-no" title="statement not covered" >makeDebug('</span>kdk:core:application')
|
|
1118
|
+
const debugLimiter = <span class="cstat-no" title="statement not covered" >makeDebug('</span>kdk:core:application:limiter')
|
|
1067
1119
|
|
|
1068
|
-
function <span class="fstat-no" title="function not covered" >tooManyRequests </span>
|
|
1069
|
-
<span class="cstat-no" title="statement not covered" > debug(
|
|
1070
|
-
const error = <span class="cstat-no" title="statement not covered" >new
|
|
1071
|
-
<span class="cstat-no" title="statement not covered" > socket.
|
|
1120
|
+
function <span class="fstat-no" title="function not covered" >tooManyRequests (s</span>ocket, message, key) {
|
|
1121
|
+
<span class="cstat-no" title="statement not covered" > debug(m</span>essage)
|
|
1122
|
+
const error = <span class="cstat-no" title="statement not covered" >new T</span>ooManyRequests(message, { translation: { key } })
|
|
1123
|
+
<span class="cstat-no" title="statement not covered" > socket.e</span>mit('rate-limit', error)
|
|
1072
1124
|
// Add a timeout so that error message is correctly handled
|
|
1073
|
-
<span class="cstat-no" title="statement not covered" > setTimeout(<span class="fstat-no" title="function not covered" >(
|
|
1125
|
+
<span class="cstat-no" title="statement not covered" > setTimeout(<span class="fstat-no" title="function not covered" >(</span>) => <span class="cstat-no" title="statement not covered" >s</span>ocket.d</span>isconnect(true), 3000)
|
|
1074
1126
|
}
|
|
1075
1127
|
|
|
1076
|
-
export function <span class="fstat-no" title="function not covered" >declareService </span>
|
|
1128
|
+
export function <span class="fstat-no" title="function not covered" >declareService (p</span>ath, app, service, middlewares = <span class="branch-0 cbranch-no" title="branch not covered" >{}) {</span>
|
|
1077
1129
|
const feathersPath = <span class="cstat-no" title="statement not covered" >app.get('apiPath') + '/' + path</span>
|
|
1078
|
-
const feathersService = <span class="cstat-no" title="statement not covered" >app.
|
|
1130
|
+
const feathersService = <span class="cstat-no" title="statement not covered" >app.s</span>ervice(feathersPath)
|
|
1079
1131
|
// Some internal Feathers service might internally declare the service
|
|
1080
1132
|
<span class="cstat-no" title="statement not covered" > if (feathersService) {</span>
|
|
1081
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1133
|
+
<span class="cstat-no" title="statement not covered" > return f</span>eathersService
|
|
1082
1134
|
}
|
|
1083
1135
|
// Initialize our service by providing any middleware as well
|
|
1084
|
-
let args = <span class="cstat-no" title="statement not covered" >[
|
|
1085
|
-
<span class="cstat-no" title="statement not covered" > if (middlewares.before) <span class="cstat-no" title="statement not covered" >args =
|
|
1086
|
-
<span class="cstat-no" title="statement not covered" > args.
|
|
1087
|
-
<span class="cstat-no" title="statement not covered" > if (middlewares.after) <span class="cstat-no" title="statement not covered" >args =
|
|
1088
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1089
|
-
<span class="cstat-no" title="statement not covered" > debug('Service declared on path ' + feathersPath)
|
|
1136
|
+
let args = <span class="cstat-no" title="statement not covered" >[f</span>eathersPath]
|
|
1137
|
+
<span class="cstat-no" title="statement not covered" > if (middlewares.before) <span class="cstat-no" title="statement not covered" >args = a</span></span>rgs.concat(middlewares.before)
|
|
1138
|
+
<span class="cstat-no" title="statement not covered" > args.p</span>ush(service)
|
|
1139
|
+
<span class="cstat-no" title="statement not covered" > if (middlewares.after) <span class="cstat-no" title="statement not covered" >args = a</span></span>rgs.concat(middlewares.after)
|
|
1140
|
+
<span class="cstat-no" title="statement not covered" > app.u</span>se.apply(app, args)
|
|
1141
|
+
<span class="cstat-no" title="statement not covered" > debug('</span>Service declared on path ' + feathersPath)
|
|
1090
1142
|
// Return the Feathers service, ie base service + Feathers' internals
|
|
1091
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1143
|
+
<span class="cstat-no" title="statement not covered" > return a</span>pp.service(feathersPath)
|
|
1092
1144
|
}
|
|
1093
1145
|
|
|
1094
|
-
export function <span class="fstat-no" title="function not covered" >configureService </span>
|
|
1146
|
+
export function <span class="fstat-no" title="function not covered" >configureService (n</span>ame, service, servicesPath) {
|
|
1095
1147
|
<span class="cstat-no" title="statement not covered" > try {</span>
|
|
1096
|
-
const hooks = <span class="cstat-no" title="statement not covered" >require(
|
|
1097
|
-
<span class="cstat-no" title="statement not covered" > service.
|
|
1098
|
-
<span class="cstat-no" title="statement not covered" > debug(
|
|
1148
|
+
const hooks = <span class="cstat-no" title="statement not covered" >require(p</span>ath.join(servicesPath, name, name + '.hooks'))
|
|
1149
|
+
<span class="cstat-no" title="statement not covered" > service.h</span>ooks(hooks)
|
|
1150
|
+
<span class="cstat-no" title="statement not covered" > debug(n</span>ame + ' service hooks configured on path ' + servicesPath)
|
|
1099
1151
|
} catch (error) {
|
|
1100
|
-
<span class="cstat-no" title="statement not covered" > debug('No ' + name + ' service hooks configured on path ' + servicesPath)
|
|
1152
|
+
<span class="cstat-no" title="statement not covered" > debug('</span>No ' + name + ' service hooks configured on path ' + servicesPath)
|
|
1101
1153
|
<span class="cstat-no" title="statement not covered" > if (error.code !== 'MODULE_NOT_FOUND') {</span>
|
|
1102
1154
|
// Log error in this case as this might be linked to a syntax error in required file
|
|
1103
|
-
<span class="cstat-no" title="statement not covered" > debug(
|
|
1155
|
+
<span class="cstat-no" title="statement not covered" > debug(e</span>rror)
|
|
1104
1156
|
}
|
|
1105
1157
|
// As this is optionnal this require has to fail silently
|
|
1106
1158
|
}
|
|
1107
1159
|
|
|
1108
1160
|
<span class="cstat-no" title="statement not covered" > try {</span>
|
|
1109
|
-
const channels = <span class="cstat-no" title="statement not covered" >require(
|
|
1110
|
-
<span class="cstat-no" title="statement not covered" > _.
|
|
1111
|
-
<span class="cstat-no" title="statement not covered" > if (event === 'all') <span class="cstat-no" title="statement not covered" >service.
|
|
1112
|
-
else <span class="cstat-no" title="statement not covered" >service.
|
|
1161
|
+
const channels = <span class="cstat-no" title="statement not covered" >require(p</span>ath.join(servicesPath, name, name + '.channels'))
|
|
1162
|
+
<span class="cstat-no" title="statement not covered" > _.f</span>orOwn(channels, <span class="fstat-no" title="function not covered" >(p</span>ublisher, event) => {
|
|
1163
|
+
<span class="cstat-no" title="statement not covered" > if (event === 'all') <span class="cstat-no" title="statement not covered" >service.p</span>ublish(publisher)</span>
|
|
1164
|
+
else <span class="cstat-no" title="statement not covered" >service.p</span>ublish(event, publisher)
|
|
1113
1165
|
})
|
|
1114
|
-
<span class="cstat-no" title="statement not covered" > debug(
|
|
1166
|
+
<span class="cstat-no" title="statement not covered" > debug(n</span>ame + ' service channels configured on path ' + servicesPath)
|
|
1115
1167
|
} catch (error) {
|
|
1116
|
-
<span class="cstat-no" title="statement not covered" > debug('No ' + name + ' service channels configured on path ' + servicesPath)
|
|
1168
|
+
<span class="cstat-no" title="statement not covered" > debug('</span>No ' + name + ' service channels configured on path ' + servicesPath)
|
|
1117
1169
|
<span class="cstat-no" title="statement not covered" > if (error.code !== 'MODULE_NOT_FOUND') {</span>
|
|
1118
1170
|
// Log error in this case as this might be linked to a syntax error in required file
|
|
1119
|
-
<span class="cstat-no" title="statement not covered" > debug(
|
|
1171
|
+
<span class="cstat-no" title="statement not covered" > debug(e</span>rror)
|
|
1120
1172
|
}
|
|
1121
1173
|
// As this is optionnal this require has to fail silently
|
|
1122
1174
|
}
|
|
1123
1175
|
|
|
1124
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1176
|
+
<span class="cstat-no" title="statement not covered" > return s</span>ervice
|
|
1125
1177
|
}
|
|
1126
1178
|
|
|
1127
|
-
export function <span class="fstat-no" title="function not covered" >createProxyService </span>
|
|
1179
|
+
export function <span class="fstat-no" title="function not covered" >createProxyService (o</span>ptions) {
|
|
1128
1180
|
const targetService = <span class="cstat-no" title="statement not covered" >options.service</span>
|
|
1129
|
-
function <span class="fstat-no" title="function not covered" >proxyParams </span>
|
|
1181
|
+
function <span class="fstat-no" title="function not covered" >proxyParams (p</span>arams) {
|
|
1130
1182
|
<span class="cstat-no" title="statement not covered" > if (options.params) {</span>
|
|
1131
1183
|
let proxiedParams
|
|
1132
1184
|
<span class="cstat-no" title="statement not covered" > if (typeof options.params === 'function') {</span>
|
|
1133
|
-
<span class="cstat-no" title="statement not covered" > proxiedParams =
|
|
1185
|
+
<span class="cstat-no" title="statement not covered" > proxiedParams = o</span>ptions.params(params)
|
|
1134
1186
|
} else {
|
|
1135
|
-
<span class="cstat-no" title="statement not covered" > proxiedParams = _
|
|
1187
|
+
<span class="cstat-no" title="statement not covered" > proxiedParams = _</span>.merge(params, options.params)
|
|
1136
1188
|
}
|
|
1137
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1138
|
-
} else <span class="cstat-no" title="statement not covered" >return
|
|
1189
|
+
<span class="cstat-no" title="statement not covered" > return p</span>roxiedParams
|
|
1190
|
+
} else <span class="cstat-no" title="statement not covered" >return p</span>arams
|
|
1139
1191
|
}
|
|
1140
|
-
function <span class="fstat-no" title="function not covered" >proxyId </span>
|
|
1141
|
-
<span class="cstat-no" title="statement not covered" > if (options.id) <span class="cstat-no" title="statement not covered" >return
|
|
1142
|
-
else <span class="cstat-no" title="statement not covered" >return
|
|
1192
|
+
function <span class="fstat-no" title="function not covered" >proxyId (i</span>d) {
|
|
1193
|
+
<span class="cstat-no" title="statement not covered" > if (options.id) <span class="cstat-no" title="statement not covered" >return o</span>ptions.id(id)</span>
|
|
1194
|
+
else <span class="cstat-no" title="statement not covered" >return i</span>d
|
|
1143
1195
|
}
|
|
1144
|
-
function <span class="fstat-no" title="function not covered" >proxyData </span>
|
|
1145
|
-
<span class="cstat-no" title="statement not covered" > if (options.data) <span class="cstat-no" title="statement not covered" >return
|
|
1146
|
-
else <span class="cstat-no" title="statement not covered" >return
|
|
1196
|
+
function <span class="fstat-no" title="function not covered" >proxyData (d</span>ata) {
|
|
1197
|
+
<span class="cstat-no" title="statement not covered" > if (options.data) <span class="cstat-no" title="statement not covered" >return o</span>ptions.data(data)</span>
|
|
1198
|
+
else <span class="cstat-no" title="statement not covered" >return d</span>ata
|
|
1147
1199
|
}
|
|
1148
|
-
function <span class="fstat-no" title="function not covered" >proxyResult </span>
|
|
1149
|
-
<span class="cstat-no" title="statement not covered" > if (options.result) <span class="cstat-no" title="statement not covered" >return
|
|
1150
|
-
else <span class="cstat-no" title="statement not covered" >return
|
|
1200
|
+
function <span class="fstat-no" title="function not covered" >proxyResult (d</span>ata) {
|
|
1201
|
+
<span class="cstat-no" title="statement not covered" > if (options.result) <span class="cstat-no" title="statement not covered" >return o</span>ptions.result(data)</span>
|
|
1202
|
+
else <span class="cstat-no" title="statement not covered" >return d</span>ata
|
|
1151
1203
|
}
|
|
1152
1204
|
<span class="cstat-no" title="statement not covered" > return {</span>
|
|
1153
|
-
<span class="fstat-no" title="function not covered" >
|
|
1154
|
-
<span class="fstat-no" title="function not covered" >
|
|
1155
|
-
<span class="fstat-no" title="function not covered" >
|
|
1156
|
-
<span class="fstat-no" title="function not covered" >
|
|
1157
|
-
<span class="fstat-no" title="function not covered" >
|
|
1158
|
-
<span class="fstat-no" title="function not covered" >
|
|
1205
|
+
async <span class="fstat-no" title="function not covered" >find (p</span>arams) <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >{ <span class="cstat-no" title="statement not covered" >r</span></span>eturn p</span>roxyResult(await targetService.find(proxyParams(params))) },
|
|
1206
|
+
async <span class="fstat-no" title="function not covered" >get (i</span>d, params) <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >{ <span class="cstat-no" title="statement not covered" >r</span></span>eturn p</span>roxyResult(await targetService.get(proxyId(id), proxyParams(params))) },
|
|
1207
|
+
async <span class="fstat-no" title="function not covered" >create (d</span>ata, params) <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >{ <span class="cstat-no" title="statement not covered" >r</span></span>eturn p</span>roxyResult(await targetService.create(proxyData(data), proxyParams(params))) },
|
|
1208
|
+
async <span class="fstat-no" title="function not covered" >update (i</span>d, data, params) <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >{ <span class="cstat-no" title="statement not covered" >r</span></span>eturn p</span>roxyResult(await targetService.update(proxyId(id), proxyData(data), proxyParams(params))) },
|
|
1209
|
+
async <span class="fstat-no" title="function not covered" >patch (i</span>d, data, params) <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >{ <span class="cstat-no" title="statement not covered" >r</span></span>eturn p</span>roxyResult(await targetService.patch(proxyId(id), proxyData(data), proxyParams(params))) },
|
|
1210
|
+
async <span class="fstat-no" title="function not covered" >remove (i</span>d, params) <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >{ <span class="cstat-no" title="statement not covered" >r</span></span>eturn p</span>roxyResult(await targetService.remove(proxyId(id), proxyParams(params))) }
|
|
1159
1211
|
}
|
|
1160
1212
|
}
|
|
1161
1213
|
|
|
1162
|
-
export function <span class="fstat-no" title="function not covered" >createService </span>
|
|
1163
|
-
const createFeathersService = <span class="cstat-no" title="statement not covered" >require('feathers-' + app.db.adapter)
|
|
1214
|
+
export function <span class="fstat-no" title="function not covered" >createService (n</span>ame, app, options = <span class="branch-0 cbranch-no" title="branch not covered" >{}) {</span>
|
|
1215
|
+
const createFeathersService = <span class="cstat-no" title="statement not covered" >require('</span>feathers-' + app.db.adapter)
|
|
1164
1216
|
|
|
1165
|
-
const paginate = <span class="cstat-no" title="statement not covered" >app.
|
|
1166
|
-
const serviceOptions = <span class="cstat-no" title="statement not covered" >Object.
|
|
1217
|
+
const paginate = <span class="cstat-no" title="statement not covered" >app.g</span>et('paginate')
|
|
1218
|
+
const serviceOptions = <span class="cstat-no" title="statement not covered" >Object.a</span>ssign({
|
|
1167
1219
|
name: name,
|
|
1168
1220
|
paginate
|
|
1169
1221
|
}, options)
|
|
1170
|
-
<span class="cstat-no" title="statement not covered" > if (serviceOptions.disabled) <span class="cstat-no" title="statement not covered" >return
|
|
1222
|
+
<span class="cstat-no" title="statement not covered" > if (serviceOptions.disabled) <span class="cstat-no" title="statement not covered" >return u</span></span>ndefined
|
|
1171
1223
|
// For DB services a model has to be provided
|
|
1172
1224
|
const fileName = <span class="cstat-no" title="statement not covered" >serviceOptions.fileName || name</span>
|
|
1173
1225
|
|
|
1174
1226
|
let dbService = <span class="cstat-no" title="statement not covered" >false</span>
|
|
1175
1227
|
<span class="cstat-no" title="statement not covered" > try {</span>
|
|
1176
1228
|
<span class="cstat-no" title="statement not covered" > if (serviceOptions.modelsPath) {</span>
|
|
1177
|
-
const configureModel = <span class="cstat-no" title="statement not covered" >require(
|
|
1178
|
-
<span class="cstat-no" title="statement not covered" > configureModel(
|
|
1179
|
-
<span class="cstat-no" title="statement not covered" > dbService =
|
|
1229
|
+
const configureModel = <span class="cstat-no" title="statement not covered" >require(p</span>ath.join(serviceOptions.modelsPath, fileName + '.model.' + app.db.adapter))
|
|
1230
|
+
<span class="cstat-no" title="statement not covered" > configureModel(a</span>pp, serviceOptions)
|
|
1231
|
+
<span class="cstat-no" title="statement not covered" > dbService = t</span>rue
|
|
1180
1232
|
}
|
|
1181
1233
|
} catch (error) {
|
|
1182
|
-
<span class="cstat-no" title="statement not covered" > debug('No ' + fileName + ' service model configured on path ' + serviceOptions.modelsPath)
|
|
1234
|
+
<span class="cstat-no" title="statement not covered" > debug('</span>No ' + fileName + ' service model configured on path ' + serviceOptions.modelsPath)
|
|
1183
1235
|
<span class="cstat-no" title="statement not covered" > if (error.code !== 'MODULE_NOT_FOUND') {</span>
|
|
1184
1236
|
// Log error in this case as this might be linked to a syntax error in required file
|
|
1185
|
-
<span class="cstat-no" title="statement not covered" > debug(
|
|
1237
|
+
<span class="cstat-no" title="statement not covered" > debug(e</span>rror)
|
|
1186
1238
|
}
|
|
1187
1239
|
// As this is optionnal this require has to fail silently
|
|
1188
1240
|
}
|
|
@@ -1190,203 +1242,229 @@ export function <span class="fstat-no" title="function not covered" >createServi
|
|
|
1190
1242
|
// Initialize our service with any options it requires
|
|
1191
1243
|
let service
|
|
1192
1244
|
<span class="cstat-no" title="statement not covered" > if (dbService) {</span>
|
|
1193
|
-
<span class="cstat-no" title="statement not covered" > service =
|
|
1194
|
-
<span class="cstat-no" title="statement not covered" > dbService =
|
|
1245
|
+
<span class="cstat-no" title="statement not covered" > service = c</span>reateFeathersService(serviceOptions)
|
|
1246
|
+
<span class="cstat-no" title="statement not covered" > dbService = s</span>ervice
|
|
1195
1247
|
} else <span class="cstat-no" title="statement not covered" >if (serviceOptions.proxy) {</span>
|
|
1196
|
-
<span class="cstat-no" title="statement not covered" > service =
|
|
1248
|
+
<span class="cstat-no" title="statement not covered" > service = c</span>reateProxyService(serviceOptions.proxy)
|
|
1197
1249
|
} else {
|
|
1198
1250
|
// Otherwise we expect the service to be provided as a Feathers service interface
|
|
1199
|
-
<span class="cstat-no" title="statement not covered" > service =
|
|
1251
|
+
<span class="cstat-no" title="statement not covered" > service = r</span>equire(path.join(serviceOptions.servicesPath, fileName, fileName + '.service'))
|
|
1200
1252
|
// If we get a function try to call it assuming it will return the service object
|
|
1201
1253
|
<span class="cstat-no" title="statement not covered" > if (typeof service === 'function') {</span>
|
|
1202
|
-
<span class="cstat-no" title="statement not covered" > service =
|
|
1254
|
+
<span class="cstat-no" title="statement not covered" > service = s</span>ervice(name, app, serviceOptions)
|
|
1203
1255
|
}
|
|
1204
1256
|
// Need to set this manually for services not using class inheritance or default adapters
|
|
1205
|
-
<span class="cstat-no" title="statement not covered" > if (serviceOptions.events) <span class="cstat-no" title="statement not covered" >service.
|
|
1257
|
+
<span class="cstat-no" title="statement not covered" > if (serviceOptions.events) <span class="cstat-no" title="statement not covered" >service.e</span></span>vents = serviceOptions.events
|
|
1206
1258
|
}
|
|
1207
1259
|
|
|
1208
1260
|
// Get our initialized service so that we can register hooks and filters
|
|
1209
1261
|
let servicePath = <span class="cstat-no" title="statement not covered" >serviceOptions.path || name</span>
|
|
1210
1262
|
let contextId
|
|
1211
1263
|
<span class="cstat-no" title="statement not covered" > if (serviceOptions.context) {</span>
|
|
1212
|
-
<span class="cstat-no" title="statement not covered" > contextId =
|
|
1213
|
-
<span class="cstat-no" title="statement not covered" > servicePath =
|
|
1264
|
+
<span class="cstat-no" title="statement not covered" > contextId = i</span>dToString(serviceOptions.context)
|
|
1265
|
+
<span class="cstat-no" title="statement not covered" > servicePath = c</span>ontextId + '/' + servicePath
|
|
1214
1266
|
}
|
|
1215
|
-
<span class="cstat-no" title="statement not covered" > service =
|
|
1267
|
+
<span class="cstat-no" title="statement not covered" > service = d</span>eclareService(servicePath, app, service, serviceOptions.middlewares)
|
|
1216
1268
|
// Register hooks and event filters
|
|
1217
|
-
<span class="cstat-no" title="statement not covered" > service =
|
|
1269
|
+
<span class="cstat-no" title="statement not covered" > service = c</span>onfigureService(fileName, service, serviceOptions.servicesPath)
|
|
1218
1270
|
// Optionnally a specific service mixin can be provided, apply it
|
|
1219
1271
|
<span class="cstat-no" title="statement not covered" > if (dbService && serviceOptions.servicesPath) {</span>
|
|
1220
1272
|
<span class="cstat-no" title="statement not covered" > try {</span>
|
|
1221
|
-
let serviceMixin = <span class="cstat-no" title="statement not covered" >require(
|
|
1273
|
+
let serviceMixin = <span class="cstat-no" title="statement not covered" >require(p</span>ath.join(serviceOptions.servicesPath, fileName, fileName + '.service'))
|
|
1222
1274
|
// If we get a function try to call it assuming it will return the mixin object
|
|
1223
1275
|
<span class="cstat-no" title="statement not covered" > if (typeof serviceMixin === 'function') {</span>
|
|
1224
|
-
<span class="cstat-no" title="statement not covered" > serviceMixin =
|
|
1276
|
+
<span class="cstat-no" title="statement not covered" > serviceMixin = s</span>erviceMixin.bind(dbService)(fileName, app, serviceOptions)
|
|
1225
1277
|
}
|
|
1226
|
-
<span class="cstat-no" title="statement not covered" > service.
|
|
1278
|
+
<span class="cstat-no" title="statement not covered" > service.m</span>ixin(serviceMixin)
|
|
1227
1279
|
} catch (error) {
|
|
1228
|
-
<span class="cstat-no" title="statement not covered" > debug('No ' + fileName + ' service mixin configured on path ' + serviceOptions.servicesPath)
|
|
1280
|
+
<span class="cstat-no" title="statement not covered" > debug('</span>No ' + fileName + ' service mixin configured on path ' + serviceOptions.servicesPath)
|
|
1229
1281
|
<span class="cstat-no" title="statement not covered" > if (error.code !== 'MODULE_NOT_FOUND') {</span>
|
|
1230
1282
|
// Log error in this case as this might be linked to a syntax error in required file
|
|
1231
|
-
<span class="cstat-no" title="statement not covered" > debug(
|
|
1283
|
+
<span class="cstat-no" title="statement not covered" > debug(e</span>rror)
|
|
1232
1284
|
}
|
|
1233
1285
|
// As this is optionnal this require has to fail silently
|
|
1234
1286
|
}
|
|
1235
1287
|
}
|
|
1236
1288
|
// Then configuration
|
|
1237
|
-
<span class="cstat-no" title="statement not covered" > service.
|
|
1238
|
-
<span class="cstat-no" title="statement not covered" > service.
|
|
1239
|
-
<span class="cstat-no" title="statement not covered" > service.
|
|
1240
|
-
<span class="cstat-no" title="statement not covered" > service.
|
|
1241
|
-
<span class="cstat-no" title="statement not covered" > service.
|
|
1289
|
+
<span class="cstat-no" title="statement not covered" > service.n</span>ame = name
|
|
1290
|
+
<span class="cstat-no" title="statement not covered" > service.a</span>pp = app
|
|
1291
|
+
<span class="cstat-no" title="statement not covered" > service.o</span>ptions = serviceOptions
|
|
1292
|
+
<span class="cstat-no" title="statement not covered" > service.p</span>ath = servicePath
|
|
1293
|
+
<span class="cstat-no" title="statement not covered" > service.c</span>ontext = serviceOptions.context
|
|
1242
1294
|
|
|
1243
1295
|
// Add some utility functions
|
|
1244
|
-
<span class="cstat-no" title="statement not covered" > service.
|
|
1296
|
+
<span class="cstat-no" title="statement not covered" > service.g</span>etPath = <span class="fstat-no" title="function not covered" >function (w</span>ithApiPrefix) {
|
|
1245
1297
|
let path = <span class="cstat-no" title="statement not covered" >service.path</span>
|
|
1246
1298
|
<span class="cstat-no" title="statement not covered" > if (withApiPrefix) {</span>
|
|
1247
|
-
<span class="cstat-no" title="statement not covered" > path =
|
|
1299
|
+
<span class="cstat-no" title="statement not covered" > path = a</span>pp.get('apiPath') + '/' + path
|
|
1248
1300
|
}
|
|
1249
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1301
|
+
<span class="cstat-no" title="statement not covered" > return p</span>ath
|
|
1250
1302
|
}
|
|
1251
|
-
<span class="cstat-no" title="statement not covered" > service.
|
|
1252
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1303
|
+
<span class="cstat-no" title="statement not covered" > service.g</span>etContextId = <span class="fstat-no" title="function not covered" >function () {</span>
|
|
1304
|
+
<span class="cstat-no" title="statement not covered" > return c</span>ontextId // As string
|
|
1253
1305
|
}
|
|
1254
1306
|
|
|
1255
|
-
<span class="cstat-no" title="statement not covered" > debug(
|
|
1256
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1307
|
+
<span class="cstat-no" title="statement not covered" > debug(s</span>ervice.name + ' service registration completed')
|
|
1308
|
+
<span class="cstat-no" title="statement not covered" > app.e</span>mit('service', service)
|
|
1257
1309
|
|
|
1258
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1310
|
+
<span class="cstat-no" title="statement not covered" > return s</span>ervice
|
|
1259
1311
|
}
|
|
1260
1312
|
|
|
1261
|
-
export function <span class="fstat-no" title="function not covered" >createWebhook </span>
|
|
1313
|
+
export function <span class="fstat-no" title="function not covered" >createWebhook (p</span>ath, app, options = <span class="branch-0 cbranch-no" title="branch not covered" >{}) {</span>
|
|
1262
1314
|
let webhookPath = <span class="cstat-no" title="statement not covered" >path</span>
|
|
1263
1315
|
<span class="cstat-no" title="statement not covered" > if (options.context) {</span>
|
|
1264
|
-
<span class="cstat-no" title="statement not covered" > webhookPath =
|
|
1316
|
+
<span class="cstat-no" title="statement not covered" > webhookPath = i</span>dToString(options.context) + '/' + webhookPath
|
|
1265
1317
|
}
|
|
1266
|
-
const isAllowed = <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >
|
|
1318
|
+
const isAllowed = (<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >payload) => {</span></span>
|
|
1267
1319
|
// Default is to expose all services/operations
|
|
1268
|
-
<span class="cstat-no" title="statement not covered" > if (!options.filter) <span class="cstat-no" title="statement not covered" >return
|
|
1269
|
-
const result = <span class="cstat-no" title="statement not covered" >[
|
|
1270
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1320
|
+
<span class="cstat-no" title="statement not covered" > if (!options.filter) <span class="cstat-no" title="statement not covered" >return t</span></span>rue
|
|
1321
|
+
const result = <span class="cstat-no" title="statement not covered" >[p</span>ayload].filter(sift(options.filter))
|
|
1322
|
+
<span class="cstat-no" title="statement not covered" > return r</span>esult.length > 0
|
|
1271
1323
|
}
|
|
1272
1324
|
|
|
1273
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1325
|
+
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" > app.p</span></span>ost(app.get('apiPath') + '/webhooks/' + webhookPath, <span class="fstat-no" title="function not covered" >async (r</span>eq, res, next) => {
|
|
1274
1326
|
const payload = <span class="cstat-no" title="statement not covered" >req.body</span>
|
|
1275
|
-
const config = <span class="cstat-no" title="statement not covered" >app.
|
|
1276
|
-
<span class="cstat-no" title="statement not covered" > res.
|
|
1327
|
+
const config = <span class="cstat-no" title="statement not covered" >app.g</span>et('authentication')
|
|
1328
|
+
<span class="cstat-no" title="statement not covered" > res.s</span>et('content-type', 'application/json')
|
|
1277
1329
|
const params = <span class="cstat-no" title="statement not covered" >{}</span>
|
|
1278
1330
|
<span class="cstat-no" title="statement not covered" > try {</span>
|
|
1331
|
+
<span class="cstat-no" title="statement not covered" > if (options.preprocessor) {</span>
|
|
1332
|
+
<span class="cstat-no" title="statement not covered" > await o</span>ptions.preprocessor(req, res, payload)
|
|
1333
|
+
}
|
|
1279
1334
|
// Authenticate when required
|
|
1280
1335
|
<span class="cstat-no" title="statement not covered" > if (config) {</span>
|
|
1281
1336
|
<span class="cstat-no" title="statement not covered" > try {</span>
|
|
1282
|
-
|
|
1283
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1284
|
-
|
|
1285
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1337
|
+
// Token is in header or payload
|
|
1338
|
+
const header = <span class="cstat-no" title="statement not covered" >req.headers.authorization</span>
|
|
1339
|
+
let accessToken
|
|
1340
|
+
<span class="cstat-no" title="statement not covered" > if (header) {</span>
|
|
1341
|
+
// Should be of the form: 'Bearer xxx'
|
|
1342
|
+
const tokens = <span class="cstat-no" title="statement not covered" >header.m</span>atch(/(\S+)\s+(\S+)/)
|
|
1343
|
+
<span class="cstat-no" title="statement not covered" > if (tokens.length >= 2) <span class="cstat-no" title="statement not covered" >accessToken = t</span></span>okens[2]
|
|
1344
|
+
} else {
|
|
1345
|
+
<span class="cstat-no" title="statement not covered" > accessToken = p</span>ayload.accessToken
|
|
1286
1346
|
}
|
|
1347
|
+
const tokenPayload = <span class="cstat-no" title="statement not covered" >await app.p</span>assport.verifyJWT(accessToken, config)
|
|
1348
|
+
<span class="cstat-no" title="statement not covered" > params.u</span>ser = await app.getService('users').get(tokenPayload.userId)
|
|
1349
|
+
<span class="cstat-no" title="statement not covered" > params.c</span>heckAuthorisation = true
|
|
1287
1350
|
} catch (error) {
|
|
1288
|
-
<span class="cstat-no" title="statement not covered" > throw
|
|
1351
|
+
<span class="cstat-no" title="statement not covered" > throw n</span>ew Forbidden('Could not verify webhook')
|
|
1289
1352
|
}
|
|
1290
1353
|
}
|
|
1291
|
-
<span class="cstat-no" title="statement not covered" > if (
|
|
1292
|
-
|
|
1293
|
-
|
|
1354
|
+
<span class="cstat-no" title="statement not covered" > if (req.headers['content-type'] !== 'application/json') {</span>
|
|
1355
|
+
<span class="cstat-no" title="statement not covered" > throw n</span>ew BadRequest('Webhooks expect application/json content type')
|
|
1356
|
+
}
|
|
1357
|
+
<span class="cstat-no" title="statement not covered" > if (!isAllowed(payload)) <span class="cstat-no" title="statement not covered" >throw n</span></span>ew Forbidden('Service or operation not allowed for webhook')
|
|
1358
|
+
const service = <span class="cstat-no" title="statement not covered" >app.g</span>etService(payload.service, options.context || payload.context)
|
|
1359
|
+
<span class="cstat-no" title="statement not covered" > if (!service) <span class="cstat-no" title="statement not covered" >throw n</span></span>ew BadRequest('Service could not be found')
|
|
1360
|
+
<span class="cstat-no" title="statement not covered" > if (typeof service[payload.operation] !== 'function') <span class="cstat-no" title="statement not covered" >throw n</span></span>ew BadRequest('Service operation could not be found')
|
|
1294
1361
|
const args = <span class="cstat-no" title="statement not covered" >[]</span>
|
|
1295
|
-
// Update/Patch/Remove
|
|
1296
|
-
|
|
1362
|
+
// Get/Update/Patch/Remove
|
|
1363
|
+
const operationsWithId = <span class="cstat-no" title="statement not covered" >['</span>get', 'update', 'patch', 'remove']
|
|
1364
|
+
<span class="cstat-no" title="statement not covered" > if (operationsWithId.includes(payload.operation)) {</span>
|
|
1365
|
+
<span class="cstat-no" title="statement not covered" > if (!_.has(payload, 'id')) <span class="cstat-no" title="statement not covered" >throw n</span></span>ew BadRequest('Missing id for operation')
|
|
1366
|
+
<span class="cstat-no" title="statement not covered" > args.p</span>ush(_.get(payload, 'id'))
|
|
1367
|
+
}
|
|
1297
1368
|
// Create/Update/Patch
|
|
1298
|
-
|
|
1369
|
+
const operationsWithData = <span class="cstat-no" title="statement not covered" >['</span>create', 'update', 'patch']
|
|
1370
|
+
<span class="cstat-no" title="statement not covered" > if (operationsWithData.includes(payload.operation)) {</span>
|
|
1371
|
+
<span class="cstat-no" title="statement not covered" > if (!_.has(payload, 'data')) <span class="cstat-no" title="statement not covered" >throw n</span></span>ew BadRequest('Missing data for operation')
|
|
1372
|
+
<span class="cstat-no" title="statement not covered" > args.p</span>ush(_.get(payload, 'data'))
|
|
1373
|
+
}
|
|
1299
1374
|
// Params
|
|
1300
|
-
<span class="cstat-no" title="statement not covered" > args.
|
|
1375
|
+
<span class="cstat-no" title="statement not covered" > args.p</span>ush(params)
|
|
1376
|
+
<span class="cstat-no" title="statement not covered" > if (options.postprocessor) {</span>
|
|
1377
|
+
<span class="cstat-no" title="statement not covered" > await o</span>ptions.postprocessor(service, args, payload)
|
|
1378
|
+
}
|
|
1301
1379
|
<span class="cstat-no" title="statement not covered" > try {</span>
|
|
1302
|
-
const result = <span class="cstat-no" title="statement not covered" >await service[
|
|
1380
|
+
const result = <span class="cstat-no" title="statement not covered" >await service[p</span>ayload.operation].apply(service, args)
|
|
1303
1381
|
// Send back result
|
|
1304
|
-
<span class="cstat-no" title="statement not covered" > res.
|
|
1382
|
+
<span class="cstat-no" title="statement not covered" > res.j</span>son(result)
|
|
1305
1383
|
} catch (error) {
|
|
1306
|
-
<span class="cstat-no" title="statement not covered" > throw
|
|
1384
|
+
<span class="cstat-no" title="statement not covered" > throw n</span>ew BadRequest('Service operation could not be performed')
|
|
1307
1385
|
}
|
|
1308
1386
|
} catch (error) {
|
|
1309
1387
|
// Send back error
|
|
1310
|
-
<span class="cstat-no" title="statement not covered" > res.
|
|
1388
|
+
<span class="cstat-no" title="statement not covered" > res.s</span>tatus(error.code).json(error.toJSON())
|
|
1311
1389
|
}
|
|
1312
1390
|
})
|
|
1313
1391
|
|
|
1314
|
-
<span class="cstat-no" title="statement not covered" > debug(`
|
|
1392
|
+
<span class="cstat-no" title="statement not covered" > debug(`W</span>ebhook ${webhookPath} registration completed`)
|
|
1315
1393
|
}
|
|
1316
1394
|
|
|
1317
|
-
function <span class="fstat-no" title="function not covered" >setupLogger </span>
|
|
1318
|
-
<span class="cstat-no" title="statement not covered" > debug('Setup application loggers')
|
|
1319
|
-
const logsConfig = <span class="cstat-no" title="statement not covered" >app.
|
|
1395
|
+
function <span class="fstat-no" title="function not covered" >setupLogger (a</span>pp) {
|
|
1396
|
+
<span class="cstat-no" title="statement not covered" > debug('</span>Setup application loggers')
|
|
1397
|
+
const logsConfig = <span class="cstat-no" title="statement not covered" >app.g</span>et('logs')
|
|
1320
1398
|
// Use winston default logger
|
|
1321
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1399
|
+
<span class="cstat-no" title="statement not covered" > app.l</span>ogger = logger
|
|
1322
1400
|
// Remove winston defaults
|
|
1323
1401
|
<span class="cstat-no" title="statement not covered" > try {</span>
|
|
1324
|
-
<span class="cstat-no" title="statement not covered" > logger.
|
|
1402
|
+
<span class="cstat-no" title="statement not covered" > logger.c</span>lear()
|
|
1325
1403
|
} catch (error) {
|
|
1326
1404
|
// Logger might be down, use console
|
|
1327
|
-
<span class="cstat-no" title="statement not covered" > console.
|
|
1405
|
+
<span class="cstat-no" title="statement not covered" > console.e</span>rror('Could not remove default logger transport(s)', error)
|
|
1328
1406
|
}
|
|
1329
1407
|
// We have one entry per log type
|
|
1330
1408
|
const logsTypes = <span class="cstat-no" title="statement not covered" >logsConfig ? Object.getOwnPropertyNames(logsConfig) : []</span>
|
|
1331
1409
|
// Create corresponding winston transports with options
|
|
1332
|
-
<span class="cstat-no" title="statement not covered" > logsTypes.
|
|
1333
|
-
const options = <span class="cstat-no" title="statement not covered" >logsConfig[
|
|
1410
|
+
<span class="cstat-no" title="statement not covered" > logsTypes.f</span>orEach(<span class="fstat-no" title="function not covered" >logType => {</span>
|
|
1411
|
+
const options = <span class="cstat-no" title="statement not covered" >logsConfig[l</span>ogType]
|
|
1334
1412
|
// Setup default log level if not defined
|
|
1335
1413
|
<span class="cstat-no" title="statement not covered" > if (!options.level) {</span>
|
|
1336
|
-
<span class="cstat-no" title="statement not covered" > options.
|
|
1414
|
+
<span class="cstat-no" title="statement not covered" > options.l</span>evel = (process.env.NODE_ENV === 'development' ? 'debug' : 'info')
|
|
1337
1415
|
}
|
|
1338
1416
|
<span class="cstat-no" title="statement not covered" > try {</span>
|
|
1339
|
-
<span class="cstat-no" title="statement not covered" > logger.
|
|
1417
|
+
<span class="cstat-no" title="statement not covered" > logger.a</span>dd(new logger.transports[logType](options))
|
|
1340
1418
|
} catch (error) {
|
|
1341
1419
|
// Logger might be down, use console
|
|
1342
|
-
<span class="cstat-no" title="statement not covered" > console.
|
|
1420
|
+
<span class="cstat-no" title="statement not covered" > console.e</span>rror('Could not setup default log levels', error)
|
|
1343
1421
|
}
|
|
1344
1422
|
})
|
|
1345
1423
|
}
|
|
1346
1424
|
|
|
1347
|
-
function <span class="fstat-no" title="function not covered" >setupSockets </span>
|
|
1348
|
-
const apiLimiter = <span class="cstat-no" title="statement not covered" >app.
|
|
1425
|
+
function <span class="fstat-no" title="function not covered" >setupSockets (a</span>pp) {
|
|
1426
|
+
const apiLimiter = <span class="cstat-no" title="statement not covered" >app.g</span>et('apiLimiter')
|
|
1349
1427
|
const connections = <span class="cstat-no" title="statement not covered" >{}</span>
|
|
1350
1428
|
let nbConnections = <span class="cstat-no" title="statement not covered" >0</span>
|
|
1351
1429
|
|
|
1352
|
-
<span class="cstat-no" title="statement not covered" > return <span class="fstat-no" title="function not covered" >
|
|
1430
|
+
<span class="cstat-no" title="statement not covered" > return <span class="fstat-no" title="function not covered" >i</span>o => {</span>
|
|
1353
1431
|
// By default EventEmitters will print a warning if more than 10 listeners are added for a particular event.
|
|
1354
1432
|
// The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
|
|
1355
|
-
<span class="cstat-no" title="statement not covered" > io.
|
|
1356
|
-
const maxConnections = <span class="cstat-no" title="statement not covered" >_.
|
|
1357
|
-
const maxIpConnections = <span class="cstat-no" title="statement not covered" >_.
|
|
1433
|
+
<span class="cstat-no" title="statement not covered" > io.s</span>ockets.setMaxListeners(0)
|
|
1434
|
+
const maxConnections = <span class="cstat-no" title="statement not covered" >_.g</span>et(apiLimiter, 'websocket.maxConcurrency', 0)
|
|
1435
|
+
const maxIpConnections = <span class="cstat-no" title="statement not covered" >_.g</span>et(apiLimiter, 'websocket.concurrency', 0)
|
|
1358
1436
|
|
|
1359
|
-
<span class="cstat-no" title="statement not covered" > io.
|
|
1437
|
+
<span class="cstat-no" title="statement not covered" > io.o</span>n('connection', <span class="fstat-no" title="function not covered" >socket => {</span>
|
|
1360
1438
|
<span class="cstat-no" title="statement not covered" > nbConnections++</span>
|
|
1361
|
-
<span class="cstat-no" title="statement not covered" > debug(`
|
|
1439
|
+
<span class="cstat-no" title="statement not covered" > debug(`N</span>ew socket connection on server with pid ${process.pid}`, socket.id, socket.conn.remoteAddress, nbConnections)
|
|
1362
1440
|
// Setup disconnect handler first
|
|
1363
|
-
<span class="cstat-no" title="statement not covered" > socket.
|
|
1441
|
+
<span class="cstat-no" title="statement not covered" > socket.o</span>n('disconnect', (<span class="fstat-no" title="function not covered" >reason) => {</span>
|
|
1364
1442
|
<span class="cstat-no" title="statement not covered" > nbConnections--</span>
|
|
1365
|
-
<span class="cstat-no" title="statement not covered" > debug(
|
|
1366
|
-
<span class="cstat-no" title="statement not covered" > debug(`
|
|
1443
|
+
<span class="cstat-no" title="statement not covered" > debug(r</span>eason)
|
|
1444
|
+
<span class="cstat-no" title="statement not covered" > debug(`S</span>ocket disconnection on server with pid ${process.pid}`, socket.id, socket.conn.remoteAddress, nbConnections)
|
|
1367
1445
|
<span class="cstat-no" title="statement not covered" > if (maxIpConnections > 0) {</span>
|
|
1368
1446
|
const nbIpConnections = <span class="cstat-no" title="statement not covered" >_.get(connections, socket.conn.remoteAddress) - 1</span>
|
|
1369
|
-
<span class="cstat-no" title="statement not covered" > debug('Total number of connections for', socket.id, socket.conn.remoteAddress, nbIpConnections)
|
|
1370
|
-
<span class="cstat-no" title="statement not covered" > _.
|
|
1447
|
+
<span class="cstat-no" title="statement not covered" > debug('</span>Total number of connections for', socket.id, socket.conn.remoteAddress, nbIpConnections)
|
|
1448
|
+
<span class="cstat-no" title="statement not covered" > _.s</span>et(connections, socket.conn.remoteAddress, nbIpConnections)
|
|
1371
1449
|
}
|
|
1372
1450
|
})
|
|
1373
1451
|
<span class="cstat-no" title="statement not covered" > if (maxConnections > 0) {</span>
|
|
1374
1452
|
<span class="cstat-no" title="statement not covered" > if (nbConnections > maxConnections) {</span>
|
|
1375
|
-
<span class="cstat-no" title="statement not covered" > tooManyRequests(
|
|
1453
|
+
<span class="cstat-no" title="statement not covered" > tooManyRequests(s</span>ocket, 'Too many concurrent connections (rate limiting)', 'RATE_LIMITING_CONCURRENCY')
|
|
1376
1454
|
<span class="cstat-no" title="statement not covered" > return</span>
|
|
1377
1455
|
}
|
|
1378
1456
|
}
|
|
1379
1457
|
<span class="cstat-no" title="statement not covered" > if (maxIpConnections > 0) {</span>
|
|
1380
1458
|
<span class="cstat-no" title="statement not covered" > if (_.has(connections, socket.conn.remoteAddress)) {</span>
|
|
1381
1459
|
const nbIpConnections = <span class="cstat-no" title="statement not covered" >_.get(connections, socket.conn.remoteAddress) + 1</span>
|
|
1382
|
-
<span class="cstat-no" title="statement not covered" > debug('Total number of connections for', socket.id, socket.conn.remoteAddress, nbConnections)
|
|
1383
|
-
<span class="cstat-no" title="statement not covered" > _.
|
|
1460
|
+
<span class="cstat-no" title="statement not covered" > debug('</span>Total number of connections for', socket.id, socket.conn.remoteAddress, nbConnections)
|
|
1461
|
+
<span class="cstat-no" title="statement not covered" > _.s</span>et(connections, socket.conn.remoteAddress, nbIpConnections)
|
|
1384
1462
|
<span class="cstat-no" title="statement not covered" > if (nbIpConnections > maxIpConnections) {</span>
|
|
1385
|
-
<span class="cstat-no" title="statement not covered" > tooManyRequests(
|
|
1463
|
+
<span class="cstat-no" title="statement not covered" > tooManyRequests(s</span>ocket, 'Too many concurrent connections (rate limiting)', 'RATE_LIMITING_CONCURRENCY')
|
|
1386
1464
|
<span class="cstat-no" title="statement not covered" > return</span>
|
|
1387
1465
|
}
|
|
1388
1466
|
} else {
|
|
1389
|
-
<span class="cstat-no" title="statement not covered" > _.
|
|
1467
|
+
<span class="cstat-no" title="statement not covered" > _.s</span>et(connections, socket.conn.remoteAddress, 1)
|
|
1390
1468
|
}
|
|
1391
1469
|
}
|
|
1392
1470
|
/* For debug purpose: trace all data received
|
|
@@ -1398,24 +1476,24 @@ function <span class="fstat-no" title="function not covered" >setupSockets </spa
|
|
|
1398
1476
|
<span class="cstat-no" title="statement not covered" > if (apiLimiter && apiLimiter.websocket) {</span>
|
|
1399
1477
|
const { tokensPerInterval, interval } = <span class="cstat-no" title="statement not covered" >apiLimiter.websocket</span>
|
|
1400
1478
|
// Function used to filter whitelisted services, defaults to none
|
|
1401
|
-
const services = <span class="cstat-no" title="statement not covered" >_.
|
|
1402
|
-
<span class="cstat-no" title="statement not covered" > socket.
|
|
1403
|
-
<span class="cstat-no" title="statement not covered" > socket.
|
|
1479
|
+
const services = <span class="cstat-no" title="statement not covered" >_.g</span>et(apiLimiter.websocket, 'services', (<span class="fstat-no" title="function not covered" >service) => <span class="cstat-no" title="statement not covered" >f</span>alse)</span>
|
|
1480
|
+
<span class="cstat-no" title="statement not covered" > socket.s</span>ocketLimiter = new SocketLimiter(tokensPerInterval, interval)
|
|
1481
|
+
<span class="cstat-no" title="statement not covered" > socket.u</span>se(<span class="fstat-no" title="function not covered" >(p</span>acket, next) => {
|
|
1404
1482
|
<span class="cstat-no" title="statement not covered" > if (packet.length > 0) {</span>
|
|
1405
1483
|
// Packets are formatted according to service interface,
|
|
1406
1484
|
// e.g. like [service_method, service_path, id or data, params]
|
|
1407
1485
|
// Bypass rate limiting on whitelist
|
|
1408
1486
|
<span class="cstat-no" title="statement not covered" > if ((packet.length > 1) && (typeof packet[1] === 'string')) {</span>
|
|
1409
|
-
const service = <span class="cstat-no" title="statement not covered" >app.
|
|
1487
|
+
const service = <span class="cstat-no" title="statement not covered" >app.s</span>ervice(packet[1])
|
|
1410
1488
|
<span class="cstat-no" title="statement not covered" > if (service && services(service)) {</span>
|
|
1411
|
-
<span class="cstat-no" title="statement not covered" > debugLimiter('By-pass rate limiting on whitelisted service operation', socket.id, socket.conn.remoteAddress, packet[0], packet[1])
|
|
1489
|
+
<span class="cstat-no" title="statement not covered" > debugLimiter('</span>By-pass rate limiting on whitelisted service operation', socket.id, socket.conn.remoteAddress, packet[0], packet[1])
|
|
1412
1490
|
<span class="cstat-no" title="statement not covered" > next()</span>
|
|
1413
1491
|
<span class="cstat-no" title="statement not covered" > return</span>
|
|
1414
1492
|
}
|
|
1415
1493
|
}
|
|
1416
|
-
<span class="cstat-no" title="statement not covered" > debugLimiter(
|
|
1494
|
+
<span class="cstat-no" title="statement not covered" > debugLimiter(s</span>ocket.socketLimiter.getTokensRemaining() + ' remaining API token for socket', socket.id, socket.conn.remoteAddress)
|
|
1417
1495
|
<span class="cstat-no" title="statement not covered" > if (!socket.socketLimiter.tryRemoveTokens(1)) { // if exceeded</span>
|
|
1418
|
-
<span class="cstat-no" title="statement not covered" > tooManyRequests(
|
|
1496
|
+
<span class="cstat-no" title="statement not covered" > tooManyRequests(s</span>ocket, 'Too many requests in a given amount of time (rate limiting)', 'RATE_LIMITING')
|
|
1419
1497
|
// FIXME: calling this causes a client timeout
|
|
1420
1498
|
// next(error)
|
|
1421
1499
|
// Need to normalize the error object as JSON
|
|
@@ -1432,103 +1510,103 @@ function <span class="fstat-no" title="function not covered" >setupSockets </spa
|
|
|
1432
1510
|
})
|
|
1433
1511
|
}
|
|
1434
1512
|
|
|
1435
|
-
<span class="cstat-no" title="statement not covered" > authSocket(
|
|
1513
|
+
<span class="cstat-no" title="statement not covered" > authSocket(a</span>pp, socket)
|
|
1436
1514
|
})
|
|
1437
1515
|
}
|
|
1438
1516
|
}
|
|
1439
1517
|
|
|
1440
|
-
export function <span class="fstat-no" title="function not covered" >kalisio
|
|
1441
|
-
const app = <span class="cstat-no" title="statement not covered" >express(
|
|
1518
|
+
export function <span class="fstat-no" title="function not covered" >kalisio () {</span>
|
|
1519
|
+
const app = <span class="cstat-no" title="statement not covered" >express(f</span>eathers())
|
|
1442
1520
|
// By default EventEmitters will print a warning if more than 10 listeners are added for a particular event.
|
|
1443
1521
|
// The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.
|
|
1444
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1522
|
+
<span class="cstat-no" title="statement not covered" > app.s</span>etMaxListeners(0)
|
|
1445
1523
|
// Load app configuration first
|
|
1446
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1524
|
+
<span class="cstat-no" title="statement not covered" > app.c</span>onfigure(configuration())
|
|
1447
1525
|
// Then setup logger
|
|
1448
|
-
<span class="cstat-no" title="statement not covered" > setupLogger(
|
|
1526
|
+
<span class="cstat-no" title="statement not covered" > setupLogger(a</span>pp)
|
|
1449
1527
|
|
|
1450
1528
|
// This retrieve corresponding service options from app config if any
|
|
1451
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1452
|
-
const services = <span class="cstat-no" title="statement not covered" >app.
|
|
1453
|
-
<span class="cstat-no" title="statement not covered" > if (!services) <span class="cstat-no" title="statement not covered" >return {
|
|
1454
|
-
<span class="cstat-no" title="statement not covered" > return _
|
|
1529
|
+
<span class="cstat-no" title="statement not covered" > app.g</span>etServiceOptions = <span class="fstat-no" title="function not covered" >function (n</span>ame) {
|
|
1530
|
+
const services = <span class="cstat-no" title="statement not covered" >app.g</span>et('services')
|
|
1531
|
+
<span class="cstat-no" title="statement not covered" > if (!services) <span class="cstat-no" title="statement not covered" >return {</span></span>}
|
|
1532
|
+
<span class="cstat-no" title="statement not covered" > return _</span>.get(services, name, {})
|
|
1455
1533
|
}
|
|
1456
1534
|
// This avoid managing the API path before each service name
|
|
1457
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1535
|
+
<span class="cstat-no" title="statement not covered" > app.g</span>etService = <span class="fstat-no" title="function not covered" >function (p</span>ath, context) {
|
|
1458
1536
|
// Context is given as string ID
|
|
1459
1537
|
<span class="cstat-no" title="statement not covered" > if (context && typeof context === 'string') {</span>
|
|
1460
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1538
|
+
<span class="cstat-no" title="statement not covered" > return a</span>pp.service(app.get('apiPath') + '/' + context + '/' + path)
|
|
1461
1539
|
} else <span class="cstat-no" title="statement not covered" >if (context && typeof context === 'object') {</span>
|
|
1462
1540
|
// Could be Object ID or raw object
|
|
1463
|
-
<span class="cstat-no" title="statement not covered" > if (ObjectID.isValid(context)) <span class="cstat-no" title="statement not covered" >return
|
|
1464
|
-
else <span class="cstat-no" title="statement not covered" >return
|
|
1541
|
+
<span class="cstat-no" title="statement not covered" > if (ObjectID.isValid(context)) <span class="cstat-no" title="statement not covered" >return a</span>pp.service(app.get('apiPath') + '/' + context.toString() + '/' + path)</span>
|
|
1542
|
+
else <span class="cstat-no" title="statement not covered" >return a</span>pp.service(app.get('apiPath') + '/' + context._id.toString() + '/' + path)
|
|
1465
1543
|
} else {
|
|
1466
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1544
|
+
<span class="cstat-no" title="statement not covered" > return a</span>pp.service(app.get('apiPath') + '/' + path)
|
|
1467
1545
|
}
|
|
1468
1546
|
}
|
|
1469
1547
|
// This is used to add hooks/filters to services
|
|
1470
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1471
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1548
|
+
<span class="cstat-no" title="statement not covered" > app.c</span>onfigureService = <span class="fstat-no" title="function not covered" >function (n</span>ame, service, servicesPath) {
|
|
1549
|
+
<span class="cstat-no" title="statement not covered" > return c</span>onfigureService(name, service, servicesPath)
|
|
1472
1550
|
}
|
|
1473
1551
|
// This is used to create standard services
|
|
1474
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1475
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1552
|
+
<span class="cstat-no" title="statement not covered" > app.c</span>reateService = <span class="fstat-no" title="function not covered" >function (n</span>ame, options) {
|
|
1553
|
+
<span class="cstat-no" title="statement not covered" > return c</span>reateService(name, app, options)
|
|
1476
1554
|
}
|
|
1477
1555
|
// This is used to create webhooks
|
|
1478
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1479
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1556
|
+
<span class="cstat-no" title="statement not covered" > app.c</span>reateWebhook = <span class="fstat-no" title="function not covered" >function (p</span>ath, options) {
|
|
1557
|
+
<span class="cstat-no" title="statement not covered" > return c</span>reateWebhook(path, app, options)
|
|
1480
1558
|
}
|
|
1481
1559
|
// Override Feathers configure that do not manage async operations,
|
|
1482
1560
|
// here we also simply call the function given as parameter but await for it
|
|
1483
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1484
|
-
<span class="cstat-no" title="statement not covered" > await
|
|
1485
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1561
|
+
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" > app.c</span></span>onfigure = <span class="fstat-no" title="function not covered" >async function (f</span>n) {
|
|
1562
|
+
<span class="cstat-no" title="statement not covered" > await f</span>n.call(this, this)
|
|
1563
|
+
<span class="cstat-no" title="statement not covered" > return t</span>his
|
|
1486
1564
|
}
|
|
1487
|
-
const apiLimiter = <span class="cstat-no" title="statement not covered" >app.
|
|
1565
|
+
const apiLimiter = <span class="cstat-no" title="statement not covered" >app.g</span>et('apiLimiter')
|
|
1488
1566
|
<span class="cstat-no" title="statement not covered" > if (apiLimiter && apiLimiter.http) {</span>
|
|
1489
1567
|
// Function used to filter whitelisted services, defaults to none
|
|
1490
|
-
const services = <span class="cstat-no" title="statement not covered" >_.
|
|
1568
|
+
const services = <span class="cstat-no" title="statement not covered" >_.g</span>et(apiLimiter.http, 'services', (<span class="fstat-no" title="function not covered" >service) => <span class="cstat-no" title="statement not covered" >f</span>alse)</span>
|
|
1491
1569
|
const handler = <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >(r</span>eq, res, next) => {</span>
|
|
1492
1570
|
// Bypass rate limiting on whitelist
|
|
1493
1571
|
let service
|
|
1494
1572
|
<span class="cstat-no" title="statement not covered" > try {</span>
|
|
1495
|
-
const serviceUrl = <span class="cstat-no" title="statement not covered" >new
|
|
1496
|
-
<span class="cstat-no" title="statement not covered" > service =
|
|
1573
|
+
const serviceUrl = <span class="cstat-no" title="statement not covered" >new u</span>rl.URL(req.originalUrl)
|
|
1574
|
+
<span class="cstat-no" title="statement not covered" > service = a</span>pp.service(serviceUrl.pathname)
|
|
1497
1575
|
} catch (error) {
|
|
1498
|
-
<span class="cstat-no" title="statement not covered" > debugLimiter(
|
|
1576
|
+
<span class="cstat-no" title="statement not covered" > debugLimiter(e</span>rror)
|
|
1499
1577
|
}
|
|
1500
1578
|
<span class="cstat-no" title="statement not covered" > if (service && services(service)) {</span>
|
|
1501
|
-
<span class="cstat-no" title="statement not covered" > debugLimiter('By-pass rate limiting on whitelisted service operation', req.method, path)
|
|
1579
|
+
<span class="cstat-no" title="statement not covered" > debugLimiter('</span>By-pass rate limiting on whitelisted service operation', req.method, path)
|
|
1502
1580
|
<span class="cstat-no" title="statement not covered" > next()</span>
|
|
1503
1581
|
} else {
|
|
1504
|
-
const error = <span class="cstat-no" title="statement not covered" >new
|
|
1582
|
+
const error = <span class="cstat-no" title="statement not covered" >new T</span>ooManyRequests('Too many requests in a given amount of time (rate limiting)',
|
|
1505
1583
|
{ translation: { key: 'RATE_LIMITING' } })
|
|
1506
|
-
<span class="cstat-no" title="statement not covered" > res.
|
|
1507
|
-
<span class="cstat-no" title="statement not covered" > res.
|
|
1508
|
-
<span class="cstat-no" title="statement not covered" > res.
|
|
1584
|
+
<span class="cstat-no" title="statement not covered" > res.s</span>tatus(error.code)
|
|
1585
|
+
<span class="cstat-no" title="statement not covered" > res.s</span>et('Content-Type', 'application/json')
|
|
1586
|
+
<span class="cstat-no" title="statement not covered" > res.j</span>son(Object.assign({}, error.toJSON()))
|
|
1509
1587
|
}
|
|
1510
1588
|
}
|
|
1511
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1589
|
+
<span class="cstat-no" title="statement not covered" > app.u</span>se(app.get('apiPath'), new HttpLimiter(Object.assign({ handler }, apiLimiter.http)))
|
|
1512
1590
|
}
|
|
1513
1591
|
|
|
1514
1592
|
// Enable CORS, security, compression, and body parsing
|
|
1515
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1516
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1517
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1518
|
-
const bodyParserConfig = <span class="cstat-no" title="statement not covered" >app.
|
|
1519
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1520
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1593
|
+
<span class="cstat-no" title="statement not covered" > app.u</span>se(cors(app.get('cors')))
|
|
1594
|
+
<span class="cstat-no" title="statement not covered" > app.u</span>se(helmet(app.get('helmet')))
|
|
1595
|
+
<span class="cstat-no" title="statement not covered" > app.u</span>se(compress(app.get('compression')))
|
|
1596
|
+
const bodyParserConfig = <span class="cstat-no" title="statement not covered" >app.g</span>et('bodyParser')
|
|
1597
|
+
<span class="cstat-no" title="statement not covered" > app.u</span>se(bodyParser.json(_.get(bodyParserConfig, 'json')))
|
|
1598
|
+
<span class="cstat-no" title="statement not covered" > app.u</span>se(bodyParser.urlencoded(Object.assign({ extended: true }, _.get(bodyParserConfig, 'urlencoded'))))
|
|
1521
1599
|
|
|
1522
1600
|
// Set up plugins and providers
|
|
1523
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1601
|
+
<span class="cstat-no" title="statement not covered" > app.c</span>onfigure(rest())
|
|
1524
1602
|
const socketioConfig = <span class="cstat-no" title="statement not covered" >app.get('socketio') || {}</span>
|
|
1525
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1526
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1603
|
+
<span class="cstat-no" title="statement not covered" > app.c</span>onfigure(socketio(Object.assign({ path: app.get('apiPath') + 'ws' }, socketioConfig), setupSockets(app)))
|
|
1604
|
+
<span class="cstat-no" title="statement not covered" > app.c</span>onfigure(auth)
|
|
1527
1605
|
|
|
1528
1606
|
// Initialize DB
|
|
1529
|
-
<span class="cstat-no" title="statement not covered" > app.
|
|
1607
|
+
<span class="cstat-no" title="statement not covered" > app.d</span>b = Database.create(app)
|
|
1530
1608
|
|
|
1531
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1609
|
+
<span class="cstat-no" title="statement not covered" > return a</span>pp
|
|
1532
1610
|
}
|
|
1533
1611
|
</pre></td></tr></table></pre>
|
|
1534
1612
|
|
|
@@ -1537,7 +1615,7 @@ export function <span class="fstat-no" title="function not covered" >kalisio </s
|
|
|
1537
1615
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1538
1616
|
Code coverage generated by
|
|
1539
1617
|
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
1540
|
-
at
|
|
1618
|
+
at Thu Feb 17 2022 13:49:01 GMT+0100 (GMT+01:00)
|
|
1541
1619
|
</div>
|
|
1542
1620
|
</div>
|
|
1543
1621
|
<script src="../../prettify.js"></script>
|