Skip to main content

ObjectsWatcherMiddleware

Watch for changes (create / update / delete) in the LDP server and send corresponding ActivityPub activities. If a private data becomes public, it is considered a new resource. If a public data becomes private, it is considered as being deleted.

Features

  • Watch for changes to the LDP servers (create, patch, put, delete...)
  • Generate corresponding ActivityPub activities (Create, Update, Delete)
  • Send them through the instance (Relay) actor or, in POD provider config, through the Pod actor.
  • Send them to:
    • All actors who have read permissions on the resource
    • Emitter followers and as:Public

Usage

const { ObjectsWatcherMiddleware } = require('@semapps/sync');
module.exports = {
middlewares: [
CacherMiddleware({ ... }),
WebAclMiddleware({ baseUrl: 'http://localhost:3000', podProvider: false }),
ObjectsWatcherMiddleware({ baseUrl: 'http://localhost:3000', podProvider: false, }) // This middleware should come after the WebAclMiddleware
],
...
};

Excluding containers

If you don't want a container with public data to be mirrored, you can add the excludeFromMirror: true option.

This choice will appear on the VoID endpoint, so that mirrors ignore them.

Settings

PropertyTypeDefaultDescription
baseUrlStringRequiredThe base URL of your instance
podProviderBooleanfalseIf your instance is a Pods provider, set to true