@rise-maritime/keelson-js 0.6.0-alpha.255.dev.1 → 0.6.0-alpha.275.dev.2
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.
- package/dist/index.d.ts +83 -8
- package/dist/index.js +23 -1
- package/dist/index.test.js +31 -0
- package/dist/interfaces/AlarmAck.d.ts +2 -2
- package/dist/interfaces/AlarmAck.js +2 -2
- package/dist/interfaces/ContainerControl.d.ts +239 -0
- package/dist/interfaces/ContainerControl.js +1053 -0
- package/dist/interfaces/ContainerHost.d.ts +403 -0
- package/dist/interfaces/ContainerHost.js +1230 -0
- package/dist/interfaces/ErrorResponse.d.ts +7 -2
- package/dist/interfaces/ErrorResponse.js +12 -2
- package/dist/interfaces/Route.d.ts +141 -6
- package/dist/interfaces/Route.js +309 -4
- package/dist/interfaces/RoutePlanner.d.ts +19 -1
- package/dist/interfaces/RoutePlanner.js +23 -1
- package/dist/interfaces/ScenarioControl.d.ts +132 -3
- package/dist/interfaces/ScenarioControl.js +439 -37
- package/dist/interfaces/VehicleNavigation.d.ts +55 -0
- package/dist/interfaces/VehicleNavigation.js +233 -1
- package/dist/interfaces/VehicleSimulatorControl.d.ts +0 -83
- package/dist/interfaces/VehicleSimulatorControl.js +1 -293
- package/dist/interfaces/serviceRegistry.d.ts +84 -8
- package/dist/interfaces/serviceRegistry.js +4 -0
- package/dist/interfaces.json +2 -0
- package/dist/payloads/AdviceDisposition.d.ts +55 -0
- package/dist/payloads/AdviceDisposition.js +242 -0
- package/dist/payloads/ChecklistHandover.d.ts +522 -0
- package/dist/payloads/ChecklistHandover.js +1735 -0
- package/dist/payloads/ContainerHost.d.ts +407 -0
- package/dist/payloads/ContainerHost.js +1245 -0
- package/dist/payloads/Encounter.d.ts +104 -0
- package/dist/payloads/Encounter.js +573 -0
- package/dist/payloads/NavigationAdvice.d.ts +94 -0
- package/dist/payloads/NavigationAdvice.js +596 -0
- package/dist/payloads/NavigationState.d.ts +90 -0
- package/dist/payloads/NavigationState.js +377 -0
- package/dist/payloads/Route.d.ts +142 -6
- package/dist/payloads/Route.js +318 -4
- package/dist/payloads/RouteExecution.d.ts +7 -0
- package/dist/payloads/ScenarioEvent.d.ts +14 -0
- package/dist/payloads/ScenarioEvent.js +16 -0
- package/dist/payloads/index.d.ts +1 -1
- package/dist/payloads/index.js +2 -2
- package/dist/payloads/index.keelson.d.ts +10 -4
- package/dist/payloads/index.keelson.js +10 -4
- package/dist/qos.json +6 -0
- package/dist/subjects.json +20 -1
- package/package.json +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
import { ColregSituation, OperationalContext } from "./Route";
|
|
3
|
+
/**
|
|
4
|
+
* One vessel-to-vessel encounter as own ship's navigation assesses it.
|
|
5
|
+
*
|
|
6
|
+
* A record, not a command, and not the advice: what own ship should DO about an encounter is a
|
|
7
|
+
* NavigationAdvice, which names the encounters it answers. Keeping them apart is what lets an
|
|
8
|
+
* assessment exist, and be recorded, whether or not anyone acts on it.
|
|
9
|
+
*
|
|
10
|
+
* EVERY RECORD IS A FULL RESTATEMENT, for the reason EnvelopeExceedance gives: the store keeps the
|
|
11
|
+
* last value per key, so a closing record must carry everything the opening one did.
|
|
12
|
+
*/
|
|
13
|
+
export interface Encounter {
|
|
14
|
+
$type: "keelson.Encounter";
|
|
15
|
+
timestamp: Date | undefined;
|
|
16
|
+
/** UUID. Also the trailing key token, stable for the life of the encounter. */
|
|
17
|
+
encounterId: string;
|
|
18
|
+
/** Absent when own ship has no voyage; the key then uses "novoyage". */
|
|
19
|
+
voyageId?: string | undefined;
|
|
20
|
+
target: Encounter_TargetRef | undefined;
|
|
21
|
+
targetName: string;
|
|
22
|
+
/** At this record's timestamp. */
|
|
23
|
+
rangeM: number;
|
|
24
|
+
bearingTrueDeg: number;
|
|
25
|
+
bearingRelativeDeg: number;
|
|
26
|
+
cpaM?: number | undefined;
|
|
27
|
+
/** negative: closest approach already past */
|
|
28
|
+
tcpaS?: number | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Latched when the encounter opened and held until it closes: the rules assign roles once,
|
|
31
|
+
* and a role that flipped as the geometry evolved would contradict a manoeuvre already begun.
|
|
32
|
+
* The same ColregSituation a Route leg is annotated with, so a planned leg and a live encounter
|
|
33
|
+
* compare without mapping. An encounter may also be OVERTAKEN or NONE, which a leg never is.
|
|
34
|
+
*/
|
|
35
|
+
situation: ColregSituation;
|
|
36
|
+
ownRole: Encounter_Role;
|
|
37
|
+
/** Rule references that decided situation and role, e.g. ["15", "16"], ["18(a)(iii)"]. */
|
|
38
|
+
rules: string[];
|
|
39
|
+
/** Why, for operators and logs. Consumers MUST NOT parse it. */
|
|
40
|
+
reasoning: string;
|
|
41
|
+
risk: Encounter_Risk;
|
|
42
|
+
peakRisk: Encounter_Risk;
|
|
43
|
+
openedAt: Date | undefined;
|
|
44
|
+
/** Absent while open, so an open encounter is distinguishable from one whose close was lost. */
|
|
45
|
+
closedAt?: Date | undefined;
|
|
46
|
+
/** The operational context whose thresholds graded the risk. */
|
|
47
|
+
thresholdContext: OperationalContext;
|
|
48
|
+
}
|
|
49
|
+
/** Own ship's role under the rules, from own ship's side. */
|
|
50
|
+
export declare enum Encounter_Role {
|
|
51
|
+
ROLE_UNSPECIFIED = 0,
|
|
52
|
+
/** ROLE_GIVE_WAY - Rules 13, 14, 15, 16, 18: keep out of the way */
|
|
53
|
+
ROLE_GIVE_WAY = 1,
|
|
54
|
+
/** ROLE_STAND_ON - Rule 17: keep course and speed */
|
|
55
|
+
ROLE_STAND_ON = 2,
|
|
56
|
+
/** ROLE_NONE - Rule 19 (restricted visibility), or no rule applies */
|
|
57
|
+
ROLE_NONE = 3,
|
|
58
|
+
UNRECOGNIZED = -1
|
|
59
|
+
}
|
|
60
|
+
export declare function encounter_RoleFromJSON(object: any): Encounter_Role;
|
|
61
|
+
export declare function encounter_RoleToJSON(object: Encounter_Role): string;
|
|
62
|
+
/** UNSPECIFIED is the proto3 default: a producer that never set risk must not read as no risk. */
|
|
63
|
+
export declare enum Encounter_Risk {
|
|
64
|
+
RISK_UNSPECIFIED = 0,
|
|
65
|
+
RISK_NONE = 1,
|
|
66
|
+
RISK_WATCH = 2,
|
|
67
|
+
RISK_RISK = 3,
|
|
68
|
+
RISK_DANGER = 4,
|
|
69
|
+
UNRECOGNIZED = -1
|
|
70
|
+
}
|
|
71
|
+
export declare function encounter_RiskFromJSON(object: any): Encounter_Risk;
|
|
72
|
+
export declare function encounter_RiskToJSON(object: Encounter_Risk): string;
|
|
73
|
+
/** Where the target was heard: the key it was published on, minus the subject. */
|
|
74
|
+
export interface Encounter_TargetRef {
|
|
75
|
+
$type: "keelson.Encounter.TargetRef";
|
|
76
|
+
/** e.g. "maritimedb" */
|
|
77
|
+
entityId: string;
|
|
78
|
+
/** e.g. "digitraffic" */
|
|
79
|
+
sourceId: string;
|
|
80
|
+
/** the @target token, e.g. "mmsi_265000000" */
|
|
81
|
+
targetId: string;
|
|
82
|
+
}
|
|
83
|
+
export declare const Encounter: MessageFns<Encounter, "keelson.Encounter">;
|
|
84
|
+
export declare const Encounter_TargetRef: MessageFns<Encounter_TargetRef, "keelson.Encounter.TargetRef">;
|
|
85
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
86
|
+
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 {} ? {
|
|
87
|
+
[K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]>;
|
|
88
|
+
} : Partial<T>;
|
|
89
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
90
|
+
type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
91
|
+
[K in keyof P]: Exact<P[K], I[K]>;
|
|
92
|
+
} & {
|
|
93
|
+
[K in Exclude<keyof I, KeysOfUnion<P> | "$type">]: never;
|
|
94
|
+
};
|
|
95
|
+
interface MessageFns<T, V extends string> {
|
|
96
|
+
readonly $type: V;
|
|
97
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
98
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
99
|
+
fromJSON(object: any): T;
|
|
100
|
+
toJSON(message: T): unknown;
|
|
101
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
102
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
103
|
+
}
|
|
104
|
+
export {};
|
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.6.1
|
|
5
|
+
// protoc v6.30.2
|
|
6
|
+
// source: Encounter.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.Encounter_TargetRef = exports.Encounter = exports.encounter_RiskToJSON = exports.encounter_RiskFromJSON = exports.Encounter_Risk = exports.encounter_RoleToJSON = exports.encounter_RoleFromJSON = exports.Encounter_Role = void 0;
|
|
9
|
+
/* eslint-disable */
|
|
10
|
+
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
|
+
const Route_1 = require("./Route");
|
|
12
|
+
const timestamp_1 = require("./google/protobuf/timestamp");
|
|
13
|
+
const typeRegistry_1 = require("./typeRegistry");
|
|
14
|
+
/** Own ship's role under the rules, from own ship's side. */
|
|
15
|
+
var Encounter_Role;
|
|
16
|
+
(function (Encounter_Role) {
|
|
17
|
+
Encounter_Role[Encounter_Role["ROLE_UNSPECIFIED"] = 0] = "ROLE_UNSPECIFIED";
|
|
18
|
+
/** ROLE_GIVE_WAY - Rules 13, 14, 15, 16, 18: keep out of the way */
|
|
19
|
+
Encounter_Role[Encounter_Role["ROLE_GIVE_WAY"] = 1] = "ROLE_GIVE_WAY";
|
|
20
|
+
/** ROLE_STAND_ON - Rule 17: keep course and speed */
|
|
21
|
+
Encounter_Role[Encounter_Role["ROLE_STAND_ON"] = 2] = "ROLE_STAND_ON";
|
|
22
|
+
/** ROLE_NONE - Rule 19 (restricted visibility), or no rule applies */
|
|
23
|
+
Encounter_Role[Encounter_Role["ROLE_NONE"] = 3] = "ROLE_NONE";
|
|
24
|
+
Encounter_Role[Encounter_Role["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
25
|
+
})(Encounter_Role || (exports.Encounter_Role = Encounter_Role = {}));
|
|
26
|
+
function encounter_RoleFromJSON(object) {
|
|
27
|
+
switch (object) {
|
|
28
|
+
case 0:
|
|
29
|
+
case "ROLE_UNSPECIFIED":
|
|
30
|
+
return Encounter_Role.ROLE_UNSPECIFIED;
|
|
31
|
+
case 1:
|
|
32
|
+
case "ROLE_GIVE_WAY":
|
|
33
|
+
return Encounter_Role.ROLE_GIVE_WAY;
|
|
34
|
+
case 2:
|
|
35
|
+
case "ROLE_STAND_ON":
|
|
36
|
+
return Encounter_Role.ROLE_STAND_ON;
|
|
37
|
+
case 3:
|
|
38
|
+
case "ROLE_NONE":
|
|
39
|
+
return Encounter_Role.ROLE_NONE;
|
|
40
|
+
case -1:
|
|
41
|
+
case "UNRECOGNIZED":
|
|
42
|
+
default:
|
|
43
|
+
return Encounter_Role.UNRECOGNIZED;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.encounter_RoleFromJSON = encounter_RoleFromJSON;
|
|
47
|
+
function encounter_RoleToJSON(object) {
|
|
48
|
+
switch (object) {
|
|
49
|
+
case Encounter_Role.ROLE_UNSPECIFIED:
|
|
50
|
+
return "ROLE_UNSPECIFIED";
|
|
51
|
+
case Encounter_Role.ROLE_GIVE_WAY:
|
|
52
|
+
return "ROLE_GIVE_WAY";
|
|
53
|
+
case Encounter_Role.ROLE_STAND_ON:
|
|
54
|
+
return "ROLE_STAND_ON";
|
|
55
|
+
case Encounter_Role.ROLE_NONE:
|
|
56
|
+
return "ROLE_NONE";
|
|
57
|
+
case Encounter_Role.UNRECOGNIZED:
|
|
58
|
+
default:
|
|
59
|
+
return "UNRECOGNIZED";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.encounter_RoleToJSON = encounter_RoleToJSON;
|
|
63
|
+
/** UNSPECIFIED is the proto3 default: a producer that never set risk must not read as no risk. */
|
|
64
|
+
var Encounter_Risk;
|
|
65
|
+
(function (Encounter_Risk) {
|
|
66
|
+
Encounter_Risk[Encounter_Risk["RISK_UNSPECIFIED"] = 0] = "RISK_UNSPECIFIED";
|
|
67
|
+
Encounter_Risk[Encounter_Risk["RISK_NONE"] = 1] = "RISK_NONE";
|
|
68
|
+
Encounter_Risk[Encounter_Risk["RISK_WATCH"] = 2] = "RISK_WATCH";
|
|
69
|
+
Encounter_Risk[Encounter_Risk["RISK_RISK"] = 3] = "RISK_RISK";
|
|
70
|
+
Encounter_Risk[Encounter_Risk["RISK_DANGER"] = 4] = "RISK_DANGER";
|
|
71
|
+
Encounter_Risk[Encounter_Risk["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
72
|
+
})(Encounter_Risk || (exports.Encounter_Risk = Encounter_Risk = {}));
|
|
73
|
+
function encounter_RiskFromJSON(object) {
|
|
74
|
+
switch (object) {
|
|
75
|
+
case 0:
|
|
76
|
+
case "RISK_UNSPECIFIED":
|
|
77
|
+
return Encounter_Risk.RISK_UNSPECIFIED;
|
|
78
|
+
case 1:
|
|
79
|
+
case "RISK_NONE":
|
|
80
|
+
return Encounter_Risk.RISK_NONE;
|
|
81
|
+
case 2:
|
|
82
|
+
case "RISK_WATCH":
|
|
83
|
+
return Encounter_Risk.RISK_WATCH;
|
|
84
|
+
case 3:
|
|
85
|
+
case "RISK_RISK":
|
|
86
|
+
return Encounter_Risk.RISK_RISK;
|
|
87
|
+
case 4:
|
|
88
|
+
case "RISK_DANGER":
|
|
89
|
+
return Encounter_Risk.RISK_DANGER;
|
|
90
|
+
case -1:
|
|
91
|
+
case "UNRECOGNIZED":
|
|
92
|
+
default:
|
|
93
|
+
return Encounter_Risk.UNRECOGNIZED;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.encounter_RiskFromJSON = encounter_RiskFromJSON;
|
|
97
|
+
function encounter_RiskToJSON(object) {
|
|
98
|
+
switch (object) {
|
|
99
|
+
case Encounter_Risk.RISK_UNSPECIFIED:
|
|
100
|
+
return "RISK_UNSPECIFIED";
|
|
101
|
+
case Encounter_Risk.RISK_NONE:
|
|
102
|
+
return "RISK_NONE";
|
|
103
|
+
case Encounter_Risk.RISK_WATCH:
|
|
104
|
+
return "RISK_WATCH";
|
|
105
|
+
case Encounter_Risk.RISK_RISK:
|
|
106
|
+
return "RISK_RISK";
|
|
107
|
+
case Encounter_Risk.RISK_DANGER:
|
|
108
|
+
return "RISK_DANGER";
|
|
109
|
+
case Encounter_Risk.UNRECOGNIZED:
|
|
110
|
+
default:
|
|
111
|
+
return "UNRECOGNIZED";
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.encounter_RiskToJSON = encounter_RiskToJSON;
|
|
115
|
+
function createBaseEncounter() {
|
|
116
|
+
return {
|
|
117
|
+
$type: "keelson.Encounter",
|
|
118
|
+
timestamp: undefined,
|
|
119
|
+
encounterId: "",
|
|
120
|
+
voyageId: undefined,
|
|
121
|
+
target: undefined,
|
|
122
|
+
targetName: "",
|
|
123
|
+
rangeM: 0,
|
|
124
|
+
bearingTrueDeg: 0,
|
|
125
|
+
bearingRelativeDeg: 0,
|
|
126
|
+
cpaM: undefined,
|
|
127
|
+
tcpaS: undefined,
|
|
128
|
+
situation: 0,
|
|
129
|
+
ownRole: 0,
|
|
130
|
+
rules: [],
|
|
131
|
+
reasoning: "",
|
|
132
|
+
risk: 0,
|
|
133
|
+
peakRisk: 0,
|
|
134
|
+
openedAt: undefined,
|
|
135
|
+
closedAt: undefined,
|
|
136
|
+
thresholdContext: 0,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
exports.Encounter = {
|
|
140
|
+
$type: "keelson.Encounter",
|
|
141
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
142
|
+
if (message.timestamp !== undefined) {
|
|
143
|
+
timestamp_1.Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).join();
|
|
144
|
+
}
|
|
145
|
+
if (message.encounterId !== "") {
|
|
146
|
+
writer.uint32(18).string(message.encounterId);
|
|
147
|
+
}
|
|
148
|
+
if (message.voyageId !== undefined) {
|
|
149
|
+
writer.uint32(26).string(message.voyageId);
|
|
150
|
+
}
|
|
151
|
+
if (message.target !== undefined) {
|
|
152
|
+
exports.Encounter_TargetRef.encode(message.target, writer.uint32(34).fork()).join();
|
|
153
|
+
}
|
|
154
|
+
if (message.targetName !== "") {
|
|
155
|
+
writer.uint32(42).string(message.targetName);
|
|
156
|
+
}
|
|
157
|
+
if (message.rangeM !== 0) {
|
|
158
|
+
writer.uint32(85).float(message.rangeM);
|
|
159
|
+
}
|
|
160
|
+
if (message.bearingTrueDeg !== 0) {
|
|
161
|
+
writer.uint32(93).float(message.bearingTrueDeg);
|
|
162
|
+
}
|
|
163
|
+
if (message.bearingRelativeDeg !== 0) {
|
|
164
|
+
writer.uint32(101).float(message.bearingRelativeDeg);
|
|
165
|
+
}
|
|
166
|
+
if (message.cpaM !== undefined) {
|
|
167
|
+
writer.uint32(109).float(message.cpaM);
|
|
168
|
+
}
|
|
169
|
+
if (message.tcpaS !== undefined) {
|
|
170
|
+
writer.uint32(117).float(message.tcpaS);
|
|
171
|
+
}
|
|
172
|
+
if (message.situation !== 0) {
|
|
173
|
+
writer.uint32(160).int32(message.situation);
|
|
174
|
+
}
|
|
175
|
+
if (message.ownRole !== 0) {
|
|
176
|
+
writer.uint32(168).int32(message.ownRole);
|
|
177
|
+
}
|
|
178
|
+
for (const v of message.rules) {
|
|
179
|
+
writer.uint32(178).string(v);
|
|
180
|
+
}
|
|
181
|
+
if (message.reasoning !== "") {
|
|
182
|
+
writer.uint32(186).string(message.reasoning);
|
|
183
|
+
}
|
|
184
|
+
if (message.risk !== 0) {
|
|
185
|
+
writer.uint32(240).int32(message.risk);
|
|
186
|
+
}
|
|
187
|
+
if (message.peakRisk !== 0) {
|
|
188
|
+
writer.uint32(248).int32(message.peakRisk);
|
|
189
|
+
}
|
|
190
|
+
if (message.openedAt !== undefined) {
|
|
191
|
+
timestamp_1.Timestamp.encode(toTimestamp(message.openedAt), writer.uint32(322).fork()).join();
|
|
192
|
+
}
|
|
193
|
+
if (message.closedAt !== undefined) {
|
|
194
|
+
timestamp_1.Timestamp.encode(toTimestamp(message.closedAt), writer.uint32(330).fork()).join();
|
|
195
|
+
}
|
|
196
|
+
if (message.thresholdContext !== 0) {
|
|
197
|
+
writer.uint32(400).int32(message.thresholdContext);
|
|
198
|
+
}
|
|
199
|
+
return writer;
|
|
200
|
+
},
|
|
201
|
+
decode(input, length) {
|
|
202
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
203
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
204
|
+
const message = createBaseEncounter();
|
|
205
|
+
while (reader.pos < end) {
|
|
206
|
+
const tag = reader.uint32();
|
|
207
|
+
switch (tag >>> 3) {
|
|
208
|
+
case 1: {
|
|
209
|
+
if (tag !== 10) {
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
message.timestamp = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
case 2: {
|
|
216
|
+
if (tag !== 18) {
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
message.encounterId = reader.string();
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
case 3: {
|
|
223
|
+
if (tag !== 26) {
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
message.voyageId = reader.string();
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
case 4: {
|
|
230
|
+
if (tag !== 34) {
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
message.target = exports.Encounter_TargetRef.decode(reader, reader.uint32());
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
case 5: {
|
|
237
|
+
if (tag !== 42) {
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
message.targetName = reader.string();
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
case 10: {
|
|
244
|
+
if (tag !== 85) {
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
message.rangeM = reader.float();
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
case 11: {
|
|
251
|
+
if (tag !== 93) {
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
message.bearingTrueDeg = reader.float();
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
case 12: {
|
|
258
|
+
if (tag !== 101) {
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
message.bearingRelativeDeg = reader.float();
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
case 13: {
|
|
265
|
+
if (tag !== 109) {
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
message.cpaM = reader.float();
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
case 14: {
|
|
272
|
+
if (tag !== 117) {
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
message.tcpaS = reader.float();
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
case 20: {
|
|
279
|
+
if (tag !== 160) {
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
message.situation = reader.int32();
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
case 21: {
|
|
286
|
+
if (tag !== 168) {
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
message.ownRole = reader.int32();
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
case 22: {
|
|
293
|
+
if (tag !== 178) {
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
message.rules.push(reader.string());
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
case 23: {
|
|
300
|
+
if (tag !== 186) {
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
message.reasoning = reader.string();
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
case 30: {
|
|
307
|
+
if (tag !== 240) {
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
message.risk = reader.int32();
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
case 31: {
|
|
314
|
+
if (tag !== 248) {
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
message.peakRisk = reader.int32();
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
case 40: {
|
|
321
|
+
if (tag !== 322) {
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
message.openedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
case 41: {
|
|
328
|
+
if (tag !== 330) {
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
message.closedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
case 50: {
|
|
335
|
+
if (tag !== 400) {
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
message.thresholdContext = reader.int32();
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
reader.skip(tag & 7);
|
|
346
|
+
}
|
|
347
|
+
return message;
|
|
348
|
+
},
|
|
349
|
+
fromJSON(object) {
|
|
350
|
+
return {
|
|
351
|
+
$type: exports.Encounter.$type,
|
|
352
|
+
timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
|
|
353
|
+
encounterId: isSet(object.encounterId) ? globalThis.String(object.encounterId) : "",
|
|
354
|
+
voyageId: isSet(object.voyageId) ? globalThis.String(object.voyageId) : undefined,
|
|
355
|
+
target: isSet(object.target) ? exports.Encounter_TargetRef.fromJSON(object.target) : undefined,
|
|
356
|
+
targetName: isSet(object.targetName) ? globalThis.String(object.targetName) : "",
|
|
357
|
+
rangeM: isSet(object.rangeM) ? globalThis.Number(object.rangeM) : 0,
|
|
358
|
+
bearingTrueDeg: isSet(object.bearingTrueDeg) ? globalThis.Number(object.bearingTrueDeg) : 0,
|
|
359
|
+
bearingRelativeDeg: isSet(object.bearingRelativeDeg) ? globalThis.Number(object.bearingRelativeDeg) : 0,
|
|
360
|
+
cpaM: isSet(object.cpaM) ? globalThis.Number(object.cpaM) : undefined,
|
|
361
|
+
tcpaS: isSet(object.tcpaS) ? globalThis.Number(object.tcpaS) : undefined,
|
|
362
|
+
situation: isSet(object.situation) ? (0, Route_1.colregSituationFromJSON)(object.situation) : 0,
|
|
363
|
+
ownRole: isSet(object.ownRole) ? encounter_RoleFromJSON(object.ownRole) : 0,
|
|
364
|
+
rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e) => globalThis.String(e)) : [],
|
|
365
|
+
reasoning: isSet(object.reasoning) ? globalThis.String(object.reasoning) : "",
|
|
366
|
+
risk: isSet(object.risk) ? encounter_RiskFromJSON(object.risk) : 0,
|
|
367
|
+
peakRisk: isSet(object.peakRisk) ? encounter_RiskFromJSON(object.peakRisk) : 0,
|
|
368
|
+
openedAt: isSet(object.openedAt) ? fromJsonTimestamp(object.openedAt) : undefined,
|
|
369
|
+
closedAt: isSet(object.closedAt) ? fromJsonTimestamp(object.closedAt) : undefined,
|
|
370
|
+
thresholdContext: isSet(object.thresholdContext) ? (0, Route_1.operationalContextFromJSON)(object.thresholdContext) : 0,
|
|
371
|
+
};
|
|
372
|
+
},
|
|
373
|
+
toJSON(message) {
|
|
374
|
+
const obj = {};
|
|
375
|
+
if (message.timestamp !== undefined) {
|
|
376
|
+
obj.timestamp = message.timestamp.toISOString();
|
|
377
|
+
}
|
|
378
|
+
if (message.encounterId !== "") {
|
|
379
|
+
obj.encounterId = message.encounterId;
|
|
380
|
+
}
|
|
381
|
+
if (message.voyageId !== undefined) {
|
|
382
|
+
obj.voyageId = message.voyageId;
|
|
383
|
+
}
|
|
384
|
+
if (message.target !== undefined) {
|
|
385
|
+
obj.target = exports.Encounter_TargetRef.toJSON(message.target);
|
|
386
|
+
}
|
|
387
|
+
if (message.targetName !== "") {
|
|
388
|
+
obj.targetName = message.targetName;
|
|
389
|
+
}
|
|
390
|
+
if (message.rangeM !== 0) {
|
|
391
|
+
obj.rangeM = message.rangeM;
|
|
392
|
+
}
|
|
393
|
+
if (message.bearingTrueDeg !== 0) {
|
|
394
|
+
obj.bearingTrueDeg = message.bearingTrueDeg;
|
|
395
|
+
}
|
|
396
|
+
if (message.bearingRelativeDeg !== 0) {
|
|
397
|
+
obj.bearingRelativeDeg = message.bearingRelativeDeg;
|
|
398
|
+
}
|
|
399
|
+
if (message.cpaM !== undefined) {
|
|
400
|
+
obj.cpaM = message.cpaM;
|
|
401
|
+
}
|
|
402
|
+
if (message.tcpaS !== undefined) {
|
|
403
|
+
obj.tcpaS = message.tcpaS;
|
|
404
|
+
}
|
|
405
|
+
if (message.situation !== 0) {
|
|
406
|
+
obj.situation = (0, Route_1.colregSituationToJSON)(message.situation);
|
|
407
|
+
}
|
|
408
|
+
if (message.ownRole !== 0) {
|
|
409
|
+
obj.ownRole = encounter_RoleToJSON(message.ownRole);
|
|
410
|
+
}
|
|
411
|
+
if (message.rules?.length) {
|
|
412
|
+
obj.rules = message.rules;
|
|
413
|
+
}
|
|
414
|
+
if (message.reasoning !== "") {
|
|
415
|
+
obj.reasoning = message.reasoning;
|
|
416
|
+
}
|
|
417
|
+
if (message.risk !== 0) {
|
|
418
|
+
obj.risk = encounter_RiskToJSON(message.risk);
|
|
419
|
+
}
|
|
420
|
+
if (message.peakRisk !== 0) {
|
|
421
|
+
obj.peakRisk = encounter_RiskToJSON(message.peakRisk);
|
|
422
|
+
}
|
|
423
|
+
if (message.openedAt !== undefined) {
|
|
424
|
+
obj.openedAt = message.openedAt.toISOString();
|
|
425
|
+
}
|
|
426
|
+
if (message.closedAt !== undefined) {
|
|
427
|
+
obj.closedAt = message.closedAt.toISOString();
|
|
428
|
+
}
|
|
429
|
+
if (message.thresholdContext !== 0) {
|
|
430
|
+
obj.thresholdContext = (0, Route_1.operationalContextToJSON)(message.thresholdContext);
|
|
431
|
+
}
|
|
432
|
+
return obj;
|
|
433
|
+
},
|
|
434
|
+
create(base) {
|
|
435
|
+
return exports.Encounter.fromPartial(base ?? {});
|
|
436
|
+
},
|
|
437
|
+
fromPartial(object) {
|
|
438
|
+
const message = createBaseEncounter();
|
|
439
|
+
message.timestamp = object.timestamp ?? undefined;
|
|
440
|
+
message.encounterId = object.encounterId ?? "";
|
|
441
|
+
message.voyageId = object.voyageId ?? undefined;
|
|
442
|
+
message.target = (object.target !== undefined && object.target !== null)
|
|
443
|
+
? exports.Encounter_TargetRef.fromPartial(object.target)
|
|
444
|
+
: undefined;
|
|
445
|
+
message.targetName = object.targetName ?? "";
|
|
446
|
+
message.rangeM = object.rangeM ?? 0;
|
|
447
|
+
message.bearingTrueDeg = object.bearingTrueDeg ?? 0;
|
|
448
|
+
message.bearingRelativeDeg = object.bearingRelativeDeg ?? 0;
|
|
449
|
+
message.cpaM = object.cpaM ?? undefined;
|
|
450
|
+
message.tcpaS = object.tcpaS ?? undefined;
|
|
451
|
+
message.situation = object.situation ?? 0;
|
|
452
|
+
message.ownRole = object.ownRole ?? 0;
|
|
453
|
+
message.rules = object.rules?.map((e) => e) || [];
|
|
454
|
+
message.reasoning = object.reasoning ?? "";
|
|
455
|
+
message.risk = object.risk ?? 0;
|
|
456
|
+
message.peakRisk = object.peakRisk ?? 0;
|
|
457
|
+
message.openedAt = object.openedAt ?? undefined;
|
|
458
|
+
message.closedAt = object.closedAt ?? undefined;
|
|
459
|
+
message.thresholdContext = object.thresholdContext ?? 0;
|
|
460
|
+
return message;
|
|
461
|
+
},
|
|
462
|
+
};
|
|
463
|
+
typeRegistry_1.messageTypeRegistry.set(exports.Encounter.$type, exports.Encounter);
|
|
464
|
+
function createBaseEncounter_TargetRef() {
|
|
465
|
+
return { $type: "keelson.Encounter.TargetRef", entityId: "", sourceId: "", targetId: "" };
|
|
466
|
+
}
|
|
467
|
+
exports.Encounter_TargetRef = {
|
|
468
|
+
$type: "keelson.Encounter.TargetRef",
|
|
469
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
470
|
+
if (message.entityId !== "") {
|
|
471
|
+
writer.uint32(10).string(message.entityId);
|
|
472
|
+
}
|
|
473
|
+
if (message.sourceId !== "") {
|
|
474
|
+
writer.uint32(18).string(message.sourceId);
|
|
475
|
+
}
|
|
476
|
+
if (message.targetId !== "") {
|
|
477
|
+
writer.uint32(26).string(message.targetId);
|
|
478
|
+
}
|
|
479
|
+
return writer;
|
|
480
|
+
},
|
|
481
|
+
decode(input, length) {
|
|
482
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
483
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
484
|
+
const message = createBaseEncounter_TargetRef();
|
|
485
|
+
while (reader.pos < end) {
|
|
486
|
+
const tag = reader.uint32();
|
|
487
|
+
switch (tag >>> 3) {
|
|
488
|
+
case 1: {
|
|
489
|
+
if (tag !== 10) {
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
message.entityId = reader.string();
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
case 2: {
|
|
496
|
+
if (tag !== 18) {
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
499
|
+
message.sourceId = reader.string();
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
case 3: {
|
|
503
|
+
if (tag !== 26) {
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
message.targetId = reader.string();
|
|
507
|
+
continue;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
reader.skip(tag & 7);
|
|
514
|
+
}
|
|
515
|
+
return message;
|
|
516
|
+
},
|
|
517
|
+
fromJSON(object) {
|
|
518
|
+
return {
|
|
519
|
+
$type: exports.Encounter_TargetRef.$type,
|
|
520
|
+
entityId: isSet(object.entityId) ? globalThis.String(object.entityId) : "",
|
|
521
|
+
sourceId: isSet(object.sourceId) ? globalThis.String(object.sourceId) : "",
|
|
522
|
+
targetId: isSet(object.targetId) ? globalThis.String(object.targetId) : "",
|
|
523
|
+
};
|
|
524
|
+
},
|
|
525
|
+
toJSON(message) {
|
|
526
|
+
const obj = {};
|
|
527
|
+
if (message.entityId !== "") {
|
|
528
|
+
obj.entityId = message.entityId;
|
|
529
|
+
}
|
|
530
|
+
if (message.sourceId !== "") {
|
|
531
|
+
obj.sourceId = message.sourceId;
|
|
532
|
+
}
|
|
533
|
+
if (message.targetId !== "") {
|
|
534
|
+
obj.targetId = message.targetId;
|
|
535
|
+
}
|
|
536
|
+
return obj;
|
|
537
|
+
},
|
|
538
|
+
create(base) {
|
|
539
|
+
return exports.Encounter_TargetRef.fromPartial(base ?? {});
|
|
540
|
+
},
|
|
541
|
+
fromPartial(object) {
|
|
542
|
+
const message = createBaseEncounter_TargetRef();
|
|
543
|
+
message.entityId = object.entityId ?? "";
|
|
544
|
+
message.sourceId = object.sourceId ?? "";
|
|
545
|
+
message.targetId = object.targetId ?? "";
|
|
546
|
+
return message;
|
|
547
|
+
},
|
|
548
|
+
};
|
|
549
|
+
typeRegistry_1.messageTypeRegistry.set(exports.Encounter_TargetRef.$type, exports.Encounter_TargetRef);
|
|
550
|
+
function toTimestamp(date) {
|
|
551
|
+
const seconds = Math.trunc(date.getTime() / 1000);
|
|
552
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
553
|
+
return { $type: "google.protobuf.Timestamp", seconds, nanos };
|
|
554
|
+
}
|
|
555
|
+
function fromTimestamp(t) {
|
|
556
|
+
let millis = (t.seconds || 0) * 1000;
|
|
557
|
+
millis += (t.nanos || 0) / 1000000;
|
|
558
|
+
return new globalThis.Date(millis);
|
|
559
|
+
}
|
|
560
|
+
function fromJsonTimestamp(o) {
|
|
561
|
+
if (o instanceof globalThis.Date) {
|
|
562
|
+
return o;
|
|
563
|
+
}
|
|
564
|
+
else if (typeof o === "string") {
|
|
565
|
+
return new globalThis.Date(o);
|
|
566
|
+
}
|
|
567
|
+
else {
|
|
568
|
+
return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
function isSet(value) {
|
|
572
|
+
return value !== null && value !== undefined;
|
|
573
|
+
}
|