- move pipeline, queue, and config logic into runtime/domain modules - remove legacy client/routes/normalizers/pipeline wiring from core - update connector usage and instrument check to new domain entrypoints - document new structure and add translator engine overrides in configs - align package metadata name in lockfile
22 lines
746 B
JavaScript
22 lines
746 B
JavaScript
const { parse } = require('../src/parsers/astmParser');
|
|
|
|
function translate(entry, parsedPayload, connector) {
|
|
const translator = entry && typeof entry.translator === 'object' ? entry.translator : {};
|
|
const overrides = translator.overrides && typeof translator.overrides === 'object'
|
|
? translator.overrides
|
|
: {};
|
|
const canonical = { ...parsedPayload, ...overrides };
|
|
if (translator.forceInstrumentId !== false) {
|
|
canonical.instrument_id = entry.instrument_id;
|
|
}
|
|
canonical.meta = {
|
|
...(parsedPayload.meta || {}),
|
|
...(translator.meta && typeof translator.meta === 'object' ? translator.meta : {}),
|
|
connector,
|
|
instrument_config: entry.config
|
|
};
|
|
return canonical;
|
|
}
|
|
|
|
module.exports = { parse, translate };
|