Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

diesis-electrician

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diesis-electrician

Adapter to use electrician components in diesis

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

diesis-electrician

This is an adapter for using electrician components with Diesis.

How it works

You import the adapter like this:

const diesisElectrician = require('diesis-electrician')

Then you pass a map of electric components:

const deps = diesisElectrician(components)

You get back an object with startAll/stopAll methods:

const deps = diesisElectrician({
  config: new Conflab(),
  endpoints: new Endpoints(),
  metrics: new ElectricMetrics(),
  refdata: new Refdata(),
  server: new Server(),
})

deps.startAll() // ... starts all components
  .then(obj => {
    // obj is a map with all components
  })

deps.stopAll() // ... stops all components
  .then(() => {
  })

Every dependency not declared in the components is intended as additional argument that can be sent in the startAll/stopAll method:

deps.startAll({ value: 5 })

startAll/stopAll are convenience methods build on top of run:

run([config, endpoints, metrics, refdata, server], { value: 5 })

deps contains also 2 registries (startRegistry and stopRegistry) with all dependencies that you can export and use:

const getConfig = deps.startRegistry.config
const getRefdata = deps.startRegistry.refdata

const { dependency } = require('diesis')
const doSomething = dependency([getConfig, getRefdata], (config, refdata) => {
  // ...
})

If you want get the same API of electrician you can call getSystem:

const system = deps.getSystem(obj) // you inject some argument if required

system.start((err) => {
  // ...
})

system.stop((err) => {
  // ...
})

Keywords

FAQs

Package last updated on 29 Dec 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc