@rise-maritime/keelson-js 0.5.1 → 0.5.3

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.
@@ -5,10 +5,12 @@
5
5
  // protoc v6.30.2
6
6
  // source: VehicleParam.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.VehicleParamClientImpl = exports.VehicleParamServiceName = exports.ParamSetBulkResponse = exports.ParamSetBulkResult = exports.ParamSetBulkRequest = exports.ParamListResponse = exports.ParamValueResponse = exports.ParamSetRequest = exports.ParamGetRequest = exports.protobufPackage = void 0;
8
+ exports.VehicleParamClientImpl = exports.VehicleParamServiceName = exports.SaveParamsResponse = exports.SaveParamsRequest = exports.ParamSetBulkResponse = exports.ParamSetBulkResult = exports.ParamSetBulkRequest = exports.ParamListResponse = exports.ParamValueResponse = exports.ParamSetRequest = exports.ParamGetRequest = exports.protobufPackage = void 0;
9
9
  /* eslint-disable */
10
10
  const wire_1 = require("@bufbuild/protobuf/wire");
11
+ const VehicleCommon_1 = require("./VehicleCommon");
11
12
  const empty_1 = require("./google/protobuf/empty");
13
+ const timestamp_1 = require("./google/protobuf/timestamp");
12
14
  exports.protobufPackage = "";
13
15
  function createBaseParamGetRequest() {
14
16
  return { name: "" };
@@ -490,6 +492,140 @@ exports.ParamSetBulkResponse = {
490
492
  return message;
491
493
  },
492
494
  };
495
+ function createBaseSaveParamsRequest() {
496
+ return { timestamp: undefined };
497
+ }
498
+ exports.SaveParamsRequest = {
499
+ encode(message, writer = new wire_1.BinaryWriter()) {
500
+ if (message.timestamp !== undefined) {
501
+ timestamp_1.Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).join();
502
+ }
503
+ return writer;
504
+ },
505
+ decode(input, length) {
506
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
507
+ let end = length === undefined ? reader.len : reader.pos + length;
508
+ const message = createBaseSaveParamsRequest();
509
+ while (reader.pos < end) {
510
+ const tag = reader.uint32();
511
+ switch (tag >>> 3) {
512
+ case 1: {
513
+ if (tag !== 10) {
514
+ break;
515
+ }
516
+ message.timestamp = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
517
+ continue;
518
+ }
519
+ }
520
+ if ((tag & 7) === 4 || tag === 0) {
521
+ break;
522
+ }
523
+ reader.skip(tag & 7);
524
+ }
525
+ return message;
526
+ },
527
+ fromJSON(object) {
528
+ return { timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined };
529
+ },
530
+ toJSON(message) {
531
+ const obj = {};
532
+ if (message.timestamp !== undefined) {
533
+ obj.timestamp = message.timestamp.toISOString();
534
+ }
535
+ return obj;
536
+ },
537
+ create(base) {
538
+ return exports.SaveParamsRequest.fromPartial(base ?? {});
539
+ },
540
+ fromPartial(object) {
541
+ const message = createBaseSaveParamsRequest();
542
+ message.timestamp = object.timestamp ?? undefined;
543
+ return message;
544
+ },
545
+ };
546
+ function createBaseSaveParamsResponse() {
547
+ return { result: 0, rawAutopilotResult: 0, detail: "" };
548
+ }
549
+ exports.SaveParamsResponse = {
550
+ encode(message, writer = new wire_1.BinaryWriter()) {
551
+ if (message.result !== 0) {
552
+ writer.uint32(8).int32(message.result);
553
+ }
554
+ if (message.rawAutopilotResult !== 0) {
555
+ writer.uint32(16).int32(message.rawAutopilotResult);
556
+ }
557
+ if (message.detail !== "") {
558
+ writer.uint32(26).string(message.detail);
559
+ }
560
+ return writer;
561
+ },
562
+ decode(input, length) {
563
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
564
+ let end = length === undefined ? reader.len : reader.pos + length;
565
+ const message = createBaseSaveParamsResponse();
566
+ while (reader.pos < end) {
567
+ const tag = reader.uint32();
568
+ switch (tag >>> 3) {
569
+ case 1: {
570
+ if (tag !== 8) {
571
+ break;
572
+ }
573
+ message.result = reader.int32();
574
+ continue;
575
+ }
576
+ case 2: {
577
+ if (tag !== 16) {
578
+ break;
579
+ }
580
+ message.rawAutopilotResult = reader.int32();
581
+ continue;
582
+ }
583
+ case 3: {
584
+ if (tag !== 26) {
585
+ break;
586
+ }
587
+ message.detail = reader.string();
588
+ continue;
589
+ }
590
+ }
591
+ if ((tag & 7) === 4 || tag === 0) {
592
+ break;
593
+ }
594
+ reader.skip(tag & 7);
595
+ }
596
+ return message;
597
+ },
598
+ fromJSON(object) {
599
+ return {
600
+ result: isSet(object.result) ? (0, VehicleCommon_1.commandResultFromJSON)(object.result) : 0,
601
+ rawAutopilotResult: isSet(object.rawAutopilotResult) ? globalThis.Number(object.rawAutopilotResult) : 0,
602
+ detail: isSet(object.detail) ? globalThis.String(object.detail) : "",
603
+ };
604
+ },
605
+ toJSON(message) {
606
+ const obj = {};
607
+ if (message.result !== 0) {
608
+ obj.result = (0, VehicleCommon_1.commandResultToJSON)(message.result);
609
+ }
610
+ if (message.rawAutopilotResult !== 0) {
611
+ obj.rawAutopilotResult = Math.round(message.rawAutopilotResult);
612
+ }
613
+ if (message.detail !== "") {
614
+ obj.detail = message.detail;
615
+ }
616
+ return obj;
617
+ },
618
+ create(base) {
619
+ return exports.SaveParamsResponse.fromPartial(base ?? {});
620
+ },
621
+ fromPartial(object) {
622
+ const message = createBaseSaveParamsResponse();
623
+ message.result = object.result ?? 0;
624
+ message.rawAutopilotResult = object.rawAutopilotResult ?? 0;
625
+ message.detail = object.detail ?? "";
626
+ return message;
627
+ },
628
+ };
493
629
  exports.VehicleParamServiceName = "VehicleParam";
