@kalisio/kdk 2.5.2 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/client/components/input/KShapePicker.vue +4 -4
- package/coverage/core/api/application.js.html +344 -344
- package/coverage/core/api/authentication.js.html +79 -79
- package/coverage/core/api/db.js.html +167 -167
- package/coverage/core/api/hooks/hooks.authentication.js.html +12 -12
- package/coverage/core/api/hooks/hooks.authorisations.js.html +166 -163
- package/coverage/core/api/hooks/hooks.groups.js.html +1 -1
- package/coverage/core/api/hooks/hooks.logger.js.html +18 -18
- package/coverage/core/api/hooks/hooks.model.js.html +280 -268
- package/coverage/core/api/hooks/hooks.organisations.js.html +1 -1
- package/coverage/core/api/hooks/hooks.push.js.html +12 -12
- package/coverage/core/api/hooks/hooks.query.js.html +92 -92
- package/coverage/core/api/hooks/hooks.schemas.js.html +13 -13
- package/coverage/core/api/hooks/hooks.service.js.html +28 -28
- package/coverage/core/api/hooks/hooks.storage.js.html +7 -7
- package/coverage/core/api/hooks/hooks.users.js.html +48 -48
- package/coverage/core/api/hooks/index.html +49 -49
- package/coverage/core/api/hooks/index.js.html +11 -11
- package/coverage/core/api/index.html +42 -42
- package/coverage/core/api/index.js.html +22 -22
- package/coverage/core/api/marshall.js.html +127 -127
- package/coverage/core/api/models/groups.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/index.html +1 -1
- package/coverage/core/api/models/messages.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/organisations.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/tags.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/users.model.mongodb.js.html +11 -11
- package/coverage/core/api/services/account/account.hooks.js.html +42 -42
- package/coverage/core/api/services/account/account.service.js.html +34 -34
- package/coverage/core/api/services/account/index.html +1 -1
- package/coverage/core/api/services/authorisations/authorisations.hooks.js.html +34 -34
- package/coverage/core/api/services/authorisations/authorisations.service.js.html +108 -120
- package/coverage/core/api/services/authorisations/index.html +19 -19
- package/coverage/core/api/services/databases/databases.hooks.js.html +1 -1
- package/coverage/core/api/services/databases/databases.service.js.html +1 -1
- package/coverage/core/api/services/databases/index.html +1 -1
- package/coverage/core/api/services/groups/groups.hooks.js.html +1 -1
- package/coverage/core/api/services/groups/index.html +1 -1
- package/coverage/core/api/services/import-export/import-export.hooks.js.html +1 -1
- package/coverage/core/api/services/import-export/import-export.service.js.html +1 -1
- package/coverage/core/api/services/import-export/index.html +1 -1
- package/coverage/core/api/services/index.html +15 -15
- package/coverage/core/api/services/index.js.html +97 -85
- package/coverage/core/api/services/mailer/index.html +1 -1
- package/coverage/core/api/services/mailer/mailer.hooks.js.html +1 -1
- package/coverage/core/api/services/mailer/mailer.service.js.html +1 -1
- package/coverage/core/api/services/messages/index.html +5 -5
- package/coverage/core/api/services/messages/messages.hooks.js.html +11 -8
- package/coverage/core/api/services/organisations/index.html +1 -1
- package/coverage/core/api/services/organisations/organisations.hooks.js.html +1 -1
- package/coverage/core/api/services/organisations/organisations.service.js.html +1 -1
- package/coverage/core/api/services/push/index.html +1 -1
- package/coverage/core/api/services/push/push.hooks.js.html +1 -1
- package/coverage/core/api/services/push/push.service.js.html +1 -1
- package/coverage/core/api/services/storage/index.html +1 -1
- package/coverage/core/api/services/storage/storage.hooks.js.html +36 -36
- package/coverage/core/api/services/storage/storage.service.js.html +30 -30
- package/coverage/core/api/services/tags/index.html +1 -1
- package/coverage/core/api/services/tags/tags.hooks.js.html +1 -1
- package/coverage/core/api/services/users/index.html +7 -7
- package/coverage/core/api/services/users/users.hooks.js.html +83 -80
- package/coverage/core/api/services/users/users.service.js.html +4 -4
- package/coverage/core/api/utils.js.html +1 -1
- package/coverage/core/common/errors.js.html +2 -2
- package/coverage/core/common/index.html +30 -30
- package/coverage/core/common/index.js.html +11 -11
- package/coverage/core/common/permissions.js.html +187 -187
- package/coverage/core/common/schema.js.html +26 -26
- package/coverage/core/common/utils.js.html +61 -61
- package/coverage/core/common/utils.offline.js.html +6 -6
- package/coverage/index.html +179 -164
- package/coverage/lcov-report/core/api/application.js.html +344 -344
- package/coverage/lcov-report/core/api/authentication.js.html +79 -79
- package/coverage/lcov-report/core/api/db.js.html +167 -167
- package/coverage/lcov-report/core/api/hooks/hooks.authentication.js.html +12 -12
- package/coverage/lcov-report/core/api/hooks/hooks.authorisations.js.html +166 -163
- package/coverage/lcov-report/core/api/hooks/hooks.groups.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.logger.js.html +18 -18
- package/coverage/lcov-report/core/api/hooks/hooks.model.js.html +280 -268
- package/coverage/lcov-report/core/api/hooks/hooks.organisations.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.push.js.html +12 -12
- package/coverage/lcov-report/core/api/hooks/hooks.query.js.html +92 -92
- package/coverage/lcov-report/core/api/hooks/hooks.schemas.js.html +13 -13
- package/coverage/lcov-report/core/api/hooks/hooks.service.js.html +28 -28
- package/coverage/lcov-report/core/api/hooks/hooks.storage.js.html +7 -7
- package/coverage/lcov-report/core/api/hooks/hooks.users.js.html +48 -48
- package/coverage/lcov-report/core/api/hooks/index.html +49 -49
- package/coverage/lcov-report/core/api/hooks/index.js.html +11 -11
- package/coverage/lcov-report/core/api/index.html +42 -42
- package/coverage/lcov-report/core/api/index.js.html +22 -22
- package/coverage/lcov-report/core/api/marshall.js.html +127 -127
- package/coverage/lcov-report/core/api/models/groups.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/index.html +1 -1
- package/coverage/lcov-report/core/api/models/messages.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/organisations.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/tags.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/users.model.mongodb.js.html +11 -11
- package/coverage/lcov-report/core/api/services/account/account.hooks.js.html +42 -42
- package/coverage/lcov-report/core/api/services/account/account.service.js.html +34 -34
- package/coverage/lcov-report/core/api/services/account/index.html +1 -1
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.hooks.js.html +34 -34
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.service.js.html +108 -120
- package/coverage/lcov-report/core/api/services/authorisations/index.html +19 -19
- package/coverage/lcov-report/core/api/services/databases/databases.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/databases/databases.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/databases/index.html +1 -1
- package/coverage/lcov-report/core/api/services/groups/groups.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/groups/index.html +1 -1
- package/coverage/lcov-report/core/api/services/import-export/import-export.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/import-export/import-export.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/import-export/index.html +1 -1
- package/coverage/lcov-report/core/api/services/index.html +15 -15
- package/coverage/lcov-report/core/api/services/index.js.html +97 -85
- package/coverage/lcov-report/core/api/services/mailer/index.html +1 -1
- package/coverage/lcov-report/core/api/services/mailer/mailer.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/mailer/mailer.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/messages/index.html +5 -5
- package/coverage/lcov-report/core/api/services/messages/messages.hooks.js.html +11 -8
- package/coverage/lcov-report/core/api/services/organisations/index.html +1 -1
- package/coverage/lcov-report/core/api/services/organisations/organisations.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/organisations/organisations.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/push/index.html +1 -1
- package/coverage/lcov-report/core/api/services/push/push.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/push/push.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/storage/index.html +1 -1
- package/coverage/lcov-report/core/api/services/storage/storage.hooks.js.html +36 -36
- package/coverage/lcov-report/core/api/services/storage/storage.service.js.html +30 -30
- package/coverage/lcov-report/core/api/services/tags/index.html +1 -1
- package/coverage/lcov-report/core/api/services/tags/tags.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/users/index.html +7 -7
- package/coverage/lcov-report/core/api/services/users/users.hooks.js.html +83 -80
- package/coverage/lcov-report/core/api/services/users/users.service.js.html +4 -4
- package/coverage/lcov-report/core/api/utils.js.html +1 -1
- package/coverage/lcov-report/core/common/errors.js.html +2 -2
- package/coverage/lcov-report/core/common/index.html +30 -30
- package/coverage/lcov-report/core/common/index.js.html +11 -11
- package/coverage/lcov-report/core/common/permissions.js.html +187 -187
- package/coverage/lcov-report/core/common/schema.js.html +26 -26
- package/coverage/lcov-report/core/common/utils.js.html +61 -61
- package/coverage/lcov-report/core/common/utils.offline.js.html +6 -6
- package/coverage/lcov-report/index.html +179 -164
- package/coverage/lcov-report/map/api/hooks/hooks.catalog.js.html +348 -258
- package/coverage/lcov-report/map/api/hooks/hooks.features.js.html +218 -218
- package/coverage/lcov-report/map/api/hooks/hooks.query.js.html +795 -810
- package/coverage/lcov-report/map/api/hooks/index.html +54 -54
- package/coverage/lcov-report/map/api/hooks/index.js.html +16 -16
- package/coverage/lcov-report/map/api/index.html +32 -32
- package/coverage/lcov-report/map/api/index.js.html +46 -46
- package/coverage/lcov-report/map/api/marshall.js.html +72 -72
- package/coverage/lcov-report/map/api/models/alerts.model.mongodb.js.html +24 -24
- package/coverage/lcov-report/map/api/models/catalog.model.mongodb.js.html +69 -27
- package/coverage/lcov-report/map/api/models/features.model.mongodb.js.html +80 -80
- package/coverage/lcov-report/map/api/models/index.html +69 -54
- package/coverage/lcov-report/map/api/models/projects.model.mongodb.js.html +26 -26
- package/coverage/lcov-report/map/api/models/styles.model.mongodb.js.html +112 -0
- package/coverage/lcov-report/map/api/services/alerts/alerts.hooks.js.html +136 -136
- package/coverage/lcov-report/map/api/services/alerts/alerts.service.js.html +343 -343
- package/coverage/lcov-report/map/api/services/alerts/index.html +32 -32
- package/coverage/lcov-report/map/api/services/catalog/catalog.hooks.js.html +177 -162
- package/coverage/lcov-report/map/api/services/catalog/index.html +21 -21
- package/coverage/lcov-report/map/api/services/daptiles/daptiles.service.js.html +1 -1
- package/coverage/lcov-report/map/api/services/daptiles/index.html +1 -1
- package/coverage/lcov-report/map/api/services/features/features.hooks.js.html +160 -160
- package/coverage/lcov-report/map/api/services/features/features.service.js.html +117 -117
- package/coverage/lcov-report/map/api/services/features/index.html +31 -31
- package/coverage/lcov-report/map/api/services/index.html +21 -21
- package/coverage/lcov-report/map/api/services/index.js.html +404 -296
- package/coverage/lcov-report/map/api/services/projects/index.html +21 -21
- package/coverage/lcov-report/map/api/services/projects/projects.hooks.js.html +237 -237
- package/coverage/lcov-report/map/api/services/styles/index.html +116 -0
- package/coverage/lcov-report/map/api/services/styles/styles.hooks.js.html +196 -0
- package/coverage/lcov-report/map/common/dynamic-grid-source.js.html +68 -68
- package/coverage/lcov-report/map/common/errors.js.html +16 -16
- package/coverage/lcov-report/map/common/geotiff-grid-source.js.html +267 -267
- package/coverage/lcov-report/map/common/grid.js.html +554 -554
- package/coverage/lcov-report/map/common/index.html +158 -158
- package/coverage/lcov-report/map/common/index.js.html +68 -68
- package/coverage/lcov-report/map/common/meteo-model-grid-source.js.html +73 -73
- package/coverage/lcov-report/map/common/moment-utils.js.html +18 -18
- package/coverage/lcov-report/map/common/opendap-grid-source.js.html +484 -484
- package/coverage/lcov-report/map/common/opendap-utils.js.html +353 -353
- package/coverage/lcov-report/map/common/permissions.js.html +42 -36
- package/coverage/lcov-report/map/common/time-based-grid-source.js.html +59 -59
- package/coverage/lcov-report/map/common/tms-utils.js.html +6 -6
- package/coverage/lcov-report/map/common/wcs-grid-source.js.html +190 -190
- package/coverage/lcov-report/map/common/wcs-utils.js.html +339 -339
- package/coverage/lcov-report/map/common/weacast-grid-source.js.html +345 -345
- package/coverage/lcov-report/map/common/wfs-utils.js.html +11 -11
- package/coverage/lcov-report/map/common/wms-utils.js.html +8 -8
- package/coverage/lcov-report/map/common/wmts-utils.js.html +7 -7
- package/coverage/lcov.info +7022 -5894
- package/coverage/map/api/hooks/hooks.catalog.js.html +348 -258
- package/coverage/map/api/hooks/hooks.features.js.html +218 -218
- package/coverage/map/api/hooks/hooks.query.js.html +795 -810
- package/coverage/map/api/hooks/index.html +54 -54
- package/coverage/map/api/hooks/index.js.html +16 -16
- package/coverage/map/api/index.html +32 -32
- package/coverage/map/api/index.js.html +46 -46
- package/coverage/map/api/marshall.js.html +72 -72
- package/coverage/map/api/models/alerts.model.mongodb.js.html +24 -24
- package/coverage/map/api/models/catalog.model.mongodb.js.html +69 -27
- package/coverage/map/api/models/features.model.mongodb.js.html +80 -80
- package/coverage/map/api/models/index.html +69 -54
- package/coverage/map/api/models/projects.model.mongodb.js.html +26 -26
- package/coverage/map/api/models/styles.model.mongodb.js.html +112 -0
- package/coverage/map/api/services/alerts/alerts.hooks.js.html +136 -136
- package/coverage/map/api/services/alerts/alerts.service.js.html +343 -343
- package/coverage/map/api/services/alerts/index.html +32 -32
- package/coverage/map/api/services/catalog/catalog.hooks.js.html +177 -162
- package/coverage/map/api/services/catalog/index.html +21 -21
- package/coverage/map/api/services/daptiles/daptiles.service.js.html +1 -1
- package/coverage/map/api/services/daptiles/index.html +1 -1
- package/coverage/map/api/services/features/features.hooks.js.html +160 -160
- package/coverage/map/api/services/features/features.service.js.html +117 -117
- package/coverage/map/api/services/features/index.html +31 -31
- package/coverage/map/api/services/index.html +21 -21
- package/coverage/map/api/services/index.js.html +404 -296
- package/coverage/map/api/services/projects/index.html +21 -21
- package/coverage/map/api/services/projects/projects.hooks.js.html +237 -237
- package/coverage/map/api/services/styles/index.html +116 -0
- package/coverage/map/api/services/styles/styles.hooks.js.html +196 -0
- package/coverage/map/common/dynamic-grid-source.js.html +68 -68
- package/coverage/map/common/errors.js.html +16 -16
- package/coverage/map/common/geotiff-grid-source.js.html +267 -267
- package/coverage/map/common/grid.js.html +554 -554
- package/coverage/map/common/index.html +158 -158
- package/coverage/map/common/index.js.html +68 -68
- package/coverage/map/common/meteo-model-grid-source.js.html +73 -73
- package/coverage/map/common/moment-utils.js.html +18 -18
- package/coverage/map/common/opendap-grid-source.js.html +484 -484
- package/coverage/map/common/opendap-utils.js.html +353 -353
- package/coverage/map/common/permissions.js.html +42 -36
- package/coverage/map/common/time-based-grid-source.js.html +59 -59
- package/coverage/map/common/tms-utils.js.html +6 -6
- package/coverage/map/common/wcs-grid-source.js.html +190 -190
- package/coverage/map/common/wcs-utils.js.html +339 -339
- package/coverage/map/common/weacast-grid-source.js.html +345 -345
- package/coverage/map/common/wfs-utils.js.html +11 -11
- package/coverage/map/common/wms-utils.js.html +8 -8
- package/coverage/map/common/wmts-utils.js.html +7 -7
- package/coverage/tmp/coverage-151198-1753351220086-0.json +1 -0
- package/coverage/tmp/coverage-151210-1753351220070-0.json +1 -0
- package/coverage/tmp/coverage-151221-1753351129816-0.json +1 -0
- package/coverage/tmp/coverage-151233-1753351129803-0.json +1 -0
- package/coverage/tmp/coverage-151240-1753351129770-0.json +1 -0
- package/coverage/tmp/coverage-151307-1753351220058-0.json +1 -0
- package/coverage/tmp/coverage-151319-1753351220044-0.json +1 -0
- package/coverage/tmp/coverage-151326-1753351220010-0.json +1 -0
- package/map/api/services/styles/styles.hooks.js +1 -1
- package/map/client/components/KLayerEditor.vue +4 -0
- package/map/client/components/catalog/KLayerCategories.vue +2 -0
- package/map/client/components/stickies/KLevelSlider.vue +10 -8
- package/map/client/components/styles/KStyleEditor.vue +1 -1
- package/map/client/components/styles/KStyleManager.vue +7 -1
- package/map/client/composables/highlight.js +5 -1
- package/map/client/i18n/map_en.json +4 -1
- package/map/client/i18n/map_fr.json +4 -1
- package/map/client/mixins/globe/mixin.geojson-layers.js +11 -5
- package/map/client/mixins/mixin.activity.js +9 -0
- package/map/client/utils/utils.layers.js +0 -2
- package/package.json +1 -1
- package/test/api/core/push.test.js +1 -1
- package/test/api/core/test-log-2025-02-05.log +23 -0
- package/test/api/core/test-log-2025-05-21.log +15 -0
- package/test/api/core/test-log-2025-06-25.log +9 -0
- package/test/api/core/test-log-2025-07-24.log +44 -0
- package/test/api/map/test-log-2025-05-27.log +13 -0
- package/test/api/map/test-log-2025-06-23.log +7 -0
- package/test/api/map/{test-log-2025-05-26.log → test-log-2025-07-24.log} +3 -4
- package/coverage/tmp/coverage-122123-1739872365211-0.json +0 -1
- package/coverage/tmp/coverage-122135-1739872365196-0.json +0 -1
- package/coverage/tmp/coverage-122146-1739872365184-0.json +0 -1
- package/coverage/tmp/coverage-122158-1739872365169-0.json +0 -1
- package/coverage/tmp/coverage-122165-1739872365141-0.json +0 -1
- package/test/api/core/test-log-2025-05-26.log +0 -22
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">95.54% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>150/157</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">98.07% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>51/52</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">100% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>9/9</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">95.54% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>150/157</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
</template>
|
|
63
63
|
</div>
|
|
64
|
-
<div class='status-line
|
|
64
|
+
<div class='status-line high'></div>
|
|
65
65
|
<pre><table class="coverage">
|
|
66
66
|
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
67
67
|
<a name='L2'></a><a href='#L2'>2</a>
|
|
@@ -189,266 +189,356 @@
|
|
|
189
189
|
<a name='L124'></a><a href='#L124'>124</a>
|
|
190
190
|
<a name='L125'></a><a href='#L125'>125</a>
|
|
191
191
|
<a name='L126'></a><a href='#L126'>126</a>
|
|
192
|
-
<a name='L127'></a><a href='#L127'>127</a
|
|
193
|
-
<
|
|
194
|
-
<
|
|
195
|
-
<
|
|
196
|
-
<
|
|
197
|
-
<
|
|
198
|
-
<
|
|
199
|
-
<
|
|
200
|
-
<
|
|
201
|
-
<
|
|
202
|
-
<
|
|
203
|
-
<
|
|
204
|
-
<
|
|
205
|
-
<
|
|
206
|
-
<
|
|
207
|
-
<
|
|
208
|
-
<
|
|
209
|
-
<
|
|
210
|
-
<
|
|
211
|
-
<
|
|
212
|
-
<
|
|
213
|
-
<
|
|
214
|
-
<
|
|
215
|
-
<
|
|
216
|
-
<
|
|
217
|
-
<
|
|
218
|
-
<
|
|
219
|
-
<
|
|
220
|
-
<
|
|
221
|
-
<
|
|
222
|
-
<span class="cline-any cline-
|
|
223
|
-
<span class="cline-any cline-
|
|
224
|
-
<span class="cline-any cline-
|
|
225
|
-
<span class="cline-any cline-
|
|
226
|
-
<span class="cline-any cline-
|
|
227
|
-
<span class="cline-any cline-
|
|
228
|
-
<span class="cline-any cline-
|
|
229
|
-
<span class="cline-any cline-
|
|
230
|
-
<span class="cline-any cline-
|
|
231
|
-
<span class="cline-any cline-
|
|
232
|
-
<span class="cline-any cline-
|
|
233
|
-
<span class="cline-any cline-
|
|
234
|
-
<span class="cline-any cline-
|
|
235
|
-
<span class="cline-any cline-
|
|
236
|
-
<span class="cline-any cline-
|
|
237
|
-
<span class="cline-any cline-
|
|
238
|
-
<span class="cline-any cline-
|
|
239
|
-
<span class="cline-any cline-
|
|
240
|
-
<span class="cline-any cline-
|
|
241
|
-
<span class="cline-any cline-
|
|
242
|
-
<span class="cline-any cline-
|
|
243
|
-
<span class="cline-any cline-
|
|
244
|
-
<span class="cline-any cline-
|
|
245
|
-
<span class="cline-any cline-
|
|
246
|
-
<span class="cline-any cline-
|
|
247
|
-
<span class="cline-any cline-
|
|
248
|
-
<span class="cline-any cline-
|
|
249
|
-
<span class="cline-any cline-
|
|
250
|
-
<span class="cline-any cline-
|
|
251
|
-
<span class="cline-any cline-
|
|
252
|
-
<span class="cline-any cline-
|
|
253
|
-
<span class="cline-any cline-
|
|
254
|
-
<span class="cline-any cline-
|
|
255
|
-
<span class="cline-any cline-
|
|
256
|
-
<span class="cline-any cline-
|
|
257
|
-
<span class="cline-any cline-
|
|
258
|
-
<span class="cline-any cline-
|
|
259
|
-
<span class="cline-any cline-
|
|
260
|
-
<span class="cline-any cline-
|
|
261
|
-
<span class="cline-any cline-
|
|
262
|
-
<span class="cline-any cline-
|
|
263
|
-
<span class="cline-any cline-no"> </span>
|
|
264
|
-
<span class="cline-any cline-no"> </span>
|
|
265
|
-
<span class="cline-any cline-no"> </span>
|
|
266
|
-
<span class="cline-any cline-no"> </span>
|
|
267
|
-
<span class="cline-any cline-no"> </span>
|
|
268
|
-
<span class="cline-any cline-
|
|
269
|
-
<span class="cline-any cline-
|
|
270
|
-
<span class="cline-any cline-
|
|
271
|
-
<span class="cline-any cline-
|
|
272
|
-
<span class="cline-any cline-
|
|
273
|
-
<span class="cline-any cline-
|
|
274
|
-
<span class="cline-any cline-
|
|
275
|
-
<span class="cline-any cline-
|
|
276
|
-
<span class="cline-any cline-
|
|
277
|
-
<span class="cline-any cline-
|
|
278
|
-
<span class="cline-any cline-
|
|
279
|
-
<span class="cline-any cline-
|
|
280
|
-
<span class="cline-any cline-
|
|
281
|
-
<span class="cline-any cline-
|
|
282
|
-
<span class="cline-any cline-
|
|
283
|
-
<span class="cline-any cline-
|
|
284
|
-
<span class="cline-any cline-
|
|
285
|
-
<span class="cline-any cline-
|
|
286
|
-
<span class="cline-any cline-
|
|
287
|
-
<span class="cline-any cline-
|
|
288
|
-
<span class="cline-any cline-
|
|
289
|
-
<span class="cline-any cline-
|
|
290
|
-
<span class="cline-any cline-
|
|
291
|
-
<span class="cline-any cline-
|
|
292
|
-
<span class="cline-any cline-
|
|
293
|
-
<span class="cline-any cline-
|
|
294
|
-
<span class="cline-any cline-
|
|
295
|
-
<span class="cline-any cline-
|
|
296
|
-
<span class="cline-any cline-
|
|
297
|
-
<span class="cline-any cline-
|
|
298
|
-
<span class="cline-any cline-
|
|
299
|
-
<span class="cline-any cline-
|
|
300
|
-
<span class="cline-any cline-
|
|
301
|
-
<span class="cline-any cline-
|
|
302
|
-
<span class="cline-any cline-
|
|
303
|
-
<span class="cline-any cline-
|
|
304
|
-
<span class="cline-any cline-
|
|
305
|
-
<span class="cline-any cline-
|
|
306
|
-
<span class="cline-any cline-
|
|
307
|
-
<span class="cline-any cline-
|
|
308
|
-
<span class="cline-any cline-
|
|
309
|
-
<span class="cline-any cline-
|
|
310
|
-
<span class="cline-any cline-
|
|
311
|
-
<span class="cline-any cline-
|
|
312
|
-
<span class="cline-any cline-
|
|
313
|
-
<span class="cline-any cline-
|
|
314
|
-
<span class="cline-any cline-
|
|
315
|
-
<span class="cline-any cline-
|
|
316
|
-
<span class="cline-any cline-
|
|
317
|
-
<span class="cline-any cline-
|
|
318
|
-
<span class="cline-any cline-
|
|
319
|
-
<span class="
|
|
320
|
-
<span class="
|
|
321
|
-
<span class="
|
|
322
|
-
<span class="
|
|
323
|
-
<span class="
|
|
324
|
-
<span class="
|
|
325
|
-
<span class="
|
|
326
|
-
<span class="
|
|
327
|
-
<span class="
|
|
328
|
-
<span class="
|
|
329
|
-
<span class="
|
|
330
|
-
<span class="
|
|
331
|
-
<span class="
|
|
332
|
-
<span class="
|
|
333
|
-
<span class="
|
|
334
|
-
<span class="
|
|
335
|
-
<span class="
|
|
336
|
-
<span class="
|
|
337
|
-
<span class="
|
|
338
|
-
<span class="
|
|
339
|
-
<span class="
|
|
340
|
-
<span class="
|
|
341
|
-
<span class="
|
|
342
|
-
<span class="
|
|
343
|
-
<span class="
|
|
344
|
-
<span class="
|
|
345
|
-
<span class="
|
|
346
|
-
<span class="
|
|
347
|
-
<span class="
|
|
348
|
-
<span class="
|
|
349
|
-
<span class="
|
|
350
|
-
<span class="
|
|
351
|
-
<span class="
|
|
352
|
-
<span class="
|
|
353
|
-
<span class="
|
|
354
|
-
<span class="
|
|
355
|
-
<span class="
|
|
356
|
-
<span class="
|
|
357
|
-
<span class="
|
|
192
|
+
<a name='L127'></a><a href='#L127'>127</a>
|
|
193
|
+
<a name='L128'></a><a href='#L128'>128</a>
|
|
194
|
+
<a name='L129'></a><a href='#L129'>129</a>
|
|
195
|
+
<a name='L130'></a><a href='#L130'>130</a>
|
|
196
|
+
<a name='L131'></a><a href='#L131'>131</a>
|
|
197
|
+
<a name='L132'></a><a href='#L132'>132</a>
|
|
198
|
+
<a name='L133'></a><a href='#L133'>133</a>
|
|
199
|
+
<a name='L134'></a><a href='#L134'>134</a>
|
|
200
|
+
<a name='L135'></a><a href='#L135'>135</a>
|
|
201
|
+
<a name='L136'></a><a href='#L136'>136</a>
|
|
202
|
+
<a name='L137'></a><a href='#L137'>137</a>
|
|
203
|
+
<a name='L138'></a><a href='#L138'>138</a>
|
|
204
|
+
<a name='L139'></a><a href='#L139'>139</a>
|
|
205
|
+
<a name='L140'></a><a href='#L140'>140</a>
|
|
206
|
+
<a name='L141'></a><a href='#L141'>141</a>
|
|
207
|
+
<a name='L142'></a><a href='#L142'>142</a>
|
|
208
|
+
<a name='L143'></a><a href='#L143'>143</a>
|
|
209
|
+
<a name='L144'></a><a href='#L144'>144</a>
|
|
210
|
+
<a name='L145'></a><a href='#L145'>145</a>
|
|
211
|
+
<a name='L146'></a><a href='#L146'>146</a>
|
|
212
|
+
<a name='L147'></a><a href='#L147'>147</a>
|
|
213
|
+
<a name='L148'></a><a href='#L148'>148</a>
|
|
214
|
+
<a name='L149'></a><a href='#L149'>149</a>
|
|
215
|
+
<a name='L150'></a><a href='#L150'>150</a>
|
|
216
|
+
<a name='L151'></a><a href='#L151'>151</a>
|
|
217
|
+
<a name='L152'></a><a href='#L152'>152</a>
|
|
218
|
+
<a name='L153'></a><a href='#L153'>153</a>
|
|
219
|
+
<a name='L154'></a><a href='#L154'>154</a>
|
|
220
|
+
<a name='L155'></a><a href='#L155'>155</a>
|
|
221
|
+
<a name='L156'></a><a href='#L156'>156</a>
|
|
222
|
+
<a name='L157'></a><a href='#L157'>157</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
223
|
+
<span class="cline-any cline-yes">1x</span>
|
|
224
|
+
<span class="cline-any cline-yes">1x</span>
|
|
225
|
+
<span class="cline-any cline-yes">1x</span>
|
|
226
|
+
<span class="cline-any cline-yes">1x</span>
|
|
227
|
+
<span class="cline-any cline-yes">1x</span>
|
|
228
|
+
<span class="cline-any cline-yes">1x</span>
|
|
229
|
+
<span class="cline-any cline-yes">1x</span>
|
|
230
|
+
<span class="cline-any cline-yes">1x</span>
|
|
231
|
+
<span class="cline-any cline-yes">1x</span>
|
|
232
|
+
<span class="cline-any cline-yes">38x</span>
|
|
233
|
+
<span class="cline-any cline-yes">38x</span>
|
|
234
|
+
<span class="cline-any cline-yes">38x</span>
|
|
235
|
+
<span class="cline-any cline-yes">38x</span>
|
|
236
|
+
<span class="cline-any cline-yes">38x</span>
|
|
237
|
+
<span class="cline-any cline-yes">1x</span>
|
|
238
|
+
<span class="cline-any cline-yes">9x</span>
|
|
239
|
+
<span class="cline-any cline-yes">9x</span>
|
|
240
|
+
<span class="cline-any cline-yes">9x</span>
|
|
241
|
+
<span class="cline-any cline-yes">9x</span>
|
|
242
|
+
<span class="cline-any cline-yes">9x</span>
|
|
243
|
+
<span class="cline-any cline-yes">9x</span>
|
|
244
|
+
<span class="cline-any cline-yes">9x</span>
|
|
245
|
+
<span class="cline-any cline-yes">1x</span>
|
|
246
|
+
<span class="cline-any cline-yes">1x</span>
|
|
247
|
+
<span class="cline-any cline-yes">1x</span>
|
|
248
|
+
<span class="cline-any cline-yes">19x</span>
|
|
249
|
+
<span class="cline-any cline-yes">19x</span>
|
|
250
|
+
<span class="cline-any cline-yes">19x</span>
|
|
251
|
+
<span class="cline-any cline-yes">9x</span>
|
|
252
|
+
<span class="cline-any cline-yes">9x</span>
|
|
253
|
+
<span class="cline-any cline-yes">9x</span>
|
|
254
|
+
<span class="cline-any cline-yes">9x</span>
|
|
255
|
+
<span class="cline-any cline-yes">9x</span>
|
|
256
|
+
<span class="cline-any cline-yes">19x</span>
|
|
257
|
+
<span class="cline-any cline-yes">1x</span>
|
|
258
|
+
<span class="cline-any cline-yes">1x</span>
|
|
259
|
+
<span class="cline-any cline-yes">1x</span>
|
|
260
|
+
<span class="cline-any cline-yes">19x</span>
|
|
261
|
+
<span class="cline-any cline-yes">19x</span>
|
|
262
|
+
<span class="cline-any cline-yes">19x</span>
|
|
263
|
+
<span class="cline-any cline-no"> </span>
|
|
264
|
+
<span class="cline-any cline-no"> </span>
|
|
265
|
+
<span class="cline-any cline-no"> </span>
|
|
266
|
+
<span class="cline-any cline-no"> </span>
|
|
267
|
+
<span class="cline-any cline-no"> </span>
|
|
268
|
+
<span class="cline-any cline-yes">19x</span>
|
|
269
|
+
<span class="cline-any cline-yes">1x</span>
|
|
270
|
+
<span class="cline-any cline-yes">1x</span>
|
|
271
|
+
<span class="cline-any cline-yes">1x</span>
|
|
272
|
+
<span class="cline-any cline-yes">19x</span>
|
|
273
|
+
<span class="cline-any cline-yes">19x</span>
|
|
274
|
+
<span class="cline-any cline-yes">19x</span>
|
|
275
|
+
<span class="cline-any cline-yes">19x</span>
|
|
276
|
+
<span class="cline-any cline-yes">1x</span>
|
|
277
|
+
<span class="cline-any cline-yes">1x</span>
|
|
278
|
+
<span class="cline-any cline-yes">1x</span>
|
|
279
|
+
<span class="cline-any cline-yes">17x</span>
|
|
280
|
+
<span class="cline-any cline-yes">17x</span>
|
|
281
|
+
<span class="cline-any cline-yes">17x</span>
|
|
282
|
+
<span class="cline-any cline-yes">8x</span>
|
|
283
|
+
<span class="cline-any cline-yes">8x</span>
|
|
284
|
+
<span class="cline-any cline-yes">8x</span>
|
|
285
|
+
<span class="cline-any cline-yes">8x</span>
|
|
286
|
+
<span class="cline-any cline-yes">8x</span>
|
|
287
|
+
<span class="cline-any cline-yes">8x</span>
|
|
288
|
+
<span class="cline-any cline-yes">8x</span>
|
|
289
|
+
<span class="cline-any cline-yes">8x</span>
|
|
290
|
+
<span class="cline-any cline-yes">8x</span>
|
|
291
|
+
<span class="cline-any cline-yes">17x</span>
|
|
292
|
+
<span class="cline-any cline-yes">5x</span>
|
|
293
|
+
<span class="cline-any cline-yes">5x</span>
|
|
294
|
+
<span class="cline-any cline-yes">5x</span>
|
|
295
|
+
<span class="cline-any cline-yes">3x</span>
|
|
296
|
+
<span class="cline-any cline-yes">3x</span>
|
|
297
|
+
<span class="cline-any cline-yes">5x</span>
|
|
298
|
+
<span class="cline-any cline-yes">5x</span>
|
|
299
|
+
<span class="cline-any cline-yes">5x</span>
|
|
300
|
+
<span class="cline-any cline-yes">2x</span>
|
|
301
|
+
<span class="cline-any cline-yes">5x</span>
|
|
302
|
+
<span class="cline-any cline-yes">3x</span>
|
|
303
|
+
<span class="cline-any cline-yes">3x</span>
|
|
304
|
+
<span class="cline-any cline-yes">5x</span>
|
|
305
|
+
<span class="cline-any cline-yes">3x</span>
|
|
306
|
+
<span class="cline-any cline-yes">3x</span>
|
|
307
|
+
<span class="cline-any cline-yes">3x</span>
|
|
308
|
+
<span class="cline-any cline-yes">3x</span>
|
|
309
|
+
<span class="cline-any cline-yes">17x</span>
|
|
310
|
+
<span class="cline-any cline-yes">1x</span>
|
|
311
|
+
<span class="cline-any cline-yes">1x</span>
|
|
312
|
+
<span class="cline-any cline-yes">1x</span>
|
|
313
|
+
<span class="cline-any cline-yes">10x</span>
|
|
314
|
+
<span class="cline-any cline-yes">10x</span>
|
|
315
|
+
<span class="cline-any cline-yes">10x</span>
|
|
316
|
+
<span class="cline-any cline-yes">10x</span>
|
|
317
|
+
<span class="cline-any cline-yes">6x</span>
|
|
318
|
+
<span class="cline-any cline-yes">10x</span>
|
|
319
|
+
<span class="cline-any cline-yes">10x</span>
|
|
320
|
+
<span class="cline-any cline-yes">7x</span>
|
|
321
|
+
<span class="cline-any cline-yes">7x</span>
|
|
322
|
+
<span class="cline-any cline-yes">7x</span>
|
|
323
|
+
<span class="cline-any cline-yes">7x</span>
|
|
324
|
+
<span class="cline-any cline-yes">5x</span>
|
|
325
|
+
<span class="cline-any cline-yes">7x</span>
|
|
326
|
+
<span class="cline-any cline-yes">2x</span>
|
|
327
|
+
<span class="cline-any cline-yes">2x</span>
|
|
328
|
+
<span class="cline-any cline-yes">7x</span>
|
|
329
|
+
<span class="cline-any cline-yes">7x</span>
|
|
330
|
+
<span class="cline-any cline-yes">7x</span>
|
|
331
|
+
<span class="cline-any cline-yes">7x</span>
|
|
332
|
+
<span class="cline-any cline-yes">7x</span>
|
|
333
|
+
<span class="cline-any cline-yes">7x</span>
|
|
334
|
+
<span class="cline-any cline-yes">4x</span>
|
|
335
|
+
<span class="cline-any cline-yes">4x</span>
|
|
336
|
+
<span class="cline-any cline-yes">4x</span>
|
|
337
|
+
<span class="cline-any cline-yes">3x</span>
|
|
338
|
+
<span class="cline-any cline-yes">3x</span>
|
|
339
|
+
<span class="cline-any cline-yes">3x</span>
|
|
340
|
+
<span class="cline-any cline-yes">3x</span>
|
|
341
|
+
<span class="cline-any cline-yes">3x</span>
|
|
342
|
+
<span class="cline-any cline-yes">3x</span>
|
|
343
|
+
<span class="cline-any cline-yes">3x</span>
|
|
344
|
+
<span class="cline-any cline-yes">3x</span>
|
|
345
|
+
<span class="cline-any cline-yes">3x</span>
|
|
346
|
+
<span class="cline-any cline-yes">3x</span>
|
|
347
|
+
<span class="cline-any cline-yes">3x</span>
|
|
348
|
+
<span class="cline-any cline-yes">10x</span>
|
|
349
|
+
<span class="cline-any cline-yes">1x</span>
|
|
350
|
+
<span class="cline-any cline-yes">1x</span>
|
|
351
|
+
<span class="cline-any cline-yes">13x</span>
|
|
352
|
+
<span class="cline-any cline-yes">13x</span>
|
|
353
|
+
<span class="cline-any cline-yes">13x</span>
|
|
354
|
+
<span class="cline-any cline-yes">13x</span>
|
|
355
|
+
<span class="cline-any cline-yes">19x</span>
|
|
356
|
+
<span class="cline-any cline-yes">19x</span>
|
|
357
|
+
<span class="cline-any cline-no"> </span>
|
|
358
|
+
<span class="cline-any cline-yes">19x</span>
|
|
359
|
+
<span class="cline-any cline-yes">13x</span>
|
|
360
|
+
<span class="cline-any cline-yes">13x</span>
|
|
361
|
+
<span class="cline-any cline-yes">13x</span>
|
|
362
|
+
<span class="cline-any cline-yes">13x</span>
|
|
363
|
+
<span class="cline-any cline-yes">13x</span>
|
|
364
|
+
<span class="cline-any cline-yes">1x</span>
|
|
365
|
+
<span class="cline-any cline-yes">1x</span>
|
|
366
|
+
<span class="cline-any cline-yes">63x</span>
|
|
367
|
+
<span class="cline-any cline-yes">63x</span>
|
|
368
|
+
<span class="cline-any cline-yes">63x</span>
|
|
369
|
+
<span class="cline-any cline-yes">63x</span>
|
|
370
|
+
<span class="cline-any cline-yes">64x</span>
|
|
371
|
+
<span class="cline-any cline-yes">64x</span>
|
|
372
|
+
<span class="cline-any cline-no"> </span>
|
|
373
|
+
<span class="cline-any cline-yes">64x</span>
|
|
374
|
+
<span class="cline-any cline-yes">63x</span>
|
|
375
|
+
<span class="cline-any cline-yes">63x</span>
|
|
376
|
+
<span class="cline-any cline-yes">63x</span>
|
|
377
|
+
<span class="cline-any cline-yes">63x</span>
|
|
378
|
+
<span class="cline-any cline-yes">63x</span></td><td class="text"><pre class="prettyprint lang-js">import _ from 'lodash'
|
|
379
|
+
import siftModule from 'sift'
|
|
380
|
+
import common from 'feathers-hooks-common'
|
|
381
|
+
import makeDebug from 'debug'
|
|
382
|
+
import { toString, toJson } from '../../../core/api/hooks/index.js'
|
|
383
|
+
|
|
384
|
+
const { getItems, replaceItems } = common
|
|
385
|
+
const sift = siftModule.default
|
|
386
|
+
const debug = makeDebug('kdk:map:catalog:hooks')
|
|
387
|
+
|
|
388
|
+
function isQueryForType(query, type) {
|
|
389
|
+
// Use sift to support MongoDB operators like $in, $nin, etc.
|
|
390
|
+
const filter = [{ type }].filter(sift(_.pick(query, ['type'])))
|
|
391
|
+
return !_.isEmpty(filter)
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function addDefaultItems(query, type, items, defaultItems) {
|
|
395
|
+
// Add implicit type as not provided in default items config
|
|
396
|
+
defaultItems = _.map(defaultItems, item => Object.assign(item, { type }))
|
|
397
|
+
// Then filter according to query
|
|
398
|
+
defaultItems = defaultItems.filter(sift(_.omit(query, ['$sort', '$limit', '$skip'])))
|
|
399
|
+
return items.concat(defaultItems.map(item => Object.assign(item, { type })))
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// By default we only return default categories
|
|
403
|
+
export function getDefaultCategories (hook) {
|
|
404
|
+
const query = _.get(hook, 'params.query', {})
|
|
405
|
+
const type = 'Category'
|
|
406
|
+
if ((query.$limit !== 0) && isQueryForType(query, type)) {
|
|
407
|
+
const service = hook.service
|
|
408
|
+
// Check for default categories config
|
|
409
|
+
const defaultCategories = _.get(service, 'options.categories', [])
|
|
410
|
+
replaceItems(hook, addDefaultItems(query, type, getItems(hook), defaultCategories))
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// By default we only return default sublegends
|
|
415
|
+
export function getDefaultSublegends (hook) {
|
|
416
|
+
const query = _.get(hook, 'params.query', {})
|
|
417
|
+
const type = 'Sublegend'
|
|
418
|
+
if ((query.$limit !== 0) && isQueryForType(query, type)) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
|
|
358
419
|
<span class="cstat-no" title="statement not covered" > const service = hook.service</span>
|
|
359
420
|
<span class="cstat-no" title="statement not covered" > // Check for default sublegends config</span>
|
|
360
421
|
<span class="cstat-no" title="statement not covered" > const defaultSublegends = _.get(service, 'options.sublegends', [])</span>
|
|
361
422
|
<span class="cstat-no" title="statement not covered" > replaceItems(hook, addDefaultItems(query, type, getItems(hook), defaultSublegends))</span>
|
|
362
423
|
<span class="cstat-no" title="statement not covered" > }</span>
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
 
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// By default we only return layers and not other objects in catalog
|
|
427
|
+
export function filterLayers (hook) {
|
|
428
|
+
const query = _.get(hook, 'params.query', {})
|
|
429
|
+
if (!query.type) query.type = { $nin: ['Context', 'Service', 'Category', 'Sublegend'] }
|
|
430
|
+
_.set(hook, 'params.query', query)
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// Update layer name in all contexts, categories, etc. when renamed/removed
|
|
434
|
+
export async function updateLayerReferences (hook) {
|
|
435
|
+
// Check if it's a layer renaming first
|
|
436
|
+
const type = _.get(hook.params, 'previousItem.type', '')
|
|
437
|
+
if (!type.endsWith('Layer')) return hook
|
|
438
|
+
const previousLayer = _.get(hook.params, 'previousItem')
|
|
439
|
+
const layer = getItems(hook)
|
|
440
|
+
|
|
441
|
+
// Retrieve the list of all contexts, categories, etc. involving the layer
|
|
442
|
+
const contexts = await hook.service.find({
|
|
443
|
+
query: { type: { $in: ['Context', 'Category'] }, layers: previousLayer.name },
|
|
444
|
+
paginate: false
|
|
445
|
+
})
|
|
446
|
+
// Stop when non found
|
|
447
|
+
if (contexts.length === 0) {
|
|
448
|
+
debug(`No context or category to update after renaming or removing layer ${layer.name} `)
|
|
449
|
+
return hook
|
|
450
|
+
}
|
|
451
|
+
// Update each context otherwise
|
|
452
|
+
await Promise.all(contexts.map(context => {
|
|
453
|
+
// Update/Remove layer name in layer list
|
|
454
|
+
let layers = context.layers
|
|
455
|
+
if (hook.method === 'remove') {
|
|
456
|
+
_.remove(layers, layerName => layerName === previousLayer.name)
|
|
457
|
+
} else {
|
|
458
|
+
layers = layers.map(layerName => (layerName === previousLayer.name ? layer.name : layerName))
|
|
459
|
+
}
|
|
460
|
+
return hook.service.patch(context._id, { layers })
|
|
461
|
+
}))
|
|
462
|
+
|
|
463
|
+
debug(`Updated ${contexts.length} contexts and categories after renaming or removing layer ${layer.name} `)
|
|
464
|
+
return hook
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// Update projects when a layer/view is removed
|
|
468
|
+
export async function updateProjects (hook) {
|
|
469
|
+
const app = hook.app
|
|
470
|
+
const context = hook.service.getContextId()
|
|
471
|
+
const projectsService = app.getService('projects', context)
|
|
472
|
+
if (!projectsService) return hook
|
|
473
|
+
let removedItems = getItems(hook)
|
|
474
|
+
if (!Array.isArray(removedItems)) removedItems = [removedItems]
|
|
475
|
+
for (let i = 0; i < removedItems.length; i++) {
|
|
476
|
+
const removedItem = removedItems[i]
|
|
477
|
+
const isLayer = removedItem.type !== 'Context'
|
|
478
|
+
const query = {}
|
|
479
|
+
if (isLayer) {
|
|
480
|
+
query.$or = [{ 'layers._id': removedItem._id }, { 'layers.name': removedItem.name }]
|
|
481
|
+
} else {
|
|
482
|
+
query['views._id'] = removedItem._id
|
|
483
|
+
}
|
|
484
|
+
// Retrieve the list of all projects involving the item
|
|
485
|
+
const projects = await projectsService.find({
|
|
486
|
+
query, paginate: false
|
|
487
|
+
})
|
|
488
|
+
// Stop when non found
|
|
489
|
+
if (projects.length === 0) {
|
|
490
|
+
debug(`No project to update after removing item ${removedItem.name} `)
|
|
491
|
+
return hook
|
|
492
|
+
}
|
|
493
|
+
// Update each project otherwise
|
|
494
|
+
await Promise.all(projects.map(project => {
|
|
495
|
+
// Remove item in list
|
|
496
|
+
const items = (isLayer ? project.layers : project.views)
|
|
497
|
+
_.remove(items, item => item._id ? removedItem._id.toString() === item._id.toString() : removedItem.name === item.name)
|
|
498
|
+
return projectsService.patch(project._id.toString(), isLayer ? { layers: items } : { views: items })
|
|
499
|
+
}))
|
|
500
|
+
|
|
501
|
+
debug(`Updated ${projects.length} projects after removing item ${removedItem.name} `)
|
|
502
|
+
}
|
|
503
|
+
return hook
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export function convertFilterQueriesToString (hook) {
|
|
507
|
+
let items = getItems(hook)
|
|
508
|
+
const isArray = Array.isArray(items)
|
|
509
|
+
items = (isArray ? items : [items])
|
|
510
|
+
items.forEach(item => {
|
|
511
|
+
const filters = _.get(item, 'filters', [])
|
|
512
|
+
_.forEach(filters, filter => {
|
|
513
|
+
<span class="cstat-no" title="statement not covered" > toString(filter, ['active', 'inactive'])</span>
|
|
514
|
+
})
|
|
515
|
+
})
|
|
516
|
+
replaceItems(hook, isArray ? items : items[0])
|
|
517
|
+
|
|
518
|
+
return hook
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
export function convertFilterQueriesToObject (hook) {
|
|
522
|
+
let items = getItems(hook)
|
|
523
|
+
const isArray = Array.isArray(items)
|
|
524
|
+
items = (isArray ? items : [items])
|
|
525
|
+
items.forEach(item => {
|
|
526
|
+
const filters = _.get(item, 'filters', [])
|
|
527
|
+
_.forEach(filters, filter => {
|
|
528
|
+
<span class="cstat-no" title="statement not covered" > toJson(filter, ['active', 'inactive'])</span>
|
|
529
|
+
})
|
|
530
|
+
})
|
|
531
|
+
replaceItems(hook, isArray ? items : items[0])
|
|
532
|
+
|
|
533
|
+
return hook
|
|
534
|
+
}</pre></td></tr></table></pre>
|
|
445
535
|
|
|
446
536
|
<div class='push'></div><!-- for sticky footer -->
|
|
447
537
|
</div><!-- /wrapper -->
|
|
448
538
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
449
539
|
Code coverage generated by
|
|
450
540
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
451
|
-
at 2025-
|
|
541
|
+
at 2025-07-24T10:00:20.508Z
|
|
452
542
|
</div>
|
|
453
543
|
<script src="../../../prettify.js"></script>
|
|
454
544
|
<script>
|