From 11f6788056e3771b01c843cde4f3b3c02b6ab0bb Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Mon, 4 Nov 2024 12:43:45 +0200 Subject: [PATCH 1/3] chore: rename leg id as legId --- app/component/itinerary/NaviContainer.js | 10 +-- app/component/itinerary/NaviTop.js | 4 +- app/component/itinerary/NaviUtils.js | 8 +- app/component/itinerary/PlanConnection.js | 2 +- build/schema.graphql | 2 +- .../schema/schema.graphql | 2 +- package.json | 2 +- yarn.lock | 77 +------------------ 8 files changed, 18 insertions(+), 89 deletions(-) diff --git a/app/component/itinerary/NaviContainer.js b/app/component/itinerary/NaviContainer.js index 4eff2c7596..de93b77926 100644 --- a/app/component/itinerary/NaviContainer.js +++ b/app/component/itinerary/NaviContainer.js @@ -10,7 +10,7 @@ import { checkPositioningPermission } from '../../action/PositionActions'; const legQuery = graphql` query NaviContainer_legQuery($id: String!) { leg(id: $id) { - id + legId start { scheduledTime estimated { @@ -69,7 +69,7 @@ function NaviContainer( fetchQuery( relayEnvironment, legQuery, - { id: leg.id }, + { id: leg.legId }, { force: true }, ).toPromise(), ); @@ -79,10 +79,10 @@ function NaviContainer( Promise.all(legQueries).then(responses => { const legMap = {}; responses.forEach(data => { - legMap[data.leg.id] = data.leg; + legMap[data.leg.legId] = data.leg; }); const rtLegs = itinerary.legs.map(l => { - const rtLeg = l.id ? legMap[l.id] : null; + const rtLeg = l.legId ? legMap[l.legId] : null; if (rtLeg) { return { ...l, @@ -110,7 +110,7 @@ function NaviContainer( }); if (lastTransitLeg) { const rtLeg = realTimeLegs.find(leg => { - return leg.id === lastTransitLeg.id; + return leg.legId === lastTransitLeg.legId; }); arrivalChange = legTime(rtLeg.end) - legTime(lastTransitLeg.end); } diff --git a/app/component/itinerary/NaviTop.js b/app/component/itinerary/NaviTop.js index 09cf2a89d3..00b8f6cdb4 100644 --- a/app/component/itinerary/NaviTop.js +++ b/app/component/itinerary/NaviTop.js @@ -62,8 +62,8 @@ function NaviTop( incomingMessages.set(alert.id, alert); }); - const legChanged = newLeg?.id - ? newLeg.id !== currentLeg?.id + const legChanged = newLeg?.legId + ? newLeg.legId !== currentLeg?.legId : currentLeg?.mode !== newLeg?.mode; const l = currentLeg || newLeg; diff --git a/app/component/itinerary/NaviUtils.js b/app/component/itinerary/NaviUtils.js index 01b1d999dd..2db260bc59 100644 --- a/app/component/itinerary/NaviUtils.js +++ b/app/component/itinerary/NaviUtils.js @@ -57,12 +57,12 @@ export const getAdditionalMessages = (leg, time, intl, config, messages) => { }; export const getTransitLegState = (leg, intl, messages) => { - const { start, realtimeState, from, mode, id } = leg; + const { start, realtimeState, from, mode, legId } = leg; const { scheduledTime, estimated } = start; if (mode === 'WALK') { return null; } - const previousMessage = messages.get(id); + const previousMessage = messages.get(legId); const prevSeverity = previousMessage ? previousMessage.severity : null; const late = estimated?.delay > 0; @@ -116,7 +116,7 @@ export const getTransitLegState = (leg, intl, messages) => { severity = 'INFO'; } const state = severity - ? { severity, content, id, expiresOn: 'legChange' } + ? { severity, content, legId, expiresOn: 'legChange' } : null; return state; }; @@ -141,7 +141,7 @@ export const getItineraryAlerts = (realTimeLegs, intl, messages) => { }); } if (transferProblem !== null) { - const transferId = `transfer-${transferProblem[0].id}-${transferProblem[1].id}}`; + const transferId = `transfer-${transferProblem[0].legId}-${transferProblem[1].legId}}`; if (!messages.get(transferId)) { // todo no current design content = ( diff --git a/app/component/itinerary/PlanConnection.js b/app/component/itinerary/PlanConnection.js index d33ff77e24..9ce52b4532 100644 --- a/app/component/itinerary/PlanConnection.js +++ b/app/component/itinerary/PlanConnection.js @@ -69,7 +69,7 @@ const planConnection = graphql` mode distance transitLeg - id + legId interlineWithPreviousLeg duration headsign diff --git a/build/schema.graphql b/build/schema.graphql index 9c3fc2cf73..e14a11a2ea 100644 --- a/build/schema.graphql +++ b/build/schema.graphql @@ -673,7 +673,7 @@ type Leg { An identifier for the leg, which can be used to re-fetch transit leg information. Re-fetching fails when the underlying transit data no longer exists. """ - id: String + legId: String """ Interlines with previous leg. This is true when the same vehicle is used for the previous leg as for this leg diff --git a/digitransit-search-util/packages/digitransit-search-util-query-utils/schema/schema.graphql b/digitransit-search-util/packages/digitransit-search-util-query-utils/schema/schema.graphql index 9c3fc2cf73..e14a11a2ea 100644 --- a/digitransit-search-util/packages/digitransit-search-util-query-utils/schema/schema.graphql +++ b/digitransit-search-util/packages/digitransit-search-util-query-utils/schema/schema.graphql @@ -673,7 +673,7 @@ type Leg { An identifier for the leg, which can be used to re-fetch transit leg information. Re-fetching fails when the underlying transit data no longer exists. """ - id: String + legId: String """ Interlines with previous leg. This is true when the same vehicle is used for the previous leg as for this leg diff --git a/package.json b/package.json index 6c11cdcc67..7a7694c103 100644 --- a/package.json +++ b/package.json @@ -146,7 +146,7 @@ "axios": "1.6.7", "babel-plugin-dynamic-import-node": "2.3.3", "babel-plugin-relay": "16.2.0", - "body-parser": "1.19.0", + "body-parser": "1.20.3", "classnames": "2.2.6", "connect-redis": "5.0.0", "cookie-parser": "1.4.5", diff --git a/yarn.lock b/yarn.lock index e8f31ff47f..fe73834559 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7994,24 +7994,6 @@ __metadata: languageName: node linkType: hard -"body-parser@npm:1.19.0": - version: 1.19.0 - resolution: "body-parser@npm:1.19.0" - dependencies: - bytes: 3.1.0 - content-type: ~1.0.4 - debug: 2.6.9 - depd: ~1.1.2 - http-errors: 1.7.2 - iconv-lite: 0.4.24 - on-finished: ~2.3.0 - qs: 6.7.0 - raw-body: 2.4.0 - type-is: ~1.6.17 - checksum: 490231b4c89bbd43112762f7ba8e5342c174a6c9f64284a3b0fcabf63277e332f8316765596f1e5b15e4f3a6cf0422e005f4bb3149ed3a224bb025b7a36b9ac1 - languageName: node - linkType: hard - "body-parser@npm:1.20.1": version: 1.20.1 resolution: "body-parser@npm:1.20.1" @@ -8420,13 +8402,6 @@ __metadata: languageName: node linkType: hard -"bytes@npm:3.1.0": - version: 3.1.0 - resolution: "bytes@npm:3.1.0" - checksum: 7c3b21c5d9d44ed455460d5d36a31abc6fa2ce3807964ba60a4b03fd44454c8cf07bb0585af83bfde1c5cc2ea4bbe5897bc3d18cd15e0acf25a3615a35aba2df - languageName: node - linkType: hard - "bytes@npm:3.1.2": version: 3.1.2 resolution: "bytes@npm:3.1.2" @@ -11223,7 +11198,7 @@ __metadata: babel-plugin-relay: 16.2.0 babel-plugin-transform-react-remove-prop-types: 0.4.24 base64-arraybuffer: 0.1.5 - body-parser: 1.19.0 + body-parser: 1.20.3 chai: 4.3.7 classnames: 2.2.6 compression-webpack-plugin: 5.0.2 @@ -15279,19 +15254,6 @@ __metadata: languageName: node linkType: hard -"http-errors@npm:1.7.2": - version: 1.7.2 - resolution: "http-errors@npm:1.7.2" - dependencies: - depd: ~1.1.2 - inherits: 2.0.3 - setprototypeof: 1.1.1 - statuses: ">= 1.5.0 < 2" - toidentifier: 1.0.0 - checksum: 5534b0ae08e77f5a45a2380f500e781f6580c4ff75b816cb1f09f99a290b57e78a518be6d866db1b48cca6b052c09da2c75fc91fb16a2fe3da3c44d9acbb9972 - languageName: node - linkType: hard - "http-errors@npm:2.0.0": version: 2.0.0 resolution: "http-errors@npm:2.0.0" @@ -23157,13 +23119,6 @@ __metadata: languageName: node linkType: hard -"qs@npm:6.7.0": - version: 6.7.0 - resolution: "qs@npm:6.7.0" - checksum: dfd5f6adef50e36e908cfa70a6233871b5afe66fbaca37ecc1da352ba29eb2151a3797991948f158bb37fccde51bd57845cb619a8035287bfc24e4591172c347 - languageName: node - linkType: hard - "qs@npm:^6.11.2, qs@npm:^6.4.0, qs@npm:^6.9.4": version: 6.11.2 resolution: "qs@npm:6.11.2" @@ -23352,18 +23307,6 @@ __metadata: languageName: node linkType: hard -"raw-body@npm:2.4.0": - version: 2.4.0 - resolution: "raw-body@npm:2.4.0" - dependencies: - bytes: 3.1.0 - http-errors: 1.7.2 - iconv-lite: 0.4.24 - unpipe: 1.0.0 - checksum: 6343906939e018c6e633a34a938a5d6d1e93ffcfa48646e00207d53b418e941953b521473950c079347220944dc75ba10e7b3c08bf97e3ac72c7624882db09bb - languageName: node - linkType: hard - "raw-body@npm:2.5.1": version: 2.5.1 resolution: "raw-body@npm:2.5.1" @@ -25473,13 +25416,6 @@ __metadata: languageName: node linkType: hard -"setprototypeof@npm:1.1.1": - version: 1.1.1 - resolution: "setprototypeof@npm:1.1.1" - checksum: a8bee29c1c64c245d460ce53f7460af8cbd0aceac68d66e5215153992cc8b3a7a123416353e0c642060e85cc5fd4241c92d1190eec97eda0dcb97436e8fcca3b - languageName: node - linkType: hard - "setprototypeof@npm:1.2.0": version: 1.2.0 resolution: "setprototypeof@npm:1.2.0" @@ -26265,7 +26201,7 @@ __metadata: languageName: node linkType: hard -"statuses@npm:>= 1.4.0 < 2, statuses@npm:>= 1.5.0 < 2": +"statuses@npm:>= 1.4.0 < 2": version: 1.5.0 resolution: "statuses@npm:1.5.0" checksum: c469b9519de16a4bb19600205cffb39ee471a5f17b82589757ca7bd40a8d92ebb6ed9f98b5a540c5d302ccbc78f15dc03cc0280dd6e00df1335568a5d5758a5c @@ -27504,13 +27440,6 @@ __metadata: languageName: node linkType: hard -"toidentifier@npm:1.0.0": - version: 1.0.0 - resolution: "toidentifier@npm:1.0.0" - checksum: 199e6bfca1531d49b3506cff02353d53ec987c9ee10ee272ca6484ed97f1fc10fb77c6c009079ca16d5c5be4a10378178c3cacdb41ce9ec954c3297c74c6053e - languageName: node - linkType: hard - "toidentifier@npm:1.0.1": version: 1.0.1 resolution: "toidentifier@npm:1.0.1" @@ -27772,7 +27701,7 @@ __metadata: languageName: node linkType: hard -"type-is@npm:~1.6.17, type-is@npm:~1.6.18": +"type-is@npm:~1.6.18": version: 1.6.18 resolution: "type-is@npm:1.6.18" dependencies: From 05a9bada3e51d4f5993d05fdafd835ed2ea2afa3 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 8 Nov 2024 11:53:36 +0200 Subject: [PATCH 2/3] chore: update axios --- .../package.json | 2 +- package.json | 2 +- yarn.lock | 27 ++++++++++++++++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/digitransit-search-util/packages/digitransit-search-util-get-json/package.json b/digitransit-search-util/packages/digitransit-search-util-get-json/package.json index a007c1ae88..b2ce27d1d6 100644 --- a/digitransit-search-util/packages/digitransit-search-util-get-json/package.json +++ b/digitransit-search-util/packages/digitransit-search-util-get-json/package.json @@ -22,6 +22,6 @@ "license": "(AGPL-3.0 OR EUPL-1.2)", "dependencies": { "@digitransit-search-util/digitransit-search-util-serialize": "0.0.2", - "axios": "1.6.7" + "axios": "1.7.7" } } diff --git a/package.json b/package.json index a78068e860..e9a383c981 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "@hsl-fi/site-header": "4.5.0", "@mapbox/sphericalmercator": "1.1.0", "@mapbox/vector-tile": "1.3.1", - "axios": "1.6.7", + "axios": "1.7.7", "babel-plugin-dynamic-import-node": "2.3.3", "babel-plugin-relay": "16.2.0", "body-parser": "1.20.3", diff --git a/yarn.lock b/yarn.lock index 4b4008db46..4fc5d65977 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2236,7 +2236,7 @@ __metadata: resolution: "@digitransit-search-util/digitransit-search-util-get-json@workspace:digitransit-search-util/packages/digitransit-search-util-get-json" dependencies: "@digitransit-search-util/digitransit-search-util-serialize": 0.0.2 - axios: 1.6.7 + axios: 1.7.7 languageName: unknown linkType: soft @@ -7573,7 +7573,18 @@ __metadata: languageName: node linkType: hard -"axios@npm:1.6.7, axios@npm:^1.6.1": +"axios@npm:1.7.7": + version: 1.7.7 + resolution: "axios@npm:1.7.7" + dependencies: + follow-redirects: ^1.15.6 + form-data: ^4.0.0 + proxy-from-env: ^1.1.0 + checksum: 882d4fe0ec694a07c7f5c1f68205eb6dc5a62aecdb632cc7a4a3d0985188ce3030e0b277e1a8260ac3f194d314ae342117660a151fabffdc5081ca0b5a8b47fe + languageName: node + linkType: hard + +"axios@npm:^1.6.1": version: 1.6.7 resolution: "axios@npm:1.6.7" dependencies: @@ -11197,7 +11208,7 @@ __metadata: async: ^3.2.2 autoprefixer: 9.8.6 axe-core: ^4.7.2 - axios: 1.6.7 + axios: 1.7.7 babel-loader: 8.2.5 babel-plugin-dynamic-import-node: 2.3.3 babel-plugin-inline-react-svg: 2.0.2 @@ -13623,6 +13634,16 @@ __metadata: languageName: node linkType: hard +"follow-redirects@npm:^1.15.6": + version: 1.15.9 + resolution: "follow-redirects@npm:1.15.9" + peerDependenciesMeta: + debug: + optional: true + checksum: 859e2bacc7a54506f2bf9aacb10d165df78c8c1b0ceb8023f966621b233717dab56e8d08baadc3ad3b9db58af290413d585c999694b7c146aaf2616340c3d2a6 + languageName: node + linkType: hard + "for-each@npm:^0.3.3": version: 0.3.3 resolution: "for-each@npm:0.3.3" From 61d76645031c4522878bc84a3ac8d431a7e28e1c Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 8 Nov 2024 12:18:57 +0200 Subject: [PATCH 3/3] fix: one more legId --- app/component/itinerary/NaviUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/component/itinerary/NaviUtils.js b/app/component/itinerary/NaviUtils.js index dc7361a35e..5e519517e5 100644 --- a/app/component/itinerary/NaviUtils.js +++ b/app/component/itinerary/NaviUtils.js @@ -117,7 +117,7 @@ export const getTransitLegState = (leg, intl, messages) => { severity = 'INFO'; } const state = severity - ? { severity, content, legId, expiresOn: 'legChange' } + ? { severity, content, id: legId, expiresOn: 'legChange' } : null; return state; };