New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@activitypods/synchronizer

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@activitypods/synchronizer

ActivityPods service to notify of objects' updates

latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Synchronizer Service

An ActivityPods service to notify of objects' updates.

When a watched object is updated or deleted, automatically send an activity to the actors who have the right to view this object.

Usage

The SynchronizerService is included in the CoreService. The easiest way to make use of it is to import the SynchronizerMixin along with the ControlledContainerMixin.

const { ControlledContainerMixin } = require('@semapps/ldp');
const { SynchronizerMixin } = require('@activitypods/synchronizer');

module.exports = {
  name: 'events',
  mixins: [SynchronizerMixin, ControlledContainerMixin], // In that order
  settings: {
    path: '/events',
    acceptedTypes: ['Event']
  }
}

Note: The SynchronizerMixin must be added before the ControlledContainerMixin, as it overrides its delete action.

Actions

watch

Watch a new type of object.

Parameters
PropertyTypeDefaultDescription
typeStringrequiredThe type of resource we want to watch

announceUpdate

Announce an object update to all actors who have the right to view this object.

Parameters
PropertyTypeDefaultDescription
objectUriStringrequiredThe URI of resource which has been updated
newDataObjectrequiredThe content of the resource (in JSON-LD)

announceDelete

Announce an object deletion to all actors who have the right to view this object.

Parameters
PropertyTypeDefaultDescription
objectUriStringrequiredThe URI of resource which has been deleted
oldDataObjectrequiredThe content of the resource before it was deleted (in JSON-LD)

Handled activities

Announce update

{
  "type": "Announce",
  "object": {
    "type": "Update",
    "object": {
      "type": "[WATCHED TYPES]"
    }
  }
}

Emitter's side effects

  • None

Recipients' side effects

  • The object cached in the recipients' PODs is refreshed

Announce delete

{
  "type": "Announce",
  "object": {
    "type": "Delete",
    "object": {
      "formerType": "[WATCHED TYPES]"
    }
  }
}

Emitter's side effects

  • None

Recipients' side effects

  • The object cached in the recipients' PODs is deleted

FAQs

Package last updated on 27 Apr 2022

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