Skip to content

About

A tiny event log demonstration server

Resources

Stars

0 stars

Watchers

5 watching

Forks

Repository files navigation

Event Log Server

A small event log server for demonstration purposes. Main purpose it displaying the tracelog that is stored in the internal Postgres database.

Install

yarn install
npm link

Configure

cp .env-example .env

See "Configuration Options" section.

Run

Start a postgres database (using Docker):

yarn db-start

Import some demo data:

yarn demo

Start the http server:

yarn server

Visit the demo page: http://localhost:8000/

Demo

Show the trace of the latest Event Log

http://localhost:8000/trace?artifact=latest

Show the trace of an Event log about http://abc.org:

http://localhost:8000/trace?artifact=http://abc.org

Show the event notification with id urn:uuid:bdf1a70d-5e70-4faf-90e7-688c3a3cd7db

http://localhost:8000/trace/urn:uuid:bdf1a70d-5e70-4faf-90e7-688c3a3cd7db

Stop

Stop the postgres server:

yarn db-stop

Configuration Options

EVENTLOG_BASEURL

The base URL of the service.

POSTGRES CONFIGURATION

The claim bot relies on a local PostgreSQL database as a cache for incoming and outgoing event notification messages. This cache is required to match incoming toots with the corresponding service result responses from the service hubs in the network.

  • POSTGRES_HOST : location of the PostgreSQL database (empty: local)
  • POSTGRES_PORT
  • POSTGRES_DATABASE
  • POSTGRES_USER
  • POSTGRES_PASSWORD
  • CACHE_NAME : name of the cache table

API

initCache(param { name: string }) : boolean

Drop and recreate an event log cache with name name.

addCache(notification: any, context: any, param { name:string }) : string | null

Add a new notification to the cache with name name. Optional provide the identifier of an ancestor notification in the context. Return the identifier of the stored notification or null on error.

Example context:

{
  "updated": "2024-10-10T10:35:40.972Z",
  "original": "urn:uuid:b6049038-f87f-42ec-918b-2b732ff3c209"
}

getCache(id: string, param { name: string }) : any | null

Return the notification with identifier id from the cache with name name.

getCacheContext(id: string, param { name: string }) : any | null

Return the notification context with identifier id from the cache with name name.

listCache(dataPath: string | null , contextPath: string | null, param { name: string , limit: num , offset: num }): [string]

Return a list of all notification identifiers from the cache with name name.

Optional provide a dataPath or contextPath to filter the notifications. Both follow the same syntax:

# Find all with actor.type equal to Person
actor.type=Person

# Find all with actor.type not equal to Person
actor.type!=Person

# Find all with object.url not set
object.url=NULL

# Find all with object.ur set
object.url!=NULL

removeCache(id: string, param { name: string} ) : boolean

Remove from the cache with name name the notification with idenfitier id.

About

A tiny event log demonstration server

Resources

Stars

0 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages