Skip to content

PB-1387: all API files as a package#1542

Merged
pakb merged 6 commits intofeat-PB-1383-pinia-storefrom
feat-PB-1387-api-as-module
Jan 7, 2026
Merged

PB-1387: all API files as a package#1542
pakb merged 6 commits intofeat-PB-1383-pinia-storefrom
feat-PB-1387-api-as-module

Conversation

@pakb
Copy link
Contributor

@pakb pakb commented Dec 19, 2025

also moving there GPX/KML utils, and legacy param utils, as they are used by some API files

Test link

@pakb pakb force-pushed the feat-PB-1387-api-as-module branch from 8a084fa to dcbc219 Compare January 5, 2026 14:23
@cypress
Copy link

cypress bot commented Jan 5, 2026

web-mapviewer    Run #6296

Run Properties:  status check errored Errored #6296  •  git commit cf7e0c2007: PB-1387: replacing use of utils with new API package in e2e tests
Project web-mapviewer
Branch Review feat-PB-1387-api-as-module
Run status status check errored Errored #6296
Run duration 25m 06s
Commit git commit cf7e0c2007: PB-1387: replacing use of utils with new API package in e2e tests
Committer Pascal Barth
View all properties for this run ↗︎

Test results
Tests that failed  Failures 44
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 9
Tests that did not run due to a failure in a mocha hook  Skipped 3
Tests that passed  Passing 150
View all changes introduced in this branch ↗︎

Tests for review

Failed  drawing.cy.ts • 12 failed tests • e2e/chrome/mobile

View Output

Test Artifacts
Drawing module tests > Drawing mode/tools > can create marker/icons and edit them Test Replay Screenshots
Drawing module tests > KML management > deletes the drawing when confirming the delete modal Test Replay Screenshots
Drawing module tests > KML management > manages the KML layer in the layer list / URL params correctly Test Replay Screenshots
Drawing module tests > KML management > keeps the KML after a page reload, and creates a copy if it is then edited Test Replay Screenshots
Drawing module tests > KML management > manages the KML layer correctly if it comes attached with an adminId at startup Test Replay Screenshots
Drawing module tests > KML management > manages the KML layer correctly if it comes attached with an adminId at startup from a legacy URL Test Replay Screenshots
Drawing module tests > KML management > receives an empty KML and can use drawing mode Test Replay Screenshots
Drawing module tests > others > doesn't save an empty drawing (if not modified) Test Replay Screenshots
Drawing module tests > others > can export the drawing/profile in multiple formats Test Replay Screenshots
Drawing module tests > others > generates short links when sharing a drawing Test Replay Screenshots
The first 10 failed tests are shown, see all 12 tests in Cypress Cloud.
Failed  layers.cy.ts • 1 failed test • e2e/chrome/mobile

View Output

Test Artifacts
... > reads and adds an external WMS correctly Test Replay Screenshots
Failed  legacyParamImport.cy.ts • 7 failed tests • e2e/chrome/mobile

View Output

Test Artifacts
Test on legacy param import > Coordinates import > center where expected when given a X, Y coordinate in LV03 Test Replay Screenshots
Test on legacy param import > Layers import > is able to import an external KML from a legacy adminId query param Test Replay Screenshots
Test on legacy param import > Layers import > don't keep KML adminId in URL after import Test Replay Screenshots
Test on legacy param import > Layers import > is able to import an external KML from a legacy adminId query param with other layers Test Replay Screenshots
Test on legacy param import > Layers import > doesn't show encoding in the search bar when serving a swisssearch legacy url Test Replay Screenshots
Test on legacy param import > 3D import > transfers camera parameter from legacy URL to the new URL only heading Test Replay Screenshots
... > Select a few features and shows the tooltip in its correct spot Test Replay Screenshots
Failed  featureSelection.cy.ts • 4 failed tests • e2e/chrome/mobile

View Output

