diff --git a/backend/package.json b/backend/package.json index 9b22b79f11..57683560c4 100644 --- a/backend/package.json +++ b/backend/package.json @@ -26,7 +26,7 @@ }, "dependencies": { "@azure/msal-node": "1.18.4", - "@elastic/elasticsearch": "7.17.0", + "@elastic/elasticsearch": "7.17.14", "amqplib": "0.8.0", "apidoc": "0.29.0", "app-config": "1.0.1", @@ -46,7 +46,7 @@ "dayjs": "1.11.11", "device": "0.3.12", "ejs": "3.1.10", - "elastic-apm-node": "3.41.1", + "elastic-apm-node": "4.7.3", "express": "4.19.2", "express-body-parser-error-handler": "1.0.7", "express-session": "1.18.0", diff --git a/backend/src/v5/middleware/dataConverter/inputs/teamspaces/projects/models/commons/modelSettings.js b/backend/src/v5/middleware/dataConverter/inputs/teamspaces/projects/models/commons/modelSettings.js index ea6c8dcc5c..cc12824ffb 100644 --- a/backend/src/v5/middleware/dataConverter/inputs/teamspaces/projects/models/commons/modelSettings.js +++ b/backend/src/v5/middleware/dataConverter/inputs/teamspaces/projects/models/commons/modelSettings.js @@ -87,6 +87,12 @@ const generateSchema = (newEntry, modelType, teamspace, project, modelId) => { const name = modelNameType(teamspace, project, modelId); const number = modelNumberType(teamspace, project, modelId); + const drawingCalibration = Yup.object().shape({ + verticalRange: Yup.array().of(Yup.number()).length(2).required() + .test('valid-verticalRange', 'The second number of the range must be larger than the first', (value) => value && value[0] <= value[1]), + units: types.strings.unit.required(), + }); + const commonProps = { name: newEntry ? name.required() : name, desc: types.strings.shortDescription, @@ -96,7 +102,10 @@ const generateSchema = (newEntry, modelType, teamspace, project, modelId) => { const schema = { ...commonProps, ...(modelType === modelTypes.DRAWING - ? { number: newEntry ? number.required() : number } + ? { + number: newEntry ? number.required() : number, + calibration: newEntry ? drawingCalibration.required() : drawingCalibration, + } : { unit: newEntry ? types.strings.unit.required() : types.strings.unit, code: types.strings.code, diff --git a/backend/src/v5/processors/teamspaces/projects/models/drawings/calibrations.js b/backend/src/v5/processors/teamspaces/projects/models/drawings/calibrations.js index 81a318d7d4..058d8ff1e4 100644 --- a/backend/src/v5/processors/teamspaces/projects/models/drawings/calibrations.js +++ b/backend/src/v5/processors/teamspaces/projects/models/drawings/calibrations.js @@ -16,15 +16,17 @@ */ const { addCalibration, getCalibration, getCalibrationForMultipleRevisions } = require('../../../../../models/calibrations'); +const { getDrawingById, updateModelSettings } = require('../../../../../models/modelSettings'); const { getRevisionByIdOrTag, getRevisions, getRevisionsByQuery } = require('../../../../../models/revisions'); const { UUIDToString } = require('../../../../../utils/helper/uuids'); const { calibrationStatuses } = require('../../../../../models/calibrations.constants'); +const { convertArrayUnits } = require('../../../../../utils/helper/units'); const { events } = require('../../../../../services/eventsManager/eventsManager.constants'); const { modelTypes } = require('../../../../../models/modelSettings.constants'); const { publish } = require('../../../../../services/eventsManager/eventsManager'); const { templates } = require('../../../../../utils/responseCodes'); -const Calibrations = { }; +const Calibrations = {}; const getRevIdToCalibMap = (revCalibrations) => { const revIdToCalib = {}; @@ -40,16 +42,23 @@ Calibrations.getCalibration = async (teamspace, project, drawing, revision) => { const projection = { _id: 0, horizontal: 1, - verticalRange: 1, - units: 1, createdAt: 1, createdBy: 1, + units: 1, }; - const latestCalibration = await getCalibration(teamspace, project, drawing, revision, projection); + const [latestCalibration, { calibration: drawingData }] = await Promise.all([ + getCalibration(teamspace, project, drawing, revision, projection), + getDrawingById(teamspace, drawing, { _id: 0, calibration: 1 }), + ]); if (latestCalibration) { - return { calibration: latestCalibration, status: calibrationStatuses.CALIBRATED }; + return { + calibration: { + ...latestCalibration, + verticalRange: convertArrayUnits(drawingData.verticalRange, drawingData.units, latestCalibration.units), + }, + status: calibrationStatuses.CALIBRATED }; } const { timestamp } = await getRevisionByIdOrTag(teamspace, drawing, @@ -67,7 +76,14 @@ Calibrations.getCalibration = async (teamspace, project, drawing, revision) => { for (let i = 0; i < previousRevisions.length; ++i) { const data = revIdToCalib[UUIDToString(previousRevisions[i]._id)]; if (data) { - return { calibration: data.latestCalibration, status: calibrationStatuses.UNCONFIRMED }; + return { + calibration: { + ...data.latestCalibration, + verticalRange: convertArrayUnits(drawingData.verticalRange, drawingData.units, + data.latestCalibration.units), + }, + status: calibrationStatuses.UNCONFIRMED, + }; } } } @@ -112,14 +128,21 @@ Calibrations.getCalibrationStatusForAllRevs = async (teamspace, project, drawing Calibrations.addCalibration = async (teamspace, project, drawing, revision, createdBy, calibration) => { const existingCalibration = await getCalibration(teamspace, project, drawing, revision, { _id: 1 }); - await addCalibration(teamspace, project, drawing, revision, createdBy, calibration); + const { verticalRange, units, ...calibrationData } = calibration; + + await Promise.all([ + addCalibration(teamspace, project, drawing, revision, createdBy, { ...calibrationData, units }), + updateModelSettings(teamspace, project, drawing, { calibration: { verticalRange, units } }), + ]); if (!existingCalibration) { - publish(events.REVISION_UPDATED, { teamspace, + publish(events.REVISION_UPDATED, { + teamspace, project, model: drawing, modelType: modelTypes.DRAWING, - data: { _id: revision, calibration: calibrationStatuses.CALIBRATED } }); + data: { _id: revision, calibration: calibrationStatuses.CALIBRATED }, + }); } }; diff --git a/backend/src/v5/processors/teamspaces/projects/models/drawings/index.js b/backend/src/v5/processors/teamspaces/projects/models/drawings/index.js index 81c51bf9c1..c6353777ed 100644 --- a/backend/src/v5/processors/teamspaces/projects/models/drawings/index.js +++ b/backend/src/v5/processors/teamspaces/projects/models/drawings/index.js @@ -176,6 +176,6 @@ Drawings.deleteFavourites = async (username, teamspace, project, favouritesToRem }; Drawings.getSettings = (teamspace, drawing) => getDrawingById(teamspace, - drawing, { name: 1, number: 1, type: 1, desc: 1 }); + drawing, { name: 1, number: 1, type: 1, desc: 1, calibration: 1 }); module.exports = Drawings; diff --git a/backend/src/v5/routes/teamspaces/projects/models/common/general.js b/backend/src/v5/routes/teamspaces/projects/models/common/general.js index 9b60cd28c9..784cd19c3d 100644 --- a/backend/src/v5/routes/teamspaces/projects/models/common/general.js +++ b/backend/src/v5/routes/teamspaces/projects/models/common/general.js @@ -894,6 +894,7 @@ const establishRoutes = (modelType) => { * number: SC1-SFT-V1-01-M3-ST-30_10_30-0001 * type: Structural * desc: The Drawing of the Lego House + * calibration: { verticalRange: [0,10], units: m } */ router.get('/:model', hasReadAccessToModel[modelType], getModelSettings(modelType), formatModelSettings); diff --git a/backend/src/v5/utils/helper/units.js b/backend/src/v5/utils/helper/units.js new file mode 100644 index 0000000000..277303f626 --- /dev/null +++ b/backend/src/v5/utils/helper/units.js @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2024 3D Repo Ltd + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +const { isNumber } = require('./typeCheck'); + +const UnitsHelper = {}; + +const UNITS_CONVERSION_FACTORS_TO_METRES = { + m: 1, + dm: 10, + cm: 100, + mm: 1000, + ft: 3.28084, +}; + +UnitsHelper.convertArrayUnits = (array, fromUnit, toUnit) => { + const fromFactor = UNITS_CONVERSION_FACTORS_TO_METRES[fromUnit]; + const toFactor = UNITS_CONVERSION_FACTORS_TO_METRES[toUnit]; + + if (!array.every(isNumber) || !fromFactor || !toFactor) { + return null; + } + + return array.map((n) => (n / fromFactor) * toFactor); +}; + +module.exports = UnitsHelper; diff --git a/backend/tests/v5/e2e/routes/teamspaces/projects/models/common/general.test.js b/backend/tests/v5/e2e/routes/teamspaces/projects/models/common/general.test.js index 7113a8bd7b..6b07f5e469 100644 --- a/backend/tests/v5/e2e/routes/teamspaces/projects/models/common/general.test.js +++ b/backend/tests/v5/e2e/routes/teamspaces/projects/models/common/general.test.js @@ -628,6 +628,7 @@ const testAddModel = () => { name, number: modelType === modelTypes.DRAWING ? ServiceHelper.generateRandomString() : undefined, unit: modelType === modelTypes.DRAWING ? undefined : 'mm', + calibration: modelType === modelTypes.DRAWING ? { verticalRange: [0, 5], units: 'mm' } : undefined, type: modelType === modelTypes.FEDERATION ? undefined : ServiceHelper.generateRandomString(), }); @@ -924,6 +925,7 @@ const testGetSettings = () => { type: settings.properties.type, ...(modelType === modelTypes.DRAWING ? { number: settings.properties.number, + calibration: settings.properties.calibration, } : { code: settings.properties.properties.code, unit: settings.properties.properties.unit, diff --git a/backend/tests/v5/e2e/routes/teamspaces/projects/models/drawings/calibrations.test.js b/backend/tests/v5/e2e/routes/teamspaces/projects/models/drawings/calibrations.test.js index b44890ed76..3f2f872f1c 100644 --- a/backend/tests/v5/e2e/routes/teamspaces/projects/models/drawings/calibrations.test.js +++ b/backend/tests/v5/e2e/routes/teamspaces/projects/models/drawings/calibrations.test.js @@ -22,6 +22,7 @@ const { times } = require('lodash'); const { modelTypes } = require(`${src}/models/modelSettings.constants`); const { templates } = require(`${src}/utils/responseCodes`); +const { convertArrayUnits } = require(`${src}/utils/helper/units`); let server; let agent; @@ -124,7 +125,7 @@ const testGetCalibration = () => { key: users.tsAdmin.apiKey, ts: teamspace, projectId: project.id, - drawingId: models.drawWithRevisions._id, + drawing: models.drawWithRevisions, revisionId: revisions.rev2._id, }; @@ -138,27 +139,30 @@ const testGetCalibration = () => { ['the user is not a member of the teamspace', { ...params, key: users.nobody.apiKey }, false, templates.teamspaceNotFound], ['the user does not have access to the drawing', { ...params, key: users.noProjectAccess.apiKey }, false, templates.notAuthorized], ['the project does not exist', { ...params, projectId: ServiceHelper.generateRandomString() }, false, templates.projectNotFound], - ['the drawing does not exist', { ...params, drawingId: ServiceHelper.generateRandomString() }, false, templates.drawingNotFound], + ['the drawing does not exist', { ...params, drawing: ServiceHelper.generateRandomString() }, false, templates.drawingNotFound], ['the revision does not exist', { ...params, revisionId: ServiceHelper.generateRandomString() }, false, templates.revisionNotFound], - ['the model is of wrong type', { ...params, drawingId: models.container._id }, false, templates.drawingNotFound], - ['the drawing has no revisions', { ...params, drawingId: models.drawWithNoRevisions._id }, false, templates.revisionNotFound], + ['the model is of wrong type', { ...params, drawing: models.container }, false, templates.drawingNotFound], + ['the drawing has no revisions', { ...params, drawing: models.drawWithNoRevisions }, false, templates.revisionNotFound], ['the drawing has revisions but revisions have no calibrations', { ...params, revisionId: revisions.rev1._id }, false, templates.calibrationNotFound], ['the drawing has revisions and revision has calibrations', params, true], ['the drawing has revisions and previous revision has calibrations', { ...params, revisionId: revisions.rev3._id }, true], ])('Get Calibration', (desc, parameters, success, error) => { test(`should ${success ? 'succeed' : `fail with ${error.code}`} if ${desc}`, async () => { const expectedStatus = success ? templates.ok.status : error.status; - const route = ({ ts, projectId, drawingId, revisionId, key }) => `/v5/teamspaces/${ts}/projects/${projectId}/drawings/${drawingId}/revisions/${revisionId}/calibrations?key=${key}`; + const route = ({ ts, projectId, drawing, revisionId, key }) => `/v5/teamspaces/${ts}/projects/${projectId}/drawings/${drawing._id}/revisions/${revisionId}/calibrations?key=${key}`; const res = await agent.get(route(parameters)).expect(expectedStatus); if (success) { const latestCalibration = calibrations.reduce( (max, cal) => (max.createdAt > cal.createdAt ? max : cal)); - const { horizontal, verticalRange, units } = latestCalibration; - expect(res.body).toEqual({ horizontal, - verticalRange, - units, + + const { verticalRange, units: drawingUnits } = parameters.drawing.properties.calibration; + + expect(res.body).toEqual({ + verticalRange: convertArrayUnits(verticalRange, drawingUnits, latestCalibration.units), + units: latestCalibration.units, + horizontal: latestCalibration.horizontal, createdAt: res.body.createdAt, createdBy: res.body.createdBy }); } else { @@ -188,8 +192,8 @@ const testAddCalibration = () => { model: times(2, () => times(3, () => ServiceHelper.generateRandomNumber())), drawing: times(2, () => times(2, () => ServiceHelper.generateRandomNumber())), }, - verticalRange: [0, 10], - units: 'm', + verticalRange: [ServiceHelper.generateRandomNumber(0, 10), ServiceHelper.generateRandomNumber(11, 20)], + units: 'mm', }; beforeAll(async () => { @@ -217,24 +221,31 @@ const testAddCalibration = () => { test(`should ${success ? 'succeed' : `fail with ${error.code}`} if ${desc}`, async () => { const expectedStatus = success ? templates.ok.status : error.status; const route = ({ ts, projectId, drawingId, revisionId, usePrevious, key }) => `/v5/teamspaces/${ts}/projects/${projectId}/drawings/${drawingId}/revisions/${revisionId}/calibrations?key=${key}&usePrevious=${usePrevious}`; + const drawingRoute = ({ ts, projectId, drawingId, key }) => `/v5/teamspaces/${ts}/projects/${projectId}/drawings/${drawingId}?key=${key}`; - let lastRevBeforePost; + let lastCalBeforePost; if (success && parameters.usePrevious) { const { body } = await agent.get(route(parameters)); - lastRevBeforePost = body; + lastCalBeforePost = body; } const res = await agent.post(route(parameters)).send(payload).expect(expectedStatus); if (success) { - const { body: newlyCreatedRev } = await agent.get(route(parameters)); + const { body: newlyCreatedCal } = await agent.get(route(parameters)); + const { body: updatedDrawing } = await agent.get(drawingRoute(parameters)); - const calibrationData = parameters.usePrevious ? lastRevBeforePost : payload; + const calibrationData = parameters.usePrevious ? lastCalBeforePost : payload; - expect(newlyCreatedRev).toEqual({ + expect(newlyCreatedCal).toEqual({ ...calibrationData, - createdAt: newlyCreatedRev.createdAt, - createdBy: newlyCreatedRev.createdBy, + createdAt: newlyCreatedCal.createdAt, + createdBy: newlyCreatedCal.createdBy, + }); + + expect(updatedDrawing.calibration).toEqual({ + verticalRange: calibrationData.verticalRange, + units: calibrationData.units, }); } else { expect(res.body.code).toEqual(error.code); diff --git a/backend/tests/v5/e2e/services/chat/modelEvents/modelSettings.test.js b/backend/tests/v5/e2e/services/chat/modelEvents/modelSettings.test.js index 5d97842507..648b36158d 100644 --- a/backend/tests/v5/e2e/services/chat/modelEvents/modelSettings.test.js +++ b/backend/tests/v5/e2e/services/chat/modelEvents/modelSettings.test.js @@ -223,9 +223,13 @@ const modelAddedTest = () => { setTimeout(reject, 1000); }); - const payload = { name: ServiceHelper.generateRandomString(), + const payload = { + name: ServiceHelper.generateRandomString(), type: generateRandomString(), - number: generateRandomString() }; + number: generateRandomString(), + calibration: { verticalRange: [0, 10], units: 'm' }, + }; + const res = await agent.post(`/v5/teamspaces/${teamspace}/projects/${project.id}/drawings?key=${user.apiKey}`) .send(payload) .expect(templates.ok.status); diff --git a/backend/tests/v5/e2e/services/chat/modelEvents/revisions.test.js b/backend/tests/v5/e2e/services/chat/modelEvents/revisions.test.js index 5cc20c8d7b..49fbb10605 100644 --- a/backend/tests/v5/e2e/services/chat/modelEvents/revisions.test.js +++ b/backend/tests/v5/e2e/services/chat/modelEvents/revisions.test.js @@ -126,13 +126,18 @@ const revisionUpdateTest = () => { setTimeout(reject, 1000); }); + const modelUpdateSocketPromise = new Promise((resolve, reject) => { + socket.on(EVENTS.DRAWING_SETTINGS_UPDATE, resolve); + setTimeout(reject, 1000); + }); + const calibration = { horizontal: { model: [[0, 0, 0], [1, 1, 1]], drawing: [[0, 0], [1, 1]], }, - verticalRange: [0, 10], - units: 'm', + verticalRange: [ServiceHelper.generateRandomNumber(0, 5), ServiceHelper.generateRandomNumber(6, 10)], + units: 'mm', }; await agent.post(`/v5/teamspaces/${teamspace}/projects/${project.id}/drawings/${drawing._id}/revisions/${drawingRevision._id}/calibrations?key=${user.apiKey}`) @@ -147,6 +152,13 @@ const revisionUpdateTest = () => { }, }); + await expect(modelUpdateSocketPromise).resolves.toEqual({ + ...data, + data: { + calibration: { verticalRange: calibration.verticalRange, units: calibration.units }, + }, + }); + // calibrating an already calibrated drawing should not trigger the event anymore const socketPromise2 = new Promise((resolve, reject) => { socket.on(EVENTS.DRAWING_REVISION_UPDATE, resolve); diff --git a/backend/tests/v5/helper/services.js b/backend/tests/v5/helper/services.js index d05b34c0cc..a45e583139 100644 --- a/backend/tests/v5/helper/services.js +++ b/backend/tests/v5/helper/services.js @@ -179,13 +179,14 @@ db.createRevision = async (teamspace, project, model, revision, modelType) => { }; db.createCalibration = async (teamspace, project, drawing, revision, calibration) => { - const formattedCalibration = { + const formattedCalibration = deleteIfUndefined({ ...calibration, _id: stringToUUID(calibration._id), project: stringToUUID(project), drawing, rev_id: stringToUUID(revision), - }; + verticalRange: undefined, + }); await DbHandler.insertOne(teamspace, 'drawings.calibrations', formattedCalibration); }; @@ -494,7 +495,7 @@ ServiceHelper.generateCalibration = () => ({ drawing: times(2, () => times(2, () => ServiceHelper.generateRandomNumber())), }, verticalRange: [0, 10], - units: 'm', + units: 'mm', createdAt: ServiceHelper.generateRandomDate(), createdBy: ServiceHelper.generateRandomString(), }); @@ -504,6 +505,7 @@ ServiceHelper.generateRandomModelProperties = (modelType = modelTypes.CONTAINER) ...(modelType === modelTypes.DRAWING ? { number: ServiceHelper.generateRandomString(), type: ServiceHelper.generateRandomString(), + calibration: { verticalRange: [ServiceHelper.generateRandomNumber(0, 10), ServiceHelper.generateRandomNumber(11, 20)], units: 'm' }, modelType, } : { properties: { diff --git a/backend/tests/v5/unit/middleware/dataConverter/inputs/teamspaces/projects/models/commons/modelSettings.test.js b/backend/tests/v5/unit/middleware/dataConverter/inputs/teamspaces/projects/models/commons/modelSettings.test.js index bb32edd9f9..082b6f1f50 100644 --- a/backend/tests/v5/unit/middleware/dataConverter/inputs/teamspaces/projects/models/commons/modelSettings.test.js +++ b/backend/tests/v5/unit/middleware/dataConverter/inputs/teamspaces/projects/models/commons/modelSettings.test.js @@ -151,6 +151,8 @@ const testValidateUpdateSettingsData = () => { [modelType, { params, body: { number: null } }, false, 'with null number'], [modelType, { params, body: { number: existingModelNumber } }, false, 'with drawing type and duplicate number'], [modelType, { params, body: { unit: generateRandomString() } }, false, 'with valid units'], + [modelType, { params, body: { calibration: null } }, false, 'with null calibration'], + [modelType, { params, body: { calibration: { verticalRange: [0, 5], units: 'm' } } }, true, 'with valid calibration'], ]; if (modelType === modelTypes.DRAWING) { @@ -185,12 +187,14 @@ const testValidateAddModelData = () => { }); }; + const calibration = { verticalRange: [0, 10], units: 'm' }; const generatePayload = (modelType) => (deleteIfUndefined({ name: generateRandomString(), desc: generateRandomString(), type: modelType === modelTypes.FEDERATION ? undefined : 'Structure', code: modelType === modelTypes.DRAWING ? undefined : generateRandomString(), unit: modelType === modelTypes.DRAWING ? undefined : 'mm', + calibration: modelType === modelTypes.DRAWING ? calibration : undefined, number: modelType === modelTypes.DRAWING ? generateRandomString() : undefined, })); @@ -335,6 +339,7 @@ const testValidateAddModelData = () => { body: { name: generateRandomString(), type: 'Structure', + calibration, }, }, modelTypes.DRAWING, false, 'if number is missing'], [{ @@ -356,8 +361,52 @@ const testValidateAddModelData = () => { body: { name: generateRandomString(), number: generateRandomString(), + calibration, }, }, modelTypes.DRAWING, false, 'if type is missing'], + [{ + params, + body: { + name: generateRandomString(), + number: generateRandomString(), + type: 'Structure', + }, + }, modelTypes.DRAWING, false, 'if calibration is missing'], + [{ + params, + body: { + ...generatePayload(modelTypes.DRAWING), + calibration: { units: 'm' }, + }, + }, modelTypes.DRAWING, false, 'if calibration verticalRange is missing'], + [{ + params, + body: { + ...generatePayload(modelTypes.DRAWING), + calibration: { ...calibration, verticalRange: [10, 0] }, + }, + }, modelTypes.DRAWING, false, 'if calibration verticalRange is invalid'], + [{ + params, + body: { + ...generatePayload(modelTypes.DRAWING), + calibration: { ...calibration, verticalRange: generateRandomString() }, + }, + }, modelTypes.DRAWING, false, 'if calibration verticalRange is string'], + [{ + params, + body: { + ...generatePayload(modelTypes.DRAWING), + calibration: { verticalRange: [0, 10] }, + }, + }, modelTypes.DRAWING, false, 'if calibration units are missing'], + [{ + params, + body: { + ...generatePayload(modelTypes.DRAWING), + calibration: { ...calibration, units: generateRandomString() }, + }, + }, modelTypes.DRAWING, false, 'if calibration units is invalid'], ]; if (modelType === modelTypes.DRAWING) { diff --git a/backend/tests/v5/unit/processors/teamspaces/projects/models/drawings/calibrations.test.js b/backend/tests/v5/unit/processors/teamspaces/projects/models/drawings/calibrations.test.js index cf882f5c59..f586e89bd5 100644 --- a/backend/tests/v5/unit/processors/teamspaces/projects/models/drawings/calibrations.test.js +++ b/backend/tests/v5/unit/processors/teamspaces/projects/models/drawings/calibrations.test.js @@ -33,6 +33,8 @@ jest.mock('../../../../../../../../src/v5/models/calibrations'); const CalibrationsModel = require(`${src}/models/calibrations`); jest.mock('../../../../../../../../src/v5/models/revisions'); const RevisionsModel = require(`${src}/models/revisions`); +jest.mock('../../../../../../../../src/v5/models/modelSettings'); +const ModelSettingsModel = require(`${src}/models/modelSettings`); jest.mock('../../../../../../../../src/v5/services/eventsManager/eventsManager'); const EventsManager = require(`${src}/services/eventsManager/eventsManager`); @@ -49,7 +51,11 @@ const testGetCalibration = () => { const drawing = generateRandomString(); const revisionId = generateRandomString(); - const calibration = generateRandomObject(); + const calibration = { units: 'mm', ...generateRandomObject() }; + const drawingData = { + calibration: { verticalRange: [0, 10], units: 'm' }, + }; + const revision = { _id: generateRandomString(), timestamp: generateRandomDate(), @@ -65,18 +71,24 @@ const testGetCalibration = () => { const projection = { _id: 0, horizontal: 1, - verticalRange: 1, - units: 1, createdAt: 1, createdBy: 1, + units: 1, }; test('should return the latest revision calibration', async () => { CalibrationsModel.getCalibration.mockResolvedValueOnce(calibration); + ModelSettingsModel.getDrawingById.mockResolvedValueOnce(drawingData); await expect(Calibrations.getCalibration(teamspace, project, drawing, revisionId)) - .resolves.toEqual({ calibration, status: calibrationStatuses.CALIBRATED }); - + .resolves.toEqual({ + calibration: { ...calibration, verticalRange: [0, 10000] }, + status: calibrationStatuses.CALIBRATED, + }); + + expect(ModelSettingsModel.getDrawingById).toHaveBeenCalledTimes(1); + expect(ModelSettingsModel.getDrawingById).toHaveBeenCalledWith(teamspace, drawing, + { _id: 0, calibration: 1 }); expect(CalibrationsModel.getCalibration).toHaveBeenCalledTimes(1); expect(CalibrationsModel.getCalibration).toHaveBeenCalledWith(teamspace, project, drawing, revisionId, projection); @@ -84,12 +96,16 @@ const testGetCalibration = () => { test('should return error if the revision has no calibrations and there are no previous revisions', async () => { CalibrationsModel.getCalibration.mockResolvedValueOnce(undefined); + ModelSettingsModel.getDrawingById.mockResolvedValueOnce(drawingData); RevisionsModel.getRevisionByIdOrTag.mockResolvedValueOnce(revision); RevisionsModel.getRevisionsByQuery.mockResolvedValueOnce([]); await expect(Calibrations.getCalibration(teamspace, project, drawing, revisionId)) .rejects.toEqual(templates.calibrationNotFound); + expect(ModelSettingsModel.getDrawingById).toHaveBeenCalledTimes(1); + expect(ModelSettingsModel.getDrawingById).toHaveBeenCalledWith(teamspace, drawing, + { _id: 0, calibration: 1 }); expect(CalibrationsModel.getCalibration).toHaveBeenCalledTimes(1); expect(CalibrationsModel.getCalibration).toHaveBeenCalledWith(teamspace, project, drawing, revisionId, projection); @@ -106,6 +122,7 @@ const testGetCalibration = () => { test('should return error if there is no calibration in any revision', async () => { CalibrationsModel.getCalibration.mockResolvedValueOnce(undefined); + ModelSettingsModel.getDrawingById.mockResolvedValueOnce(drawingData); RevisionsModel.getRevisionByIdOrTag.mockResolvedValueOnce(revision); RevisionsModel.getRevisionsByQuery.mockResolvedValueOnce(revisions); CalibrationsModel.getCalibrationForMultipleRevisions.mockResolvedValueOnce([]); @@ -113,6 +130,9 @@ const testGetCalibration = () => { await expect(Calibrations.getCalibration(teamspace, project, drawing, revisionId)) .rejects.toEqual(templates.calibrationNotFound); + expect(ModelSettingsModel.getDrawingById).toHaveBeenCalledTimes(1); + expect(ModelSettingsModel.getDrawingById).toHaveBeenCalledWith(teamspace, drawing, + { _id: 0, calibration: 1 }); expect(CalibrationsModel.getCalibration).toHaveBeenCalledTimes(1); expect(CalibrationsModel.getCalibration).toHaveBeenCalledWith(teamspace, project, drawing, revisionId, projection); @@ -129,6 +149,7 @@ const testGetCalibration = () => { test('should return calibration if a previous revision has one', async () => { CalibrationsModel.getCalibration.mockResolvedValueOnce(undefined); + ModelSettingsModel.getDrawingById.mockResolvedValueOnce(drawingData); RevisionsModel.getRevisionByIdOrTag.mockResolvedValueOnce(revision); RevisionsModel.getRevisionsByQuery.mockResolvedValueOnce(revisions); CalibrationsModel.getCalibrationForMultipleRevisions.mockResolvedValueOnce([{ @@ -136,8 +157,14 @@ const testGetCalibration = () => { }]); await expect(Calibrations.getCalibration(teamspace, project, drawing, revisionId)) - .resolves.toEqual({ calibration, status: calibrationStatuses.UNCONFIRMED }); - + .resolves.toEqual({ + calibration: { ...calibration, verticalRange: [0, 10000] }, + status: calibrationStatuses.UNCONFIRMED, + }); + + expect(ModelSettingsModel.getDrawingById).toHaveBeenCalledTimes(1); + expect(ModelSettingsModel.getDrawingById).toHaveBeenCalledWith(teamspace, drawing, + { _id: 0, calibration: 1 }); expect(CalibrationsModel.getCalibration).toHaveBeenCalledTimes(1); expect(CalibrationsModel.getCalibration).toHaveBeenCalledWith(teamspace, project, drawing, revisionId, projection); @@ -160,6 +187,9 @@ const testGetCalibrationStatus = () => { const project = generateRandomString(); const drawing = generateRandomString(); const revisionId = generateRandomString(); + const drawingData = { + calibration: { verticalRange: [0, 10], units: 'm' }, + }; const calibration = generateRandomObject(); const revision = { @@ -176,6 +206,7 @@ const testGetCalibrationStatus = () => { test(`should return ${calibrationStatuses.CALIBRATED} if the revision has a calibration`, async () => { CalibrationsModel.getCalibration.mockResolvedValueOnce(calibration); + ModelSettingsModel.getDrawingById.mockResolvedValueOnce(drawingData); await expect(Calibrations.getCalibrationStatus(teamspace, project, drawing, revisionId)) .resolves.toEqual(calibrationStatuses.CALIBRATED); @@ -185,6 +216,7 @@ const testGetCalibrationStatus = () => { CalibrationsModel.getCalibration.mockResolvedValueOnce(undefined); RevisionsModel.getRevisionByIdOrTag.mockResolvedValueOnce(revision); RevisionsModel.getRevisionsByQuery.mockResolvedValueOnce([]); + ModelSettingsModel.getDrawingById.mockResolvedValueOnce(drawingData); await expect(Calibrations.getCalibrationStatus(teamspace, project, drawing, revisionId)) .resolves.toEqual(calibrationStatuses.UNCALIBRATED); @@ -195,6 +227,7 @@ const testGetCalibrationStatus = () => { RevisionsModel.getRevisionByIdOrTag.mockResolvedValueOnce(revision); RevisionsModel.getRevisionsByQuery.mockResolvedValueOnce(revisions); CalibrationsModel.getCalibrationForMultipleRevisions.mockResolvedValueOnce([]); + ModelSettingsModel.getDrawingById.mockResolvedValueOnce(drawingData); await expect(Calibrations.getCalibrationStatus(teamspace, project, drawing, revisionId)) .resolves.toEqual(calibrationStatuses.UNCALIBRATED); @@ -207,6 +240,7 @@ const testGetCalibrationStatus = () => { CalibrationsModel.getCalibrationForMultipleRevisions.mockResolvedValueOnce([{ _id: revisions[0]._id, latestCalibration: calibration, }]); + ModelSettingsModel.getDrawingById.mockResolvedValueOnce(drawingData); await expect(Calibrations.getCalibrationStatus(teamspace, project, drawing, revisionId)) .resolves.toEqual(calibrationStatuses.UNCONFIRMED); @@ -218,6 +252,9 @@ const testGetCalibrationStatusForAllRevs = () => { const teamspace = generateRandomString(); const project = generateRandomString(); const drawing = generateRandomString(); + const drawingData = { + calibration: { verticalRange: [0, 10], units: 'm' }, + }; const nRevs = 3; const revs = times(nRevs, () => generateUUID()); @@ -242,6 +279,7 @@ const testGetCalibrationStatusForAllRevs = () => { ])('Get calibration status for all revs', (desc, revData, calibration, expectedResults) => { test(desc, async () => { RevisionsModel.getRevisions.mockResolvedValueOnce(revData); + ModelSettingsModel.getDrawingById.mockResolvedValueOnce(drawingData); CalibrationsModel.getCalibrationForMultipleRevisions.mockResolvedValueOnce(calibration); await expect(Calibrations.getCalibrationStatusForAllRevs(teamspace, project, drawing)) @@ -257,16 +295,25 @@ const testAddCalibration = () => { const drawing = generateRandomString(); const revision = generateRandomString(); const createdBy = generateRandomString(); - const calibration = generateRandomObject(); + const calibration = { + ...generateRandomObject(), + verticalRange: [0, 5], + units: 'm', + }; test('should add a new calibration', async () => { CalibrationsModel.getCalibration.mockResolvedValueOnce(calibration); await Calibrations.addCalibration(teamspace, project, drawing, revision, createdBy, calibration); + const { verticalRange, units, ...calibrationData } = calibration; + expect(CalibrationsModel.addCalibration).toHaveBeenCalledTimes(1); expect(CalibrationsModel.addCalibration).toHaveBeenCalledWith(teamspace, project, drawing, revision, - createdBy, calibration); + createdBy, { ...calibrationData, units }); + expect(ModelSettingsModel.updateModelSettings).toHaveBeenCalledTimes(1); + expect(ModelSettingsModel.updateModelSettings).toHaveBeenCalledWith(teamspace, project, drawing, + { calibration: { verticalRange, units } }); expect(CalibrationsModel.getCalibration).toHaveBeenCalledTimes(1); expect(CalibrationsModel.getCalibration).toHaveBeenCalledWith(teamspace, project, drawing, revision, { _id: 1 }); @@ -278,9 +325,14 @@ const testAddCalibration = () => { await Calibrations.addCalibration(teamspace, project, drawing, revision, createdBy, calibration); + const { verticalRange, units, ...calibrationData } = calibration; + expect(CalibrationsModel.addCalibration).toHaveBeenCalledTimes(1); expect(CalibrationsModel.addCalibration).toHaveBeenCalledWith(teamspace, project, drawing, revision, - createdBy, calibration); + createdBy, { ...calibrationData, units }); + expect(ModelSettingsModel.updateModelSettings).toHaveBeenCalledTimes(1); + expect(ModelSettingsModel.updateModelSettings).toHaveBeenCalledWith(teamspace, project, drawing, + { calibration: { verticalRange, units } }); expect(CalibrationsModel.getCalibration).toHaveBeenCalledTimes(1); expect(CalibrationsModel.getCalibration).toHaveBeenCalledWith(teamspace, project, drawing, revision, { _id: 1 }); diff --git a/backend/tests/v5/unit/processors/teamspaces/projects/models/drawings/index.test.js b/backend/tests/v5/unit/processors/teamspaces/projects/models/drawings/index.test.js index afd7466cea..82b4993c55 100644 --- a/backend/tests/v5/unit/processors/teamspaces/projects/models/drawings/index.test.js +++ b/backend/tests/v5/unit/processors/teamspaces/projects/models/drawings/index.test.js @@ -403,7 +403,7 @@ const testGetSettings = () => { const drawingSettings = generateRandomString(); const teamspace = generateRandomString(); const drawing = generateRandomString(); - const projection = { name: 1, number: 1, type: 1, desc: 1 }; + const projection = { name: 1, number: 1, type: 1, desc: 1, calibration: 1 }; ModelSettings.getDrawingById.mockResolvedValueOnce(drawingSettings); const res = await Drawings.getSettings(teamspace, drawing); diff --git a/backend/tests/v5/unit/utils/helper/units.test.js b/backend/tests/v5/unit/utils/helper/units.test.js new file mode 100644 index 0000000000..a05c09457e --- /dev/null +++ b/backend/tests/v5/unit/utils/helper/units.test.js @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2024 3D Repo Ltd + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +const { src } = require('../../../helper/path'); +const { generateRandomString } = require('../../../helper/services'); + +const UnitsHelper = require(`${src}/utils/helper/units`); + +const testConvertArrayUnits = () => { + describe.each([ + ['invalid fromUnit', [1, 5], generateRandomString(), 'm'], + ['invalid toUnit', [1, 5], 'm', generateRandomString()], + ['array with non numbers', [generateRandomString(), 5], 'm', 'mm'], + ['m to dm', [1, 5], 'm', 'dm', [10, 50]], + ['m to cm', [1, 5], 'm', 'cm', [100, 500]], + ['m to mm', [1, 5], 'm', 'mm', [1000, 5000]], + ['m to ft', [1, 5], 'm', 'ft', [3.281, 16.404]], + ['dm to m', [1, 5], 'dm', 'm', [0.1, 0.5]], + ['dm to cm', [1, 5], 'dm', 'cm', [10, 50]], + ['dm to mm', [1, 5], 'dm', 'mm', [100, 500]], + ['dm to ft', [1, 5], 'dm', 'ft', [0.328, 1.640]], + ['mm to dm', [1, 5], 'mm', 'dm', [0.01, 0.05]], + ['mm to cm', [1, 5], 'mm', 'cm', [0.1, 0.5]], + ['mm to m', [1, 5], 'mm', 'm', [0.001, 0.005]], + ['mm to ft', [1, 5], 'mm', 'ft', [0.003, 0.016]], + ['ft to dm', [1, 5], 'ft', 'dm', [3.048, 15.24]], + ['ft to cm', [1, 5], 'ft', 'cm', [30.48, 152.4]], + ['ft to m', [1, 5], 'ft', 'm', [0.305, 1.524]], + ['ft to mm', [1, 5], 'ft', 'mm', [304.8, 1524]], + ])('Convert array units', (description, array, fromUnit, toUnit, result = null) => { + test(`with ${description} should return ${result}`, () => { + let res = UnitsHelper.convertArrayUnits(array, fromUnit, toUnit); + + if (res) { + res = res.map((r) => Math.round(r * 1000) / 1000); + } + + expect(res).toEqual(result); + }); + }); +}; + +describe('utils/helper/units', () => { + testConvertArrayUnits(); +}); diff --git a/backend/yarn.lock b/backend/yarn.lock index d357a688ab..47033557cf 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -373,17 +373,17 @@ resolved "https://registry.yarnpkg.com/@elastic/ecs-helpers/-/ecs-helpers-2.1.1.tgz#8a375b307c33a959938d9ae8f9abb466eb9fb3bf" integrity sha512-ItoNazMnYdlUCmkBYTXc3SG6PF7UlVTbvMdHPvXkfTMPdwGv2G1Xtp5CjDHaGHGOZSwaDrW4RSCXvA/lMSU+rg== -"@elastic/ecs-pino-format@^1.2.0": +"@elastic/ecs-pino-format@^1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@elastic/ecs-pino-format/-/ecs-pino-format-1.5.0.tgz#48610e06e939b50bfa3629da0d2fcb1c74a69a20" integrity sha512-7MMVmT50ucEl7no8mUgCIl+pffBVNRl36uZi0vmalWa2xPWISBxM9k9WSP/WTgOkmGj9G35e5g3UfCS1zxshBg== dependencies: "@elastic/ecs-helpers" "^2.1.1" -"@elastic/elasticsearch@7.17.0": - version "7.17.0" - resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-7.17.0.tgz#589fb219234cf1b0da23744e82b1d25e2fe9a797" - integrity sha512-5QLPCjd0uLmLj1lSuKSThjNpq39f6NmlTy9ROLFwG5gjyTgpwSqufDeYG/Fm43Xs05uF7WcscoO7eguI3HuuYA== +"@elastic/elasticsearch@7.17.14": + version "7.17.14" + resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-7.17.14.tgz#5ffd6d04e2be38b3dba56cf80af4359fc43b7f1f" + integrity sha512-6uQ1pVXutwz1Krwooo67W+3K8BwH1ASMh1WoHTpomUzw8EXecXN5lHIJ9EPqTHuv1WqR2LKkSJyagcq0HYUJpg== dependencies: debug "^4.3.1" hpagent "^0.1.1" @@ -702,11 +702,39 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@opentelemetry/api@^1.1.0": +"@opentelemetry/api@^1.4.1": version "1.9.0" resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.9.0.tgz#d03eba68273dc0f7509e2a3d5cba21eae10379fe" integrity sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg== +"@opentelemetry/core@1.26.0", "@opentelemetry/core@^1.11.0": + version "1.26.0" + resolved "https://registry.yarnpkg.com/@opentelemetry/core/-/core-1.26.0.tgz#7d84265aaa850ed0ca5813f97d831155be42b328" + integrity sha512-1iKxXXE8415Cdv0yjG3G6hQnB5eVEsJce3QaawX8SjDn0mAS0ZM8fAbZZJD4ajvhC15cePvosSCut404KrIIvQ== + dependencies: + "@opentelemetry/semantic-conventions" "1.27.0" + +"@opentelemetry/resources@1.26.0": + version "1.26.0" + resolved "https://registry.yarnpkg.com/@opentelemetry/resources/-/resources-1.26.0.tgz#da4c7366018bd8add1f3aa9c91c6ac59fd503cef" + integrity sha512-CPNYchBE7MBecCSVy0HKpUISEeJOniWqcHaAHpmasZ3j9o6V3AyBzhRc90jdmemq0HOxDr6ylhUbDhBqqPpeNw== + dependencies: + "@opentelemetry/core" "1.26.0" + "@opentelemetry/semantic-conventions" "1.27.0" + +"@opentelemetry/sdk-metrics@^1.12.0": + version "1.26.0" + resolved "https://registry.yarnpkg.com/@opentelemetry/sdk-metrics/-/sdk-metrics-1.26.0.tgz#37bb0afb1d4447f50aab9cdd05db6f2d8b86103e" + integrity sha512-0SvDXmou/JjzSDOjUmetAAvcKQW6ZrvosU0rkbDGpXvvZN+pQF6JbK/Kd4hNdK4q/22yeruqvukXEJyySTzyTQ== + dependencies: + "@opentelemetry/core" "1.26.0" + "@opentelemetry/resources" "1.26.0" + +"@opentelemetry/semantic-conventions@1.27.0": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@opentelemetry/semantic-conventions/-/semantic-conventions-1.27.0.tgz#1a857dcc95a5ab30122e04417148211e6f945e6c" + integrity sha512-sAay1RrB+ONOem0OZanAR1ZI/k7yDpnOQSQmTMuGImUQb2y8EbSaCJ94FQluM74xoU03vlb2d2U90hZluL6nQg== + "@shelf/jest-mongodb@4.3.2": version "4.3.2" resolved "https://registry.yarnpkg.com/@shelf/jest-mongodb/-/jest-mongodb-4.3.2.tgz#b94096b9bcd8bc0bb88472b41de8f64d384bb834" @@ -1019,6 +1047,13 @@ resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + accepts@^1.3.4, accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" @@ -1027,6 +1062,11 @@ accepts@^1.3.4, accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" +acorn-import-attributes@^1.9.5: + version "1.9.5" + resolved "https://registry.yarnpkg.com/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz#7eb1557b1ba05ef18b5ed0ec67591bfab04688ef" + integrity sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ== + acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -1037,6 +1077,11 @@ acorn@^7.1.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== +acorn@^8.8.2: + version "8.12.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== + acorn@^8.9.0: version "8.12.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.0.tgz#1627bfa2e058148036133b8d9b51a700663c294c" @@ -1325,13 +1370,6 @@ assertion-error@^1.1.0: resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== -async-cache@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/async-cache/-/async-cache-1.1.0.tgz#4a9a5a89d065ec5d8e5254bd9ee96ba76c532b5a" - integrity sha512-YDQc4vBn5NFhY6g6HhVshyi3Fy9+SQ5ePnE7JLDJn1DoL+i7ER+vMwtTNOYk9leZkYMnOwpBCWqyLDPw8Aig8g== - dependencies: - lru-cache "^4.0.0" - async-mutex@^0.4.0: version "0.4.1" resolved "https://registry.yarnpkg.com/async-mutex/-/async-mutex-0.4.1.tgz#bccf55b96f2baf8df90ed798cb5544a1f6ee4c2c" @@ -1521,6 +1559,11 @@ basic-auth@^2.0.1: dependencies: safe-buffer "5.1.2" +bignumber.js@^9.0.0: + version "9.1.2" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" + integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== + binary-extensions@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" @@ -1674,6 +1717,14 @@ buffer@^5.1.0, buffer@^5.5.0: base64-js "^1.3.1" ieee754 "^1.1.13" +buffer@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + busboy@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893" @@ -1843,6 +1894,11 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz#c485341ae8fd999ca4ee5af2d7a1c9ae01e0099c" integrity sha512-a3KdPAANPbNE4ZUv9h6LckSl9zLsYOP4MBmhIPkRaeyybt+r4UghLvq+xw/YwUcC1gqylCkL4rdVs3Lwupjm4Q== +cjs-module-lexer@^1.2.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz#707413784dbb3a72aa11c2f2b042a0bef4004170" + integrity sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA== + cliui@^7.0.2: version "7.0.4" resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" @@ -2095,16 +2151,11 @@ cookie@0.4.1: resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.1.tgz#afd713fe26ebd21ba95ceb61f9a8116e50a537d1" integrity sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA== -cookie@0.6.0: +cookie@0.6.0, cookie@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== -cookie@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" - integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== - cookie@~0.4.1: version "0.4.2" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" @@ -2272,6 +2323,13 @@ debug@^3.1.0, debug@^3.2.7: dependencies: ms "^2.1.1" +debug@^4.3.5: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + decamelize@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" @@ -2432,57 +2490,47 @@ ejs@3.1.10: dependencies: jake "^10.8.5" -elastic-apm-http-client@11.0.4: - version "11.0.4" - resolved "https://registry.yarnpkg.com/elastic-apm-http-client/-/elastic-apm-http-client-11.0.4.tgz#3e44e56fa42235b1b16a33c6a7656cfde595f9ff" - integrity sha512-449Qj/STi9hgnIk2KQ7719E7lpM3/i4Afs7NUhSOX8wV3sxn/+ItIHx9kKJthzhDDezxIfQcH83v83AF67GspQ== - dependencies: - agentkeepalive "^4.2.1" - breadth-filter "^2.0.0" - end-of-stream "^1.4.4" - fast-safe-stringify "^2.0.7" - fast-stream-to-buffer "^1.0.0" - object-filter-sequence "^1.0.0" - readable-stream "^3.4.0" - semver "^6.3.0" - stream-chopper "^3.0.1" - -elastic-apm-node@3.41.1: - version "3.41.1" - resolved "https://registry.yarnpkg.com/elastic-apm-node/-/elastic-apm-node-3.41.1.tgz#e0829d69d5e8a6062ef567d0a8db0ec0e3736ea8" - integrity sha512-bLCVIyAgQC+ZfY5fd/UaAId+8dh3vusaxZF2A0YtHBAwx1YGpIA3dqOt5zc1UuYmbjCdsEAiUjaUEAHOWdjTzA== +elastic-apm-node@4.7.3: + version "4.7.3" + resolved "https://registry.yarnpkg.com/elastic-apm-node/-/elastic-apm-node-4.7.3.tgz#d819a9030f7321cc858c788f60b383de85461f24" + integrity sha512-x+cQKrXSCz6JgoTFAiBpLlC85ruqZ7sAl+jAS3+DeSmc6ZXLRTwTa2ay2PCGv3DxGLZjVZ+ItzGdHTj5B7PYKg== dependencies: - "@elastic/ecs-pino-format" "^1.2.0" - "@opentelemetry/api" "^1.1.0" + "@elastic/ecs-pino-format" "^1.5.0" + "@opentelemetry/api" "^1.4.1" + "@opentelemetry/core" "^1.11.0" + "@opentelemetry/sdk-metrics" "^1.12.0" after-all-results "^2.0.0" - async-cache "^1.1.0" + agentkeepalive "^4.2.1" async-value-promise "^1.1.1" basic-auth "^2.0.1" - cookie "^0.5.0" + breadth-filter "^2.0.0" + cookie "^0.6.0" core-util-is "^1.0.2" - elastic-apm-http-client "11.0.4" end-of-stream "^1.4.4" error-callsites "^2.0.4" error-stack-parser "^2.0.6" escape-string-regexp "^4.0.0" fast-safe-stringify "^2.0.7" + fast-stream-to-buffer "^1.0.0" http-headers "^3.0.2" - is-native "^1.0.1" - lru-cache "^6.0.0" + import-in-the-middle "1.11.0" + json-bigint "^1.0.0" + lru-cache "10.2.0" measured-reporting "^1.51.1" + module-details-from-path "^1.0.3" monitor-event-loop-delay "^1.0.0" object-filter-sequence "^1.0.0" object-identity-map "^1.0.2" original-url "^1.2.3" - pino "^6.11.2" + pino "^8.15.0" + readable-stream "^3.6.2" relative-microtime "^2.0.0" - require-in-the-middle "^5.2.0" - semver "^6.3.0" - set-cookie-serde "^1.0.0" + require-in-the-middle "^7.1.1" + semver "^7.5.4" shallow-clone-shim "^2.0.0" source-map "^0.8.0-beta.0" sql-summary "^1.0.1" - traverse "^0.6.6" + stream-chopper "^3.0.1" unicode-byte-truncate "^1.0.0" electron-to-chromium@^1.4.796: @@ -2901,11 +2949,21 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + events-intercept@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/events-intercept/-/events-intercept-2.0.0.tgz#adbf38681c5a4b2011c41ee41f61a34cba448897" integrity sha512-blk1va0zol9QOrdZt0rFXo5KMkNPVSp92Eju/Qz8THwKWKRKeE0T8Br/1aW6+Edkyq9xHYgYxn2QtOnUKPUp+Q== +events@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== + execa@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" @@ -3034,12 +3092,12 @@ fast-levenshtein@^2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== -fast-redact@^3.0.0: +fast-redact@^3.1.1: version "3.5.0" resolved "https://registry.yarnpkg.com/fast-redact/-/fast-redact-3.5.0.tgz#e9ea02f7e57d0cd8438180083e93077e496285e4" integrity sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A== -fast-safe-stringify@^2.0.4, fast-safe-stringify@^2.0.7, fast-safe-stringify@^2.0.8: +fast-safe-stringify@^2.0.4, fast-safe-stringify@^2.0.7: version "2.1.1" resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== @@ -3179,11 +3237,6 @@ flat@^5.0.2: resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== -flatstr@^1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/flatstr/-/flatstr-1.0.12.tgz#c2ba6a08173edbb6c9640e3055b95e287ceb5931" - integrity sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw== - flatted@^3.2.9: version "3.3.1" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" @@ -3640,6 +3693,16 @@ import-fresh@^3.0.0, import-fresh@^3.2.1: parent-module "^1.0.0" resolve-from "^4.0.0" +import-in-the-middle@1.11.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/import-in-the-middle/-/import-in-the-middle-1.11.0.tgz#a94c4925b8da18256cde3b3b7b38253e6ca5e708" + integrity sha512-5DimNQGoe0pLUHbR9qK84iWaWjjbsxiqXnw6Qz64+azRgleqv9k2kTt5fw7QsOpmaGYtuxxursnPPsnTKEx10Q== + dependencies: + acorn "^8.8.2" + acorn-import-attributes "^1.9.5" + cjs-module-lexer "^1.2.2" + module-details-from-path "^1.0.3" + import-local@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" @@ -3815,24 +3878,11 @@ is-integer@^1.0.6: dependencies: is-finite "^1.0.0" -is-native@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-native/-/is-native-1.0.1.tgz#cd18cc162e8450d683b5babe79ac99c145449675" - integrity sha512-I4z9hx+4u3/zyvpvGtAR+n7SodJugE+i2jiS8yfq1A9QAZY0KldLQz0SBptLC9ti7kBlpghWUwTKE2BA62eCcw== - dependencies: - is-nil "^1.0.0" - to-source-code "^1.0.0" - is-negative-zero@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.3.tgz#ced903a027aca6381b777a5743069d7376a49747" integrity sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw== -is-nil@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-nil/-/is-nil-1.0.1.tgz#2daba29e0b585063875e7b539d071f5b15937969" - integrity sha512-m2Rm8PhUFDNNhgvwZJjJG74a9h5CHU0fkA8WT+WGlCjyEbZ2jPwgb+ZxHu4np284EqNVyOsgppReK4qy/TwEwg== - is-number-object@^1.0.4: version "1.0.7" resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.7.tgz#59d50ada4c45251784e9904f5246c742f07a42fc" @@ -4399,6 +4449,13 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== +json-bigint@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" + integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ== + dependencies: + bignumber.js "^9.0.0" + json-buffer@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" @@ -4716,7 +4773,12 @@ lowercase-keys@^2.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== -lru-cache@4.1.x, lru-cache@^4.0.0: +lru-cache@10.2.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3" + integrity sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q== + +lru-cache@4.1.x: version "4.1.5" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== @@ -5292,6 +5354,11 @@ object.values@^1.1.7: define-properties "^1.2.1" es-object-atoms "^1.0.0" +on-exit-leak-free@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz#fed195c9ebddb7d9e4c3842f93f281ac8dadd3b8" + integrity sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA== + on-finished@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" @@ -5501,23 +5568,35 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -pino-std-serializers@^3.1.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz#b56487c402d882eb96cd67c257868016b61ad671" - integrity sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg== - -pino@^6.11.2: - version "6.14.0" - resolved "https://registry.yarnpkg.com/pino/-/pino-6.14.0.tgz#b745ea87a99a6c4c9b374e4f29ca7910d4c69f78" - integrity sha512-iuhEDel3Z3hF9Jfe44DPXR8l07bhjuFY3GMHIXbjnY9XcafbyDDwl2sN2vw2GjMPf5Nkoe+OFao7ffn9SXaKDg== - dependencies: - fast-redact "^3.0.0" - fast-safe-stringify "^2.0.8" - flatstr "^1.0.12" - pino-std-serializers "^3.1.0" - process-warning "^1.0.0" +pino-abstract-transport@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-1.2.0.tgz#97f9f2631931e242da531b5c66d3079c12c9d1b5" + integrity sha512-Guhh8EZfPCfH+PMXAb6rKOjGQEoy0xlAIn+irODG5kgfYV+BQ0rGYYWTIel3P5mmyXqkYkPmdIkywsn6QKUR1Q== + dependencies: + readable-stream "^4.0.0" + split2 "^4.0.0" + +pino-std-serializers@^6.0.0: + version "6.2.2" + resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-6.2.2.tgz#d9a9b5f2b9a402486a5fc4db0a737570a860aab3" + integrity sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA== + +pino@^8.15.0: + version "8.21.0" + resolved "https://registry.yarnpkg.com/pino/-/pino-8.21.0.tgz#e1207f3675a2722940d62da79a7a55a98409f00d" + integrity sha512-ip4qdzjkAyDDZklUaZkcRFb2iA118H9SgRh8yzTkSQK8HilsOJF7rSY8HoW5+I0M46AZgX/pxbprf2vvzQCE0Q== + dependencies: + atomic-sleep "^1.0.0" + fast-redact "^3.1.1" + on-exit-leak-free "^2.1.0" + pino-abstract-transport "^1.2.0" + pino-std-serializers "^6.0.0" + process-warning "^3.0.0" quick-format-unescaped "^4.0.3" - sonic-boom "^1.0.2" + real-require "^0.2.0" + safe-stable-stringify "^2.3.1" + sonic-boom "^3.7.0" + thread-stream "^2.6.0" pirates@^4.0.4: version "4.0.6" @@ -5573,10 +5652,15 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -process-warning@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-1.0.0.tgz#980a0b25dc38cd6034181be4b7726d89066b4616" - integrity sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q== +process-warning@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-3.0.0.tgz#96e5b88884187a1dce6f5c3166d611132058710b" + integrity sha512-mqn0kFRl0EoqhnL0GQ0veqFHyIN1yig9RHh/InzORTUiZHFRAur+aMtRkELNwGs9aNwKS6tg/An4NYBPGwvtzQ== + +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== promise@^7.0.1: version "7.3.1" @@ -5855,7 +5939,7 @@ readable-stream@^2.0.5, readable-stream@^2.2.2, readable-stream@^2.3.5: string_decoder "~1.1.1" util-deprecate "~1.0.1" -readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: +readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0, readable-stream@^3.6.2: version "3.6.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== @@ -5864,6 +5948,17 @@ readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable string_decoder "^1.1.1" util-deprecate "^1.0.1" +readable-stream@^4.0.0: + version "4.5.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-4.5.2.tgz#9e7fc4c45099baeed934bff6eb97ba6cf2729e09" + integrity sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g== + dependencies: + abort-controller "^3.0.0" + buffer "^6.0.3" + events "^3.3.0" + process "^0.11.10" + string_decoder "^1.3.0" + readable-web-to-node-stream@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz#5d52bb5df7b54861fd48d015e93a2cb87b3ee0bb" @@ -5885,6 +5980,11 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" +real-require@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/real-require/-/real-require-0.2.0.tgz#209632dea1810be2ae063a6ac084fee7e33fba78" + integrity sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg== + regenerator-runtime@^0.14.0: version "0.14.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f" @@ -5930,14 +6030,14 @@ require-from-string@^2.0.2: resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== -require-in-the-middle@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/require-in-the-middle/-/require-in-the-middle-5.2.0.tgz#4b71e3cc7f59977100af9beb76bf2d056a5a6de2" - integrity sha512-efCx3b+0Z69/LGJmm9Yvi4cqEdxnoGnxYxGxBghkkTTFeXRtTCmmhO0AnAfHz59k957uTSuy8WaHqOs8wbYUWg== +require-in-the-middle@^7.1.1: + version "7.4.0" + resolved "https://registry.yarnpkg.com/require-in-the-middle/-/require-in-the-middle-7.4.0.tgz#606977820d4b5f9be75e5a108ce34cfed25b3bb4" + integrity sha512-X34iHADNbNDfr6OTStIAHWSAvvKQRYgLO6duASaVf7J2VA3lvmNYboAHOuLC2huav1IwgZJtyEcJCKVzFxOSMQ== dependencies: - debug "^4.1.1" + debug "^4.3.5" module-details-from-path "^1.0.3" - resolve "^1.22.1" + resolve "^1.22.8" requires-port@^1.0.0: version "1.0.0" @@ -5971,7 +6071,7 @@ resolve.exports@^2.0.0: resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== -resolve@^1.10.1, resolve@^1.11.1, resolve@^1.15.1, resolve@^1.20.0, resolve@^1.22.1, resolve@^1.22.4: +resolve@^1.10.1, resolve@^1.11.1, resolve@^1.15.1, resolve@^1.20.0, resolve@^1.22.4, resolve@^1.22.8: version "1.22.8" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== @@ -6162,11 +6262,6 @@ serve-static@1.15.0: parseurl "~1.3.3" send "0.18.0" -set-cookie-serde@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/set-cookie-serde/-/set-cookie-serde-1.0.0.tgz#bcf9c260ed2212ac4005a53eacbaaa37c07ac452" - integrity sha512-Vq8e5GsupfJ7okHIvEPcfs5neCo7MZ1ZuWrO3sllYi3DOWt6bSSCpADzqXjz3k0fXehnoFIrmmhty9IN6U6BXQ== - set-function-length@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" @@ -6343,13 +6438,12 @@ socks@^2.7.1: ip-address "^9.0.5" smart-buffer "^4.2.0" -sonic-boom@^1.0.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-1.4.1.tgz#d35d6a74076624f12e6f917ade7b9d75e918f53e" - integrity sha512-LRHh/A8tpW7ru89lrlkU4AszXt1dbwSjVWguGrmlxE7tawVmDBlI1PILMkXAxJTwqhgsEeTHzj36D5CmHgQmNg== +sonic-boom@^3.7.0: + version "3.8.1" + resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-3.8.1.tgz#d5ba8c4e26d6176c9a1d14d549d9ff579a163422" + integrity sha512-y4Z8LCDBuum+PBP3lSV7RHrXscqksve/bi0as7mhwVnBW+/wUqKT/2Kb7um8yqcFy0duYbbPxzt89Zy2nOCaxg== dependencies: atomic-sleep "^1.0.0" - flatstr "^1.0.12" sort-any@^2.0.0: version "2.0.0" @@ -6385,6 +6479,11 @@ sparse-bitfield@^3.0.3: dependencies: memory-pager "^1.0.2" +split2@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" + integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== + sprintf-js@1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.2.tgz#da1765262bf8c0f571749f2ad6c26300207ae673" @@ -6502,7 +6601,7 @@ string.prototype.trimstart@^1.0.8: define-properties "^1.2.1" es-object-atoms "^1.0.0" -string_decoder@^1.1.1: +string_decoder@^1.1.1, string_decoder@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== @@ -6718,6 +6817,13 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== +thread-stream@^2.6.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-2.7.0.tgz#d8a8e1b3fd538a6cca8ce69dbe5d3d097b601e11" + integrity sha512-qQiRWsU/wvNolI6tbbCKd9iKaTnCXsTwVxhhKM6nctPdujTyztjlbUkUTUymidWcMnZ5pWR0ej4a0tjsW021vw== + dependencies: + real-require "^0.2.0" + tmp@0.0.x: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -6742,13 +6848,6 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -to-source-code@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/to-source-code/-/to-source-code-1.0.2.tgz#dd136bdb1e1dbd80bbeacf088992678e9070bfea" - integrity sha512-YzWtjmNIf3E75eZYa7m1SCyl0vgOGoTzdpH3svfa8SUm5rqTgl9hnDolrAGOghCF9P2gsITXQoMrlujOoz+RPw== - dependencies: - is-nil "^1.0.0" - toidentifier@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" @@ -6791,15 +6890,6 @@ tr46@^3.0.0: dependencies: punycode "^2.1.1" -traverse@^0.6.6: - version "0.6.9" - resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.6.9.tgz#76cfdbacf06382d460b76f8b735a44a6209d8b81" - integrity sha512-7bBrcF+/LQzSgFmT0X5YclVqQxtv7TDJ1f8Wj7ibBu/U6BMLeOpUxuZjV7rMc44UtKxlnMFigdhFAIszSX1DMg== - dependencies: - gopd "^1.0.1" - typedarray.prototype.slice "^1.0.3" - which-typed-array "^1.1.15" - triple-beam@^1.2.0, triple-beam@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.4.1.tgz#6fde70271dc6e5d73ca0c3b24e2d92afb7441984" @@ -6901,18 +6991,6 @@ typed-array-length@^1.0.6: is-typed-array "^1.1.13" possible-typed-array-names "^1.0.0" -typedarray.prototype.slice@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/typedarray.prototype.slice/-/typedarray.prototype.slice-1.0.3.tgz#bce2f685d3279f543239e4d595e0d021731d2d1a" - integrity sha512-8WbVAQAUlENo1q3c3zZYuy5k9VzBQvp8AX9WOtbvyWlLM1v5JaSRmjubLjzHF4JFtptjH/5c/i95yaElvcjC0A== - dependencies: - call-bind "^1.0.7" - define-properties "^1.2.1" - es-abstract "^1.23.0" - es-errors "^1.3.0" - typed-array-buffer "^1.0.2" - typed-array-byte-offset "^1.0.2" - typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" diff --git a/frontend/src/v4/routes/components/dateField/dateField.component.tsx b/frontend/src/v4/routes/components/dateField/dateField.component.tsx index aa38b09906..6fc9a872ba 100644 --- a/frontend/src/v4/routes/components/dateField/dateField.component.tsx +++ b/frontend/src/v4/routes/components/dateField/dateField.component.tsx @@ -17,7 +17,6 @@ import { TextField } from '@mui/material'; import { useEffect, useState } from 'react'; import { DateTimePicker } from '@controls/inputs/datePicker/dateTimePicker.component'; -import { DatePicker } from '@controls/inputs/datePicker/datePicker.component'; interface IProps { value?: any; diff --git a/frontend/src/v4/routes/viewerGui/components/risks/components/riskDetails/riskDetails.component.tsx b/frontend/src/v4/routes/viewerGui/components/risks/components/riskDetails/riskDetails.component.tsx index 09dc3bd07b..4ef8ba1257 100644 --- a/frontend/src/v4/routes/viewerGui/components/risks/components/riskDetails/riskDetails.component.tsx +++ b/frontend/src/v4/routes/viewerGui/components/risks/components/riskDetails/riskDetails.component.tsx @@ -274,7 +274,7 @@ export class RiskDetails extends PureComponent { } public handleHeaderClick = () => { - if (!this.isNewRisk) { // if its a new issue it shouldnt go to the viewpoint + if (!this.isNewRisk && !this.props.disableViewer) { // if its a new issue or kanban it shouldnt go to the viewpoint this.setCameraOnViewpoint({ viewpoint: this.riskData.viewpoint }); } } diff --git a/frontend/src/v5/services/intl.ts b/frontend/src/v5/services/intl.ts index 681d178dbb..c814920354 100644 --- a/frontend/src/v5/services/intl.ts +++ b/frontend/src/v5/services/intl.ts @@ -63,17 +63,12 @@ export const getIntl = () => { return intlInternal; }; -// eslint-disable-next-line max-len export const formatMessage: typeof intlInternal.formatMessage = (descriptor, values?, opts?): string => getIntl().formatMessage(descriptor, values, opts); -// eslint-disable-next-line max-len -export const formatDate: typeof intlInternal.formatDate = (value, opts?): string => getIntl().formatDate(value, opts); +export const formatDate: typeof intlInternal.formatDate = (value, opts?): string => value && getIntl().formatDate(value, opts); -// eslint-disable-next-line max-len -export const formatTime: typeof intlInternal.formatTime = (value, opts?): string => getIntl().formatTime(value, opts); +export const formatTime: typeof intlInternal.formatTime = (value, opts?): string => value && getIntl().formatTime(value, opts); -// eslint-disable-next-line max-len export const formatRelativeTime: typeof intlInternal.formatRelativeTime = (value, unit?, opts?): string => getIntl().formatRelativeTime(value, unit, opts); -// eslint-disable-next-line max-len export const formatPlural: typeof intlInternal.formatPlural = (value, opts?): Intl.LDMLPluralRule => getIntl().formatPlural(value, opts);