@signalk/streams 2.0.4 → 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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/simple.js +14 -0
  3. package/tcp.js +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalk/streams",
3
- "version": "2.0.4",
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
  )