
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@eventstore/db-client
Advanced tools
NodeJS EventStoreDB version 20+ and uses gRPC as the communication protocol.
This is the package for the NodeJS client for EventStoreDB 20+ and uses gRPC as the communication protocol.
# Yarn
$ yarn add @eventstore/db-client
# NPM
$ npm install --save @eventstore/db-client
This client is compatible with version 20.6.1
upwards.
Server setup instructions can be found under the installation section of the Event Store Docs. Follow the Docker setup for the simplest configuration.
The following snippet showcases a simple example where we form a connection, then append and read events from the server.
const {
EventStoreDBClient,
jsonEvent,
FORWARDS,
START,
} = require('@eventstore/db-client');
const client = new EventStoreDBClient({
endpoint: "localhost:2113",
});
async function simpleTest() {
const streamName = "es_supported_clients";
const event = jsonEvent({
type: "grpc-client",
data: {
languages: ["typescript", "javascript"],
runtime: "NodeJS",
},
});
const appendResult = await client.appendToStream(streamName, [event]);
// read the event
const events = client.readStream(streamName, {
fromRevision: START,
direction: FORWARDS,
maxCount: 10,
});
for await (const { event } of events) {
console.log('Appended event: ', event);
}
} catch (error) {
console.error('An error occured: ', error);
} finally {
await client.dispose();
}
})();
import {
EventStoreDBClient,
jsonEvent,
FORWARDS,
START,
JSONEventType,
} from '@eventstore/db-client';
const client = new EventStoreDBClient({
endpoint: 'localhost:2113',
});
interface Reservation {
reservationId: string;
movieId: string;
userId: string;
seatId: string;
}
type SeatReservedEvent = JSONEventType<
'seat-reserved',
{
reservationId: string;
movieId: string;
userId: string;
seatId: string;
}
>;
type SeatChangedEvent = JSONEventType<
'seat-changed',
{
reservationId: string;
newSeatId: string;
}
>;
type ReservationEvents = SeatReservedEvent | SeatChangedEvent;
async function simpleTest(): Promise<void> {
const streamName = 'booking-abc123';
const event = jsonEvent<SeatReservedEvent>({
type: 'seat-reserved',
data: {
reservationId: 'abc123',
movieId: 'tt0368226',
userId: 'nm0802995',
seatId: '4b',
},
});
const appendResult = await client.appendToStream<ReservationEvents>(
streamName,
event
);
// By reading the events in the stream, we can construct the current state of the booking
interface Reservation {
reservationId: string;
movieId: string;
userId: string;
seatId: string;
}
const events = client.readStream<ReservationEvents>(streamName, {
fromRevision: START,
direction: FORWARDS,
maxCount: 10,
});
const reservation: Partial<Reservation> = {};
for await (const { event } of events) {
switch (event.type) {
case 'seat-reserved': {
reservation.reservationId = event.data.reservationId;
reservation.movieId = event.data.movieId;
reservation.seatId = event.data.seatId;
reservation.userId = event.data.userId;
break;
}
case 'seat-changed': {
reservation.seatId = event.data.newSeatId;
break;
}
default: {
const _exhaustiveCheck: never = event;
break;
}
}
}
}
// Do something with our reservation
console.log(reservation);
Information on support can be found on our website: Event Store Support
Refer to our Contribution Guidelines
FAQs
NodeJS EventStoreDB version 20+ and uses gRPC as the communication protocol.
The npm package @eventstore/db-client receives a total of 5,616 weekly downloads. As such, @eventstore/db-client popularity was classified as popular.
We found that @eventstore/db-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.