@kalisio/kdk 2.5.1 → 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.
Files changed (255) hide show
  1. package/core/api/hooks/hooks.authorisations.js +1 -2
  2. package/core/api/services/authorisations/authorisations.service.js +1 -3
  3. package/core/api/services/index.js +5 -1
  4. package/core/api/services/users/users.hooks.js +4 -3
  5. package/core/client/components/input/KShapePicker.vue +4 -4
  6. package/core/client/utils/index.js +1 -0
  7. package/coverage/core/api/application.js.html +344 -344
  8. package/coverage/core/api/authentication.js.html +79 -79
  9. package/coverage/core/api/db.js.html +167 -167
  10. package/coverage/core/api/hooks/hooks.authentication.js.html +12 -12
  11. package/coverage/core/api/hooks/hooks.authorisations.js.html +154 -157
  12. package/coverage/core/api/hooks/hooks.logger.js.html +18 -18
  13. package/coverage/core/api/hooks/hooks.model.js.html +275 -275
  14. package/coverage/core/api/hooks/hooks.push.js.html +34 -34
  15. package/coverage/core/api/hooks/hooks.query.js.html +89 -89
  16. package/coverage/core/api/hooks/hooks.schemas.js.html +13 -13
  17. package/coverage/core/api/hooks/hooks.service.js.html +28 -28
  18. package/coverage/core/api/hooks/hooks.storage.js.html +7 -7
  19. package/coverage/core/api/hooks/hooks.users.js.html +50 -50
  20. package/coverage/core/api/hooks/index.html +51 -51
  21. package/coverage/core/api/hooks/index.js.html +11 -11
  22. package/coverage/core/api/index.html +42 -42
  23. package/coverage/core/api/index.js.html +22 -22
  24. package/coverage/core/api/marshall.js.html +127 -127
  25. package/coverage/core/api/models/index.html +1 -1
  26. package/coverage/core/api/models/messages.model.mongodb.js.html +1 -1
  27. package/coverage/core/api/models/users.model.mongodb.js.html +11 -11
  28. package/coverage/core/api/services/account/account.hooks.js.html +42 -42
  29. package/coverage/core/api/services/account/account.service.js.html +34 -34
  30. package/coverage/core/api/services/account/index.html +1 -1
  31. package/coverage/core/api/services/authorisations/authorisations.hooks.js.html +34 -34
  32. package/coverage/core/api/services/authorisations/authorisations.service.js.html +87 -93
  33. package/coverage/core/api/services/authorisations/index.html +19 -19
  34. package/coverage/core/api/services/databases/databases.hooks.js.html +1 -1
  35. package/coverage/core/api/services/databases/databases.service.js.html +1 -1
  36. package/coverage/core/api/services/databases/index.html +1 -1
  37. package/coverage/core/api/services/import-export/import-export.hooks.js.html +1 -1
  38. package/coverage/core/api/services/import-export/import-export.service.js.html +1 -1
  39. package/coverage/core/api/services/import-export/index.html +1 -1
  40. package/coverage/core/api/services/index.html +15 -15
  41. package/coverage/core/api/services/index.js.html +97 -85
  42. package/coverage/core/api/services/mailer/index.html +1 -1
  43. package/coverage/core/api/services/mailer/mailer.hooks.js.html +1 -1
  44. package/coverage/core/api/services/mailer/mailer.service.js.html +1 -1
  45. package/coverage/core/api/services/messages/index.html +1 -1
  46. package/coverage/core/api/services/messages/messages.hooks.js.html +1 -1
  47. package/coverage/core/api/services/push/index.html +1 -1
  48. package/coverage/core/api/services/push/push.hooks.js.html +1 -1
  49. package/coverage/core/api/services/push/push.service.js.html +1 -1
  50. package/coverage/core/api/services/storage/index.html +1 -1
  51. package/coverage/core/api/services/storage/storage.hooks.js.html +36 -36
  52. package/coverage/core/api/services/storage/storage.service.js.html +30 -30
  53. package/coverage/core/api/services/users/index.html +7 -7
  54. package/coverage/core/api/services/users/users.hooks.js.html +83 -80
  55. package/coverage/core/api/services/users/users.service.js.html +4 -4
  56. package/coverage/core/common/errors.js.html +2 -2
  57. package/coverage/core/common/index.html +30 -30
  58. package/coverage/core/common/index.js.html +11 -11
  59. package/coverage/core/common/permissions.js.html +187 -187
  60. package/coverage/core/common/schema.js.html +26 -26
  61. package/coverage/core/common/utils.js.html +61 -61
  62. package/coverage/core/common/utils.offline.js.html +6 -6
  63. package/coverage/index.html +173 -173
  64. package/coverage/lcov-report/core/api/application.js.html +344 -344
  65. package/coverage/lcov-report/core/api/authentication.js.html +79 -79
  66. package/coverage/lcov-report/core/api/db.js.html +167 -167
  67. package/coverage/lcov-report/core/api/hooks/hooks.authentication.js.html +12 -12
  68. package/coverage/lcov-report/core/api/hooks/hooks.authorisations.js.html +154 -157
  69. package/coverage/lcov-report/core/api/hooks/hooks.logger.js.html +18 -18
  70. package/coverage/lcov-report/core/api/hooks/hooks.model.js.html +275 -275
  71. package/coverage/lcov-report/core/api/hooks/hooks.push.js.html +34 -34
  72. package/coverage/lcov-report/core/api/hooks/hooks.query.js.html +89 -89
  73. package/coverage/lcov-report/core/api/hooks/hooks.schemas.js.html +13 -13
  74. package/coverage/lcov-report/core/api/hooks/hooks.service.js.html +28 -28
  75. package/coverage/lcov-report/core/api/hooks/hooks.storage.js.html +7 -7
  76. package/coverage/lcov-report/core/api/hooks/hooks.users.js.html +50 -50
  77. package/coverage/lcov-report/core/api/hooks/index.html +51 -51
  78. package/coverage/lcov-report/core/api/hooks/index.js.html +11 -11
  79. package/coverage/lcov-report/core/api/index.html +42 -42
  80. package/coverage/lcov-report/core/api/index.js.html +22 -22
  81. package/coverage/lcov-report/core/api/marshall.js.html +127 -127
  82. package/coverage/lcov-report/core/api/models/index.html +1 -1
  83. package/coverage/lcov-report/core/api/models/messages.model.mongodb.js.html +1 -1
  84. package/coverage/lcov-report/core/api/models/users.model.mongodb.js.html +11 -11
  85. package/coverage/lcov-report/core/api/services/account/account.hooks.js.html +42 -42
  86. package/coverage/lcov-report/core/api/services/account/account.service.js.html +34 -34
  87. package/coverage/lcov-report/core/api/services/account/index.html +1 -1
  88. package/coverage/lcov-report/core/api/services/authorisations/authorisations.hooks.js.html +34 -34
  89. package/coverage/lcov-report/core/api/services/authorisations/authorisations.service.js.html +87 -93
  90. package/coverage/lcov-report/core/api/services/authorisations/index.html +19 -19
  91. package/coverage/lcov-report/core/api/services/databases/databases.hooks.js.html +1 -1
  92. package/coverage/lcov-report/core/api/services/databases/databases.service.js.html +1 -1
  93. package/coverage/lcov-report/core/api/services/databases/index.html +1 -1
  94. package/coverage/lcov-report/core/api/services/import-export/import-export.hooks.js.html +1 -1
  95. package/coverage/lcov-report/core/api/services/import-export/import-export.service.js.html +1 -1
  96. package/coverage/lcov-report/core/api/services/import-export/index.html +1 -1
  97. package/coverage/lcov-report/core/api/services/index.html +15 -15
  98. package/coverage/lcov-report/core/api/services/index.js.html +97 -85
  99. package/coverage/lcov-report/core/api/services/mailer/index.html +1 -1
  100. package/coverage/lcov-report/core/api/services/mailer/mailer.hooks.js.html +1 -1
  101. package/coverage/lcov-report/core/api/services/mailer/mailer.service.js.html +1 -1
  102. package/coverage/lcov-report/core/api/services/messages/index.html +1 -1
  103. package/coverage/lcov-report/core/api/services/messages/messages.hooks.js.html +1 -1
  104. package/coverage/lcov-report/core/api/services/push/index.html +1 -1
  105. package/coverage/lcov-report/core/api/services/push/push.hooks.js.html +1 -1
  106. package/coverage/lcov-report/core/api/services/push/push.service.js.html +1 -1
  107. package/coverage/lcov-report/core/api/services/storage/index.html +1 -1
  108. package/coverage/lcov-report/core/api/services/storage/storage.hooks.js.html +36 -36
  109. package/coverage/lcov-report/core/api/services/storage/storage.service.js.html +30 -30
  110. package/coverage/lcov-report/core/api/services/users/index.html +7 -7
  111. package/coverage/lcov-report/core/api/services/users/users.hooks.js.html +83 -80
  112. package/coverage/lcov-report/core/api/services/users/users.service.js.html +4 -4
  113. package/coverage/lcov-report/core/common/errors.js.html +2 -2
  114. package/coverage/lcov-report/core/common/index.html +30 -30
  115. package/coverage/lcov-report/core/common/index.js.html +11 -11
  116. package/coverage/lcov-report/core/common/permissions.js.html +187 -187
  117. package/coverage/lcov-report/core/common/schema.js.html +26 -26
  118. package/coverage/lcov-report/core/common/utils.js.html +61 -61
  119. package/coverage/lcov-report/core/common/utils.offline.js.html +6 -6
  120. package/coverage/lcov-report/index.html +173 -173
  121. package/coverage/lcov-report/map/api/hooks/hooks.catalog.js.html +316 -316
  122. package/coverage/lcov-report/map/api/hooks/hooks.features.js.html +218 -218
  123. package/coverage/lcov-report/map/api/hooks/hooks.query.js.html +798 -789
  124. package/coverage/lcov-report/map/api/hooks/index.html +54 -54
  125. package/coverage/lcov-report/map/api/hooks/index.js.html +16 -16
  126. package/coverage/lcov-report/map/api/index.html +32 -32
  127. package/coverage/lcov-report/map/api/index.js.html +46 -46
  128. package/coverage/lcov-report/map/api/marshall.js.html +72 -72
  129. package/coverage/lcov-report/map/api/models/alerts.model.mongodb.js.html +24 -24
  130. package/coverage/lcov-report/map/api/models/catalog.model.mongodb.js.html +44 -44
  131. package/coverage/lcov-report/map/api/models/features.model.mongodb.js.html +80 -80
  132. package/coverage/lcov-report/map/api/models/index.html +65 -65
  133. package/coverage/lcov-report/map/api/models/projects.model.mongodb.js.html +26 -26
  134. package/coverage/lcov-report/map/api/models/styles.model.mongodb.js.html +28 -28
  135. package/coverage/lcov-report/map/api/services/alerts/alerts.hooks.js.html +136 -136
  136. package/coverage/lcov-report/map/api/services/alerts/alerts.service.js.html +343 -343
  137. package/coverage/lcov-report/map/api/services/alerts/index.html +32 -32
  138. package/coverage/lcov-report/map/api/services/catalog/catalog.hooks.js.html +172 -172
  139. package/coverage/lcov-report/map/api/services/catalog/index.html +21 -21
  140. package/coverage/lcov-report/map/api/services/daptiles/daptiles.service.js.html +1 -1
  141. package/coverage/lcov-report/map/api/services/daptiles/index.html +1 -1
  142. package/coverage/lcov-report/map/api/services/features/features.hooks.js.html +160 -160
  143. package/coverage/lcov-report/map/api/services/features/features.service.js.html +117 -117
  144. package/coverage/lcov-report/map/api/services/features/index.html +31 -31
  145. package/coverage/lcov-report/map/api/services/index.html +21 -21
  146. package/coverage/lcov-report/map/api/services/index.js.html +334 -334
  147. package/coverage/lcov-report/map/api/services/projects/index.html +21 -21
  148. package/coverage/lcov-report/map/api/services/projects/projects.hooks.js.html +237 -237
  149. package/coverage/lcov-report/map/api/services/styles/index.html +21 -21
  150. package/coverage/lcov-report/map/api/services/styles/styles.hooks.js.html +84 -84
  151. package/coverage/lcov-report/map/common/dynamic-grid-source.js.html +68 -68
  152. package/coverage/lcov-report/map/common/errors.js.html +16 -16
  153. package/coverage/lcov-report/map/common/geotiff-grid-source.js.html +267 -267
  154. package/coverage/lcov-report/map/common/grid.js.html +554 -554
  155. package/coverage/lcov-report/map/common/index.html +159 -159
  156. package/coverage/lcov-report/map/common/index.js.html +68 -68
  157. package/coverage/lcov-report/map/common/meteo-model-grid-source.js.html +73 -73
  158. package/coverage/lcov-report/map/common/moment-utils.js.html +18 -18
  159. package/coverage/lcov-report/map/common/opendap-grid-source.js.html +484 -484
  160. package/coverage/lcov-report/map/common/opendap-utils.js.html +353 -353
  161. package/coverage/lcov-report/map/common/permissions.js.html +40 -40
  162. package/coverage/lcov-report/map/common/time-based-grid-source.js.html +59 -59
  163. package/coverage/lcov-report/map/common/tms-utils.js.html +1 -1
  164. package/coverage/lcov-report/map/common/wcs-grid-source.js.html +190 -190
  165. package/coverage/lcov-report/map/common/wcs-utils.js.html +338 -338
  166. package/coverage/lcov-report/map/common/weacast-grid-source.js.html +345 -345
  167. package/coverage/lcov-report/map/common/wfs-utils.js.html +1 -1
  168. package/coverage/lcov-report/map/common/wms-utils.js.html +1 -1
  169. package/coverage/lcov-report/map/common/wmts-utils.js.html +1 -1
  170. package/coverage/lcov.info +6880 -5908
  171. package/coverage/map/api/hooks/hooks.catalog.js.html +316 -316
  172. package/coverage/map/api/hooks/hooks.features.js.html +218 -218
  173. package/coverage/map/api/hooks/hooks.query.js.html +798 -789
  174. package/coverage/map/api/hooks/index.html +54 -54
  175. package/coverage/map/api/hooks/index.js.html +16 -16
  176. package/coverage/map/api/index.html +32 -32
  177. package/coverage/map/api/index.js.html +46 -46
  178. package/coverage/map/api/marshall.js.html +72 -72
  179. package/coverage/map/api/models/alerts.model.mongodb.js.html +24 -24
  180. package/coverage/map/api/models/catalog.model.mongodb.js.html +44 -44
  181. package/coverage/map/api/models/features.model.mongodb.js.html +80 -80
  182. package/coverage/map/api/models/index.html +65 -65
  183. package/coverage/map/api/models/projects.model.mongodb.js.html +26 -26
  184. package/coverage/map/api/models/styles.model.mongodb.js.html +28 -28
  185. package/coverage/map/api/services/alerts/alerts.hooks.js.html +136 -136
  186. package/coverage/map/api/services/alerts/alerts.service.js.html +343 -343
  187. package/coverage/map/api/services/alerts/index.html +32 -32
  188. package/coverage/map/api/services/catalog/catalog.hooks.js.html +172 -172
  189. package/coverage/map/api/services/catalog/index.html +21 -21
  190. package/coverage/map/api/services/daptiles/daptiles.service.js.html +1 -1
  191. package/coverage/map/api/services/daptiles/index.html +1 -1
  192. package/coverage/map/api/services/features/features.hooks.js.html +160 -160
  193. package/coverage/map/api/services/features/features.service.js.html +117 -117
  194. package/coverage/map/api/services/features/index.html +31 -31
  195. package/coverage/map/api/services/index.html +21 -21
  196. package/coverage/map/api/services/index.js.html +334 -334
  197. package/coverage/map/api/services/projects/index.html +21 -21
  198. package/coverage/map/api/services/projects/projects.hooks.js.html +237 -237
  199. package/coverage/map/api/services/styles/index.html +21 -21
  200. package/coverage/map/api/services/styles/styles.hooks.js.html +84 -84
  201. package/coverage/map/common/dynamic-grid-source.js.html +68 -68
  202. package/coverage/map/common/errors.js.html +16 -16
  203. package/coverage/map/common/geotiff-grid-source.js.html +267 -267
  204. package/coverage/map/common/grid.js.html +554 -554
  205. package/coverage/map/common/index.html +159 -159
  206. package/coverage/map/common/index.js.html +68 -68
  207. package/coverage/map/common/meteo-model-grid-source.js.html +73 -73
  208. package/coverage/map/common/moment-utils.js.html +18 -18
  209. package/coverage/map/common/opendap-grid-source.js.html +484 -484
  210. package/coverage/map/common/opendap-utils.js.html +353 -353
  211. package/coverage/map/common/permissions.js.html +40 -40
  212. package/coverage/map/common/time-based-grid-source.js.html +59 -59
  213. package/coverage/map/common/tms-utils.js.html +1 -1
  214. package/coverage/map/common/wcs-grid-source.js.html +190 -190
  215. package/coverage/map/common/wcs-utils.js.html +338 -338
  216. package/coverage/map/common/weacast-grid-source.js.html +345 -345
  217. package/coverage/map/common/wfs-utils.js.html +1 -1
  218. package/coverage/map/common/wms-utils.js.html +1 -1
  219. package/coverage/map/common/wmts-utils.js.html +1 -1
  220. package/coverage/tmp/coverage-151198-1753351220086-0.json +1 -0
  221. package/coverage/tmp/coverage-151210-1753351220070-0.json +1 -0
  222. package/coverage/tmp/coverage-151221-1753351129816-0.json +1 -0
  223. package/coverage/tmp/coverage-151233-1753351129803-0.json +1 -0
  224. package/coverage/tmp/coverage-151240-1753351129770-0.json +1 -0
  225. package/coverage/tmp/coverage-151307-1753351220058-0.json +1 -0
  226. package/coverage/tmp/coverage-151319-1753351220044-0.json +1 -0
  227. package/coverage/tmp/coverage-151326-1753351220010-0.json +1 -0
  228. package/map/api/hooks/hooks.query.js +7 -4
  229. package/map/api/services/styles/styles.hooks.js +1 -1
  230. package/map/client/components/KLayerEditor.vue +4 -0
  231. package/map/client/components/catalog/KLayerCategories.vue +2 -0
  232. package/map/client/components/stickies/KAttribution.vue +8 -7
  233. package/map/client/components/stickies/KLevelSlider.vue +10 -8
  234. package/map/client/components/styles/KStyleEditor.vue +1 -1
  235. package/map/client/components/styles/KStyleManager.vue +7 -1
  236. package/map/client/composables/highlight.js +5 -1
  237. package/map/client/i18n/map_en.json +4 -1
  238. package/map/client/i18n/map_fr.json +5 -2
  239. package/map/client/leaflet/utils/utils.geojson.js +5 -4
  240. package/map/client/mixins/globe/mixin.geojson-layers.js +11 -5
  241. package/map/client/mixins/mixin.activity.js +9 -0
  242. package/map/client/utils/utils.layers.js +0 -2
  243. package/package.json +1 -1
  244. package/test/api/core/index.test.js +49 -60
  245. package/test/api/core/push.test.js +1 -1
  246. package/test/api/core/test-log-2025-06-25.log +9 -0
  247. package/test/api/core/test-log-2025-07-24.log +44 -0
  248. package/test/api/map/test-log-2025-05-27.log +13 -0
  249. package/test/api/map/test-log-2025-06-23.log +7 -0
  250. package/test/api/map/test-log-2025-07-24.log +11 -0
  251. package/coverage/tmp/coverage-323534-1747828879483-0.json +0 -1
  252. package/coverage/tmp/coverage-323546-1747828879453-0.json +0 -1
  253. package/coverage/tmp/coverage-323557-1747828879439-0.json +0 -1
  254. package/coverage/tmp/coverage-323569-1747828879416-0.json +0 -1
  255. package/coverage/tmp/coverage-323576-1747828879390-0.json +0 -1
