Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions QualityControl/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export default [
'never',
],
'no-magic-numbers': 'off', // TODO: enable
'no-useless-assignment': 'off',
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export class BaseRepository {

/**
* Finds all records that match the given options.
* @param {object} [constraints={}] - Constraints to filter the records.
* @param {object} [options={}] - Options for filtering, sorting, and including related models.
* @returns {Promise<Model[]>} A promise that resolves to an array of found records.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { InvalidInputError, updateAndSendExpressResponseFromNativeError } from '
* Middleware function to validate the run number if in run mode.
* @param {object} req - The request object.
* @param {object} res - The response object.
* @param {Function} next - The next middleware function in the stack.
* @param {() => void} next - The next middleware function in the stack.
* @returns {Promise<void>}
*/
export const runModeMiddleware = async (req, res, next) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { RunNumberDto } from '../../dtos/filters/RunNumberDto.js';
f
* @param {object} req - The request object.
* @param {object} res - The response object.
* @param {Function} next - The next middleware function in the stack.
* @param {() => void} next - The next middleware function in the stack.
* @returns {Promise<void>}
*/
export const runStatusFilterMiddleware = async (req, res, next) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { InvalidInputError, updateAndSendExpressResponseFromNativeError } from '
/**
* Middleware that checks if the layout id is present in the request
* @param {LayoutRepository} layoutRepository - repository for getting/setting layout data
* @returns {function(req, res, next): Function} - middleware function
* @returns {(req: Express.Request, res: Express.Response, next: Express.Next) => Promise<void>} - middleware function
*/
export const layoutIdMiddleware = (layoutRepository) =>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { NotFoundError, UnauthorizedAccessError, updateAndSendExpressResponseFro
/**
* Middleware that checks if the requestor is the owner of the layout
* @param {LayoutRepository} layoutRepository - Repository for getting/setting layout data
* @returns {function(req, res, next): Function} - middleware function
* @returns {(req: Express.Request, res: Express.Response, next: Express.Next) => Promise<void>} - middleware function
*/
export const layoutOwnerMiddleware = (layoutRepository) =>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { JsonFileService } from '../../services/JsonFileService.js';
/**
* Middleware that checks if the layout service is correctly initialized
* @param {JSONFileConnector} dataService - service for getting/setting layout data
* @returns {function(req, res, next): Function} - middleware function
* @returns {(req: Express.Request, res: Express.Response, next: Express.Next) => Promise<void>} - middleware function
*/
export const layoutServiceMiddleware = (dataService) =>

Expand Down
2 changes: 1 addition & 1 deletion QualityControl/lib/services/BookkeepingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class BookkeepingService {
}

/**
* Retrieves runs that are currently ongoing (started within the last \@see {RECENT_RUN_THRESHOLD_MS}
* Retrieves runs that are currently ongoing (started within the last \@link {RECENT_RUN_THRESHOLD_MS}
* but have not yet ended).
* @returns {Promise<Array<object>|undefined>} A promise that resolves to an array of run objects,
* or undefined if the service is inactive, no data is found, or an error occurs
Expand Down
2 changes: 1 addition & 1 deletion QualityControl/lib/services/Intervals.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class IntervalsService {

/**
* Method to allow other services to register events that should trigger based on an interval rate
* @param {Function} callback - function that should be called based on interval rate
* @param {() => void} callback - function that should be called based on interval rate
* @param {number} intervalRate = 60 * 1000 - (ms) on how often the callback should be called
* @returns {symbol} - unique key for registered callback
*/
Expand Down
8 changes: 4 additions & 4 deletions QualityControl/lib/services/QcObject.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ export class QcObjectService {
file = await this._rootService.openFile(`${url}+`);
} catch (error) {
this._logger.error(error.message || error);
throw new Error(`JSROOT failed to open file '${url}'`);
throw new Error(`JSROOT failed to open file '${url}'`, { cause: error });
}

let root = undefined;
try {
root = await file.readObject('ccdb_object');
} catch (error) {
this._logger.error(error.message || error);
throw new Error(`JSROOT failed to read object 'ccdb_object' from '${url}'`);
throw new Error(`JSROOT failed to read object 'ccdb_object' from '${url}'`, { cause: error });
}

root['_typename'] = root['mTreatMeAs'] || root['_typename'];
Expand All @@ -238,15 +238,15 @@ export class QcObjectService {
return JSON.parse(JSON.stringify(root, (_, value) => typeof value === 'bigint' ? value.toString() : value));
} catch (error) {
this._logger.error(error.message || error);
throw new Error(`Failed to serialize ROOT object '${QC_CHECKER_TYPE}' with BigInt-safe JSON`);
throw new Error(`Failed to serialize ROOT object '${QC_CHECKER_TYPE}' with BigInt-safe JSON`, { cause: error });
}
}

try {
return await this._rootService.toJSON(root);
} catch (error) {
this._logger.error(error.message || error);
throw new Error(`JSROOT failed to convert object '${root['_typename']}' to JSON`);
throw new Error(`JSROOT failed to convert object '${root['_typename']}' to JSON`, { cause: error });
}
}

