chore: upgrade prettier and fix linting errors
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { readFileSync } from 'fs'
|
||||
import * as protobuf from 'protobufjs'
|
||||
import { Base64Message } from './Base64Message';
|
||||
import { Decoder } from './Decoder';
|
||||
import { Base64Message } from './Base64Message'
|
||||
import { Decoder } from './Decoder'
|
||||
|
||||
const buffer = readFileSync(require.resolve('../../../../res/sparkplug_b.proto'));
|
||||
const buffer = readFileSync(require.resolve('../../../../res/sparkplug_b.proto'))
|
||||
const root = protobuf.parse(buffer.toString()).root
|
||||
export let SparkplugPayload = root.lookupType('com.cirruslink.sparkplug.protobuf.Payload')
|
||||
|
||||
@@ -11,14 +11,12 @@ export const SparkplugDecoder = {
|
||||
decode(input: Buffer): Base64Message | undefined {
|
||||
try {
|
||||
let message = Base64Message.fromString(
|
||||
JSON.stringify(
|
||||
SparkplugPayload.toObject(SparkplugPayload.decode(new Uint8Array(input)))
|
||||
)
|
||||
JSON.stringify(SparkplugPayload.toObject(SparkplugPayload.decode(new Uint8Array(input))))
|
||||
)
|
||||
message.decoder = Decoder.SPARKPLUG
|
||||
return message
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user