Merge branch 'updatePackages' into 'main'

Update packages

See merge request v3/service/matcher!27
This commit is contained in:
Sylvain Briat 2024-01-17 08:07:07 +00:00
commit c392d87f43
14 changed files with 2750 additions and 1821 deletions

4344
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@mobicoop/matcher",
"version": "1.5.2",
"version": "1.5.3",
"description": "Mobicoop V3 Matcher",
"author": "sbriat",
"private": true,
@ -30,63 +30,62 @@
"migrate:deploy": "npx prisma migrate deploy"
},
"dependencies": {
"@grpc/grpc-js": "^1.9.9",
"@grpc/grpc-js": "^1.9.14",
"@grpc/proto-loader": "^0.7.10",
"@songkeys/nestjs-redis": "^10.0.0",
"@mobicoop/configuration-module": "^7.2.1",
"@mobicoop/ddd-library": "^2.1.1",
"@mobicoop/health-module": "^2.3.1",
"@mobicoop/message-broker-module": "^2.1.1",
"@mobicoop/configuration-module": "^8.0.0",
"@mobicoop/ddd-library": "^2.4.3",
"@mobicoop/health-module": "^2.3.2",
"@mobicoop/message-broker-module": "^2.1.2",
"@nestjs/axios": "^3.0.1",
"@nestjs/cache-manager": "^2.1.0",
"@nestjs/common": "^10.2.7",
"@nestjs/cache-manager": "^2.2.0",
"@nestjs/common": "^10.3.0",
"@nestjs/config": "^3.1.1",
"@nestjs/core": "^10.2.7",
"@nestjs/core": "^10.3.0",
"@nestjs/cqrs": "^10.2.6",
"@nestjs/event-emitter": "^2.0.2",
"@nestjs/microservices": "^10.2.7",
"@nestjs/platform-express": "^10.2.7",
"@nestjs/terminus": "^10.1.1",
"@prisma/client": "^5.5.2",
"axios": "^1.6.0",
"cache-manager": "^5.2.4",
"@nestjs/event-emitter": "^2.0.3",
"@nestjs/microservices": "^10.3.0",
"@nestjs/platform-express": "^10.3.0",
"@nestjs/terminus": "^10.2.0",
"@prisma/client": "^5.8.1",
"axios": "^1.6.5",
"cache-manager": "^5.3.2",
"cache-manager-ioredis-yet": "^1.2.2",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"geo-tz": "^7.0.7",
"class-validator": "^0.14.1",
"geo-tz": "^8.0.0",
"geographiclib-geodesic": "^2.0.0",
"got": "^13.0.0",
"got": "^14.0.0",
"ioredis": "^5.3.2",
"nestjs-request-context": "^3.0.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
"timezonecomplete": "^5.12.4"
},
"devDependencies": {
"@nestjs/cli": "^10.2.1",
"@nestjs/schematics": "^10.0.3",
"@nestjs/testing": "^10.2.7",
"@types/express": "^4.17.20",
"@types/jest": "29.5.7",
"@types/node": "20.8.10",
"@types/supertest": "^2.0.15",
"@types/uuid": "^9.0.6",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"@nestjs/cli": "^10.3.0",
"@nestjs/schematics": "^10.1.0",
"@nestjs/testing": "^10.3.0",
"@types/express": "^4.17.21",
"@types/jest": "29.5.11",
"@types/node": "20.11.5",
"@types/supertest": "^6.0.2",
"@types/uuid": "^9.0.7",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"dotenv-cli": "^7.3.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "29.7.0",
"prettier": "^3.0.3",
"prisma": "^5.5.2",
"prettier": "^3.2.3",
"prisma": "^5.8.1",
"source-map-support": "^0.5.21",
"supertest": "^6.3.3",
"supertest": "^6.3.4",
"ts-jest": "29.1.1",
"ts-loader": "^9.5.0",
"ts-node": "^10.9.1",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "4.2.0",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
},
"jest": {
"moduleFileExtensions": [

View File

@ -1,7 +1,4 @@
import {
ConfigurationDomainGet,
ConfigurationType,
} from '@mobicoop/configuration-module';
import { KeyType, Type } from '@mobicoop/configuration-module';
export const CARPOOL_CONFIG_ROLE = 'role';
export const CARPOOL_CONFIG_SEATS_PROPOSED = 'seatsProposed';
@ -9,25 +6,25 @@ export const CARPOOL_CONFIG_SEATS_REQUESTED = 'seatsRequested';
export const CARPOOL_CONFIG_DEPARTURE_TIME_MARGIN = 'departureTimeMargin';
export const CARPOOL_CONFIG_STRICT_FREQUENCY = 'strictFrequency';
export const CarpoolConfig: ConfigurationDomainGet[] = [
export const CarpoolKeyTypes: KeyType[] = [
{
key: CARPOOL_CONFIG_ROLE,
type: ConfigurationType.STRING,
type: Type.STRING,
},
{
key: CARPOOL_CONFIG_SEATS_PROPOSED,
type: ConfigurationType.INT,
type: Type.INT,
},
{
key: CARPOOL_CONFIG_SEATS_REQUESTED,
type: ConfigurationType.INT,
type: Type.INT,
},
{
key: CARPOOL_CONFIG_DEPARTURE_TIME_MARGIN,
type: ConfigurationType.INT,
type: Type.INT,
},
{
key: CARPOOL_CONFIG_STRICT_FREQUENCY,
type: ConfigurationType.BOOLEAN,
type: Type.BOOLEAN,
},
];

View File

@ -17,7 +17,7 @@ import { Paginator } from '@mobicoop/ddd-library';
import { MatchingEntity } from '@modules/ad/core/domain/matching.entity';
import { MatchingRepositoryPort } from '../../ports/matching.repository.port';
import {
ConfigurationDomain,
Domain,
Configurator,
GetConfigurationRepositoryPort,
} from '@mobicoop/configuration-module';
@ -27,7 +27,7 @@ import {
CARPOOL_CONFIG_SEATS_PROPOSED,
CARPOOL_CONFIG_SEATS_REQUESTED,
CARPOOL_CONFIG_STRICT_FREQUENCY,
CarpoolConfig,
CarpoolKeyTypes,
} from '@modules/ad/ad.constants';
import {
MATCH_CONFIG_ALGORITHM,
@ -57,18 +57,12 @@ export class MatchQueryHandler implements IQueryHandler {
execute = async (query: MatchQuery): Promise<MatchingResult> => {
const carpoolConfigurator: Configurator =
await this.configurationRepository.mget(
ConfigurationDomain.CARPOOL,
CarpoolConfig,
);
await this.configurationRepository.mget(Domain.CARPOOL, CarpoolKeyTypes);
const matchConfigurator: Configurator =
await this.configurationRepository.mget(
ConfigurationDomain.MATCH,
MatchConfig,
);
await this.configurationRepository.mget(Domain.MATCH, MatchConfig);
const paginationConfigurator: Configurator =
await this.configurationRepository.mget(
ConfigurationDomain.PAGINATION,
Domain.PAGINATION,
PaginationConfig,
);
query

View File

@ -1,7 +1,4 @@
import {
ConfigurationDomainGet,
ConfigurationType,
} from '@mobicoop/configuration-module';
import { KeyType, Type } from '@mobicoop/configuration-module';
export const MATCH_CONFIG_ALGORITHM = 'algorithm';
export const MATCH_CONFIG_REMOTENESS = 'remoteness';
@ -13,44 +10,44 @@ export const MATCH_CONFIG_MAX_DETOUR_DISTANCE_RATIO = 'maxDetourDistanceRatio';
export const MATCH_CONFIG_MAX_DETOUR_DURATION_RATIO = 'maxDetourDurationRatio';
export const PAGINATION_CONFIG_PER_PAGE = 'perPage';
export const MatchConfig: ConfigurationDomainGet[] = [
export const MatchConfig: KeyType[] = [
{
key: MATCH_CONFIG_ALGORITHM,
type: ConfigurationType.STRING,
type: Type.STRING,
},
{
key: MATCH_CONFIG_REMOTENESS,
type: ConfigurationType.INT,
type: Type.INT,
},
{
key: MATCH_CONFIG_USE_PROPORTION,
type: ConfigurationType.BOOLEAN,
type: Type.BOOLEAN,
},
{
key: MATCH_CONFIG_PROPORTION,
type: ConfigurationType.FLOAT,
type: Type.FLOAT,
},
{
key: MATCH_CONFIG_USE_AZIMUTH,
type: ConfigurationType.BOOLEAN,
type: Type.BOOLEAN,
},
{
key: MATCH_CONFIG_AZIMUTH_MARGIN,
type: ConfigurationType.INT,
type: Type.INT,
},
{
key: MATCH_CONFIG_MAX_DETOUR_DISTANCE_RATIO,
type: ConfigurationType.FLOAT,
type: Type.FLOAT,
},
{
key: MATCH_CONFIG_MAX_DETOUR_DURATION_RATIO,
type: ConfigurationType.FLOAT,
type: Type.FLOAT,
},
];
export const PaginationConfig: ConfigurationDomainGet[] = [
export const PaginationConfig: KeyType[] = [
{
key: PAGINATION_CONFIG_PER_PAGE,
type: ConfigurationType.INT,
type: Type.INT,
},
];

View File

@ -54,6 +54,7 @@ const mockAdRepository: AdRepositoryPort = {
findOneById: jest.fn(),
findOne: jest.fn(),
findAll: jest.fn(),
findAllByIds: jest.fn(),
insert: jest.fn(),
update: jest.fn(),
updateWhere: jest.fn(),

View File

@ -1,6 +1,6 @@
import {
ConfigurationDomain,
ConfigurationDomainGet,
Domain,
KeyType,
Configurator,
GetConfigurationRepositoryPort,
} from '@mobicoop/configuration-module';
@ -258,83 +258,83 @@ const mockConfigurationRepository: GetConfigurationRepositoryPort = {
get: jest.fn(),
mget: jest.fn().mockImplementation(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(domain: ConfigurationDomain, configs: ConfigurationDomainGet[]) => {
(domain: Domain, keyTypes: KeyType[]) => {
switch (domain) {
case ConfigurationDomain.CARPOOL:
return new Configurator(ConfigurationDomain.CARPOOL, [
case Domain.CARPOOL:
return new Configurator(Domain.CARPOOL, [
{
domain: ConfigurationDomain.CARPOOL,
domain: Domain.CARPOOL,
key: CARPOOL_CONFIG_DEPARTURE_TIME_MARGIN,
value: 900,
},
{
domain: ConfigurationDomain.CARPOOL,
domain: Domain.CARPOOL,
key: CARPOOL_CONFIG_ROLE,
value: 'passenger',
},
{
domain: ConfigurationDomain.CARPOOL,
domain: Domain.CARPOOL,
key: CARPOOL_CONFIG_SEATS_PROPOSED,
value: 3,
},
{
domain: ConfigurationDomain.CARPOOL,
domain: Domain.CARPOOL,
key: CARPOOL_CONFIG_SEATS_REQUESTED,
value: 1,
},
{
domain: ConfigurationDomain.CARPOOL,
domain: Domain.CARPOOL,
key: CARPOOL_CONFIG_STRICT_FREQUENCY,
value: false,
},
]);
case ConfigurationDomain.MATCH:
return new Configurator(ConfigurationDomain.MATCH, [
case Domain.MATCH:
return new Configurator(Domain.MATCH, [
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_ALGORITHM,
value: 'PASSENGER_ORIENTED',
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_REMOTENESS,
value: 15000,
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_USE_PROPORTION,
value: true,
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_PROPORTION,
value: 0.3,
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_USE_AZIMUTH,
value: true,
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_AZIMUTH_MARGIN,
value: 10,
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_MAX_DETOUR_DISTANCE_RATIO,
value: 0.3,
},
{
domain: ConfigurationDomain.MATCH,
domain: Domain.MATCH,
key: MATCH_CONFIG_MAX_DETOUR_DURATION_RATIO,
value: 0.3,
},
]);
case ConfigurationDomain.PAGINATION:
return new Configurator(ConfigurationDomain.PAGINATION, [
case Domain.PAGINATION:
return new Configurator(Domain.PAGINATION, [
{
domain: ConfigurationDomain.PAGINATION,
domain: Domain.PAGINATION,
key: PAGINATION_CONFIG_PER_PAGE,
value: 10,
},

View File

@ -55,6 +55,7 @@ const mockMatcherRepository: AdRepositoryPort = {
findOneById: jest.fn(),
findOne: jest.fn(),
findAll: jest.fn(),
findAllByIds: jest.fn(),
insert: jest.fn(),
update: jest.fn(),
updateWhere: jest.fn(),

View File

@ -100,6 +100,7 @@ const mockMatcherRepository: AdRepositoryPort = {
findOneById: jest.fn(),
findOne: jest.fn(),
findAll: jest.fn(),
findAllByIds: jest.fn(),
insert: jest.fn(),
update: jest.fn(),
updateWhere: jest.fn(),

View File

@ -1,18 +1,15 @@
import {
ConfigurationDomainGet,
ConfigurationType,
} from '@mobicoop/configuration-module';
import { KeyType, Type } from '@mobicoop/configuration-module';
export const GEOGRAPHY_CONFIG_GEOROUTER_TYPE = 'georouterType';
export const GEOGRAPHY_CONFIG_GEOROUTER_URL = 'georouterUrl';
export const GeographyConfig: ConfigurationDomainGet[] = [
export const GeographyKeyTypes: KeyType[] = [
{
key: GEOGRAPHY_CONFIG_GEOROUTER_TYPE,
type: ConfigurationType.STRING,
type: Type.STRING,
},
{
key: GEOGRAPHY_CONFIG_GEOROUTER_URL,
type: ConfigurationType.STRING,
type: Type.STRING,
},
];

View File

@ -15,13 +15,13 @@ import {
} from '../core/domain/route.errors';
import { GeodesicPort } from '../core/application/ports/geodesic.port';
import {
ConfigurationDomain,
Domain,
Configurator,
GetConfigurationRepositoryPort,
} from '@mobicoop/configuration-module';
import {
GEOGRAPHY_CONFIG_GEOROUTER_URL,
GeographyConfig,
GeographyKeyTypes,
} from '../geography.constants';
@Injectable()
@ -42,8 +42,8 @@ export class GraphhopperGeorouter implements GeorouterPort {
): Promise<Route> => {
const geographyConfigurator: Configurator =
await this.configurationRepository.mget(
ConfigurationDomain.GEOGRAPHY,
GeographyConfig,
Domain.GEOGRAPHY,
GeographyKeyTypes,
);
this.url = [
geographyConfigurator.get<string>(GEOGRAPHY_CONFIG_GEOROUTER_URL),

View File

@ -1,6 +1,6 @@
import {
ConfigurationDomain,
ConfigurationDomainGet,
Domain,
KeyType,
Configurator,
GetConfigurationRepositoryPort,
} from '@mobicoop/configuration-module';
@ -272,12 +272,12 @@ const mockConfigurationRepository: GetConfigurationRepositoryPort = {
get: jest.fn(),
mget: jest.fn().mockImplementation(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(domain: ConfigurationDomain, configs: ConfigurationDomainGet[]) => {
(domain: Domain, keyTypes: KeyType[]) => {
switch (domain) {
case ConfigurationDomain.GEOGRAPHY:
return new Configurator(ConfigurationDomain.GEOGRAPHY, [
case Domain.GEOGRAPHY:
return new Configurator(Domain.GEOGRAPHY, [
{
domain: ConfigurationDomain.GEOGRAPHY,
domain: Domain.GEOGRAPHY,
key: GEOGRAPHY_CONFIG_GEOROUTER_URL,
value: 'http://localhost:8989',
},

View File

@ -20,7 +20,7 @@
"paths": {
"@libs/*": ["src/libs/*"],
"@modules/*": ["src/modules/*"],
"@src/*": ["src/*"]
}
}
"@src/*": ["src/*"],
},
},
}