2.1.1 • Published 1 year ago

@flexiblepersistence/service v2.1.1

Weekly downloads
148
License
MIT
Repository
github
Last release
1 year ago

servicePersistence

Publish npm version npm downloads

A Service implementation for Flexible Persistence's PersistenceAdapter

// Init Journaly as a observer platform for using as a message broker
const journaly = Journaly.newJournaly() as SubjectObserver<any>;

// config read database
read = new ServiceHandler(new PersistenceInfo({}, journaly), {
  test: new TestService(),
});

// config write database
write = new MongoDB(
  new PersistenceInfo(
    {
      database: 'write',
      host: process.env.MONGO_HOST || 'localhost',
      port: process.env.MONGO_PORT,
    },
    journaly
  )
);

// init Flexible Persistence handler with write and read databases
const handler = new Handler(write, read);

// sample object
const obj = {};
obj['test'] = 'test';

// create an event to create an object
const persistencePromise = await handler.addEvent(
  new Event({ operation: Operation.create, name: 'object', content: obj })
);

// prints create event
console.log(persistencePromise);

Overview

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js.

If this is a brand new project, make sure to create a package.json first with the npm init command or yarn init command.

Installation is done using the npm install command or yarn add command:

$ npm install @flexiblepersistence/service

or

$ yarn add @flexiblepersistence/service

Tests

To run the test suite, first install Docker and dependencies, then run docker-compose up -d and npm test:

$ docker-compose up -d
$ npm install
$ npm test

or

$ docker-compose up -d
$ yarn
$ yarn test

People

The original author of Journaly is Judah Lima

List of all contributors

2.1.1

1 year ago

2.0.10

1 year ago

2.1.0

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.2

2 years ago

1.0.3

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.2.1

3 years ago

0.2.2

3 years ago

0.2.0

3 years ago

0.1.18

3 years ago

0.1.17

3 years ago

0.1.16

3 years ago

0.1.15

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1-t

4 years ago