tfk-seneca-collect-content

1.1.1 • Public • Published

Build Status js-standard-style

tfk-seneca-collect-content

Seneca content collector

Messages handled

cmd: collect-info, type: user

Collects content for a user and/or a user's roles

seneca.act({cmd: 'collect-info', type:'user', user:user, roles:[roles]}, (error, data) => {})

Messages emitted

role: info, info: content-collected

Contains collected info for user/role wrapped in the data property

{
    system: 'systemname',
    type: 'news',
    user: user,
    data: [] //collected info
  }

Example

'use strict'
 
const seneca = require('seneca')()
const content = require('./index')
const options = {
  type: 'news',
  channelId: 'news',
  feedHostUrl: 'https://info.portalen.no/articles.json',
  verbose: true, // optional
  timeout: 2000 // optional, defaults to 5000 ms
}
 
seneca.add('role: info, info: content-collected', (args, callback) => {
  console.log(args.data)
})
 
seneca.use(content, options)
 
seneca.act('cmd: collect-info, type: user', {user: 'gasg', roles: ['alle', 'administrasjonen']})

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i tfk-seneca-collect-content

Weekly Downloads

1

Version

1.1.1

License

MIT

Last publish

Collaborators

  • maccyber
  • telemark
  • zrrrzzt