@@ -355,14 +355,16 @@ export async function aggregateFeaturesQuery (hook) {
355
355
  // Delete accumulator
356
356
  _.unset(result, element)
357
357
  }
358
- // Keep track of result in map to improve search later
359
- const resultKeys = keys.map(key => _.get(singleTime ? result : result._id, key))
360
- const resultKey = resultKeys.join('-')
361
- if (!aggregatedResultsMap.has(resultKey)) aggregatedResultsMap.set(resultKey, result)
362
358
  })
363
359
  // Now merge with previous element results
364
360
  if (!aggregatedResults) {
365
361
  aggregatedResults = elementResults
362
+ aggregatedResults.forEach(result => {
363
+ // Keep track of result in map to improve search later
364
+ const resultKeys = keys.map(key => _.get(singleTime ? result : result._id, key))
365
+ const resultKey = resultKeys.join('-')
366
+ aggregatedResultsMap.set(resultKey, result)
367
+ })
366
368
  } else {
367
369
  elementResults.forEach(result => {
368
370
  // When single time no aggregation is performed at all so we only have raw features
@@ -385,6 +387,7 @@ export async function aggregateFeaturesQuery (hook) {
385
387
  _.set(previousResult, prefix + element, _.get(result, prefix + element))
386
388
  } else {
387
389
  aggregatedResults.push(result)
390
+ aggregatedResultsMap.set(resultKey, result)
388
391
  }
389
392
  })
390
393
  }