494
630
  class VehicleParamClientImpl {
495
631
  constructor(rpc, opts) {
@@ -499,6 +635,7 @@ class VehicleParamClientImpl {
499
635
  this.set_param = this.set_param.bind(this);
500
636
  this.list_params = this.list_params.bind(this);
501
637
  this.set_params = this.set_params.bind(this);
638
+ this.save_params = this.save_params.bind(this);
502
639
  }
503
640
  get_param(request) {
504
641
  const data = exports.ParamGetRequest.encode(request).finish();
@@ -520,8 +657,34 @@ class VehicleParamClientImpl {
520
657
  const promise = this.rpc.request(this.service, "set_params", data);
521
658
  return promise.then((data) => exports.ParamSetBulkResponse.decode(new wire_1.BinaryReader(data)));
522
659
  }
660
+ save_params(request) {
661
+ const data = exports.SaveParamsRequest.encode(request).finish();
662
+ const promise = this.rpc.request(this.service, "save_params", data);
663
+ return promise.then((data) => exports.SaveParamsResponse.decode(new wire_1.BinaryReader(data)));
664
+ }
523
665
  }
524
666
  exports.VehicleParamClientImpl = VehicleParamClientImpl;
667
+ function toTimestamp(date) {
668
+ const seconds = Math.trunc(date.getTime() / 1000);
669
+ const nanos = (date.getTime() % 1000) * 1000000;
670
+ return { seconds, nanos };
671
+ }
672
+ function fromTimestamp(t) {
673
+ let millis = (t.seconds || 0) * 1000;
674
+ millis += (t.nanos || 0) / 1000000;
675
+ return new globalThis.Date(millis);
676
+ }
677
+ function fromJsonTimestamp(o) {
678
+ if (o instanceof globalThis.Date) {
679
+ return o;
680
+ }
681
+ else if (typeof o === "string") {
682
+ return new globalThis.Date(o);
683
+ }
684
+ else {
685
+ return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
686
+ }
687
+ }
525
688
  function isSet(value) {
526
689
  return value !== null && value !== undefined;
527
690
  }
@@ -52,6 +52,16 @@ export interface TimestampedQuaternion {
52
52
  /** Quaternion is defined in foxglove/Quaternion.proto */
53
53
  value: Quaternion | undefined;
54
54
  }
55
+ /**
56
+ * Anchors a scalar value to an end-of-interval timestamp plus the interval duration.
57
+ * Use for windowed aggregates such as max wind speed over a 10-minute window.
58
+ */
59
+ export interface TimestampedFloatPeriod {
60
+ $type: "keelson.TimestampedFloatPeriod";
61
+ timestamp: Date | undefined;
62
+ value: number;
63
+ period: Duration | undefined;
64
+ }
55
65
  export declare const TimestampedBytes: MessageFns<TimestampedBytes, "keelson.TimestampedBytes">;
56
66
  export declare const TimestampedDouble: MessageFns<TimestampedDouble, "keelson.TimestampedDouble">;
57
67
  export declare const TimestampedFloat: MessageFns<TimestampedFloat, "keelson.TimestampedFloat">;
@@ -62,6 +72,7 @@ export declare const TimestampedBool: MessageFns<TimestampedBool, "keelson.Times
62
72
  export declare const TimestampedDuration: MessageFns<TimestampedDuration, "keelson.TimestampedDuration">;
63
73
  export declare const TimestampedTimestamp: MessageFns<TimestampedTimestamp, "keelson.TimestampedTimestamp">;
64
74
  export declare const TimestampedQuaternion: MessageFns<TimestampedQuaternion, "keelson.TimestampedQuaternion">;
75
+ export declare const TimestampedFloatPeriod: MessageFns<TimestampedFloatPeriod, "keelson.TimestampedFloatPeriod">;
65
76
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
66
77
  type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
67
78
  [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]>;
@@ -5,7 +5,7 @@
5
5
  // protoc v6.30.2
6
6
  // source: Primitives.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.TimestampedQuaternion = exports.TimestampedTimestamp = exports.TimestampedDuration = exports.TimestampedBool = exports.TimestampedString = exports.TimestampedInt64 = exports.TimestampedInt = exports.TimestampedFloat = exports.TimestampedDouble = exports.TimestampedBytes = void 0;
8
+ exports.TimestampedFloatPeriod = exports.TimestampedQuaternion = exports.TimestampedTimestamp = exports.TimestampedDuration = exports.TimestampedBool = exports.TimestampedString = exports.TimestampedInt64 = exports.TimestampedInt = exports.TimestampedFloat = exports.TimestampedDouble = exports.TimestampedBytes = void 0;
9
9
  /* eslint-disable */
10
10
  const wire_1 = require("@bufbuild/protobuf/wire");
11
11
  const Quaternion_1 = require("./foxglove/Quaternion");
@@ -726,6 +726,94 @@ exports.TimestampedQuaternion = {
726
726
  },
727
727
  };
728
728
  typeRegistry_1.messageTypeRegistry.set(exports.TimestampedQuaternion.$type, exports.TimestampedQuaternion);
729
+ function createBaseTimestampedFloatPeriod() {
730
+ return { $type: "keelson.TimestampedFloatPeriod", timestamp: undefined, value: 0, period: undefined };
731
+ }
732
+ exports.TimestampedFloatPeriod = {
733
+ $type: "keelson.TimestampedFloatPeriod",
734
+ encode(message, writer = new wire_1.BinaryWriter()) {
735
+ if (message.timestamp !== undefined) {
736
+ timestamp_1.Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).join();
737
+ }
738
+ if (message.value !== 0) {
739
+ writer.uint32(21).float(message.value);
740
+ }
741
+ if (message.period !== undefined) {
742
+ duration_1.Duration.encode(message.period, writer.uint32(26).fork()).join();
743
+ }
744
+ return writer;
745
+ },
746
+ decode(input, length) {
747
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
748
+ let end = length === undefined ? reader.len : reader.pos + length;
749
+ const message = createBaseTimestampedFloatPeriod();
750
+ while (reader.pos < end) {
751
+ const tag = reader.uint32();
752
+ switch (tag >>> 3) {
753
+ case 1: {
754
+ if (tag !== 10) {
755
+ break;
756
+ }
757
+ message.timestamp = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
758
+ continue;
759
+ }
760
+ case 2: {
761
+ if (tag !== 21) {
762
+ break;
763
+ }
764
+ message.value = reader.float();
765
+ continue;
766
+ }
767
+ case 3: {
768
+ if (tag !== 26) {
769
+ break;
770
+ }
771
+ message.period = duration_1.Duration.decode(reader, reader.uint32());
772
+ continue;
773
+ }
774
+ }
775
+ if ((tag & 7) === 4 || tag === 0) {
776
+ break;
777
+ }
778
+ reader.skip(tag & 7);
779
+ }
780
+ return message;
781
+ },
782
+ fromJSON(object) {
783
+ return {
784
+ $type: exports.TimestampedFloatPeriod.$type,
785
+ timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
786
+ value: isSet(object.value) ? globalThis.Number(object.value) : 0,
787
+ period: isSet(object.period) ? duration_1.Duration.fromJSON(object.period) : undefined,
788
+ };
789
+ },
790
+ toJSON(message) {
791
+ const obj = {};
792
+ if (message.timestamp !== undefined) {
793
+ obj.timestamp = message.timestamp.toISOString();
794
+ }
795
+ if (message.value !== 0) {
796
+ obj.value = message.value;
797
+ }
798
+ if (message.period !== undefined) {
799
+ obj.period = duration_1.Duration.toJSON(message.period);
800
+ }
801
+ return obj;
802
+ },
803
+ create(base) {
804
+ return exports.TimestampedFloatPeriod.fromPartial(base ?? {});
805
+ },
806
+ fromPartial(object) {
807
+ const message = createBaseTimestampedFloatPeriod();
808
+ message.timestamp = object.timestamp ?? undefined;
809
+ message.value = object.value ?? 0;
810
+ message.period = (object.period !== undefined && object.period !== null)
811
+ ? duration_1.Duration.fromPartial(object.period)
812
+ : undefined;
813
+ return message;
814
+ },
815
+ };
816
+ typeRegistry_1.messageTypeRegistry.set(exports.TimestampedFloatPeriod.$type, exports.TimestampedFloatPeriod);
729
817
  function bytesFromBase64(b64) {
730
818
  if (globalThis.Buffer) {
731
819
  return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
@@ -0,0 +1,76 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ /**
3
+ * Identifies the replay daemon producing this status. Static across the
4
+ * daemon's lifetime; populated on every sample so clients can discover and
5
+ * label replayers via the broadcast alone (no separate RPC needed).
6
+ */
7
+ export interface DaemonInfo {
8
+ $type: "keelson.DaemonInfo";
9
+ /** keelson SDK version, e.g. "0.5.1" */
10
+ version: string;
11
+ hostname: string;
12
+ startedAt: Date | undefined;
13
+ baseDirectory: string;
14
+ }
15
+ export interface ReplayStatus {
16
+ $type: "keelson.ReplayStatus";
17
+ state: ReplayStatus_State;
18
+ /** Current playhead position in the loaded file. */
19
+ currentTime: Date | undefined;
20
+ /** Start and end timestamps of the loaded file. */
21
+ startTime: Date | undefined;
22
+ endTime: Date | undefined;
23
+ /** Playback speed multiplier (1.0 = real time). */
24
+ playbackSpeed: number;
25
+ /** Path of the currently loaded MCAP file, or empty if none loaded. */
26
+ loadedFile: string;
27
+ /** Number of messages already emitted since the file was loaded. */
28
+ playedMessageCount: number;
29
+ /** Total number of messages in the loaded file. */
30
+ totalMessageCount: number;
31
+ /** Progress through the file as a percentage in [0.0, 100.0]. */
32
+ progressPct: number;
33
+ /** Whether the replayer is configured to loop on end-of-file. */
34
+ loop: boolean;
35
+ /** Identification of the daemon producing this sample. See DaemonInfo above. */
36
+ daemon: DaemonInfo | undefined;
37
+ /** Progress of an in-flight load_file, 0..100. Zero outside of LOADING. */
38
+ loadProgressPct: number;
39
+ /**
40
+ * Most-recent load_file failure, surfaced through the broadcast because
41
+ * the RPC reply has already returned OK by the time the worker fails.
42
+ * Cleared on a successful load. Empty if the most recent load succeeded.
43
+ */
44
+ lastLoadError: string;
45
+ }
46
+ export declare enum ReplayStatus_State {
47
+ STOPPED = 0,
48
+ PLAYING = 1,
49
+ PAUSED = 2,
50
+ LOADING = 3,
51
+ UNRECOGNIZED = -1
52
+ }
53
+ export declare function replayStatus_StateFromJSON(object: any): ReplayStatus_State;
54
+ export declare function replayStatus_StateToJSON(object: ReplayStatus_State): string;
55
+ export declare const DaemonInfo: MessageFns<DaemonInfo, "keelson.DaemonInfo">;
56
+ export declare const ReplayStatus: MessageFns<ReplayStatus, "keelson.ReplayStatus">;
57
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
58
+ type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
59
+ [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]>;
60
+ } : Partial<T>;
61
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
62
+ type Exact<P, I extends P> = P extends Builtin ? P : P & {
63
+ [K in keyof P]: Exact<P[K], I[K]>;
64
+ } & {
65
+ [K in Exclude<keyof I, KeysOfUnion<P> | "$type">]: never;
66
+ };
67
+ interface MessageFns<T, V extends string> {
68
+ readonly $type: V;
69
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
70
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
71
+ fromJSON(object: any): T;
72
+ toJSON(message: T): unknown;
73
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
74
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
75
+ }
76
+ export {};