@signalk/streams 2.0.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/mdns-ws.js CHANGED
@@ -34,12 +34,12 @@ function MdnsWs(options) {
34
34
  const createDebug = options.createDebug || require('debug')
35
35
  this.debug = createDebug('signalk:streams:mdns-ws')
36
36
  this.dataDebug = createDebug('signalk:streams:mdns-ws-data')
37
- debug(`deltaStreamBehaviour:${deltaStreamBehaviour}`)
37
+ this.debug(`deltaStreamBehaviour:${deltaStreamBehaviour}`)
38
38
 
39
39
  this.handleContext = () => {}
40
40
  if (options.selfHandling === 'manualSelf') {
41
41
  if (options.remoteSelf) {
42
- debug(`Using manual remote self ${options.remoteSelf}`)
42
+ this.debug(`Using manual remote self ${options.remoteSelf}`)
43
43
  this.handleContext = (delta) => {
44
44
  if (delta.context === options.remoteSelf) {
45
45
  delete delta.context
@@ -39,6 +39,9 @@ function Nmea0183ToSignalK(options) {
39
39
  Transform.call(this, {
40
40
  objectMode: true,
41
41
  })
42
+ this.debug = (options.createDebug || require('debug'))(
43
+ 'signalk:streams:nmea0183-signalk'
44
+ )
42
45
 
43
46
  this.parser = new Parser(options)
44
47
  this.n2kParser = new FromPgn(options)
@@ -107,7 +110,7 @@ Nmea0183ToSignalK.prototype._transform = function (chunk, encoding, done) {
107
110
  }
108
111
  }
109
112
  } catch (e) {
110
- console.error(e)
113
+ this.debug(e)
111
114
  }
112
115
 
113
116
  done()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalk/streams",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "Utilities for handling streams of Signal K data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/simple.js CHANGED
@@ -80,6 +80,20 @@ function Simple(options) {
80
80
  getLogger(options.app, options.logging, discriminatorByDataType[dataType]),
81
81
  dataTypeMapping[mappingType](options)
82
82
  )
83
+ if (options.subOptions.overrideTimestamp) {
84
+ pipeline.push(
85
+ new Transform({
86
+ objectMode: true,
87
+ transform(delta, encoding, callback) {
88
+ if (delta.updates) {
89
+ const now = new Date().toISOString()
90
+ delta.updates.forEach((update) => (update.timestamp = now))
91
+ }
92
+ callback(null, delta)
93
+ },
94
+ })
95
+ )
96
+ }
83
97
 
84
98
  for (let i = pipeline.length - 2; i >= 0; i--) {
85
99
  pipeline[i].pipe(pipeline[i + 1])
package/tcp.js CHANGED
@@ -38,6 +38,7 @@ function TcpStream(options) {
38
38
  this.noDataReceivedTimeout =
39
39
  Number.parseInt((this.options.noDataReceivedTimeout + '').trim()) * 1000
40
40
  this.debug = (options.createDebug || require('debug'))('signalk:streams:tcp')
41
+ this.debug(`noDataReceivedTimeout:${this.noDataReceivedTimeout}`)
41
42
  this.debugData = (options.createDebug || require('debug'))(
42
43
  'signalk:streams:tcp-data'
43
44
  )
Binary file