@signalk/streams 5.1.4 → 6.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 (132) hide show
  1. package/dist/actisense-serial.d.ts +3 -0
  2. package/dist/actisense-serial.d.ts.map +1 -0
  3. package/dist/actisense-serial.js +4 -0
  4. package/dist/autodetect.d.ts +54 -0
  5. package/dist/autodetect.d.ts.map +1 -0
  6. package/dist/autodetect.js +186 -0
  7. package/dist/canboatjs.d.ts +25 -0
  8. package/dist/canboatjs.d.ts.map +1 -0
  9. package/dist/canboatjs.js +57 -0
  10. package/dist/canbus.d.ts +3 -0
  11. package/dist/canbus.d.ts.map +1 -0
  12. package/dist/canbus.js +4 -0
  13. package/dist/execute.d.ts +34 -0
  14. package/dist/execute.d.ts.map +1 -0
  15. package/dist/execute.js +101 -0
  16. package/dist/filestream.d.ts +24 -0
  17. package/dist/filestream.d.ts.map +1 -0
  18. package/dist/filestream.js +58 -0
  19. package/dist/folderstream.d.ts +12 -0
  20. package/dist/folderstream.d.ts.map +1 -0
  21. package/dist/folderstream.js +36 -0
  22. package/dist/from_json.d.ts +6 -0
  23. package/dist/from_json.d.ts.map +1 -0
  24. package/dist/from_json.js +22 -0
  25. package/dist/gpiod-seatalk.d.ts +19 -0
  26. package/dist/gpiod-seatalk.d.ts.map +1 -0
  27. package/{gpiod-seatalk.js → dist/gpiod-seatalk.js} +18 -16
  28. package/dist/gpsd.d.ts +23 -0
  29. package/dist/gpsd.d.ts.map +1 -0
  30. package/dist/gpsd.js +55 -0
  31. package/dist/index.d.ts +5 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +14 -0
  34. package/dist/keys-filter.d.ts +27 -0
  35. package/dist/keys-filter.d.ts.map +1 -0
  36. package/dist/keys-filter.js +59 -0
  37. package/dist/liner.d.ts +14 -0
  38. package/dist/liner.d.ts.map +1 -0
  39. package/dist/liner.js +35 -0
  40. package/dist/log.d.ts +15 -0
  41. package/dist/log.d.ts.map +1 -0
  42. package/dist/log.js +17 -0
  43. package/dist/logging.d.ts +14 -0
  44. package/dist/logging.d.ts.map +1 -0
  45. package/dist/logging.js +125 -0
  46. package/dist/mdns-ws.d.ts +39 -0
  47. package/dist/mdns-ws.d.ts.map +1 -0
  48. package/dist/mdns-ws.js +180 -0
  49. package/dist/multiplexedlog.d.ts +3 -0
  50. package/dist/multiplexedlog.d.ts.map +1 -0
  51. package/dist/multiplexedlog.js +7 -0
  52. package/dist/n2k-signalk.d.ts +39 -0
  53. package/dist/n2k-signalk.d.ts.map +1 -0
  54. package/dist/n2k-signalk.js +180 -0
  55. package/dist/n2kAnalyzer.d.ts +19 -0
  56. package/dist/n2kAnalyzer.d.ts.map +1 -0
  57. package/dist/n2kAnalyzer.js +61 -0
  58. package/dist/nmea0183-signalk.d.ts +33 -0
  59. package/dist/nmea0183-signalk.d.ts.map +1 -0
  60. package/dist/nmea0183-signalk.js +105 -0
  61. package/dist/nullprovider.d.ts +5 -0
  62. package/dist/nullprovider.d.ts.map +1 -0
  63. package/dist/nullprovider.js +9 -0
  64. package/dist/pigpio-seatalk.d.ts +19 -0
  65. package/dist/pigpio-seatalk.d.ts.map +1 -0
  66. package/{pigpio-seatalk.js → dist/pigpio-seatalk.js} +21 -18
  67. package/dist/replacer.d.ts +13 -0
  68. package/dist/replacer.d.ts.map +1 -0
  69. package/dist/replacer.js +20 -0
  70. package/dist/s3.d.ts +13 -0
  71. package/dist/s3.d.ts.map +1 -0
  72. package/dist/s3.js +82 -0
  73. package/dist/serialport.d.ts +35 -0
  74. package/dist/serialport.d.ts.map +1 -0
  75. package/dist/serialport.js +129 -0
  76. package/dist/simple.d.ts +78 -0
  77. package/dist/simple.d.ts.map +1 -0
  78. package/dist/simple.js +446 -0
  79. package/dist/splitting-liner.d.ts +12 -0
  80. package/dist/splitting-liner.d.ts.map +1 -0
  81. package/dist/splitting-liner.js +19 -0
  82. package/dist/tcp.d.ts +33 -0
  83. package/dist/tcp.d.ts.map +1 -0
  84. package/dist/tcp.js +117 -0
  85. package/dist/tcpserver.d.ts +14 -0
  86. package/dist/tcpserver.d.ts.map +1 -0
  87. package/dist/tcpserver.js +18 -0
  88. package/dist/test-helpers.d.ts +52 -0
  89. package/dist/test-helpers.d.ts.map +1 -0
  90. package/dist/test-helpers.js +73 -0
  91. package/dist/throttle.d.ts +3 -0
  92. package/dist/throttle.d.ts.map +1 -0
  93. package/dist/throttle.js +4 -0
  94. package/dist/timestamp-throttle.d.ts +17 -0
  95. package/dist/timestamp-throttle.d.ts.map +1 -0
  96. package/dist/timestamp-throttle.js +41 -0
  97. package/dist/types.d.ts +8 -0
  98. package/dist/types.d.ts.map +1 -0
  99. package/dist/types.js +2 -0
  100. package/dist/udp.d.ts +27 -0
  101. package/dist/udp.d.ts.map +1 -0
  102. package/dist/udp.js +55 -0
  103. package/package.json +48 -5
  104. package/actisense-serial.js +0 -1
  105. package/autodetect.js +0 -201
  106. package/canboatjs.js +0 -71
  107. package/canbus.js +0 -17
  108. package/execute.js +0 -137
  109. package/filestream.js +0 -90
  110. package/folderstream.js +0 -36
  111. package/from_json.js +0 -51
  112. package/gpsd.js +0 -94
  113. package/keys-filter.js +0 -81
  114. package/liner.js +0 -68
  115. package/log.js +0 -51
  116. package/logging.js +0 -149
  117. package/mdns-ws.js +0 -167
  118. package/multiplexedlog.js +0 -3
  119. package/n2k-signalk.js +0 -197
  120. package/n2kAnalyzer.js +0 -82
  121. package/nmea0183-signalk.js +0 -119
  122. package/nullprovider.js +0 -31
  123. package/replacer.js +0 -57
  124. package/s3.js +0 -87
  125. package/serialport.js +0 -209
  126. package/simple.js +0 -448
  127. package/splitting-liner.js +0 -46
  128. package/tcp.js +0 -138
  129. package/tcpserver.js +0 -40
  130. package/throttle.js +0 -31
  131. package/timestamp-throttle.js +0 -63
  132. package/udp.js +0 -95