Expand Down
9 changes: 5 additions & 4 deletions QualityControl/lib/services/ccdb/CcdbService.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class CcdbService {
const path = `/monitor/${CCDB_MONITOR}/.*/${CCDB_VERSION_KEY}`;
serviceInfo = await httpGetJson(this._hostname, this._port, path, { headers: { Accept: 'application/json' } });
} catch (error) {
throw new Error(`Unable to connect to CCDB due to: ${error}`);
throw new Error(`Unable to connect to CCDB due to: ${error}`, { cause: error });
}
try {
const monitorData = serviceInfo?.[CCDB_MONITOR] ?? {};
Expand All @@ -95,7 +95,7 @@ export class CcdbService {
const version = monitorData[firstKey]?.[0]?.value ?? 'unknown version';
return { version };
} catch (error) {
throw new Error(`Unable to read version of CCDB due to: ${error}`);
throw new Error(`Unable to read version of CCDB due to: ${error}`, { cause: error });
}
}

Expand Down Expand Up @@ -190,8 +190,9 @@ export class CcdbService {
let result = null;
try {
result = await httpGetJson(this._hostname, this._port, url, { headers });
} catch {
throw new Error(`Failed to fetch object at url '${url}' and path '${partialIdentification.path}'.`);
} catch (error) {
const { path } = partialIdentification;
throw new Error(`Failed to fetch object at url '${url}' and path '${path}'.`, { cause: error });
}

if (!result?.objects?.length) {
Expand Down
9 changes: 4 additions & 5 deletions QualityControl/lib/services/external/AliEcsSynchronizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class AliEcsSynchronizer {
* @param {import('kafkajs').Kafka} kafkaClient - configured kafka client
* @param {KafkaConfiguration.consumerGroups} consumerGroups - consumer groups to be used for various topics
* @param {EventEmitter} eventEmitter - event emitter to be used to emit events when new data is available
* @param {class} ConsumerClass - class to be used for creating the consumer, defaults to AliEcsEventMessagesConsumer
* @param {typeof AliEcsEventMessagesConsumer} ConsumerClass - class to be used for creating the consumer
*/
constructor(kafkaClient, consumerGroups, eventEmitter, ConsumerClass = AliEcsEventMessagesConsumer) {
this._logger = LogManager.getLogger(LOG_FACILITY);
Expand Down Expand Up @@ -76,13 +76,12 @@ export class AliEcsSynchronizer {

/**
* Callback for when a message is received on the run topic
* @param {events.proto.Event} eventMessage - message received on run topic
* @param {object} eventMessage - message received on run topic
* @param {RunEvent} eventMessage.runEvent - the run event object
* @param {object} eventMessage.timestamp - the timestamp object
* @returns {void}
*/
async _onRunMessage(eventMessage) {
/**
* @param {RunEvent} - eventMessage - message received on run topic
*/
const { runEvent, timestamp } = eventMessage;
if (!runEvent) {
this._logger.warnMessage('Received run message on run topic without runEvent field');
Expand Down
Loading
Loading