@blueyerobotics/blueye-ts 3.6.0 → 3.7.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.
@@ -66,11 +66,15 @@ const parseMessages = (decompressed, fixTimes = true) => {
66
66
  const msgBytes = decompressed.buffer.slice(start, end);
67
67
  reader.pos = end;
68
68
  const msg = protocol_definitions_1.blueye.protocol.BinlogRecord.decode(new Uint8Array(msgBytes), length);
69
- const key = msg.payload.typeUrl.split(".").at(-1);
69
+ const key = msg.payload?.typeUrl.split(".").at(-1);
70
70
  if (!key || !(0, client_1.isInProtocol)(key)) {
71
71
  console.warn(`Unknown protocol key: ${key}`);
72
72
  continue;
73
73
  }
74
+ if (msg.payload == null) {
75
+ console.warn(`Missing payload for key: ${key}`);
76
+ continue;
77
+ }
74
78
  const data = protocol_definitions_1.blueye.protocol[key].decode(msg.payload.value);
75
79
  let innerData;
76
80
  if (key === "GetTelemetryRep") {
@@ -80,7 +84,9 @@ const parseMessages = (decompressed, fixTimes = true) => {
80
84
  console.warn(`Unknown inner protocol key: ${innerKey}`);
81
85
  continue;
82
86
  }
83
- innerData = protocol_definitions_1.blueye.protocol[innerKey].decode(telRep.payload.value);
87
+ innerData = telRep.payload
88
+ ? protocol_definitions_1.blueye.protocol[innerKey].decode(telRep.payload.value)
89
+ : undefined;
84
90
  }
85
91
  let type = "Tel";
86
92
  if (key.endsWith("Ctrl"))
@@ -89,10 +95,9 @@ const parseMessages = (decompressed, fixTimes = true) => {
89
95
  type = "Rep";
90
96
  else if (key.endsWith("Req"))
91
97
  type = "Req";
92
- // @ts-expect-error 2345
93
98
  messages.push({
94
- monotonicTime: msg.clockMonotonic.getTime(),
95
- time: msg.unixTimestamp.getTime(),
99
+ monotonicTime: msg.clockMonotonic?.getTime() ?? 0,
100
+ time: msg.unixTimestamp?.getTime() ?? 0,
96
101
  type,
97
102
  key,
98
103
  data,
@@ -114,6 +119,8 @@ const fixMessageTimes = (messages) => {
114
119
  if (messages.length === 0)
115
120
  return messages;
116
121
  const last = messages.at(-1);
122
+ if (!last)
123
+ return messages;
117
124
  const ssbLast = last.monotonicTime;
118
125
  const unixLast = last.time;
119
126
  for (const message of messages) {
@@ -7,6 +7,6 @@ export declare const responseSchema: z.ZodObject<{
7
7
  export declare const telemetrySchema: z.ZodObject<{
8
8
  payload: z.ZodObject<{
9
9
  typeUrl: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
10
- value: z.ZodPipe<z.ZodAny, z.ZodTransform<Buffer, any>>;
10
+ value: z.ZodPipe<z.ZodAny & z.ZodType<Buffer | Uint8Array<ArrayBufferLike>, any, z.core.$ZodTypeInternals<Buffer | Uint8Array<ArrayBufferLike>, any>>, z.ZodTransform<Buffer, any>>;
11
11
  }, z.core.$strip>;
12
12
  }, z.core.$strip>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueyerobotics/blueye-ts",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "A TypeScript client for interacting with Blueye underwater drones.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,17 +15,17 @@
15
15
  "author": "Blueye <contact@blueye.no> (https://blueye.no/)",
16
16
  "license": "LGPL-3.0-only",
17
17
  "dependencies": {
18
- "@blueyerobotics/protocol-definitions": "3.2.0-b1918def",
19
- "@bufbuild/protobuf": "^2.10.0",
18
+ "@blueyerobotics/protocol-definitions": "3.2.0-c75f3166",
19
+ "@bufbuild/protobuf": "^2.10.2",
20
20
  "buffer": "^6.0.3",
21
21
  "consola": "^3.4.2",
22
22
  "fflate": "^0.8.2",
23
23
  "jszmq": "^0.1.2",
24
24
  "strict-event-emitter": "^0.5.1",
25
- "zod": "^4.1.12"
25
+ "zod": "^4.3.5"
26
26
  },
27
27
  "devDependencies": {
28
- "@biomejs/biome": "2.3.2",
28
+ "@biomejs/biome": "2.3.11",
29
29
  "typescript": "^5.9.3"
30
30
  },
31
31
  "scripts": {