@@ -3,7 +3,7 @@ import { hooks as kdkCoreHooks } from '../../../../core/api/index.js'
3
3
 
4
4
  export default {
5
5
  before: {
6
- all: [],
6
+ all: [kdkCoreHooks.marshallHttpQuery],
7
7
  find: [
8
8
  fuzzySearch({ fields: ['name'] }),
9
9
  kdkCoreHooks.diacriticSearch()
@@ -430,7 +430,11 @@ function apply () {
430
430
 
431
431
  const layer = CurrentActivity.value.getLayerByName(props.layerName)
432
432
  if (isInMemoryLayer(layer)) {
433
+ const previousName = _.get(layer, 'name', '')
433
434
  _.merge(layer, updatedLayer)
435
+ if (previousName !== layer.name) {
436
+ CurrentActivity.value.renameLayer(previousName, layer.name)
437
+ }
434
438
  CurrentActivity.value.resetLayer(layer)
435
439
  } else {
436
440
  // Dotify the layer to avoid patching the whole object
@@ -233,6 +233,7 @@ export default {
233
233
  throw error
234
234
  }
235
235
  this.mode = 'list'
236
+ this.addForm = null
236
237
  }
237
238
  },
238
239
  async onEdit () {
@@ -248,6 +249,7 @@ export default {
248
249
  }
249
250
  this.editedCategory = null
250
251
  this.mode = 'list'
252
+ this.editForm = null
251
253
  }
252
254
  },
253
255
  refreshCategories (items) {
@@ -64,17 +64,18 @@ import KShape from '../../../../core/client/components/media/KShape.vue'
64
64
  // Data
65
65
  const { CurrentActivity } = useCurrentActivity({ selection: false, probe: false })
66
66
  const attributions = ref({})
67
- const header = ref(_.get(config, 'attribution.header', []))
68
- const headerClass = ref(_.get(config, 'attribution.headerClass', ''))
69
- const footer = ref(_.get(config, 'attribution.footer', []))
70
- const footerClass = ref(_.get(config, 'attribution.footerClass', ''))
67
+ const header = _.get(config, 'attribution.header', [])
68
+ const headerClass = _.get(config, 'attribution.headerClass', '')
69
+ const footer = _.get(config, 'attribution.footer', [])
70
+ const footerClass = _.get(config, 'attribution.footerClass', '')
71
71
 
72
72
  // Computed
73
73
  const sanitizedAttributions = computed(() => {
74
- let content = ''
75
- _.forOwn(attributions.value, (attribution, layer) => {
74
+ const filteredAttributions = _.uniq(_.map(attributions.value))
75
+ const content = _.reduce(filteredAttributions, (content, attribution) => {
76
76
  content += `${attribution}<br>`
77
- })
77
+ return content
78
+ }, '')
78
79
  return Document.sanitizeHtml(content)
79
80
  })
80
81
 
@@ -32,7 +32,7 @@
32
32
  class="text-caption text-grey-9"
33
33
  style="writing-mode: vertical-lr; min-width: 1rem;"
34
34
  >
35
- {{ $t(label) }} - {{ getFormattedLevel(CurrentActivity.selectedLevel) }}
35
+ {{ $t(label) }} - {{ getFormattedLevel(level) }}
36
36
  </div>
37
37
  </div>
38
38
  </div>
@@ -68,6 +68,10 @@ const levels = computed(() => {
68
68
  const selectableLevels = _.get(CurrentActivity.value, 'selectableLevels')
69
69
  return !_.isEmpty(selectableLevels) ? selectableLevels : null
70
70
  })
71
+ const unit = computed(() => {
72
+ const selectableLevels = _.get(CurrentActivity.value, 'selectableLevels')
73
+ return !_.isEmpty(selectableLevels) ? selectableLevels.unit : ''
74
+ })
71
75
  const label = computed(() => {
72
76
  return _.get(levels.value, 'label')
73
77
  })
@@ -85,10 +89,9 @@ const sliderStep = computed(() => {
85
89
  })
86
90
 
87
91
  // Watch
88
- watch(() => CurrentActivity.value.selectableLevels, (levels) => {
89
- if (levels.values) level.value = _.head(levels.values)
90
- else if (levels.range) level.value = _.get(levels.range, 'min', 0)
91
- else level.value = 0
92
+ watch(() => CurrentActivity.value.selectedLevel, (selectedLevel) => {
93
+ if (levels.value && levels.value.values) level.value = levels.value.values.indexOf(selectedLevel)
94
+ else level.value = selectedLevel
92
95
  })
93
96
 
94
97
  // Functions
@@ -100,9 +103,8 @@ function onLevelChanged (level) {
100
103
  }
101
104
  }
102
105
  function getFormattedLevel (level) {
103
- const unit = _.get(CurrentActivity.value.selectableLevels, 'unit')
104
- if (levels.value.values) return `${levels.value.values[level]} ${unit}`
105
- return `${level} ${unit}`
106
+ if (levels.value.values) return `${levels.value.values[level]} ${unit.value}`
107
+ return `${level} ${unit.value}`
106
108
  }
107
109
  </script>
108
110
 
@@ -224,7 +224,7 @@ const canEditPolygon = computed(() => props.allowedTypes.includes('polygon'))
224
224
 
225
225
  // Watch
226
226
  watch(() => props.style, (value) => {
227
- if (!value) model.value = _.clone(engine.value.style)
227
+ if (!value) model.value = _.clone(_.pick(engine.value.style, ['point', 'line', 'polygon']))
228
228
  else model.value = value
229
229
  }, { immediate: true })
230
230
 
@@ -154,7 +154,13 @@ function applyToSelection (styleToApply) {
154
154
  _.forEach(getSelectedFeaturesByLayer(), layer => {
155
155
  if (isLayerStyleEditable(layer.layer)) {
156
156
  _.forEach(layer.features, f => {
157
- _.set(f, 'style', _.get(styleToApply, ['item', _.get(type, f.geometry.type, 'point')], null))
157
+ let geometryType = f.geometry.type
158
+ if (_.has(f, 'properties.entityStyle')) {
159
+ // Walls and corridors must be treated as polygons in style editor
160
+ if (_.has(f, 'properties.entityStyle.wall')) geometryType = 'Polygon'
161
+ else if (_.has(f, 'properties.entityStyle.corridor')) geometryType = 'Polygon'
162
+ }
163
+ _.set(f, 'style', _.get(styleToApply, ['item', _.get(type, geometryType, 'point')], null))
158
164
  })
159
165
  if (CurrentActivity.value.isInMemoryLayer(layer.layer)) {
160
166
  CurrentActivity.value.resetLayer(layer.layer)
@@ -122,8 +122,12 @@ export function useHighlight (name, options = {}) {
122
122
  // If highlight size is based on a shape with a radius use it, otherwise go for size
123
123
  if (radius) Object.assign(highlightStyle, { radius: radius + 0.5 * HighlightMargin })
124
124
  else if (size) Object.assign(highlightStyle, { size: [size[0] + HighlightMargin, size[1] + HighlightMargin] })
125
+
126
+ Object.assign(highlight, { style: highlightStyle })
127
+ } else {
128
+ // In 3D, keep important style properties from feature, such as "altitudeMode"
129
+ Object.assign(highlight, { style: _.defaults({}, highlightStyle, feature.style) })
125
130
  }
126
- Object.assign(highlight, { style: highlightStyle })
127
131
  } else {
128
132
  // Retrieve feature sytle
129
133
  Object.assign(highlight, { style: feature.style })
@@ -386,7 +386,10 @@
386
386
  "KOwsServiceField": {
387
387
  "INVALID_URL": "Invalid URL",
388
388
  "CANNOT_FETCH_URL": "Failed fetching resource.",
389
- "WFS_MISSING_GEOJSON_SUPPORT": "The WFS service has no support for GeoJSON, which is required."
389
+ "WFS_MISSING_GEOJSON_SUPPORT": "The WFS service has no support for GeoJSON, which is required.",
390
+ "HEADER_KEY": "Token header key",
391
+ "HEADER_VALUE": "Token value",
392
+ "UNAUTHORIZED_MESSAGE": "You do not seem to be authorized to access this service, you might need to add an API key in the request header."
390
393
  },
391
394
  "KOwsLayerField": {
392
395
  "UNABLE_TO_DESCRIBE_FEATURE_TYPE": "Failed fetching layer's description.",
@@ -375,7 +375,7 @@
375
375
  },
376
376
  "side-nav": {
377
377
  "HELP_LABEL": "Accédez à notre aide en ligne à tout moment",
378
- "CONTEXT_HELP_LABEL": "Pour obtenir de l'aide contextuelle lorsque vous êtes perdu cliquez à tout moment cette l'icône",
378
+ "CONTEXT_HELP_LABEL": "Pour obtenir de l'aide contextuelle lorsque vous êtes perdu, cliquez à tout moment sur cette icône",
379
379
  "ABOUT_LABEL": "Affichez les informations détaillées du système et signalez-nous une anomalie.",
380
380
  "BUG_LABEL": "Signalez-nous une anomalie via un email contenant automatiquement les informations nécessaires.",
381
381
  "SETTINGS_LABEL": "Modifiez les paramètres généraux du système sur votre appareil.",
@@ -386,7 +386,10 @@
386
386
  "KOwsServiceField": {
387
387
  "INVALID_URL": "URL invalide",
388
388
  "CANNOT_FETCH_URL": "Impossible de récupérer la ressource.",
389
- "WFS_MISSING_GEOJSON_SUPPORT": "Le service WFS ne supporte pas le format GeoJSON qui est un prérequis."
389
+ "WFS_MISSING_GEOJSON_SUPPORT": "Le service WFS ne supporte pas le format GeoJSON qui est un prérequis.",
390
+ "HEADER_KEY": "Clef d'en-tête du jeton",
391
+ "HEADER_VALUE": "Valeur du jeton",
392
+ "UNAUTHORIZED_MESSAGE": "Vous ne semblez pas autorisé(e) à accéder à ce service, un jeton d'accès dans l'en-tête de requête peut être nécessaire."
390
393
  },
391
394
  "KOwsLayerField": {
392
395
  "UNABLE_TO_DESCRIBE_FEATURE_TYPE": "Impossible de récupérer la description des propriétés de la couche.",
@@ -93,14 +93,13 @@ export function getUpdateFeatureFunction(leafletOptions) {
93
93
  if (!oldLayer) return
94
94
  const oldType = _.get(oldLayer, 'feature.geometry.type')
95
95
  const type = _.get(feature, 'geometry.type')
96
- // The feature is changing its geometry type, recreate it
97
- if (type !== oldType) return
98
96
  const staticGeometry = _.get(leafletOptions, 'staticGeometry', false)
97
+ // The feature is changing its geometry type, recreate it except for static geometry
98
+ // as we'd like the geometry of the features tu remain stable in this case (eg lines in for probes vs bbox for measures)
99
+ if (!staticGeometry && (type !== oldType)) return
99
100
  // Keep track of previous geometry if we don't want to update it
100
101
  // Indeed, styling might depend on it
101
102
  if (staticGeometry) feature.geometry = _.get(oldLayer, 'feature.geometry')
102
- // Now update coordinates if not static geometry
103
- if (staticGeometry) return oldLayer
104
103
  // An existing one is found, simply update styling, properties, etc.
105
104
  leafletOptions.onEachFeature(feature, oldLayer)
106
105
  if (oldLayer.setStyle) {
@@ -130,6 +129,8 @@ export function getUpdateFeatureFunction(leafletOptions) {
130
129
  // oldLayer.setIcon(_.get(leafletOptions.pointToLayer(feature, oldLayer.getLatLng()), 'options.icon'))
131
130
  return
132
131
  }
132
+ // Now update coordinates if not static geometry
133
+ if (staticGeometry) return oldLayer
133
134
  const coordinates = feature.geometry.coordinates
134
135
  // FIXME: support others geometry types ?
135
136
  switch (type) {
@@ -138,7 +138,8 @@ export const geojsonLayers = {
138
138
  outlineColor: new ConstantProperty(stroke),
139
139
  outlineWidth: strokeWidth,
140
140
  outline: new ConstantProperty(true)
141
- }
141
+ },
142
+ feature: entity.feature
142
143
  })
143
144
  entitiesToRemove.push(entity)
144
145
  }
@@ -172,8 +173,10 @@ export const geojsonLayers = {
172
173
  outlineColor: new ConstantProperty(stroke),
173
174
  outlineWidth: strokeWidth,
174
175
  outline: new ConstantProperty(true)
175
- }
176
+ },
177
+ feature: entity.feature
176
178
  })
179
+ entitiesToRemove.push(entity)
177
180
  }
178
181
  }
179
182
  // Corridors
@@ -206,7 +209,8 @@ export const geojsonLayers = {
206
209
  outlineColor: new ConstantProperty(stroke),
207
210
  outlineWidth: strokeWidth,
208
211
  outline: new ConstantProperty(true)
209
- }
212
+ },
213
+ feature: entity.feature
210
214
  })
211
215
  entitiesToRemove.push(entity)
212
216
  }
@@ -234,7 +238,8 @@ export const geojsonLayers = {
234
238
  outlineColor: new ConstantProperty(stroke),
235
239
  outlineWidth: strokeWidth
236
240
  },
237
- billboard: billboardImage ? { image: billboardImage } : undefined
241
+ billboard: billboardImage ? { image: billboardImage } : undefined,
242
+ feature: entity.feature
238
243
  })
239
244
  entitiesToRemove.push(entity)
240
245
  }
@@ -257,7 +262,8 @@ export const geojsonLayers = {
257
262
  width: strokeWidth,
258
263
  material: stroke,
259
264
  clampToGround: true
260
- }
265
+ },
266
+ feature: entity.feature
261
267
  }
262
268
  entitiesToAdd.push(strokeEntity)
263
269
  if (dataSource.entities.getById(strokeEntity.id)) {
@@ -130,6 +130,15 @@ export const activity = {
130
130
  isLayerRemovable: layers.isLayerRemovable,
131
131
  isLayerStyleEditable: layers.isLayerStyleEditable,
132
132
  isLayerDataEditable: layers.isLayerDataEditable,
133
+ canCreateLayer () {
134
+ return this.$can('create', 'catalog')
135
+ },
136
+ canUpdateLayer (layer) {
137
+ return layers.isInMemoryLayer(layer) || this.$can('update', 'catalog')
138
+ },
139
+ canRemoveLayer (layer) {
140
+ return layers.isInMemoryLayer(layer) || this.$can('remove', 'catalog')
141
+ },
133
142
  async resetLayer (layer) {
134
143
  // Keep track of data as we will reset the layer
135
144
  let geoJson
@@ -48,8 +48,6 @@ export function isLayerStorable (layer) {
48
48
  }
49
49
 
50
50
  export function isLayerEditable (layer) {
51
- // Only possible when saved by default
52
- if (!layer._id) return false
53
51
  return _.get(layer, 'isEditable', isUserLayer(layer))
54
52
  }
55
53
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kalisio/kdk",
3
3
  "description": "Kalisio Development Kit",
4
- "version": "2.5.1",
4
+ "version": "2.5.3",
5
5
  "homepage": "https://github.com/kalisio/kdk",
6
6
  "type": "module",
7
7
  "keywords": [
@@ -1,9 +1,11 @@
1
+ /* eslint-disable no-unused-expressions */
1
2
  import path, { dirname } from 'path'
2
3
  import assert from 'assert'
3
4
  import fs from 'fs-extra'
4
5
  import request from 'superagent'
5
6
  import chai from 'chai'
6
7
  import chailint from 'chai-lint'
8
+ import spies from 'chai-spies'
7
9
  import core, { kdk, hooks, permissions, createMessagesService } from '../../../core/api/index.js'
8
10
  import { fileURLToPath } from 'url'
9
11
 
@@ -13,10 +15,12 @@ const { util, expect } = chai
13
15
 
14
16
  describe('core:services', () => {
15
17
  let app, server, port, baseUrl, accessToken,
16
- userService, userObject, authorisationService, messagesService, messageObject
18
+ userService, userObject, authorisationService, messagesService, messageObject,
19
+ spyUpdateAbilities
17
20
 
18
21
  before(async () => {
19
22
  chailint(chai, util)
23
+ chai.use(spies)
20
24
 
21
25
  // Register default rules for all users
22
26
  permissions.defineAbilities.registerHook(permissions.defineUserAbilities)
@@ -52,6 +56,7 @@ describe('core:services', () => {
52
56
  authorisationService.hooks({
53
57
  before: { create: hooks.preventEscalation, remove: hooks.preventEscalation }
54
58
  })
59
+ spyUpdateAbilities = chai.spy.on(authorisationService, 'updateAbilities')
55
60
  // Now app is configured launch the server
56
61
  server = await app.listen(port)
57
62
  await new Promise(resolve => server.once('listening', () => resolve()))
@@ -129,42 +134,37 @@ describe('core:services', () => {
129
134
  // Let enough time to process
130
135
  .timeout(20000)
131
136
 
132
- it('creates a user', () => {
137
+ it('creates a user', async () => {
133
138
  // Test password generation
134
139
  const hook = hooks.generatePassword()({ type: 'before', data: {}, params: {}, app })
135
- return userService.create({
140
+ userObject = await userService.create({
136
141
  email: 'test@test.org',
137
142
  password: hook.data.password,
138
143
  name: 'test-user',
139
144
  profile: { phone: '0623256968' }
140
145
  }, { checkAuthorisation: true })
141
- .then(user => {
142
- userObject = user
143
- // Keep track of clear password
144
- userObject.clearPassword = hook.data.password
145
- return userService.find({ query: { 'profile.name': 'test-user' } })
146
- })
147
- .then(users => {
148
- expect(users.data.length > 0).beTrue()
149
- expect(users.data[0].email).toExist()
150
- expect(users.data[0].clearPassword).beUndefined()
151
- expect(users.data[0].profile).toExist()
152
- expect(users.data[0].profile.name).toExist()
153
- expect(users.data[0].profile.description).toExist()
154
- })
146
+ expect(spyUpdateAbilities).to.have.been.called.once
147
+ spyUpdateAbilities.reset()
148
+ // Keep track of clear password
149
+ userObject.clearPassword = hook.data.password
150
+ const users = await userService.find({ query: { 'profile.name': 'test-user' } })
151
+ expect(users.data.length > 0).beTrue()
152
+ expect(users.data[0].email).toExist()
153
+ expect(users.data[0].clearPassword).beUndefined()
154
+ expect(users.data[0].profile).toExist()
155
+ expect(users.data[0].profile.name).toExist()
156
+ expect(users.data[0].profile.description).toExist()
155
157
  })
156
158
  // Let enough time to process
157
159
  .timeout(10000)
158
160
 
159
- it('changing user password keeps password history', () => {
160
- return userService.patch(userObject._id.toString(), { password: userObject.password })
161
- .then(() => {
162
- return userService.get(userObject._id.toString())
163
- })
164
- .then(user => {
165
- expect(user.previousPasswords).toExist()
166
- expect(user.previousPasswords).to.deep.equal([userObject.password])
167
- })
161
+ it('changing user password keeps password history', async () => {
162
+ await userService.patch(userObject._id.toString(), { password: userObject.password })
163
+ expect(spyUpdateAbilities).to.have.been.called.once
164
+ spyUpdateAbilities.reset()
165
+ const user = await userService.get(userObject._id.toString())
166
+ expect(user.previousPasswords).toExist()
167
+ expect(user.previousPasswords).to.deep.equal([userObject.password])
168
168
  })
169
169
 
170
170
  it('authenticates a user', () => {
@@ -257,8 +257,8 @@ describe('core:services', () => {
257
257
  // Let enough time to process
258
258
  .timeout(5000)
259
259
 
260
- it('creates an authorisation', () => {
261
- return authorisationService.create({
260
+ it('creates an authorisation', async () => {
261
+ const authorisation = await authorisationService.create({
262
262
  scope: 'authorisations',
263
263
  permissions: 'manager',
264
264
  subjects: userObject._id.toString(),
@@ -268,16 +268,13 @@ describe('core:services', () => {
268
268
  }, {
269
269
  user: userObject
270
270
  })
271
- .then(authorisation => {
272
- expect(authorisation).toExist()
273
- return userService.get(userObject._id.toString())
274
- })
275
- .then(user => {
276
- userObject = user
277
- expect(user.authorisations).toExist()
278
- expect(user.authorisations.length > 0).beTrue()
279
- expect(user.authorisations[0].permissions).to.deep.equal('manager')
280
- })
271
+ expect(authorisation).toExist()
272
+ expect(spyUpdateAbilities).to.have.been.called.once
273
+ spyUpdateAbilities.reset()
274
+ userObject = await userService.get(userObject._id.toString())
275
+ expect(userObject.authorisations).toExist()
276
+ expect(userObject.authorisations.length > 0).beTrue()
277
+ expect(userObject.authorisations[0].permissions).to.deep.equal('manager')
281
278
  })
282
279
  // Let enough time to process
283
280
  .timeout(5000)
@@ -323,8 +320,8 @@ describe('core:services', () => {
323
320
  })
324
321
  })
325
322
 
326
- it('removes an authorisation', () => {
327
- return authorisationService.remove(messageObject._id, {
323
+ it('removes an authorisation', async () => {
324
+ const authorisation = await authorisationService.remove(messageObject._id, {
328
325
  query: {
329
326
  scope: 'authorisations',
330
327
  subjects: userObject._id.toString(),
@@ -334,14 +331,12 @@ describe('core:services', () => {
334
331
  user: userObject,
335
332
  checkEscalation: true
336
333
  })
337
- .then(authorisation => {
338
- expect(authorisation).toExist()
339
- return userService.get(userObject._id.toString())
340
- })
341
- .then(user => {
342
- expect(user.authorisations).toExist()
343
- expect(user.authorisations.length === 0).beTrue()
344
- })
334
+ expect(authorisation).toExist()
335
+ expect(spyUpdateAbilities).to.have.been.called.once
336
+ spyUpdateAbilities.reset()
337
+ const user = await userService.get(userObject._id.toString())
338
+ expect(user.authorisations).toExist()
339
+ expect(user.authorisations.length === 0).beTrue()
345
340
  })
346
341
  // Let enough time to process
347
342
  .timeout(5000)
@@ -365,21 +360,15 @@ describe('core:services', () => {
365
360
  })
366
361
  })
367
362
 
368
- it('removes a user', () => {
369
- return userService.remove(userObject._id, {
363
+ it('removes a user', async () => {
364
+ await userService.remove(userObject._id, {
370
365
  user: userObject,
371
366
  checkAuthorisation: true
372
367
  })
373
- .then(user => {
374
- return userService.find({ query: { name: 'test-user' } })
375
- })
376
- .then(users => {
377
- expect(users.data.length === 0).beTrue()
378
- return messagesService.find({ query: { title: 'Title' } })
379
- })
380
- .then(messages => {
381
- expect(messages.data.length === 0).beTrue()
382
- })
368
+ const users = await userService.find({ query: { name: 'test-user' } })
369
+ expect(users.data.length === 0).beTrue()
370
+ const messages = await messagesService.find({ query: { title: 'Title' } })
371
+ expect(messages.data.length === 0).beTrue()
383
372
  })
384
373
  // Let enough time to process
385
374
  .timeout(5000)
@@ -175,7 +175,7 @@ describe('core:push', () => {
175
175
  expect(operation.succesful.length === 1).beTrue()
176
176
  expect(operation.succesful[0].statusCode).to.equal(201)
177
177
  expect(operation.failed.length === 1).beTrue()
178
- expect(operation.failed[0].statusCode).to.equal(404)
178
+ expect((operation.failed[0].statusCode === 404) || (operation.failed[0].statusCode === 410)).beTrue()
179
179
  expect(operation.failed[0].endpoint).to.equal(expiredSubscription.endpoint)
180
180
  })
181
181
  // Let enough time to process
@@ -0,0 +1,9 @@
1
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
2
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
3
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
4
+ {"level":"error","message":"error: api/messages - Method: create: You are not allowed to access service messages"}
5
+ {"level":"error","message":"error: api/users - Method: create: The provided password does not comply to the password policy"}
6
+ {"level":"error","message":"error: api/users - Method: create: The provided password does not comply to the password policy"}
7
+ {"level":"error","message":"error: api/authorisations - Method: create: You are not allowed to change authorisation on resource"}
8
+ {"level":"error","message":"error: api/authorisations - Method: remove: You are not allowed to change authorisation on subject(s)"}
9
+ {"level":"info","message":"This is a log test"}