Skip to content

Commit

Permalink
transit: Rename chaire-lib-common's trRouting service to transitRouting
Browse files Browse the repository at this point in the history
trRouting refers to the `trRouting` project, but the service itself,
while currently heavily coupled with trRouting provides transit routing
in general and trRouting should only be an implementation detail.
Renaming to transitRouting makes the distinction clearer.

This commit only renames the directories and packages, as later commits
will refactor the classes themselves and rename them properly at that
time.
  • Loading branch information
tahini committed Sep 20, 2024
1 parent 61dcfe7 commit 932a294
Show file tree
Hide file tree
Showing 28 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions packages/chaire-lib-backend/src/services/routing/Routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import TrError from 'chaire-lib-common/lib/utils/TrError';

import { TripRoutingQueryAttributes, RoutingResultsByMode } from 'chaire-lib-common/lib/services/routing/types';
import { getRouteByMode } from 'chaire-lib-common/lib/services/routing/RoutingUtils';
import { routingServiceManager as trRoutingServiceManager } from 'chaire-lib-common/lib/services/trRouting/TrRoutingServiceManager';
import { routingServiceManager as trRoutingServiceManager } from 'chaire-lib-common/lib/services/transitRouting/TransitRoutingServiceManager';
import { TransitMode, RoutingMode } from 'chaire-lib-common/lib/config/routingModes';
import { RouteResults } from 'chaire-lib-common/lib/services/routing/RoutingService';
import { TrRoutingRouteResult } from 'chaire-lib-common/lib/services/trRouting/types';
import { TrRoutingRouteResult } from 'chaire-lib-common/lib/services/transitRouting/types';
import { TransitRouteQueryOptions, HostPort } from 'chaire-lib-common/lib/api/TrRouting';

type TransitOrRouteCalculatorResult =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* License text available at https://opensource.org/licenses/MIT
*/
import { default as mockedRoutingUtils } from 'chaire-lib-common/lib/test/services/routing/RoutingUtilsMock';
import { default as mockedTrRouting } from 'chaire-lib-common/lib/test/services/trRouting/TrRoutingServiceMock';
import { default as mockedTrRouting } from 'chaire-lib-common/lib/test/services/transitRouting/TransitRoutingServiceMock';
import { TestUtils } from 'chaire-lib-common/lib/test';

import { pathNoTransferRouteResult, pathOneTransferRouteResult } from 'chaire-lib-common/lib/test/services/trRouting/TrRoutingConstantsStubs';
import { TrRoutingRouteResult } from 'chaire-lib-common/lib/services/trRouting/types';
import { pathNoTransferRouteResult, pathOneTransferRouteResult } from 'chaire-lib-common/lib/test/services/transitRouting/TrRoutingConstantsStubs';
import { TrRoutingRouteResult } from 'chaire-lib-common/lib/services/transitRouting/types';
import { Routing } from '../Routing';
import { validateAndCreateTripRoutingAttributes } from 'chaire-lib-common/lib/services/routing/RoutingAttributes';
import { TripRoutingQueryAttributes } from 'chaire-lib-common/lib/services/routing/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Preferences from '../../config/Preferences';
import { Route } from './RoutingService';
import { RoutingOrTransitMode, RoutingMode } from '../../config/routingModes';
import TrError, { ErrorMessage } from '../../utils/TrError';
import { TrRoutingRoute } from '../trRouting/types';
import { TrRoutingRoute } from '../transitRouting/types';

export const pathIsRoute = (path: Route | TrRoutingRoute | undefined): path is Route => {
return typeof (path as any).distance === 'number';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import _get from 'lodash/get';

import Preferences from '../../config/Preferences';
import { TrRoutingV2 } from '../../api/TrRouting';
import { TrRoutingRoute } from '../trRouting/types';
import { TrRoutingRoute } from '../transitRouting/types';
import { Route, RouteResults } from './RoutingService';
import { getRouteByMode } from './RoutingUtils';
import TrError, { ErrorMessage } from '../../utils/TrError';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import { UnimodalRoutingResult } from "../RoutingResult";
import { resultToObject } from "../RoutingResultUtils";
import { pathNoTransferRouteResult } from '../../../test/services/trRouting/TrRoutingConstantsStubs';
import { pathNoTransferRouteResult } from '../../../test/services/transitRouting/TrRoutingConstantsStubs';
import TestUtils from "../../../test/TestUtils";
import { TransitRoutingResult } from "../TransitRoutingResult";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import TrError from "../../../utils/TrError";
import { SegmentToGeoJSON, TransitRoutingResult } from "../TransitRoutingResult";
import { pathNoTransferRouteResult } from '../../../test/services/trRouting/TrRoutingConstantsStubs';
import { pathNoTransferRouteResult } from '../../../test/services/transitRouting/TrRoutingConstantsStubs';
import { getRouteByMode } from "../RoutingUtils";

jest.mock("../RoutingUtils", () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This file is licensed under the MIT License.
* License text available at https://opensource.org/licenses/MIT
*/
import { TrRoutingService } from './TrRoutingService';
import { TrRoutingService } from './TransitRoutingService';

/**
* This class manages the various routing services and engines for the application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* License text available at https://opensource.org/licenses/MIT
*/
import _cloneDeep from 'lodash/cloneDeep';
import { pathNoTransferRouteResult, pathNoTransfer } from '../../../test/services/trRouting/TrRoutingConstantsStubs';
import { pathNoTransferRouteResult, pathNoTransfer } from '../../../test/services/transitRouting/TrRoutingConstantsStubs';
import { routeToUserObject } from '../TrRoutingResultConversion';

test('Test result conversion', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* This file is licensed under the MIT License.
* License text available at https://opensource.org/licenses/MIT
*/
import { TrRoutingService } from '../TrRoutingService';
import { TrRoutingService } from '../TransitRoutingService';
import { TransitRouteQueryOptions, TrRoutingConstants } from '../../../api/TrRouting';
import serviceLocator from '../../../utils/ServiceLocator';
import TrError from '../../../utils/TrError';
import { TestUtils } from '../../../test';
import fetchMock from 'jest-fetch-mock';
import * as Status from '../../../utils/Status';
import { pathNoTransferRouteV2 } from '../../../test/services/trRouting/TrRoutingConstantsStubs';
import { pathNoTransferRouteV2 } from '../../../test/services/transitRouting/TrRoutingConstantsStubs';
import { ErrorCodes } from '../types';

const trRoutingService = new TrRoutingService();
Expand Down
2 changes: 1 addition & 1 deletion packages/chaire-lib-common/src/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* License text available at https://opensource.org/licenses/MIT
*/
import { default as RoutingUtilsMock } from './services/routing/RoutingUtilsMock';
import { default as TrRoutingServiceMock } from './services/trRouting/TrRoutingServiceMock';
import { default as TrRoutingServiceMock } from './services/transitRouting/TransitRoutingServiceMock';
import { default as RoutingServiceManagerMock } from './services/routing/RoutingServiceManagerMock';
import { default as EventManagerMock } from './services/events/EventManagerMock';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* License text available at https://opensource.org/licenses/MIT
*/
import { TrRoutingPath, TrRoutingV2 } from '../../../api/TrRouting';
import { TrRoutingRoute } from '../../../services/trRouting/types';
import { TrRoutingRoute } from '../../../services/transitRouting/types';
import TestUtils from '../../TestUtils';

// TODO These constant paths seem to have as base an actual reply from trRouting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This file is licensed under the MIT License.
* License text available at https://opensource.org/licenses/MIT
*/
import * as TrRoutingService from '../../../services/trRouting/TrRoutingService';
import * as TrRoutingService from '../../../services/transitRouting/TransitRoutingService';
import { pathNoTransferRouteResult } from './TrRoutingConstantsStubs';

const mockRouteFunction: jest.MockedFunction<typeof TrRoutingService.TrRoutingService.prototype.route> = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { Feature, FeatureCollection, LineString, Point } from 'geojson';
import { RoutingMode, RoutingOrTransitMode } from 'chaire-lib-common/lib/config/routingModes';
import * as TrRoutingApi from 'chaire-lib-common/lib/api/TrRouting';
import { TrRoutingRoute } from 'chaire-lib-common/lib/services/trRouting/types';
import { TrRoutingRoute } from 'chaire-lib-common/lib/services/transitRouting/types';
import { Route } from 'chaire-lib-common/lib/services/routing/RoutingService';
import APIResponseBase from './APIResponseBase';
import { TripRoutingQueryAttributes } from 'chaire-lib-common/lib/services/routing/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import _sum from 'lodash/sum';

import { AccessibilityMapAttributes } from 'transition-common/lib/services/accessibilityMap/TransitAccessibilityMapRouting';
import TrError from 'chaire-lib-common/lib/utils/TrError';
import { routingServiceManager as trRoutingServiceManager } from 'chaire-lib-common/lib/services/trRouting/TrRoutingServiceManager';
import { TrRoutingResultAccessibilityMap } from 'chaire-lib-common/lib/services/trRouting/types';
import { routingServiceManager as trRoutingServiceManager } from 'chaire-lib-common/lib/services/transitRouting/TransitRoutingServiceManager';
import { TrRoutingResultAccessibilityMap } from 'chaire-lib-common/lib/services/transitRouting/types';
import { AccessibilityMapQueryOptions } from 'chaire-lib-common/lib/api/TrRouting';
import { secondsSinceMidnightToTimeStr } from 'chaire-lib-common/lib/utils/DateTimeUtils';
import { _toInteger, _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* License text available at https://opensource.org/licenses/MIT
*/
import { circle as turfCircle } from '@turf/turf';
import { default as mockedTrRouting } from 'chaire-lib-common/lib/test/services/trRouting/TrRoutingServiceMock';
import { default as mockedTrRouting } from 'chaire-lib-common/lib/test/services/transitRouting/TransitRoutingServiceMock';
import { TestUtils } from 'chaire-lib-common/lib/test';
import polygonClipping from 'polygon-clipping';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
TransitAccessibilityMapResult,
TransitAccessibilityMapWithPolygonResult
} from 'transition-common/lib/services/accessibilityMap/TransitAccessibilityMapResult';
import { TrRoutingResultAccessibilityMap } from 'chaire-lib-common/lib/services/trRouting/types';
import { TrRoutingResultAccessibilityMap } from 'chaire-lib-common/lib/services/transitRouting/types';
import { RoutingMode } from 'chaire-lib-common/lib/config/routingModes';
import { SegmentToGeoJSONFromPaths } from 'transition-common/lib/services/transitRouting/TransitRoutingResult';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { calculateAccessibilityMap, calculateRoute } from '../RoutingCalculator'
import { Routing } from 'chaire-lib-backend/lib/services/routing/Routing';
import NodeCollection from 'transition-common/lib/services/nodes/NodeCollection';
import PathCollection from 'transition-common/lib/services/path/PathCollection';
import { pathNoTransferRouteResult, pathOneTransferRouteResult } from 'chaire-lib-common/lib/test/services/trRouting/TrRoutingConstantsStubs';
import { pathNoTransferRouteResult, pathOneTransferRouteResult } from 'chaire-lib-common/lib/test/services/transitRouting/TrRoutingConstantsStubs';
import TestUtils from 'chaire-lib-common/src/test/TestUtils';
import { TransitRoutingResult } from 'chaire-lib-common/lib/services/routing/TransitRoutingResult';
import TransitAccessibilityMapRouting from 'transition-common/lib/services/accessibilityMap/TransitAccessibilityMapRouting';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { SegmentToGeoJSONFromPaths } from 'transition-common/lib/services/transi
import { getDefaultCsvAttributes, getDefaultStepsAttributes } from './ResultAttributes';
import { OdTripRouteOutput, OdTripRouteResult } from './types';
import { unparse } from 'papaparse';
import { ErrorCodes, TrRoutingRoute } from 'chaire-lib-common/lib/services/trRouting/types';
import { ErrorCodes, TrRoutingRoute } from 'chaire-lib-common/lib/services/transitRouting/types';
import { TransitRoutingResultData } from 'chaire-lib-common/lib/services/routing/TransitRoutingResult';
import { routeToUserObject } from 'chaire-lib-common/lib/services/trRouting/TrRoutingResultConversion';
import { routeToUserObject } from 'chaire-lib-common/lib/services/transitRouting/TrRoutingResultConversion';
import TrError from 'chaire-lib-common/lib/utils/TrError';
import { Route } from 'chaire-lib-common/lib/services/routing/RoutingService';
import PathCollection from 'transition-common/lib/services/path/PathCollection';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import { directoryManager } from 'chaire-lib-backend/lib/utils/filesystem/direct
import { createRoutingFileResultProcessor, generateFileOutputResults } from '../TrRoutingBatchResult';
import { BaseOdTrip } from 'transition-common/lib/services/odTrip/BaseOdTrip';
import { getDefaultCsvAttributes, getDefaultStepsAttributes } from '../ResultAttributes';
import { routeToUserObject, TrRoutingBoardingStep, TrRoutingUnboardingStep, TrRoutingWalkingStep } from 'chaire-lib-common/src/services/trRouting/TrRoutingResultConversion';
import { routeToUserObject, TrRoutingBoardingStep, TrRoutingUnboardingStep, TrRoutingWalkingStep } from 'chaire-lib-common/src/services/transitRouting/TrRoutingResultConversion';
import { UnimodalRoutingResult } from 'chaire-lib-common/lib/services/routing/RoutingResult';
import Path from 'transition-common/lib/services/path/Path';
import PathCollection from 'transition-common/lib/services/path/PathCollection';
import TrError from 'chaire-lib-common/lib/utils/TrError';
import { ErrorCodes } from 'chaire-lib-common/lib/services/trRouting/types';
import { ErrorCodes } from 'chaire-lib-common/lib/services/transitRouting/types';


const absoluteDir = `${directoryManager.userDataDirectory}/1/exports`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import routeOdTrip from '../TrRoutingOdTrip';
import { simplePathResult, alternativesResult, walkingRouteResult, cyclingRouteResult } from './TrRoutingResultStub';
import { BaseOdTrip } from 'transition-common/lib/services/odTrip/BaseOdTrip';
import TrError from 'chaire-lib-common/lib/utils/TrError';
import { ErrorCodes } from 'chaire-lib-common/lib/services/trRouting/types';
import { routeToUserObject } from 'chaire-lib-common/src/services/trRouting/TrRoutingResultConversion';
import { ErrorCodes } from 'chaire-lib-common/lib/services/transitRouting/types';
import { routeToUserObject } from 'chaire-lib-common/src/services/transitRouting/TrRoutingResultConversion';
import { Routing } from 'chaire-lib-backend/lib/services/routing/Routing';
import { TransitRoutingQueryAttributes } from 'chaire-lib-common/lib/services/routing/types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* This file is licensed under the MIT License.
* License text available at https://opensource.org/licenses/MIT
*/
import { TrRoutingRouteResult } from 'chaire-lib-common/lib/services/trRouting/types';
import { TrRoutingRouteResult } from 'chaire-lib-common/lib/services/transitRouting/types';
import { RouteResults } from 'chaire-lib-common/lib/services/routing/RoutingService';
import { pathNoTransferRouteResult, pathOneTransferRouteResult } from 'chaire-lib-common/lib/test/services/trRouting/TrRoutingConstantsStubs';
import { pathNoTransferRouteResult, pathOneTransferRouteResult } from 'chaire-lib-common/lib/test/services/transitRouting/TrRoutingConstantsStubs';

// TODO tahini: this is considered a test file, so we need a test, should be a mock
test('Dummy', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import _sum from 'lodash/sum';
import _uniq from 'lodash/uniq';

import { TrRoutingResultAccessibilityMap } from 'chaire-lib-common/lib/services/trRouting/types';
import { TrRoutingResultAccessibilityMap } from 'chaire-lib-common/lib/services/transitRouting/types';
import {
categories,
detailedCategories,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* This file is licensed under the MIT License.
* License text available at https://opensource.org/licenses/MIT
*/
import { pathNoTransferRouteResult, pathOneTransferRouteResult } from 'chaire-lib-common/lib/test/services/trRouting/TrRoutingConstantsStubs';
import { TrRoutingRouteResult } from 'chaire-lib-common/lib/services/trRouting/types';
import { pathNoTransferRouteResult, pathOneTransferRouteResult } from 'chaire-lib-common/lib/test/services/transitRouting/TrRoutingConstantsStubs';
import { TrRoutingRouteResult } from 'chaire-lib-common/lib/services/transitRouting/types';

// TODO tahini: this is considered a test file, so we need a test, should be a mock
test('Dummy', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import _cloneDeep from 'lodash/cloneDeep';
import { SegmentToGeoJSONFromPaths } from "../TransitRoutingResult";
import { pathNoTransferRouteResult } from 'chaire-lib-common/lib/test/services/trRouting/TrRoutingConstantsStubs';
import { pathNoTransferRouteResult } from 'chaire-lib-common/lib/test/services/transitRouting/TrRoutingConstantsStubs';
import { PathCollection } from '../../path/PathCollection';
import { getPathObject } from '../../path/__tests__/PathData.test';
import { TrRoutingV2 } from 'chaire-lib-common/lib/api/TrRouting';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { TrRoutingV2 } from 'chaire-lib-common/lib/api/TrRouting';
import { Route } from 'chaire-lib-common/lib/services/routing/RoutingService';
import { RoutingOrTransitMode } from 'chaire-lib-common/lib/config/routingModes';
import { TransitRoutingAttributes } from 'transition-common/lib/services/transitRouting/TransitRouting';
import { TrRoutingRoute } from 'chaire-lib-common/lib/services/trRouting/types';
import { TrRoutingRoute } from 'chaire-lib-common/lib/services/transitRouting/types';
import { pathIsRoute } from 'chaire-lib-common/lib/services/routing/RoutingResult';

export interface TransitRoutingResultsProps extends WithTranslation {
Expand Down

0 comments on commit 932a294

Please sign in to comment.