
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
event-mapper
Advanced tools
[](https://github.com/fazley-kholil-cko/event-mapper/actions/workflows/node.js.yml)
Utility to map a dto to an event based on a json mapping definition.
$ npm install --save event-mapper
1.First of all create a folder and define some mapping definition files.
Name
field is the name of the event.Mapping
object defines the fields that needs to be mapped from the dto to the event{
"Name": "TestEvent1",
"Mapping": {
"Field1": "FieldDest1",
"Field2": "FieldDest2",
"Field3": "SchemeData.FieldDest3"
}
}
2.In your app, add the required dependencies and initialise the library for it to compile the mapping files.
var eventMapper = require('event-mapper');
var mappers = eventMapper.init('./test-definitions/');
var dto = {
"Field1": "12345",
"Field2": "99999912345X",
"Field3": 200
};
var event = eventMapper.map(dto, mappers['TestEvent1']);
console.log(event);
//returns a structured json containing the event
// {
// TestEvent1: {
// FieldDest1: '12345',
// FieldDest2: '99999912345X',
// SchemeData: { FieldDest3: 200 }
// }
// }
console.log(event.TestEvent1.SchemeData.FieldDest3);
//200
//Generating an event hash - eventMapper.generateEventHash('string_here')
var hash = eventMapper.generateEventHash('TestEvent1_65d6b12c-68a3-4518-a863-8082c3443410_19e72db8-dfd6-4bd4-92a5-8e8ba43455c1');
console.log(hash);
//output:
//5a7210728bd4f27c0a142fc8ac808918
FAQs
[](https://github.com/fazley-kholil-cko/event-mapper/actions/workflows/node.js.yml)
We found that event-mapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.