Test Artifacts
Testing the feature selection > Feature pre-selection in the URL > Synchronise URL and feature selection Test Replay Screenshots
Testing the feature selection > Feature identification on the map > can select an area to identify features inside it Test Replay Screenshots
Testing the feature selection > Feature identification on the map > can select feature by click, add more feature, and deselect feature Test Replay Screenshots
Testing the feature selection > Feature identification on the map > can print feature information Test Replay Screenshots
Failed  importToolMaps.cy.ts • 1 failed test • e2e/chrome/mobile

View Output

Test Artifacts
The Import Maps Tool > Import external WMTS layers Test Replay Screenshots

The first 5 failed specs are shown, see all 16 specs in Cypress Cloud.

@pakb pakb force-pushed the feat-PB-1387-api-as-module branch from dcbc219 to d00e500 Compare January 6, 2026 07:40
also moving there GPX/KML utils, and legacy param utils, as they are used by some API files
@pakb pakb force-pushed the feat-PB-1387-api-as-module branch 2 times, most recently from 3bba59e to bd39c66 Compare January 6, 2026 10:01
Moving Vitest CLI "flags" found in package json files into the config itself
@pakb pakb force-pushed the feat-PB-1387-api-as-module branch from bd39c66 to 7af7374 Compare January 6, 2026 10:51
pakb added 2 commits January 6, 2026 14:32
and especially Vitest, as there is in v4.0.9+ a fix for the pooling of threads, which fails sporadically on the CI.
Locking Vite in version v7.2.2, as upgrading further breaks the build with unplugin-dts.

Unplugin-dts has been in the same "beta" version for the last 6 month, we should maybe look for an alternative if it stays like that too long
since switching to the version 1.2.0, the manifest for the PWA has slightly increased, reaching the limit of 5MB.
I've pushed it to 7MB to keep the build from failing because of that.
@pakb pakb requested a review from schtibe January 6, 2026 14:11
@pakb pakb force-pushed the feat-PB-1387-api-as-module branch from cf7e0c2 to 6be25a2 Compare January 6, 2026 15:10
Copy link
Contributor

@schtibe schtibe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packaging looks OK. I mostly pointed out some cases where the enum wasn't used anymore

const distance =
BASE_OFFSET_DISTANCE +
(selectedFeatureType.value === EditableFeatureTypes.Measure ? MEASURE_ADDITIONAL_OFFSET : 0)
(selectedFeatureType.value === 'MEASURE' ? MEASURE_ADDITIONAL_OFFSET : 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional not to use the enum here?

let selectedInteraction
switch (drawingStore.edit.featureType) {
case EditableFeatureTypes.Annotation:
case 'ANNOTATION':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, why not the enum from the package?

*/
const isFeatureMarker = computed<boolean>(
() => drawingStore.feature.current?.featureType === EditableFeatureTypes.Marker
() => drawingStore.feature.current?.featureType === 'MARKER'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import enum?

import { isOnlineMode } from '@/store/modules/drawing/utils/isOnlineMode'
import useLayersStore from '@/store/modules/layers'

const layersStore = useLayersStore()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Maybe the answer lies elsewhere so this would be a comment to myself :D) why don't we need this filtering anymore?

textPlacement: TextPlacement.Top,
size: featureStyleUtils.MEDIUM,
color: featureStyleUtils.RED,
textPlacement: 'top',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think text_placement could also be used from @swissgeo/api

return visibleLayers
return visibleLayers.filter((layer) => {
// we filter out any "drawing" layer that are currently edited (it will be loaded by the drawing module onto the map)
if (layer.type === LayerType.KML) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it! 😁

looks like it could fix the issue that is present on the CI with video recording (takes forever)
@pakb pakb merged commit 8418cba into feat-PB-1383-pinia-store Jan 7, 2026
4 of 6 checks passed
@pakb pakb deleted the feat-PB-1387-api-as-module branch January 7, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants