Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ges-client

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ges-client

(Get) EventStore Client

  • 0.10.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

ges-client

![Gitter](https://badges.gitter.im/Join Chat.svg)

A nodejs client library for (Get) Event Store

Build Status

NPM NPM

Want to help out? Check out a waiting issue Stories in Ready

Introduction

This client assumes that you already have an Event Store instance running.

Basic usage

Install

$ npm install ges-client

Append and read from an event stream

var ges = require('ges-client')

// 1) Create a connection to a running EventStore
//    using default connection options and credentials
var connection = ges()
	, stream = 'intro-events'

// 2) Append events that can be read
connection.on('connect', function() {
	var appendData = {
	      expectedVersion: ges.expectedVersion.emptyStream
	    , events: [array of events]
			}
	connection.appendToStream(stream, appendData, function(err, appendResult) {
	  if(err) return console.log('Ooops!', err) // connection error
  	
	  // 3) Read first events from the stream
  	connection.readStreamEventsForward(stream, { start: 0, count: 1 }, function(err, readResult) {
	    if(err) return console.log('Ooops!', err) // connection error or stream does not exist

	    // ta da!
  		console.log(readResult.Events)
  	})
  })
})

Subscribe to stream updates

var ges = require('ges-client')

// 1) Create a connection to a running EventStore
//    using default connection options and credentials
var connection = ges()
	, stream = 'intro-events'

// 2) Create a subscription
connection.on('connect', function() {
  var subscription = connection.subscribeToStream(stream)

	// 3) Listen for events
  subscription.on('event', function(evt) {
  	// ta da!
  	console.log(evt)
  })

	var appendData = {
	      expectedVersion: ges.expectedVersion.emptyStream
	    , events: [array of events]
			}
	connection.appendToStream(stream, appendData, function(err, appendResult) {
	  if(err) return console.log('Ooops!', err) // connection error
  })
})

Major Feature Status

  • Connection (Partial - not all events are available)
  • Append to stream (Complete)
  • Read from stream (Complete)
  • Subscriptions (Complete)
  • Read from all (Complete)
  • Stream ACLs (Not Started)
  • Transactions (Complete)
  • Stream deletes (Complete)
  • Stream metadata (Complete)

Copyright (c) 2014 Brian Mavity.

ges-client is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.

Special Thanks

Special thanks to Ken Pratt for writing the first version of this over at https://github.com/kenpratt/nodejs-EventStore . It made early development go by much faster.

FAQs

Package last updated on 18 Sep 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc