How to use the @signalk/signalk-schema.FullSignalK function in @signalk/signalk-schema

To help you get started, we’ve selected a few @signalk/signalk-schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SignalK / signalk-server-node / src / index.js View on Github external
app.use(require('cors')())
  app.use(bodyParser.json({ limit: FILEUPLOADSIZELIMIT }))

  this.app = app
  app.started = false
  _.merge(app, opts)

  require('./config/config').load(app)
  app.version = '0.0.1'

  startSecurity(app, opts ? opts.securityConfig : null)

  require('./serverroutes')(app, saveSecurityConfig, getSecurityConfig)
  require('./put').start(app)

  app.signalk = new FullSignalK(app.selfId, app.selfType, app.config.defaults)

  const deltachain = new DeltaChain(app.signalk.addDelta.bind(app.signalk))
  app.registerDeltaInputHandler = deltachain.register

  app.providerStatus = {}

  app.setProviderStatus = function(providerId, statusMessage) {
    doSetProviderStatus(providerId, statusMessage, 'status')
  }

  app.setProviderError = function(providerId, errorMessage) {
    doSetProviderStatus(providerId, errorMessage, 'error')
  }

  function doSetProviderStatus(providerId, statusMessage, type) {
    if (!statusMessage) {
github SignalK / signalk-server-node / src / deltacache.js View on Github external
DeltaCache.prototype.buildFullFromDeltas = function(
  user,
  deltas,
  includeSources
) {
  const signalk = new FullSignalK(
    this.app.selfId,
    this.app.selfType,
    JSON.parse(JSON.stringify(this.defaults))
  )

  const addDelta = signalk.addDelta.bind(signalk)

  if (includeSources) {
    _.values(this.sourceDeltas).forEach(addDelta)
  }

  if (deltas && deltas.length) {
    const secFilter = this.app.securityStrategy.shouldFilterDeltas()
      ? delta => this.app.securityStrategy.filterReadDelta(user, delta)
      : delta => true
    deltas.filter(secFilter).forEach(addDelta)

@signalk/signalk-schema

SignalK specification schema as an npm module with tests

CC-BY-SA-2.0
Latest version published 4 months ago

Package Health Score

78 / 100
Full package analysis