@kalisio/kdk 2.4.1 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/api/application.js +12 -12
- package/core/api/authentication.js +51 -7
- package/core/api/hooks/hooks.authentication.js +1 -59
- package/core/api/hooks/hooks.authorisations.js +9 -104
- package/core/api/hooks/hooks.model.js +4 -0
- package/core/api/hooks/hooks.push.js +18 -14
- package/core/api/hooks/hooks.users.js +0 -91
- package/core/api/hooks/index.js +0 -2
- package/core/api/services/account/account.service.js +1 -1
- package/core/api/services/authorisations/authorisations.service.js +28 -31
- package/core/api/services/index.js +42 -50
- package/core/api/services/messages/messages.hooks.js +4 -3
- package/core/api/services/users/users.hooks.js +4 -3
- package/core/api/services/users/users.service.js +5 -0
- package/core/client/api.js +182 -71
- package/core/client/broadcaster.js +20 -0
- package/core/client/capabilities.js +17 -7
- package/core/client/components/KActivity.vue +29 -34
- package/core/client/components/KAvatar.vue +0 -6
- package/core/client/components/KChip.vue +142 -39
- package/core/client/components/KContent.vue +13 -32
- package/core/client/components/KDialog.vue +29 -8
- package/core/client/components/KEditor.vue +120 -0
- package/core/client/components/KFollower.vue +75 -0
- package/core/client/components/KLogo.vue +2 -3
- package/core/client/components/KModal.vue +30 -10
- package/core/client/components/KSponsor.vue +1 -1
- package/core/client/components/KTextArea.vue +2 -5
- package/core/client/components/account/KDeleteAccountManager.vue +1 -1
- package/core/client/components/account/KProfile.vue +52 -14
- package/core/client/components/account/KSubscription.vue +19 -9
- package/core/client/components/account/KSubscriptionsManager.vue +10 -11
- package/core/client/components/action/KAction.vue +44 -24
- package/core/client/components/action/KBugReportAction.vue +4 -5
- package/core/client/components/action/KToggleStickyVisibility.vue +41 -0
- package/core/client/components/action/KToggleWidgetVisibility.vue +41 -0
- package/core/client/components/app/KPlatform.vue +122 -35
- package/core/client/components/app/KRequestProgressBar.vue +59 -0
- package/core/client/components/app/KSettings.vue +13 -2
- package/core/client/components/app/KTour.vue +2 -2
- package/core/client/components/chart/KTimeSeriesChart.vue +11 -3
- package/core/client/components/collection/KCard.vue +27 -33
- package/core/client/components/collection/KCardSection.vue +3 -23
- package/core/client/components/collection/KColumn.vue +0 -5
- package/core/client/components/collection/KDescriptionCardSection.vue +10 -5
- package/core/client/components/collection/KFilterView.vue +15 -0
- package/core/client/components/collection/KGrid.vue +4 -9
- package/core/client/components/collection/KHistory.vue +0 -5
- package/core/client/components/collection/KHistoryEntry.vue +0 -2
- package/core/client/components/collection/KItem.vue +1 -2
- package/core/client/components/collection/KSearchFilterControl.vue +139 -0
- package/core/client/components/collection/KTable.vue +1 -4
- package/core/client/components/collection/KTagsFilterControl.vue +70 -0
- package/core/client/components/collection/KTagsFilterView.vue +61 -0
- package/core/client/components/collection/KTimeFilterControl.vue +40 -0
- package/core/client/components/collection/KTimeFilterView.vue +106 -0
- package/core/client/components/collection/KTimeLine.vue +18 -11
- package/core/client/components/document/KBrowser.vue +283 -0
- package/core/client/components/document/KCsv.vue +52 -0
- package/core/client/components/document/KDocument.vue +19 -5
- package/core/client/components/document/KImage.vue +50 -19
- package/core/client/components/document/KMarkdown.vue +10 -2
- package/core/client/components/document/KUploader.vue +126 -0
- package/core/client/components/document/KVideo.vue +39 -0
- package/core/client/components/form/KDateField.vue +70 -0
- package/core/client/components/form/KDateTimeRangeField.vue +6 -17
- package/core/client/components/form/KDatetimeField.vue +6 -13
- package/core/client/components/form/KForm.vue +8 -8
- package/core/client/components/form/KOptionsField.vue +2 -0
- package/core/client/components/form/KResolutionField.vue +54 -52
- package/core/client/components/form/KSelectField.vue +27 -13
- package/core/client/components/form/KTextareaField.vue +23 -5
- package/core/client/components/graphics/KIcon.vue +64 -0
- package/core/client/components/index.js +1 -3
- package/core/client/components/input/KColorPicker.vue +70 -0
- package/core/client/components/input/KIconPicker.vue +188 -0
- package/core/client/components/input/KShapePicker.vue +81 -0
- package/core/client/components/input/index.js +7 -1
- package/core/client/components/layout/KFab.vue +1 -1
- package/core/client/components/layout/KLayout.vue +14 -2
- package/core/client/components/layout/KOpener.vue +9 -11
- package/core/client/components/layout/KPage.vue +31 -17
- package/core/client/components/layout/KWindow.vue +34 -18
- package/core/client/components/menu/KMenu.vue +52 -36
- package/core/client/components/menu/KSubMenu.vue +105 -0
- package/core/client/components/messages/KMessageCard.vue +207 -0
- package/core/client/components/messages/KMessageComposer.vue +199 -0
- package/core/client/components/messages/KMessagesTimeLine.vue +137 -0
- package/core/client/components/messages/index.js +7 -0
- package/core/client/components/screen/KErrorScreen.vue +2 -3
- package/core/client/components/screen/KLogoutScreen.vue +3 -1
- package/core/client/components/screen/KOAuthLoginScreen.vue +15 -0
- package/core/client/components/screen/KOAuthLogoutScreen.vue +33 -0
- package/core/client/components/screen/KUnauthorizedScreen.vue +16 -0
- package/core/client/components/time/KAbsoluteTimeRange.vue +7 -14
- package/core/client/components/time/KDate.vue +55 -28
- package/core/client/components/time/KDateTime.vue +93 -37
- package/core/client/components/time/KDateTimeRange.vue +197 -52
- package/core/client/components/time/KTime.vue +55 -27
- package/core/client/composables/activity.js +40 -30
- package/core/client/composables/{counter.js → collection-counter.js} +2 -4
- package/core/client/composables/collection-filter.js +111 -0
- package/core/client/composables/collection-timerange.js +56 -0
- package/core/client/composables/collection.js +13 -11
- package/core/client/composables/context.js +92 -0
- package/core/client/composables/errors.js +83 -0
- package/core/client/composables/index.js +5 -1
- package/core/client/composables/layout.js +14 -11
- package/core/client/composables/messages.js +4 -4
- package/core/client/composables/pwa.js +20 -27
- package/core/client/composables/schema.js +1 -1
- package/core/client/composables/screen.js +21 -9
- package/core/client/composables/selection.js +16 -4
- package/core/client/composables/session.js +13 -7
- package/core/client/composables/store.js +2 -1
- package/core/client/context.js +38 -0
- package/core/client/directives/v-hover.js +7 -4
- package/core/client/document.js +43 -15
- package/core/client/events.js +2 -2
- package/core/client/exporter.js +5 -4
- package/core/client/filter.js +1 -8
- package/core/client/guards.js +3 -3
- package/core/client/hooks/hooks.logger.js +1 -1
- package/core/client/hooks/hooks.offline.js +32 -0
- package/core/client/hooks/index.js +2 -1
- package/core/client/i18n/core_en.json +95 -268
- package/core/client/i18n/core_fr.json +181 -353
- package/core/client/index.js +22 -8
- package/core/client/layout.js +64 -25
- package/core/client/local-cache.js +67 -0
- package/core/client/local-storage.js +6 -2
- package/core/client/mixins/index.js +0 -1
- package/core/client/mixins/mixin.base-activity.js +22 -10
- package/core/client/mixins/mixin.base-editor.js +1 -1
- package/core/client/mixins/mixin.base-field.js +10 -1
- package/core/client/mixins/mixin.base-item.js +14 -11
- package/core/client/mixins/mixin.service.js +1 -5
- package/core/client/platform.js +44 -0
- package/core/client/readers/reader.blob.js +3 -3
- package/core/client/readers/reader.csv.js +2 -2
- package/core/client/readers/reader.json.js +2 -2
- package/core/client/services/index.js +7 -11
- package/core/client/storage.js +43 -8
- package/core/client/template-context.js +14 -14
- package/core/client/time.js +2 -2
- package/core/client/units.js +7 -4
- package/core/client/utils/index.js +7 -5
- package/core/client/utils/utils.collection.js +71 -0
- package/core/client/utils/utils.colors.js +29 -8
- package/core/client/utils/utils.content.js +14 -14
- package/core/client/utils/utils.files.js +17 -0
- package/core/client/utils/utils.items.js +4 -0
- package/core/client/utils/utils.math.js +18 -1
- package/core/client/utils/utils.push.js +22 -13
- package/core/client/utils/utils.screen.js +6 -2
- package/core/client/utils/utils.services.js +42 -0
- package/core/client/utils/utils.session.js +48 -12
- package/core/client/utils/utils.shapes.js +15 -11
- package/core/common/permissions.js +3 -108
- package/core/common/schemas/messages.update.json +16 -0
- package/core/common/schemas/settings.update.json +27 -8
- package/core/common/utils.js +2 -0
- package/core/common/utils.offline.js +38 -0
- package/coverage/core/api/application.js.html +296 -296
- package/coverage/core/api/authentication.js.html +206 -74
- package/coverage/core/api/db.js.html +61 -61
- package/coverage/core/api/hooks/hooks.authentication.js.html +15 -189
- package/coverage/core/api/hooks/hooks.authorisations.js.html +172 -460
- package/coverage/core/api/hooks/hooks.groups.js.html +1 -1
- package/coverage/core/api/hooks/hooks.logger.js.html +16 -16
- package/coverage/core/api/hooks/hooks.model.js.html +52 -52
- package/coverage/core/api/hooks/hooks.organisations.js.html +1 -1
- package/coverage/core/api/hooks/hooks.push.js.html +58 -46
- package/coverage/core/api/hooks/hooks.query.js.html +136 -136
- package/coverage/core/api/hooks/hooks.schemas.js.html +1 -1
- 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.users.js.html +55 -328
- package/coverage/core/api/hooks/index.html +58 -88
- package/coverage/core/api/hooks/index.js.html +4 -10
- package/coverage/core/api/index.html +39 -54
- package/coverage/core/api/index.js.html +1 -1
- 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 +13 -58
- package/coverage/core/api/models/messages.model.mongodb.js.html +35 -35
- package/coverage/core/api/models/organisations.model.mongodb.js.html +3 -3
- 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/services/account/account.hooks.js.html +1 -1
- package/coverage/core/api/services/account/account.service.js.html +67 -67
- package/coverage/core/api/services/account/index.html +16 -16
- package/coverage/core/api/services/authorisations/authorisations.hooks.js.html +1 -1
- package/coverage/core/api/services/authorisations/authorisations.service.js.html +120 -117
- package/coverage/core/api/services/authorisations/index.html +15 -15
- package/coverage/core/api/services/databases/databases.hooks.js.html +82 -82
- package/coverage/core/api/services/databases/databases.service.js.html +20 -20
- package/coverage/core/api/services/databases/index.html +32 -32
- package/coverage/core/api/services/groups/groups.hooks.js.html +1 -1
- package/coverage/core/api/services/groups/index.html +1 -1
- package/coverage/core/api/services/import-export/import-export.hooks.js.html +1 -1
- package/coverage/core/api/services/import-export/import-export.service.js.html +1 -1
- package/coverage/core/api/services/import-export/index.html +1 -1
- package/coverage/core/api/services/index.html +21 -21
- package/coverage/core/api/services/index.js.html +118 -154
- package/coverage/core/api/services/mailer/index.html +1 -1
- package/coverage/core/api/services/mailer/mailer.hooks.js.html +1 -1
- package/coverage/core/api/services/mailer/mailer.service.js.html +1 -1
- package/coverage/core/api/services/messages/index.html +21 -21
- package/coverage/core/api/services/messages/messages.hooks.js.html +86 -86
- 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 +23 -23
- package/coverage/core/api/services/push/index.html +1 -1
- package/coverage/core/api/services/push/push.hooks.js.html +1 -1
- package/coverage/core/api/services/push/push.service.js.html +1 -1
- package/coverage/core/api/services/storage/index.html +5 -5
- package/coverage/core/api/services/storage/storage.hooks.js.html +1 -1
- package/coverage/core/api/services/storage/storage.service.js.html +27 -27
- 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 +23 -8
- package/coverage/core/api/services/users/users.hooks.js.html +1 -1
- package/coverage/core/api/services/users/users.service.js.html +100 -0
- package/coverage/core/api/utils.js.html +1 -1
- package/coverage/core/common/errors.js.html +1 -1
- package/coverage/core/common/index.html +42 -27
- package/coverage/core/common/index.js.html +1 -1
- package/coverage/core/common/permissions.js.html +195 -510
- package/coverage/core/common/schema.js.html +1 -1
- package/coverage/core/common/utils.js.html +12 -6
- package/coverage/core/common/utils.offline.js.html +199 -0
- package/coverage/index.html +121 -166
- package/coverage/lcov-report/core/api/application.js.html +296 -296
- package/coverage/lcov-report/core/api/authentication.js.html +206 -74
- package/coverage/lcov-report/core/api/db.js.html +61 -61
- package/coverage/lcov-report/core/api/hooks/hooks.authentication.js.html +15 -189
- package/coverage/lcov-report/core/api/hooks/hooks.authorisations.js.html +172 -460
- package/coverage/lcov-report/core/api/hooks/hooks.groups.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.logger.js.html +16 -16
- package/coverage/lcov-report/core/api/hooks/hooks.model.js.html +52 -52
- package/coverage/lcov-report/core/api/hooks/hooks.organisations.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.push.js.html +58 -46
- package/coverage/lcov-report/core/api/hooks/hooks.query.js.html +136 -136
- package/coverage/lcov-report/core/api/hooks/hooks.schemas.js.html +1 -1
- 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.users.js.html +55 -328
- package/coverage/lcov-report/core/api/hooks/index.html +58 -88
- package/coverage/lcov-report/core/api/hooks/index.js.html +4 -10
- package/coverage/lcov-report/core/api/index.html +39 -54
- package/coverage/lcov-report/core/api/index.js.html +1 -1
- 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 +13 -58
- package/coverage/lcov-report/core/api/models/messages.model.mongodb.js.html +35 -35
- package/coverage/lcov-report/core/api/models/organisations.model.mongodb.js.html +3 -3
- 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/services/account/account.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/account/account.service.js.html +67 -67
- package/coverage/lcov-report/core/api/services/account/index.html +16 -16
- 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 +120 -117
- package/coverage/lcov-report/core/api/services/authorisations/index.html +15 -15
- package/coverage/lcov-report/core/api/services/databases/databases.hooks.js.html +82 -82
- package/coverage/lcov-report/core/api/services/databases/databases.service.js.html +20 -20
- package/coverage/lcov-report/core/api/services/databases/index.html +32 -32
- package/coverage/lcov-report/core/api/services/groups/groups.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/groups/index.html +1 -1
- package/coverage/lcov-report/core/api/services/import-export/import-export.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/import-export/import-export.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/import-export/index.html +1 -1
- package/coverage/lcov-report/core/api/services/index.html +21 -21
- package/coverage/lcov-report/core/api/services/index.js.html +118 -154
- package/coverage/lcov-report/core/api/services/mailer/index.html +1 -1
- package/coverage/lcov-report/core/api/services/mailer/mailer.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/mailer/mailer.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/messages/index.html +21 -21
- package/coverage/lcov-report/core/api/services/messages/messages.hooks.js.html +86 -86
- 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 +23 -23
- package/coverage/lcov-report/core/api/services/push/index.html +1 -1
- package/coverage/lcov-report/core/api/services/push/push.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/push/push.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/storage/index.html +5 -5
- package/coverage/lcov-report/core/api/services/storage/storage.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/storage/storage.service.js.html +27 -27
- 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 +23 -8
- package/coverage/lcov-report/core/api/services/users/users.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/users/users.service.js.html +100 -0
- package/coverage/lcov-report/core/api/utils.js.html +1 -1
- package/coverage/lcov-report/core/common/errors.js.html +1 -1
- package/coverage/lcov-report/core/common/index.html +42 -27
- package/coverage/lcov-report/core/common/index.js.html +1 -1
- package/coverage/lcov-report/core/common/permissions.js.html +195 -510
- package/coverage/lcov-report/core/common/schema.js.html +1 -1
- package/coverage/lcov-report/core/common/utils.js.html +12 -6
- package/coverage/lcov-report/core/common/utils.offline.js.html +199 -0
- package/coverage/lcov-report/index.html +121 -166
- package/coverage/lcov-report/map/api/hooks/hooks.catalog.js.html +33 -27
- package/coverage/lcov-report/map/api/hooks/hooks.features.js.html +1 -1
- package/coverage/lcov-report/map/api/hooks/hooks.query.js.html +4 -4
- package/coverage/lcov-report/map/api/hooks/index.html +5 -5
- 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 +1 -1
- package/coverage/lcov-report/map/api/models/index.html +1 -1
- package/coverage/lcov-report/map/api/models/projects.model.mongodb.js.html +1 -1
- 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 +10 -7
- package/coverage/lcov-report/map/api/services/catalog/index.html +5 -5
- 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 +78 -9
- package/coverage/lcov-report/map/api/services/features/features.service.js.html +307 -4
- package/coverage/lcov-report/map/api/services/features/index.html +7 -7
- package/coverage/lcov-report/map/api/services/index.html +5 -5
- package/coverage/lcov-report/map/api/services/index.js.html +171 -42
- package/coverage/lcov-report/map/api/services/projects/index.html +1 -1
- package/coverage/lcov-report/map/api/services/projects/projects.hooks.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 +8 -5
- package/coverage/lcov-report/map/common/grid.js.html +1 -1
- package/coverage/lcov-report/map/common/index.html +5 -5
- 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 +2314 -3167
- package/coverage/map/api/hooks/hooks.catalog.js.html +33 -27
- package/coverage/map/api/hooks/hooks.features.js.html +1 -1
- package/coverage/map/api/hooks/hooks.query.js.html +4 -4
- package/coverage/map/api/hooks/index.html +5 -5
- 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 +1 -1
- package/coverage/map/api/models/index.html +1 -1
- package/coverage/map/api/models/projects.model.mongodb.js.html +1 -1
- 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 +10 -7
- package/coverage/map/api/services/catalog/index.html +5 -5
- 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 +78 -9
- package/coverage/map/api/services/features/features.service.js.html +307 -4
- package/coverage/map/api/services/features/index.html +7 -7
- package/coverage/map/api/services/index.html +5 -5
- package/coverage/map/api/services/index.js.html +171 -42
- package/coverage/map/api/services/projects/index.html +1 -1
- package/coverage/map/api/services/projects/projects.hooks.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 +8 -5
- package/coverage/map/common/grid.js.html +1 -1
- package/coverage/map/common/index.html +5 -5
- 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/coverage/tmp/{coverage-280506-1731704745613-0.json → coverage-122123-1739872365211-0.json} +1 -1
- package/coverage/tmp/{coverage-280518-1731704745599-0.json → coverage-122135-1739872365196-0.json} +1 -1
- package/coverage/tmp/{coverage-280529-1731704745588-0.json → coverage-122146-1739872365184-0.json} +1 -1
- package/coverage/tmp/{coverage-280541-1731704745574-0.json → coverage-122158-1739872365169-0.json} +1 -1
- package/coverage/tmp/{coverage-280548-1731704745545-0.json → coverage-122165-1739872365141-0.json} +1 -1
- package/extras/configs/helpers.js +78 -0
- package/extras/configs/panes.left.js +118 -0
- package/extras/configs/panes.top.js +222 -0
- package/extras/configs/stickies.js +57 -0
- package/extras/configs/widgets.left.js +23 -0
- package/extras/configs/widgets.top.js +73 -0
- package/extras/css/core.variables.scss +8 -0
- package/extras/images/north.svg +3 -0
- package/extras/tours/map/side-nav.js +3 -3
- package/map/api/hooks/hooks.catalog.js +56 -23
- package/map/api/hooks/hooks.query.js +19 -24
- package/map/api/models/catalog.model.mongodb.js +16 -2
- package/{core/api/models/groups.model.mongodb.js → map/api/models/styles.model.mongodb.js} +2 -1
- package/map/api/services/catalog/catalog.hooks.js +13 -7
- package/map/api/services/features/features.hooks.js +28 -5
- package/map/api/services/features/features.service.js +101 -0
- package/map/api/services/index.js +125 -46
- package/map/api/services/styles/styles.hooks.js +37 -0
- package/map/client/cesium/utils/index.js +1 -0
- package/map/client/cesium/utils/utils.cesium.js +397 -0
- package/map/client/cesium/utils/utils.features.js +8 -0
- package/map/client/cesium/utils/utils.geojson.js +59 -0
- package/map/client/cesium/utils/utils.style.js +134 -17
- package/map/client/components/KEditLayerData.vue +17 -79
- package/map/client/components/KFeatureEditor.vue +2 -7
- package/map/client/components/KFeaturesChart.vue +2 -6
- package/map/client/components/KFeaturesFilterEditor.vue +300 -0
- package/map/client/components/KFeaturesFilterManager.vue +196 -0
- package/map/client/components/KFeaturesTable.vue +0 -5
- package/map/client/components/KFilterCondition.vue +303 -0
- package/map/client/components/KLayerEditionToolbar.vue +4 -3
- package/map/client/components/KLayerEditor.vue +451 -36
- package/map/client/components/KMeasureTool.vue +36 -9
- package/map/client/components/KProjectMenu.vue +14 -8
- package/map/client/components/catalog/KAddLayer.vue +0 -4
- package/map/client/components/catalog/KBaseLayersSelector.vue +42 -46
- package/map/client/components/catalog/KConnectLayer.vue +295 -291
- package/map/client/components/catalog/KCreateLayer.vue +141 -146
- package/map/client/components/catalog/KCreateOfflineView.vue +100 -0
- package/map/client/components/catalog/KCreateView.vue +2 -8
- package/map/client/components/catalog/KFilteredLayerItem.vue +72 -25
- package/map/client/components/catalog/KImportLayer.vue +121 -129
- package/map/client/components/catalog/KLayerItem.vue +44 -32
- package/map/client/components/catalog/KLayersPanel.vue +45 -17
- package/map/client/components/catalog/KLayersSelector.vue +51 -50
- package/map/client/components/catalog/KProjectManager.vue +4 -8
- package/map/client/components/catalog/KProjectSelector.vue +33 -2
- package/map/client/components/catalog/KProjectsPanel.vue +84 -106
- package/map/client/components/catalog/KSelectLayers.vue +56 -69
- package/map/client/components/catalog/KSelectViews.vue +56 -69
- package/map/client/components/catalog/KViewSelector.vue +32 -2
- package/map/client/components/catalog/KViewsPanel.vue +178 -110
- package/map/client/components/catalog/KWeatherLayersSelector.vue +77 -85
- package/map/client/components/form/KLocationField.vue +21 -2
- package/map/client/components/form/KOwsLayerField.vue +1 -1
- package/map/client/components/form/KOwsServiceField.vue +102 -63
- package/map/client/components/form/KSelectLayersField.vue +1 -1
- package/map/client/components/form/KSelectViewsField.vue +1 -1
- package/map/client/components/form/KTimezoneField.vue +0 -1
- package/map/client/components/legend/KLegend.vue +4 -4
- package/map/client/components/location/KLocationCardSection.vue +16 -0
- package/map/client/components/location/KLocationMap.vue +3 -2
- package/map/client/components/location/KLocationSearch.vue +46 -8
- package/map/client/components/location/KLocationTimeLineCard.vue +25 -3
- package/map/client/components/location/KLocationTip.vue +57 -10
- package/map/client/components/selection/KFeaturesSelection.vue +71 -0
- package/map/client/components/selection/KSelectedLayerFeatures.vue +343 -0
- package/map/client/components/stickies/KAttribution.vue +115 -0
- package/map/client/components/stickies/KLevelSlider.vue +114 -0
- package/map/client/components/stickies/KNorthArrow.vue +26 -0
- package/map/client/components/stickies/KPosition.vue +103 -0
- package/map/client/components/stickies/KTarget.vue +34 -0
- package/map/client/components/styles/KLayerStyleAction.vue +58 -0
- package/map/client/components/styles/KStyleEditor.vue +273 -0
- package/map/client/components/styles/KStyleEditorSection.vue +79 -0
- package/map/client/components/styles/KStyleManager.vue +183 -0
- package/map/client/components/styles/KStylePreview.vue +64 -0
- package/map/client/components/styles/KStylePreviewItem.vue +68 -0
- package/map/client/components/styles/KStylePropertiesGroup.vue +76 -0
- package/map/client/components/styles/KStyleProperty.vue +136 -0
- package/map/client/components/styles/KStyleTip.vue +118 -0
- package/map/client/components/tools/KGeolocateTool.vue +3 -2
- package/map/client/components/tools/KSearchTool.vue +34 -6
- package/map/client/components/widget/KMapillaryViewer.vue +1 -1
- package/map/client/components/widget/KStackableTimeSeries.vue +8 -5
- package/map/client/composables/activity.js +29 -43
- package/map/client/composables/catalog.js +1 -1
- package/map/client/composables/highlight.js +117 -57
- package/map/client/composables/location.js +33 -14
- package/map/client/composables/project.js +9 -10
- package/map/client/composables/selection.js +136 -23
- package/map/client/geocoder.js +104 -0
- package/map/client/geolocation.js +1 -1
- package/map/client/globe.js +3 -0
- package/map/client/hooks/hooks.offline.js +95 -0
- package/map/client/hooks/index.js +1 -0
- package/map/client/i18n/map_en.json +159 -94
- package/map/client/i18n/map_fr.json +187 -128
- package/map/client/index.js +3 -0
- package/map/client/init.js +44 -8
- package/map/client/leaflet/BoxSelection.js +2 -2
- package/map/client/leaflet/GradientPath.js +84 -4
- package/map/client/leaflet/WindBarb.js +323 -0
- package/map/client/leaflet/utils/index.js +1 -0
- package/map/client/leaflet/utils/utils.events.js +8 -3
- package/map/client/leaflet/utils/utils.geojson.js +222 -0
- package/map/client/leaflet/utils/utils.style.js +10 -9
- package/map/client/map.js +3 -0
- package/map/client/mixins/globe/mixin.base-globe.js +151 -19
- package/map/client/mixins/globe/mixin.geojson-layers.js +208 -86
- package/map/client/mixins/globe/mixin.popup.js +3 -2
- package/map/client/mixins/globe/mixin.style.js +3 -1
- package/map/client/mixins/globe/mixin.tooltip.js +3 -2
- package/map/client/mixins/map/index.js +1 -3
- package/map/client/mixins/map/mixin.base-map.js +267 -79
- package/map/client/mixins/map/mixin.canvas-layers.js +44 -10
- package/map/client/mixins/map/mixin.edit-layers.js +142 -57
- package/map/client/mixins/map/mixin.geojson-layers.js +127 -204
- package/map/client/mixins/map/mixin.pmtiles-layers.js +24 -11
- package/map/client/mixins/map/mixin.tiled-mesh-layers.js +1 -2
- package/map/client/mixins/map/mixin.tiled-wind-layers.js +2 -1
- package/map/client/mixins/mixin.activity.js +61 -41
- package/map/client/mixins/mixin.context.js +19 -14
- package/map/client/mixins/mixin.feature-selection.js +0 -1
- package/map/client/mixins/mixin.feature-service.js +41 -59
- package/map/client/mixins/mixin.weacast.js +1 -1
- package/map/client/navigator.js +38 -0
- package/map/client/pixi-utils.js +1 -1
- package/map/client/planets.js +1 -1
- package/map/client/readers/reader.kml.js +57 -1
- package/map/client/utils/index.js +1 -0
- package/map/client/utils/utils.capture.js +10 -7
- package/map/client/utils/utils.catalog.js +2 -2
- package/map/client/utils/utils.features.js +193 -39
- package/map/client/utils/utils.js +0 -21
- package/map/client/utils/utils.layers.js +381 -4
- package/map/client/utils/utils.location.js +39 -74
- package/map/client/utils/utils.offline.js +89 -0
- package/map/client/utils/utils.style.js +133 -80
- package/map/common/geotiff-grid-source.js +2 -1
- package/map/common/permissions.js +2 -0
- package/map/common/schemas/capture.create.json +4 -4
- package/map/common/schemas/catalog.update.json +18 -2
- package/map/common/schemas/projects.create.json +2 -2
- package/map/common/schemas/projects.update.json +2 -2
- package/map/common/tms-utils.js +5 -5
- package/map/common/wcs-grid-source.js +2 -2
- package/map/common/wcs-utils.js +8 -8
- package/map/common/wfs-utils.js +10 -10
- package/map/common/wms-utils.js +7 -7
- package/map/common/wmts-utils.js +6 -6
- package/package.json +7 -4
- package/test/api/core/account.test.js +0 -72
- package/test/api/core/authentication.test.js +184 -0
- package/test/api/core/config/default.cjs +1 -3
- package/test/api/core/index.test.js +77 -151
- package/test/api/core/offline.test.js +55 -0
- package/test/api/core/push.test.js +3 -3
- package/test/api/core/{test-log-2024-11-05.log → test-log-2025-05-26.log} +1 -9
- package/test/api/map/alerts.test.js +1 -1
- package/test/api/map/config/default.cjs +2 -1
- package/test/api/map/data/vigicrues.observations.Q.json +47042 -0
- package/test/api/map/index.test.js +113 -9
- package/test/api/map/style.test.js +62 -0
- package/test/api/map/{test-log-2024-10-28.log → test-log-2025-05-26.log} +4 -3
- package/test/client/core/layout.js +2 -2
- package/test/client/core/runner.js +1 -1
- package/test/client/core/utils.js +52 -0
- package/test/client/map/catalog.js +1 -0
- package/core/api/hooks/hooks.groups.js +0 -48
- package/core/api/hooks/hooks.organisations.js +0 -152
- package/core/api/models/organisations.model.mongodb.js +0 -3
- package/core/api/models/tags.model.mongodb.js +0 -10
- package/core/api/services/groups/groups.hooks.js +0 -31
- package/core/api/services/organisations/organisations.hooks.js +0 -31
- package/core/api/services/organisations/organisations.service.js +0 -86
- package/core/api/services/tags/tags.hooks.js +0 -31
- package/core/api/utils.js +0 -11
- package/core/client/components/KChipsPane.vue +0 -103
- package/core/client/components/document/index.js +0 -9
- package/core/client/components/team/KAddMember.vue +0 -378
- package/core/client/components/team/KAddTag.vue +0 -121
- package/core/client/components/team/KChangeRole.vue +0 -118
- package/core/client/components/team/KGroupCard.vue +0 -110
- package/core/client/components/team/KGroupsActivity.vue +0 -78
- package/core/client/components/team/KJoinGroup.vue +0 -132
- package/core/client/components/team/KMemberCard.vue +0 -328
- package/core/client/components/team/KMemberFilter.vue +0 -49
- package/core/client/components/team/KMembersActivity.vue +0 -136
- package/core/client/components/team/KOrganisationsActivity.vue +0 -51
- package/core/client/components/team/KTagCard.vue +0 -72
- package/core/client/components/team/KTagsActivity.vue +0 -73
- package/core/client/components/team/index.js +0 -9
- package/core/client/mixins/mixin.base-context.js +0 -54
- package/core/client/utils/utils.platform.js +0 -12
- package/core/common/schemas/groups.create.json +0 -28
- package/core/common/schemas/groups.update.json +0 -28
- package/core/common/schemas/organisations.create.json +0 -28
- package/core/common/schemas/organisations.update.json +0 -49
- package/core/common/schemas/tags.create.json +0 -35
- package/core/common/schemas/tags.update.json +0 -35
- package/map/client/components/KAttribution.vue +0 -108
- package/map/client/components/KFeaturesFilter.vue +0 -259
- package/map/client/components/KLayerStyleEditor.vue +0 -118
- package/map/client/components/KLayerStyleForm.vue +0 -740
- package/map/client/components/KLevelSlider.vue +0 -100
- package/map/client/components/KNorth.vue +0 -31
- package/map/client/components/KPositionIndicator.vue +0 -83
- package/map/client/components/catalog/KCreateProject.vue +0 -100
- package/map/client/mixins/map/mixin.forecast-layers.js +0 -81
- package/map/client/mixins/map/mixin.georaster-layers.js +0 -107
- package/test/api/core/team.test.js +0 -670
- package/test/api/core/test-log-2023-12-19.log +0 -7
- package/test/api/core/test-log-2024-01-04.log +0 -14
- package/test/api/core/test-log-2024-05-14.log +0 -6
- package/test/api/core/test-log-2024-06-06.log +0 -23
- package/test/api/core/test-log-2024-06-26.log +0 -25
- package/test/api/core/test-log-2024-06-28.log +0 -2
- package/test/api/core/test-log-2024-07-09.log +0 -0
- package/test/api/core/test-log-2024-08-13.log +0 -69
- package/test/api/core/test-log-2024-10-28.log +0 -53
- package/test/api/core/test-log-2024-11-15.log +0 -23
- package/test/api/core/test-log-2024-11-18.log +0 -0
- package/test/api/core/test-log-2024-12-03.log +0 -30
- package/test/api/map/test-log-2023-11-24.log +0 -121
- package/test/api/map/test-log-2023-12-12.log +0 -29
- package/test/api/map/test-log-2023-12-13.log +0 -5
- package/test/api/map/test-log-2024-01-04.log +0 -2
- package/test/api/map/test-log-2024-01-11.log +0 -1
- package/test/api/map/test-log-2024-01-25.log +0 -19
- package/test/api/map/test-log-2024-06-06.log +0 -39
- package/test/api/map/test-log-2024-08-13.log +0 -13
- package/test/api/map/test-log-2024-08-20.log +0 -55
- package/test/api/map/test-log-2024-09-09.log +0 -92
- /package/extras/{logos → images}/kalisio.png +0 -0
- /package/extras/{icons → images}/target.svg +0 -0
- /package/test/api/map/data/{vigicrues.observations.json → vigicrues.observations.H.json} +0 -0
|
@@ -2,6 +2,8 @@ import _ from 'lodash'
|
|
|
2
2
|
import path from 'path'
|
|
3
3
|
import makeDebug from 'debug'
|
|
4
4
|
import { fileURLToPath } from 'url'
|
|
5
|
+
import mongodb from 'mongodb'
|
|
6
|
+
const { ObjectID } = mongodb
|
|
5
7
|
|
|
6
8
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
7
9
|
const modelsPath = path.join(__dirname, '..', 'models')
|
|
@@ -9,17 +11,44 @@ const servicesPath = path.join(__dirname, '..', 'services')
|
|
|
9
11
|
|
|
10
12
|
const debug = makeDebug('kdk:core:services')
|
|
11
13
|
|
|
12
|
-
export function
|
|
14
|
+
export function getServiceNameAndContext (servicePath) {
|
|
13
15
|
const app = this
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
// Get name from service path without api prefix
|
|
17
|
+
let name = servicePath.replace(app.get('apiPath').substring(1) + '/', '')
|
|
18
|
+
// Then without context if any
|
|
19
|
+
const lastSlash = name.lastIndexOf('/')
|
|
20
|
+
const contextId = (lastSlash >= 0 ? name.substring(0, lastSlash) : '')
|
|
21
|
+
// Check if a string is a valid MongoDB Object ID.
|
|
22
|
+
// We don't use ObjectID.isValid as it returns true for any string that contains 12 characters: https://jira.mongodb.org/browse/NODE-4912.
|
|
23
|
+
// Regular expression that checks for hex value
|
|
24
|
+
const checkForHexRegExp = /^[0-9a-fA-F]{24}$/
|
|
25
|
+
if (contextId && (contextId.length === 24) && checkForHexRegExp.test(contextId)) {
|
|
26
|
+
name = name.replace(contextId + '/', '')
|
|
27
|
+
return { name, contextId }
|
|
28
|
+
} else {
|
|
29
|
+
return { name }
|
|
30
|
+
}
|
|
18
31
|
}
|
|
19
32
|
|
|
20
|
-
export function
|
|
33
|
+
export function decorateDistributedService (service) {
|
|
21
34
|
const app = this
|
|
22
|
-
|
|
35
|
+
// Remote service are registered according to their path, ie with API prefix (but without trailing /)
|
|
36
|
+
const remoteService = app.service(service.path)
|
|
37
|
+
const { name, contextId } = getServiceNameAndContext.call(app, service.path)
|
|
38
|
+
remoteService.name = name
|
|
39
|
+
remoteService.context = contextId
|
|
40
|
+
// As remote services have no context, from the internal point of view path = name
|
|
41
|
+
// Unfortunately this property is already set and used by feathers-distributed and should not be altered
|
|
42
|
+
// remoteService.path = name
|
|
43
|
+
remoteService.app = app
|
|
44
|
+
remoteService.getPath = function (withApiPrefix) {
|
|
45
|
+
const path = (contextId ? contextId + '/' + name : name)
|
|
46
|
+
return (withApiPrefix ? app.get('apiPath') + '/' + path : path)
|
|
47
|
+
}
|
|
48
|
+
remoteService.getContextId = function () {
|
|
49
|
+
return contextId
|
|
50
|
+
}
|
|
51
|
+
return remoteService
|
|
23
52
|
}
|
|
24
53
|
|
|
25
54
|
export function createStorageService (options = {}) {
|
|
@@ -64,48 +93,17 @@ export function removeDatabasesService (options = {}) {
|
|
|
64
93
|
return app.removeService(app.getService('databases', options.context))
|
|
65
94
|
}
|
|
66
95
|
|
|
67
|
-
export async function createOrganisationService (options = {}) {
|
|
68
|
-
const app = this
|
|
69
|
-
|
|
70
|
-
// Create services to manage MongoDB databases, organisations, etc.
|
|
71
|
-
await createDatabasesService.call(app)
|
|
72
|
-
const orgsService = await app.createService('organisations', { modelsPath, servicesPath })
|
|
73
|
-
|
|
74
|
-
// Replication management
|
|
75
|
-
const usersService = app.getService('users')
|
|
76
|
-
const authorisationsService = app.getService('authorisations')
|
|
77
|
-
// Ensure permissions are correctly distributed when replicated
|
|
78
|
-
usersService.on('patched', user => {
|
|
79
|
-
// Patching profile should not trigger abilities update since
|
|
80
|
-
// it is a perspective and permissions are not available in this case
|
|
81
|
-
// Updating abilities in this case will result in loosing permissions for orgs/groups as none are available
|
|
82
|
-
if (_.has(user, 'organisations') || _.has(user, 'groups')) authorisationsService.updateAbilities(user)
|
|
83
|
-
})
|
|
84
|
-
// Ensure org services are correctly distributed when replicated
|
|
85
|
-
orgsService.on('created', organisation => {
|
|
86
|
-
// Check if already done (initiator)
|
|
87
|
-
const orgMembersService = app.getService('members', organisation)
|
|
88
|
-
if (!orgMembersService) {
|
|
89
|
-
// Jump from infos/stats to real DB object
|
|
90
|
-
const db = app.db.client.db(organisation._id.toString())
|
|
91
|
-
orgsService.createOrganisationServices(organisation, db)
|
|
92
|
-
}
|
|
93
|
-
})
|
|
94
|
-
orgsService.on('removed', organisation => {
|
|
95
|
-
// Check if already done (initiator)
|
|
96
|
-
const orgMembersService = app.getService('members', organisation)
|
|
97
|
-
if (!orgMembersService) return
|
|
98
|
-
orgsService.removeOrganisationServices(organisation)
|
|
99
|
-
})
|
|
100
|
-
return orgsService
|
|
101
|
-
}
|
|
102
|
-
|
|
103
96
|
export default async function () {
|
|
104
97
|
const app = this
|
|
105
98
|
|
|
106
99
|
const authConfig = app.get('authentication')
|
|
107
100
|
if (authConfig) {
|
|
108
|
-
await app.createService('users', {
|
|
101
|
+
await app.createService('users', {
|
|
102
|
+
modelsPath,
|
|
103
|
+
servicesPath,
|
|
104
|
+
methods: ['create', 'get', 'find', 'update', 'patch', 'remove', 'logout'],
|
|
105
|
+
events: ['logout']
|
|
106
|
+
})
|
|
109
107
|
debug('\'users\' service created')
|
|
110
108
|
await app.createService('account', {
|
|
111
109
|
servicesPath,
|
|
@@ -137,12 +135,6 @@ export default async function () {
|
|
|
137
135
|
debug('\'messages\' service created')
|
|
138
136
|
}
|
|
139
137
|
|
|
140
|
-
const orgConfig = app.get('organisations')
|
|
141
|
-
if (orgConfig) {
|
|
142
|
-
await createOrganisationService.call(app)
|
|
143
|
-
debug('\'organisations\' service created')
|
|
144
|
-
}
|
|
145
|
-
|
|
146
138
|
const mailerConfig = app.get('mailer')
|
|
147
139
|
if (mailerConfig) {
|
|
148
140
|
await app.createService('mailer', { servicesPath })
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import fuzzySearch from 'feathers-mongodb-fuzzy-search'
|
|
2
1
|
import commonHooks from 'feathers-hooks-common'
|
|
3
|
-
import
|
|
2
|
+
import fuzzySearch from 'feathers-mongodb-fuzzy-search'
|
|
3
|
+
import { diacriticSearch, marshallComparisonQuery } from '../../hooks/index.js'
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
before: {
|
|
7
7
|
all: [],
|
|
8
8
|
find: [
|
|
9
9
|
fuzzySearch({ fields: ['title', 'body', 'author'] }),
|
|
10
|
-
diacriticSearch()
|
|
10
|
+
diacriticSearch(),
|
|
11
|
+
marshallComparisonQuery
|
|
11
12
|
],
|
|
12
13
|
get: [],
|
|
13
14
|
create: [commonHooks.setNow('createdAt')],
|
|
@@ -56,9 +56,10 @@ export default {
|
|
|
56
56
|
],
|
|
57
57
|
find: [],
|
|
58
58
|
get: [],
|
|
59
|
-
create: [updateAbilities()],
|
|
60
|
-
update: [],
|
|
61
|
-
|
|
59
|
+
create: [updateAbilities({ subjectAsItem: true })],
|
|
60
|
+
update: [updateAbilities({ subjectAsItem: true })],
|
|
61
|
+
// Fetch user in this case as we might only have partial data and miss permission properties
|
|
62
|
+
patch: [updateAbilities({ subjectAsItem: true, fetchSubject: true }), sendNewSubscriptionEmail],
|
|
62
63
|
remove: []
|
|
63
64
|
},
|
|
64
65
|
|
package/core/client/api.js
CHANGED
|
@@ -6,21 +6,42 @@ import jwtdecode from 'jwt-decode'
|
|
|
6
6
|
import feathers from '@feathersjs/client'
|
|
7
7
|
import { io } from 'socket.io-client'
|
|
8
8
|
import reactive from 'feathers-reactive/dist/feathers-reactive.js'
|
|
9
|
+
import createOfflineService from '@kalisio/feathers-localforage'
|
|
9
10
|
import configuration from 'config'
|
|
10
11
|
import { permissions } from '../common/index.js'
|
|
11
12
|
import { Store } from './store.js'
|
|
13
|
+
import { LocalCache } from './local-cache.js'
|
|
12
14
|
import { Events } from './events.js'
|
|
15
|
+
import * as hooks from './hooks/index.js'
|
|
16
|
+
import { makeServiceSnapshot } from '../common/utils.js'
|
|
13
17
|
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
logger.setLevel(_.get(configuration, 'logs.level'), false)
|
|
17
|
-
} else {
|
|
18
|
-
logger.setLevel('info')
|
|
19
|
-
}
|
|
18
|
+
// Disable default feathers behavior of re-authenticating on disconnect
|
|
19
|
+
feathers.authentication.AuthenticationClient.prototype.handleSocket = () => {}
|
|
20
20
|
|
|
21
|
-
export function createClient (config) {
|
|
21
|
+
export async function createClient (config) {
|
|
22
|
+
// Setup log level
|
|
23
|
+
if (_.get(configuration, 'logs.level')) {
|
|
24
|
+
logger.setLevel(_.get(configuration, 'logs.level'), false)
|
|
25
|
+
} else {
|
|
26
|
+
logger.setLevel('info')
|
|
27
|
+
}
|
|
22
28
|
// Initiate the client
|
|
23
29
|
const api = feathers()
|
|
30
|
+
// Initialize connection state/listeners
|
|
31
|
+
api.isDisconnected = !navigator.onLine
|
|
32
|
+
addEventListener('online', () => {
|
|
33
|
+
api.isDisconnected = false
|
|
34
|
+
Events.emit('navigator-reconnected', api)
|
|
35
|
+
})
|
|
36
|
+
addEventListener('offline', () => {
|
|
37
|
+
api.isDisconnected = true
|
|
38
|
+
Events.emit('navigator-disconnected', api)
|
|
39
|
+
})
|
|
40
|
+
// This can force to use offline services it they exist even if connected
|
|
41
|
+
api.useLocalFirst = config.useLocalFirst
|
|
42
|
+
api.setLocalFirstEnabled = function (enabled) {
|
|
43
|
+
api.useLocalFirst = enabled
|
|
44
|
+
}
|
|
24
45
|
|
|
25
46
|
// Matchers that can be added to customize route guards
|
|
26
47
|
let matchers = []
|
|
@@ -55,87 +76,148 @@ export function createClient (config) {
|
|
|
55
76
|
api.matcher = siftMatcher
|
|
56
77
|
|
|
57
78
|
// This avoid managing the API path before each service name
|
|
58
|
-
// If a context is not given it will be retrieved from the store if any and used for contextual services
|
|
59
79
|
api.getServicePath = function (name, context, withApiPrefix = true) {
|
|
60
|
-
|
|
61
|
-
let path
|
|
62
|
-
|
|
63
|
-
if (!options.context) {
|
|
64
|
-
path = name
|
|
65
|
-
} else {
|
|
80
|
+
// Defaults to global service path on "nil" context
|
|
81
|
+
let path = name
|
|
82
|
+
if (!_.isEmpty(context)) {
|
|
66
83
|
// Context is given as string ID or object ?
|
|
67
84
|
if (typeof context === 'string') {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (context && context._id) path = context._id + '/' + name
|
|
73
|
-
// Force global context on empty object
|
|
74
|
-
else path = name
|
|
75
|
-
} else {
|
|
76
|
-
// Otherwise test for current context as service is registered as contextual
|
|
77
|
-
const context = Store.get('context')
|
|
78
|
-
if (context) {
|
|
79
|
-
path = api.getServicePath(name, context, false)
|
|
80
|
-
} else {
|
|
81
|
-
// Because it could also be registered as global with the same name fallback
|
|
82
|
-
path = name
|
|
83
|
-
}
|
|
85
|
+
// 'global' keyword is to get the global service
|
|
86
|
+
if (context !== 'global') path = context + '/' + name
|
|
87
|
+
} else if (context._id) {
|
|
88
|
+
path = context._id + '/' + name
|
|
84
89
|
}
|
|
85
90
|
}
|
|
86
|
-
|
|
87
91
|
if (withApiPrefix) {
|
|
88
92
|
path = config.apiPath + '/' + path
|
|
89
93
|
}
|
|
94
|
+
// Take care that feathers strip slashes
|
|
95
|
+
if (path.startsWith('/')) path = path.substr(1)
|
|
90
96
|
return path
|
|
91
97
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
// If no context is given the current from the store will be retrieved (if any)
|
|
99
|
+
// and the associated contextual service returned (if any)
|
|
100
|
+
api.getServiceInstance = function (name, context, options = {}) {
|
|
101
|
+
// Depending on the create option we don't directly use service() here
|
|
102
|
+
// as it will automatically create a new service wrapper even if it does not exist
|
|
103
|
+
let service
|
|
104
|
+
// If a context is given use it
|
|
105
|
+
if (!_.isEmpty(context)) {
|
|
106
|
+
const servicePath = api.getServicePath(name, context)
|
|
107
|
+
service = (options.create ? api.service(servicePath) : api.services[servicePath])
|
|
108
|
+
} else { // Otherwise check for a potential current context to be used
|
|
109
|
+
const currentContext = Store.get('context')
|
|
110
|
+
const contextualPath = api.getServicePath(name, currentContext)
|
|
111
|
+
const contextualService = api.services[contextualPath]
|
|
112
|
+
const globalPath = api.getServicePath(name)
|
|
113
|
+
const globalService = api.services[globalPath]
|
|
114
|
+
// If one of the service do exist use it, contextual one first
|
|
115
|
+
service = contextualService || globalService
|
|
116
|
+
// Otherwise as a fallback create a new global service as we don't really know if context should apply,
|
|
117
|
+
// if so the app should declare it upfront
|
|
118
|
+
if (!service && options.create) {
|
|
119
|
+
service = api.service(globalPath)
|
|
120
|
+
}
|
|
97
121
|
}
|
|
98
|
-
// Store the path on first call
|
|
99
|
-
if (!service.path) service.path = path
|
|
100
122
|
return service
|
|
101
123
|
}
|
|
102
|
-
//
|
|
103
|
-
api.
|
|
104
|
-
|
|
124
|
+
// Check if an online, ie "standard", version of a service is available
|
|
125
|
+
api.getOnlineService = function (name, context, options = {}) {
|
|
126
|
+
return api.getServiceInstance(name, context, Object.assign({ create: true }, options))
|
|
105
127
|
}
|
|
106
|
-
|
|
107
|
-
|
|
128
|
+
// Check if an offline version of a service is available
|
|
129
|
+
api.getOfflineService = function (name, context, options = {}) {
|
|
130
|
+
return api.getServiceInstance(`${name}-offline`, context, Object.assign({ create: false }, options))
|
|
131
|
+
}
|
|
132
|
+
api.getService = function (name, context, options = {}) {
|
|
133
|
+
let service
|
|
134
|
+
// When offline try to use offline service version if any
|
|
135
|
+
if (api.isDisconnected || api.useLocalFirst) {
|
|
136
|
+
service = api.getOfflineService(name, context, options)
|
|
137
|
+
// In local first mode we allow to use remote service if offline one doesn't exist
|
|
138
|
+
if (!service && !api.useLocalFirst) {
|
|
139
|
+
// Do not throw as a lot of components expect services to be available at initialization, eg
|
|
140
|
+
// api.getService('xxx').on('event', () => ...)
|
|
141
|
+
// In this case we simply warn and return the wrapper to the online service.
|
|
142
|
+
// However, it is up to the application to make sure of not using such components when offline
|
|
143
|
+
// throw new Error('Cannot retrieve offline service ' + name + ' for context ' + (typeof context === 'object' ? context._id : context))
|
|
144
|
+
logger.warn('[KDK] Cannot retrieve offline service ' + name + ' for context ' + (typeof context === 'object' ? context._id : context))
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (!service) {
|
|
148
|
+
service = api.getOnlineService(name, context, options)
|
|
149
|
+
if (!service) {
|
|
150
|
+
throw new Error('Cannot retrieve service ' + name + ' for context ' + (typeof context === 'object' ? context._id : context))
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return service
|
|
108
154
|
}
|
|
109
155
|
// Used to create a frontend only service with its options
|
|
110
156
|
api.createService = function (name, options = {}) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (options.context) {
|
|
114
|
-
contextId = (typeof options.context === 'object' ? options.context._id : options.context)
|
|
115
|
-
servicePath = contextId + '/' + servicePath
|
|
116
|
-
}
|
|
117
|
-
servicePath = config.apiPath + '/' + servicePath
|
|
118
|
-
if (servicePath.startsWith('/')) servicePath = servicePath.substr(1)
|
|
119
|
-
api.declareService(name, options)
|
|
157
|
+
const servicePath = api.getServicePath(name, options.context)
|
|
158
|
+
// Service object/constructor fucntion provided ?
|
|
120
159
|
let service = options.service
|
|
121
160
|
// If we get a function try to call it assuming it will return the service object
|
|
122
161
|
if (typeof service === 'function') {
|
|
123
162
|
service = service(name, api, options)
|
|
124
163
|
}
|
|
125
|
-
//
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
})
|
|
130
|
-
} else {
|
|
131
|
-
api.use(servicePath, service)
|
|
132
|
-
}
|
|
164
|
+
// Otherwise initialize a default wrapper
|
|
165
|
+
if (!service) service = api.transporter.service(servicePath)
|
|
166
|
+
// Register service up-front (required for custom methods)
|
|
167
|
+
api.use(servicePath, service, options)
|
|
133
168
|
service = api.service(servicePath)
|
|
134
169
|
if (options.hooks) service.hooks(options.hooks)
|
|
135
170
|
if (options.context) service.context = options.context
|
|
171
|
+
service.path = servicePath
|
|
136
172
|
return service
|
|
137
173
|
}
|
|
138
|
-
//
|
|
174
|
+
// Used to create a frontend only service to be used in offline mode
|
|
175
|
+
// based on an online service name, will snapshot service data by default
|
|
176
|
+
api.createOfflineService = async function (serviceName, options = {}) {
|
|
177
|
+
const offlineServiceName = `${serviceName}-offline`
|
|
178
|
+
let offlineService = api.getOfflineService(serviceName)
|
|
179
|
+
|
|
180
|
+
if (!offlineService) {
|
|
181
|
+
// Pass options not used internally for offline management as service options and store it along with service
|
|
182
|
+
const serviceOptions = _.omit(options, ['hooks', 'snapshot', 'clear', 'baseQuery', 'baseQueries', 'dataPath'])
|
|
183
|
+
const services = await LocalCache.getItem('services') || {}
|
|
184
|
+
_.set(services, serviceName, serviceOptions)
|
|
185
|
+
await LocalCache.setItem('services', services)
|
|
186
|
+
offlineService = api.createService(offlineServiceName, {
|
|
187
|
+
service: createOfflineService({
|
|
188
|
+
id: '_id',
|
|
189
|
+
name: 'offline_services',
|
|
190
|
+
storeName: serviceName,
|
|
191
|
+
multi: true,
|
|
192
|
+
storage: ['IndexedDB'],
|
|
193
|
+
// FIXME: this should not be hard-coded as it depends on the service
|
|
194
|
+
// For now we set it at the max value but if a component
|
|
195
|
+
// does not explicitly set the limit it will get a lot of data
|
|
196
|
+
paginate: { default: 5000, max: 5000 }
|
|
197
|
+
}),
|
|
198
|
+
// Set required default hooks
|
|
199
|
+
hooks: _.defaultsDeep(_.get(options, 'hooks'), {
|
|
200
|
+
before: {
|
|
201
|
+
all: [hooks.ensureSerializable, hooks.removeServerSideParameters],
|
|
202
|
+
create: [hooks.generateId]
|
|
203
|
+
}
|
|
204
|
+
}),
|
|
205
|
+
...serviceOptions
|
|
206
|
+
})
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (_.get(options, 'snapshot', true)) {
|
|
210
|
+
const service = api.getOnlineService(serviceName)
|
|
211
|
+
await makeServiceSnapshot(service, Object.assign({ offlineService }, options))
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return offlineService
|
|
215
|
+
}
|
|
216
|
+
api.removeService = function (name, context) {
|
|
217
|
+
const path = api.getServicePath(name, context)
|
|
218
|
+
api.unuse(path)
|
|
219
|
+
}
|
|
220
|
+
// Helper functions to access/alter config used at creation time
|
|
139
221
|
api.getConfig = function (path) {
|
|
140
222
|
return (path ? _.get(config, path) : config)
|
|
141
223
|
}
|
|
@@ -171,9 +253,9 @@ export function createClient (config) {
|
|
|
171
253
|
if (_.has(resource, 'abilities')) resource = undefined
|
|
172
254
|
|
|
173
255
|
const abilities = (hasUser ? _.get(user, 'abilities') : Store.get('user.abilities'))
|
|
174
|
-
logger.debug('Check for abilities ', operation, service, context, resource, abilities)
|
|
256
|
+
logger.debug('[KDK] Check for abilities ', operation, service, context, resource, abilities)
|
|
175
257
|
if (!abilities) {
|
|
176
|
-
logger.debug('Access denied without abilities')
|
|
258
|
+
logger.debug('[KDK] Access denied without abilities')
|
|
177
259
|
return false
|
|
178
260
|
}
|
|
179
261
|
let result
|
|
@@ -183,7 +265,7 @@ export function createClient (config) {
|
|
|
183
265
|
const path = api.getServicePath(service, context, false)
|
|
184
266
|
result = permissions.hasServiceAbilities(abilities, path)
|
|
185
267
|
if (!result) {
|
|
186
|
-
logger.debug('Access to service path ' + path + ' denied')
|
|
268
|
+
logger.debug('[KDK] Access to service path ' + path + ' denied')
|
|
187
269
|
return false
|
|
188
270
|
} else if (operation === 'service') {
|
|
189
271
|
// When we only check for service-level access return
|
|
@@ -195,9 +277,9 @@ export function createClient (config) {
|
|
|
195
277
|
result = abilities.can(operation)
|
|
196
278
|
}
|
|
197
279
|
if (!result) {
|
|
198
|
-
logger.debug('Access to resource denied')
|
|
280
|
+
logger.debug('[KDK] Access to resource denied')
|
|
199
281
|
} else {
|
|
200
|
-
logger.debug('Access to resource granted')
|
|
282
|
+
logger.debug('[KDK] Access to resource granted')
|
|
201
283
|
}
|
|
202
284
|
return result
|
|
203
285
|
}
|
|
@@ -215,6 +297,21 @@ export function createClient (config) {
|
|
|
215
297
|
api.configure(api.transporter)
|
|
216
298
|
// Retrieve our specific errors on rate-limiting
|
|
217
299
|
api.socket.on('rate-limit', (error) => Events.emit('error', error))
|
|
300
|
+
// Disable default socketio behavior of buffering messages when disconnected
|
|
301
|
+
// Also keep track of connection state with the server
|
|
302
|
+
api.socket.io.on('reconnect', async () => {
|
|
303
|
+
api.isDisconnected = false
|
|
304
|
+
api.socket.sendBuffer = []
|
|
305
|
+
// Re-authenticate on reconnect
|
|
306
|
+
await api.reAuthenticate(true)
|
|
307
|
+
Events.emit('websocket-reconnected', api)
|
|
308
|
+
logger.info('[KDK] Socket has been reconnected')
|
|
309
|
+
})
|
|
310
|
+
api.socket.io.on('reconnect_error', () => {
|
|
311
|
+
api.isDisconnected = true
|
|
312
|
+
Events.emit('websocket-disconnected', api)
|
|
313
|
+
logger.error(new Error('[KDK] Socket has been disconnected'))
|
|
314
|
+
})
|
|
218
315
|
}
|
|
219
316
|
api.configure(feathers.authentication({
|
|
220
317
|
storage: window.localStorage,
|
|
@@ -243,8 +340,6 @@ export function createClient (config) {
|
|
|
243
340
|
if (_.get(config, 'renewJwt', true)) {
|
|
244
341
|
api.on('login', api.renewJwtOnExpiration)
|
|
245
342
|
}
|
|
246
|
-
// Object used to store configuration options for services
|
|
247
|
-
api.serviceOptions = {}
|
|
248
343
|
// Override Feathers configure that do not manage async operations,
|
|
249
344
|
// here we also simply call the function given as parameter but await for it
|
|
250
345
|
api.configure = async function (fn) {
|
|
@@ -255,16 +350,32 @@ export function createClient (config) {
|
|
|
255
350
|
// Define domain in config if not forced
|
|
256
351
|
if (!api.getConfig('domain')) api.setConfig('domain', window.location.origin)
|
|
257
352
|
|
|
353
|
+
// It appears that navigator.onLine is not reliable so that
|
|
354
|
+
// we perform an actual request to the domain in order to ensure we are online.
|
|
355
|
+
// We avoid CORS errors with a request to your own origin.
|
|
356
|
+
// We also add a random query parameter to prevent cached responses.
|
|
357
|
+
if (!api.isDisconnected) {
|
|
358
|
+
try {
|
|
359
|
+
const url = new URL(api.getConfig('domain'))
|
|
360
|
+
url.searchParams.set('random', Math.random().toFixed(18).substring(2, 18))
|
|
361
|
+
await window.fetch(url.toString(), { method: 'HEAD' })
|
|
362
|
+
} catch (error) {
|
|
363
|
+
api.isDisconnected = true
|
|
364
|
+
Events.emit('navigator-disconnected', api)
|
|
365
|
+
logger.warn(`[KDK] Cannot request target domain ${api.getConfig('domain')}, setting state to offline`, error)
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
258
369
|
return api
|
|
259
370
|
}
|
|
260
371
|
|
|
261
372
|
// We don't create a default client based on app configuration here
|
|
262
373
|
// as we don't know when the file will be imported first,
|
|
263
374
|
// eg it might be imported before another one updating the config.
|
|
264
|
-
// It is up to the application to
|
|
375
|
+
// It is up to the application to instantiate the client when required.
|
|
265
376
|
export let api
|
|
266
|
-
export function initializeApi (fn) {
|
|
267
|
-
api = createClient(configuration)
|
|
377
|
+
export async function initializeApi (fn) {
|
|
378
|
+
api = await createClient(configuration)
|
|
268
379
|
if (fn) fn.call(api, configuration)
|
|
269
380
|
return api
|
|
270
381
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
import logger from 'loglevel'
|
|
3
|
+
import config from 'config'
|
|
4
|
+
|
|
5
|
+
export const Broadcaster = {
|
|
6
|
+
initialize () {
|
|
7
|
+
this.channelName = _.get(config, 'appSlug', _.kebabCase(_.get(config, 'appName', 'kdk')))
|
|
8
|
+
this.channel = new BroadcastChannel(this.channelName)
|
|
9
|
+
logger.debug(`[KDK] Broadcaster initialized with channel '${this.channelName}'`)
|
|
10
|
+
},
|
|
11
|
+
getChannelName () {
|
|
12
|
+
return this.channelName
|
|
13
|
+
},
|
|
14
|
+
getChannel () {
|
|
15
|
+
return this.channel
|
|
16
|
+
},
|
|
17
|
+
post (message) {
|
|
18
|
+
this.channel.postMessage(message)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
import _ from 'lodash'
|
|
2
2
|
import logger from 'loglevel'
|
|
3
3
|
import config from 'config'
|
|
4
|
+
import { LocalCache } from './local-cache.js'
|
|
4
5
|
import { api } from './api.js'
|
|
5
6
|
import { Store } from './store.js'
|
|
6
7
|
|
|
7
8
|
// Export singleton
|
|
8
9
|
export const Capabilities = {
|
|
9
10
|
async initialize () {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// If browser has detected an offline state then go for cached data
|
|
12
|
+
if (api.isDisconnected || api.useLocalFirst) {
|
|
13
|
+
this.content = await LocalCache.getItem('capabilities')
|
|
14
|
+
}
|
|
15
|
+
if (!this.content) {
|
|
16
|
+
// Otherwise try to fetch capabilities from server
|
|
17
|
+
const capabilities = await window.fetch(api.getConfig('domain') + _.get(config, 'apiPath') + '/capabilities')
|
|
18
|
+
this.content = await capabilities.json()
|
|
19
|
+
// Store latest capabilities data for offline mode
|
|
20
|
+
await LocalCache.setItem('capabilities', this.content)
|
|
21
|
+
}
|
|
22
|
+
logger.debug('[KDK] Capabilities initialized with content:', this.content)
|
|
23
|
+
if (!this.content) return
|
|
14
24
|
// Backend might override some defaults in client config
|
|
15
|
-
_.forOwn(_.pick(content, ['gateway']), (value, key) => {
|
|
25
|
+
_.forOwn(_.pick(this.content, ['gateway']), (value, key) => {
|
|
16
26
|
api.setConfig(key, value)
|
|
17
27
|
})
|
|
18
28
|
// Used to ensure backward compatibility
|
|
19
|
-
Store.set('capabilities.api', content)
|
|
29
|
+
Store.set('capabilities.api', this.content)
|
|
20
30
|
Store.set('capabilities.client', _.pick(config, ['version', 'buildNumber']))
|
|
21
31
|
},
|
|
22
32
|
get (key, defaultValue) {
|
|
23
|
-
if (!this.content) logger.error(new Error('Capabilities must be initialized first'))
|
|
33
|
+
if (!this.content) logger.error(new Error('[KDK] Capabilities must be initialized first'))
|
|
24
34
|
else return _.get(this.content, key, defaultValue)
|
|
25
35
|
}
|
|
26
36
|
}
|