Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
aws-event-stream
Advanced tools
**This library is based on https://github.com/thiagobustamante/node-eventstore
It is an open source library to create Event Stores that works with AWS using DynamoDB as Provider and SNS to publish messages.
This is an open source library to create Event Stores that works with DynamoDB as persistence providers and SNS notification systems.
The Event Store is a database accompanied by a publication and subscription system. The database stores all the events related to an event stream. The pub / sub system allows other systems or microservices to react to changes in event streams. It is a core component in any event sourcing + CQRS architectures.
npm install --save aws-event-stream
To Create an EventStore you must provide two implementations:
If there is no publisher provided, the event store will not send any notification.
const awsConfig = { region: 'us-east-1' };
const dynamodbConfig = {
awsConfig: awsConfig,
dynamodb: {
tableName: 'events'
}
} as Config;
const eventStore = new EventStore(
new DynamodbProvider(dynamodbConfig),
new SNSPublisher('arn:sns', awsConfig),
);
The object DynamodbConfig is related to Dynamodb configuration, the possible parameters are:
| Parameter | Description |
Parameter | Description |
---|---|
tableName | The name of the table. |
createTable | True: create the table, False assume that table alreaday exists. |
readCapacityUnit | The total number of read capacity units consumed by the operation. |
writeCapacityUnit | The total number of write capacity units consumed by the operation. |
endpointUrl | An Endpoint object representing the endpoint URL for service requests. |
maxRetries | The maximum amount of retries to attempt with a request. |
httpOptions | A set of options to pass to the low-level HTTP request. |
ttl | Time to Live (TTL) in seconds on the specified table. |
To add Events you need to ask to EventStore a reference to an EventStream. You can add Events passing anything you want as a payload.
const orderStream = eventStore.getEventStream('orders', '123');
await orderStream.addEvent({ data: 'any data', eventType: 'PLACED' });
To read Events you need to ask to EventStore a reference to an EventStream. You can read a stream to receive an ordered list containing all the events in the store.
Returns an array with all events published in the Stream specified.
const orderStream = eventStore.getEventStream('orders', '123');
const events = await orderStream.getEvents();
Example of event from getEvents method:
[
{
'commitTimestamp': 1611206813,
'eventType': 'SENT',
'payload': {'text': 'EVENT PAYLOAD', 'sequence': 1 }
},
{
'commitTimestamp': 1611206823,
'eventType': 'PLACED',
'payload': {'text': 'EVENT PAYLOAD', 'sequence': 2 }
}
]
Or
Returns an Object with all data from events happened in a Stream. What happens is a merge in all fields from all events, keeping the eventTypes as an array.
The fields which have conflicts will always be considered the last event.
const orderStream = eventStore.getEventStream('orders', '123');
await orderStream.loadFromHistory();
Example of event from loadFromHistory method:
{
'commitTimestamp': 1611206823,
'eventTypes': ['SENT', 'PLACED'],
'payload': {'text': "EVENT PAYLOAD", 'eventType': 'PLACED'}, 'sequence': 2
}
Steps:
FAQs
A simple and fast EventStore for AWS.
The npm package aws-event-stream receives a total of 2 weekly downloads. As such, aws-event-stream popularity was classified as not popular.
We found that aws-event-stream 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.