@@ -1,63 +0,0 @@
1
- /*
2
- * Copyright 2015 Teppo Kurki <teppo.kurki@ıki.fi>
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- const Transform = require('stream').Transform
18
- const moment = require('moment')
19
-
20
- /*
21
- This Transformer throttles the stream based on the stream's timestamp properties
22
- so that throughput rate is real time. Aimed at canboat analyzer output
23
- rate control
24
- */
25
-
26
- function TimestampThrottle(options) {
27
- Transform.call(this, {
28
- objectMode: true
29
- })
30
- this.lastMsgMillis = new Date().getTime()
31
- this.getMilliseconds =
32
- options && options.getMilliseconds
33
- ? options.getMilliseconds
34
- : getMilliseconds
35
- }
36
-
37
- require('util').inherits(TimestampThrottle, Transform)
38
-
39
- TimestampThrottle.prototype._transform = function (msg, encoding, done) {
40
- const msgMillis = this.getMilliseconds(msg)
41
- if (msgMillis < this.lastMsgMillis) {
42
- this.offsetMillis = new Date().getTime() - msgMillis
43
- }
44
- this.lastMsgMillis = msgMillis
45
- const millisToCorrectSendTime = msgMillis - Date.now() + this.offsetMillis
46
- if (millisToCorrectSendTime <= 0) {
47
- this.push(msg)
48
- done()
49
- } else {
50
- const doPush = this.push.bind(this, msg)
51
- setTimeout(function () {
52
- doPush()
53
- done()
54
- }, millisToCorrectSendTime)
55
- }
56
- }
57
-
58
- function getMilliseconds(msg) {
59
- // 2014-08-15-16:00:00.083
60
- return moment(msg.timestamp, 'YYYY-MM-DD-HH:mm:ss.SSS').valueOf()
61
- }
62
-
63
- module.exports = TimestampThrottle
package/udp.js DELETED
@@ -1,95 +0,0 @@
1
- /*
2
- * Copyright 2015 Teppo Kurki <teppo.kurki@iki.fi>
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- /* Usage: This pipeElement takes any TCP stream and passes it to the next pipeElement.
18
- * It takes the options "host" and "port" and optionally "reconnect" (default true) and "maxRetries" (default 10)
19
- * Example:
20
-
21
- {
22
- "type": "providers/udp",
23
- "options": {
24
- "port": 12345
25
- },
26
- "optionMappings": [
27
- {
28
- "fromAppProperty": "argv.udpport",
29
- "toOption": "port"
30
- }
31
- ]
32
- },
33
-
34
- */
35
-
36
- const Transform = require('stream').Transform
37
-
38
- function Udp(options) {
39
- Transform.call(this, {
40
- objectMode: false
41
- })
42
- this.options = options
43
- this.debug = (options.createDebug || require('debug'))('signalk:streams:udp')
44
- this.debugData = (options.createDebug || require('debug'))(
45
- 'signalk:streams:udp-data'
46
- )
47
- }
48
-
49
- require('util').inherits(Udp, Transform)
50
-
51
- Udp.prototype.pipe = function (pipeTo) {
52
- this.pipeTo = pipeTo
53
- Udp.super_.prototype.pipe.call(this, pipeTo)
54
-
55
- const socket = require('dgram').createSocket('udp4')
56
- const self = this
57
-
58
- if (this.options.outEvent && this.options.port !== undefined) {
59
- this.options.app.on(this.options.outEvent, function (d) {
60
- self.debug('sending over udp: %s', d)
61
- socket.send(
62
- d,
63
- 0,
64
- d.length,
65
- self.options.port,
66
- self.options.host || '255.255.255.255'
67
- )
68
- })
69
- }
70
-
71
- socket.on('message', function (message) {
72
- self.debug(message.toString())
73
- self.push(message)
74
- })
75
-
76
- socket.on('error', (err) => {
77
- this.options.app.setProviderError(this.options.providerId, err.message)
78
- console.error('UdpProvider:' + err)
79
- })
80
-
81
- socket.bind(this.options.port, function () {
82
- socket.setBroadcast(true)
83
- })
84
- }
85
-
86
- Udp.prototype._transform = function (chunk, encoding, done) {
87
- done()
88
- }
89
-
90
- Udp.prototype.end = function () {
91
- this.socket.close()
92
- this.pipeTo.end()
93
- }
94
-
95
- module.exports = Udp