@rise-maritime/keelson-js 0.6.0-alpha.281.dev.1 → 0.6.0-alpha.282.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.
@@ -0,0 +1,855 @@
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: Voyage.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Voyage = exports.DynamicReroutingPolicy = exports.VoyageAuditEntry = exports.voyageAuditActionToJSON = exports.voyageAuditActionFromJSON = exports.VoyageAuditAction = exports.voyageStatusToJSON = exports.voyageStatusFromJSON = exports.VoyageStatus = exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ const wire_1 = require("@bufbuild/protobuf/wire");
11
+ const Route_1 = require("./Route");
12
+ const VesselType_1 = require("./VesselType");
13
+ const duration_1 = require("./google/protobuf/duration");
14
+ const timestamp_1 = require("./google/protobuf/timestamp");
15
+ exports.protobufPackage = "keelson";
16
+ /**
17
+ * Voyage lifecycle status. Prefixed to avoid collision with RouteStatus
18
+ * values that share the keelson package.
19
+ */
20
+ var VoyageStatus;
21
+ (function (VoyageStatus) {
22
+ VoyageStatus[VoyageStatus["VOYAGE_STATUS_UNSPECIFIED"] = 0] = "VOYAGE_STATUS_UNSPECIFIED";
23
+ VoyageStatus[VoyageStatus["VOYAGE_STATUS_PLANNED"] = 1] = "VOYAGE_STATUS_PLANNED";
24
+ VoyageStatus[VoyageStatus["VOYAGE_STATUS_ACTIVE"] = 2] = "VOYAGE_STATUS_ACTIVE";
25
+ VoyageStatus[VoyageStatus["VOYAGE_STATUS_PAUSED"] = 3] = "VOYAGE_STATUS_PAUSED";
26
+ VoyageStatus[VoyageStatus["VOYAGE_STATUS_COMPLETED"] = 4] = "VOYAGE_STATUS_COMPLETED";
27
+ VoyageStatus[VoyageStatus["VOYAGE_STATUS_ABORTED"] = 5] = "VOYAGE_STATUS_ABORTED";
28
+ VoyageStatus[VoyageStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
29
+ })(VoyageStatus || (exports.VoyageStatus = VoyageStatus = {}));
30
+ function voyageStatusFromJSON(object) {
31
+ switch (object) {
32
+ case 0:
33
+ case "VOYAGE_STATUS_UNSPECIFIED":
34
+ return VoyageStatus.VOYAGE_STATUS_UNSPECIFIED;
35
+ case 1:
36
+ case "VOYAGE_STATUS_PLANNED":
37
+ return VoyageStatus.VOYAGE_STATUS_PLANNED;
38
+ case 2:
39
+ case "VOYAGE_STATUS_ACTIVE":
40
+ return VoyageStatus.VOYAGE_STATUS_ACTIVE;
41
+ case 3:
42
+ case "VOYAGE_STATUS_PAUSED":
43
+ return VoyageStatus.VOYAGE_STATUS_PAUSED;
44
+ case 4:
45
+ case "VOYAGE_STATUS_COMPLETED":
46
+ return VoyageStatus.VOYAGE_STATUS_COMPLETED;
47
+ case 5:
48
+ case "VOYAGE_STATUS_ABORTED":
49
+ return VoyageStatus.VOYAGE_STATUS_ABORTED;
50
+ case -1:
51
+ case "UNRECOGNIZED":
52
+ default:
53
+ return VoyageStatus.UNRECOGNIZED;
54
+ }
55
+ }
56
+ exports.voyageStatusFromJSON = voyageStatusFromJSON;
57
+ function voyageStatusToJSON(object) {
58
+ switch (object) {
59
+ case VoyageStatus.VOYAGE_STATUS_UNSPECIFIED:
60
+ return "VOYAGE_STATUS_UNSPECIFIED";
61
+ case VoyageStatus.VOYAGE_STATUS_PLANNED:
62
+ return "VOYAGE_STATUS_PLANNED";
63
+ case VoyageStatus.VOYAGE_STATUS_ACTIVE:
64
+ return "VOYAGE_STATUS_ACTIVE";
65
+ case VoyageStatus.VOYAGE_STATUS_PAUSED:
66
+ return "VOYAGE_STATUS_PAUSED";
67
+ case VoyageStatus.VOYAGE_STATUS_COMPLETED:
68
+ return "VOYAGE_STATUS_COMPLETED";
69
+ case VoyageStatus.VOYAGE_STATUS_ABORTED:
70
+ return "VOYAGE_STATUS_ABORTED";
71
+ case VoyageStatus.UNRECOGNIZED:
72
+ default:
73
+ return "UNRECOGNIZED";
74
+ }
75
+ }
76
+ exports.voyageStatusToJSON = voyageStatusToJSON;
77
+ /**
78
+ * Defined voyage audit actions. VOYAGE_AUDIT_ACTION_OTHER is the escape hatch
79
+ * when a publisher needs an action that isn't yet covered by this enum; the
80
+ * free-text `detail` field carries the specifics in that case.
81
+ */
82
+ var VoyageAuditAction;
83
+ (function (VoyageAuditAction) {
84
+ VoyageAuditAction[VoyageAuditAction["VOYAGE_AUDIT_ACTION_UNSPECIFIED"] = 0] = "VOYAGE_AUDIT_ACTION_UNSPECIFIED";
85
+ VoyageAuditAction[VoyageAuditAction["VOYAGE_AUDIT_ACTION_ACTIVATED"] = 1] = "VOYAGE_AUDIT_ACTION_ACTIVATED";
86
+ VoyageAuditAction[VoyageAuditAction["VOYAGE_AUDIT_ACTION_PAUSED"] = 2] = "VOYAGE_AUDIT_ACTION_PAUSED";
87
+ VoyageAuditAction[VoyageAuditAction["VOYAGE_AUDIT_ACTION_RESUMED"] = 3] = "VOYAGE_AUDIT_ACTION_RESUMED";
88
+ VoyageAuditAction[VoyageAuditAction["VOYAGE_AUDIT_ACTION_EDITION_BUMP"] = 4] = "VOYAGE_AUDIT_ACTION_EDITION_BUMP";
89
+ VoyageAuditAction[VoyageAuditAction["VOYAGE_AUDIT_ACTION_DEVIATION"] = 5] = "VOYAGE_AUDIT_ACTION_DEVIATION";
90
+ VoyageAuditAction[VoyageAuditAction["VOYAGE_AUDIT_ACTION_REROUTE_ACCEPTED"] = 6] = "VOYAGE_AUDIT_ACTION_REROUTE_ACCEPTED";
91
+ VoyageAuditAction[VoyageAuditAction["VOYAGE_AUDIT_ACTION_COMPLETED"] = 7] = "VOYAGE_AUDIT_ACTION_COMPLETED";
92
+ VoyageAuditAction[VoyageAuditAction["VOYAGE_AUDIT_ACTION_ABORTED"] = 8] = "VOYAGE_AUDIT_ACTION_ABORTED";
93
+ VoyageAuditAction[VoyageAuditAction["VOYAGE_AUDIT_ACTION_OTHER"] = 99] = "VOYAGE_AUDIT_ACTION_OTHER";
94
+ VoyageAuditAction[VoyageAuditAction["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
95
+ })(VoyageAuditAction || (exports.VoyageAuditAction = VoyageAuditAction = {}));
96
+ function voyageAuditActionFromJSON(object) {
97
+ switch (object) {
98
+ case 0:
99
+ case "VOYAGE_AUDIT_ACTION_UNSPECIFIED":
100
+ return VoyageAuditAction.VOYAGE_AUDIT_ACTION_UNSPECIFIED;
101
+ case 1:
102
+ case "VOYAGE_AUDIT_ACTION_ACTIVATED":
103
+ return VoyageAuditAction.VOYAGE_AUDIT_ACTION_ACTIVATED;
104
+ case 2:
105
+ case "VOYAGE_AUDIT_ACTION_PAUSED":
106
+ return VoyageAuditAction.VOYAGE_AUDIT_ACTION_PAUSED;
107
+ case 3:
108
+ case "VOYAGE_AUDIT_ACTION_RESUMED":
109
+ return VoyageAuditAction.VOYAGE_AUDIT_ACTION_RESUMED;
110
+ case 4:
111
+ case "VOYAGE_AUDIT_ACTION_EDITION_BUMP":
112
+ return VoyageAuditAction.VOYAGE_AUDIT_ACTION_EDITION_BUMP;
113
+ case 5:
114
+ case "VOYAGE_AUDIT_ACTION_DEVIATION":
115
+ return VoyageAuditAction.VOYAGE_AUDIT_ACTION_DEVIATION;
116
+ case 6:
117
+ case "VOYAGE_AUDIT_ACTION_REROUTE_ACCEPTED":
118
+ return VoyageAuditAction.VOYAGE_AUDIT_ACTION_REROUTE_ACCEPTED;
119
+ case 7:
120
+ case "VOYAGE_AUDIT_ACTION_COMPLETED":
121
+ return VoyageAuditAction.VOYAGE_AUDIT_ACTION_COMPLETED;
122
+ case 8:
123
+ case "VOYAGE_AUDIT_ACTION_ABORTED":
124
+ return VoyageAuditAction.VOYAGE_AUDIT_ACTION_ABORTED;
125
+ case 99:
126
+ case "VOYAGE_AUDIT_ACTION_OTHER":
127
+ return VoyageAuditAction.VOYAGE_AUDIT_ACTION_OTHER;
128
+ case -1:
129
+ case "UNRECOGNIZED":
130
+ default:
131
+ return VoyageAuditAction.UNRECOGNIZED;
132
+ }
133
+ }
134
+ exports.voyageAuditActionFromJSON = voyageAuditActionFromJSON;
135
+ function voyageAuditActionToJSON(object) {
136
+ switch (object) {
137
+ case VoyageAuditAction.VOYAGE_AUDIT_ACTION_UNSPECIFIED:
138
+ return "VOYAGE_AUDIT_ACTION_UNSPECIFIED";
139
+ case VoyageAuditAction.VOYAGE_AUDIT_ACTION_ACTIVATED:
140
+ return "VOYAGE_AUDIT_ACTION_ACTIVATED";
141
+ case VoyageAuditAction.VOYAGE_AUDIT_ACTION_PAUSED:
142
+ return "VOYAGE_AUDIT_ACTION_PAUSED";
143
+ case VoyageAuditAction.VOYAGE_AUDIT_ACTION_RESUMED:
144
+ return "VOYAGE_AUDIT_ACTION_RESUMED";
145
+ case VoyageAuditAction.VOYAGE_AUDIT_ACTION_EDITION_BUMP:
146
+ return "VOYAGE_AUDIT_ACTION_EDITION_BUMP";
147
+ case VoyageAuditAction.VOYAGE_AUDIT_ACTION_DEVIATION:
148
+ return "VOYAGE_AUDIT_ACTION_DEVIATION";
149
+ case VoyageAuditAction.VOYAGE_AUDIT_ACTION_REROUTE_ACCEPTED:
150
+ return "VOYAGE_AUDIT_ACTION_REROUTE_ACCEPTED";
151
+ case VoyageAuditAction.VOYAGE_AUDIT_ACTION_COMPLETED:
152
+ return "VOYAGE_AUDIT_ACTION_COMPLETED";
153
+ case VoyageAuditAction.VOYAGE_AUDIT_ACTION_ABORTED:
154
+ return "VOYAGE_AUDIT_ACTION_ABORTED";
155
+ case VoyageAuditAction.VOYAGE_AUDIT_ACTION_OTHER:
156
+ return "VOYAGE_AUDIT_ACTION_OTHER";
157
+ case VoyageAuditAction.UNRECOGNIZED:
158
+ default:
159
+ return "UNRECOGNIZED";
160
+ }
161
+ }
162
+ exports.voyageAuditActionToJSON = voyageAuditActionToJSON;
163
+ function createBaseVoyageAuditEntry() {
164
+ return { at: undefined, actorId: "", actorSite: "", action: 0, detail: "" };
165
+ }
166
+ exports.VoyageAuditEntry = {
167
+ encode(message, writer = new wire_1.BinaryWriter()) {
168
+ if (message.at !== undefined) {
169
+ timestamp_1.Timestamp.encode(toTimestamp(message.at), writer.uint32(10).fork()).join();
170
+ }
171
+ if (message.actorId !== "") {
172
+ writer.uint32(18).string(message.actorId);
173
+ }
174
+ if (message.actorSite !== "") {
175
+ writer.uint32(26).string(message.actorSite);
176
+ }
177
+ if (message.action !== 0) {
178
+ writer.uint32(32).int32(message.action);
179
+ }
180
+ if (message.detail !== "") {
181
+ writer.uint32(42).string(message.detail);
182
+ }
183
+ return writer;
184
+ },
185
+ decode(input, length) {
186
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
187
+ let end = length === undefined ? reader.len : reader.pos + length;
188
+ const message = createBaseVoyageAuditEntry();
189
+ while (reader.pos < end) {
190
+ const tag = reader.uint32();
191
+ switch (tag >>> 3) {
192
+ case 1: {
193
+ if (tag !== 10) {
194
+ break;
195
+ }
196
+ message.at = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
197
+ continue;
198
+ }
199
+ case 2: {
200
+ if (tag !== 18) {
201
+ break;
202
+ }
203
+ message.actorId = reader.string();
204
+ continue;
205
+ }
206
+ case 3: {
207
+ if (tag !== 26) {
208
+ break;
209
+ }
210
+ message.actorSite = reader.string();
211
+ continue;
212
+ }
213
+ case 4: {
214
+ if (tag !== 32) {
215
+ break;
216
+ }
217
+ message.action = reader.int32();
218
+ continue;
219
+ }
220
+ case 5: {
221
+ if (tag !== 42) {
222
+ break;
223
+ }
224
+ message.detail = reader.string();
225
+ continue;
226
+ }
227
+ }
228
+ if ((tag & 7) === 4 || tag === 0) {
229
+ break;
230
+ }
231
+ reader.skip(tag & 7);
232
+ }
233
+ return message;
234
+ },
235
+ fromJSON(object) {
236
+ return {
237
+ at: isSet(object.at) ? fromJsonTimestamp(object.at) : undefined,
238
+ actorId: isSet(object.actorId) ? globalThis.String(object.actorId) : "",
239
+ actorSite: isSet(object.actorSite) ? globalThis.String(object.actorSite) : "",
240
+ action: isSet(object.action) ? voyageAuditActionFromJSON(object.action) : 0,
241
+ detail: isSet(object.detail) ? globalThis.String(object.detail) : "",
242
+ };
243
+ },
244
+ toJSON(message) {
245
+ const obj = {};
246
+ if (message.at !== undefined) {
247
+ obj.at = message.at.toISOString();
248
+ }
249
+ if (message.actorId !== "") {
250
+ obj.actorId = message.actorId;
251
+ }
252
+ if (message.actorSite !== "") {
253
+ obj.actorSite = message.actorSite;
254
+ }
255
+ if (message.action !== 0) {
256
+ obj.action = voyageAuditActionToJSON(message.action);
257
+ }
258
+ if (message.detail !== "") {
259
+ obj.detail = message.detail;
260
+ }
261
+ return obj;
262
+ },
263
+ create(base) {
264
+ return exports.VoyageAuditEntry.fromPartial(base ?? {});
265
+ },
266
+ fromPartial(object) {
267
+ const message = createBaseVoyageAuditEntry();
268
+ message.at = object.at ?? undefined;
269
+ message.actorId = object.actorId ?? "";
270
+ message.actorSite = object.actorSite ?? "";
271
+ message.action = object.action ?? 0;
272
+ message.detail = object.detail ?? "";
273
+ return message;
274
+ },
275
+ };
276
+ function createBaseDynamicReroutingPolicy() {
277
+ return {
278
+ autoRerouteAllowed: false,
279
+ maxCrossTrackDeviationM: undefined,
280
+ maxArrivalDelay: undefined,
281
+ speedProfileChangeAllowed: false,
282
+ maxSogDeviationKnots: undefined,
283
+ };
284
+ }
285
+ exports.DynamicReroutingPolicy = {
286
+ encode(message, writer = new wire_1.BinaryWriter()) {
287
+ if (message.autoRerouteAllowed !== false) {
288
+ writer.uint32(8).bool(message.autoRerouteAllowed);
289
+ }
290
+ if (message.maxCrossTrackDeviationM !== undefined) {
291
+ writer.uint32(21).float(message.maxCrossTrackDeviationM);
292
+ }
293
+ if (message.maxArrivalDelay !== undefined) {
294
+ duration_1.Duration.encode(message.maxArrivalDelay, writer.uint32(26).fork()).join();
295
+ }
296
+ if (message.speedProfileChangeAllowed !== false) {
297
+ writer.uint32(32).bool(message.speedProfileChangeAllowed);
298
+ }
299
+ if (message.maxSogDeviationKnots !== undefined) {
300
+ writer.uint32(45).float(message.maxSogDeviationKnots);
301
+ }
302
+ return writer;
303
+ },
304
+ decode(input, length) {
305
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
306
+ let end = length === undefined ? reader.len : reader.pos + length;
307
+ const message = createBaseDynamicReroutingPolicy();
308
+ while (reader.pos < end) {
309
+ const tag = reader.uint32();
310
+ switch (tag >>> 3) {
311
+ case 1: {
312
+ if (tag !== 8) {
313
+ break;
314
+ }
315
+ message.autoRerouteAllowed = reader.bool();
316
+ continue;
317
+ }
318
+ case 2: {
319
+ if (tag !== 21) {
320
+ break;
321
+ }
322
+ message.maxCrossTrackDeviationM = reader.float();
323
+ continue;
324
+ }
325
+ case 3: {
326
+ if (tag !== 26) {
327
+ break;
328
+ }
329
+ message.maxArrivalDelay = duration_1.Duration.decode(reader, reader.uint32());
330
+ continue;
331
+ }
332
+ case 4: {
333
+ if (tag !== 32) {
334
+ break;
335
+ }
336
+ message.speedProfileChangeAllowed = reader.bool();
337
+ continue;
338
+ }
339
+ case 5: {
340
+ if (tag !== 45) {
341
+ break;
342
+ }
343
+ message.maxSogDeviationKnots = reader.float();
344
+ continue;
345
+ }
346
+ }
347
+ if ((tag & 7) === 4 || tag === 0) {
348
+ break;
349
+ }
350
+ reader.skip(tag & 7);
351
+ }
352
+ return message;
353
+ },
354
+ fromJSON(object) {
355
+ return {
356
+ autoRerouteAllowed: isSet(object.autoRerouteAllowed) ? globalThis.Boolean(object.autoRerouteAllowed) : false,
357
+ maxCrossTrackDeviationM: isSet(object.maxCrossTrackDeviationM)
358
+ ? globalThis.Number(object.maxCrossTrackDeviationM)
359
+ : undefined,
360
+ maxArrivalDelay: isSet(object.maxArrivalDelay) ? duration_1.Duration.fromJSON(object.maxArrivalDelay) : undefined,
361
+ speedProfileChangeAllowed: isSet(object.speedProfileChangeAllowed)
362
+ ? globalThis.Boolean(object.speedProfileChangeAllowed)
363
+ : false,
364
+ maxSogDeviationKnots: isSet(object.maxSogDeviationKnots)
365
+ ? globalThis.Number(object.maxSogDeviationKnots)
366
+ : undefined,
367
+ };
368
+ },
369
+ toJSON(message) {
370
+ const obj = {};
371
+ if (message.autoRerouteAllowed !== false) {
372
+ obj.autoRerouteAllowed = message.autoRerouteAllowed;
373
+ }
374
+ if (message.maxCrossTrackDeviationM !== undefined) {
375
+ obj.maxCrossTrackDeviationM = message.maxCrossTrackDeviationM;
376
+ }
377
+ if (message.maxArrivalDelay !== undefined) {
378
+ obj.maxArrivalDelay = duration_1.Duration.toJSON(message.maxArrivalDelay);
379
+ }
380
+ if (message.speedProfileChangeAllowed !== false) {
381
+ obj.speedProfileChangeAllowed = message.speedProfileChangeAllowed;
382
+ }
383
+ if (message.maxSogDeviationKnots !== undefined) {
384
+ obj.maxSogDeviationKnots = message.maxSogDeviationKnots;
385
+ }
386
+ return obj;
387
+ },
388
+ create(base) {
389
+ return exports.DynamicReroutingPolicy.fromPartial(base ?? {});
390
+ },
391
+ fromPartial(object) {
392
+ const message = createBaseDynamicReroutingPolicy();
393
+ message.autoRerouteAllowed = object.autoRerouteAllowed ?? false;
394
+ message.maxCrossTrackDeviationM = object.maxCrossTrackDeviationM ?? undefined;
395
+ message.maxArrivalDelay = (object.maxArrivalDelay !== undefined && object.maxArrivalDelay !== null)
396
+ ? duration_1.Duration.fromPartial(object.maxArrivalDelay)
397
+ : undefined;
398
+ message.speedProfileChangeAllowed = object.speedProfileChangeAllowed ?? false;
399
+ message.maxSogDeviationKnots = object.maxSogDeviationKnots ?? undefined;
400
+ return message;
401
+ },
402
+ };
403
+ function createBaseVoyage() {
404
+ return {
405
+ version: "",
406
+ voyageId: "",
407
+ routeRef: undefined,
408
+ vesselMmsi: 0,
409
+ vesselName: "",
410
+ vesselCallSign: "",
411
+ vesselImo: 0,
412
+ vesselType: undefined,
413
+ status: 0,
414
+ plannedDeparture: undefined,
415
+ plannedArrival: undefined,
416
+ startedAt: undefined,
417
+ completedAt: undefined,
418
+ departurePortLocode: "",
419
+ arrivalPortLocode: "",
420
+ departurePortName: "",
421
+ arrivalPortName: "",
422
+ actualTrackKeyExpr: "",
423
+ deviationCount: 0,
424
+ maxXtdObservedM: 0,
425
+ linkedProcedureIds: [],
426
+ auditTrail: [],
427
+ reroutingPolicy: undefined,
428
+ };
429
+ }
430
+ exports.Voyage = {
431
+ encode(message, writer = new wire_1.BinaryWriter()) {
432
+ if (message.version !== "") {
433
+ writer.uint32(10).string(message.version);
434
+ }
435
+ if (message.voyageId !== "") {
436
+ writer.uint32(18).string(message.voyageId);
437
+ }
438
+ if (message.routeRef !== undefined) {
439
+ Route_1.RouteRef.encode(message.routeRef, writer.uint32(42).fork()).join();
440
+ }
441
+ if (message.vesselMmsi !== 0) {
442
+ writer.uint32(80).uint64(message.vesselMmsi);
443
+ }
444
+ if (message.vesselName !== "") {
445
+ writer.uint32(90).string(message.vesselName);
446
+ }
447
+ if (message.vesselCallSign !== "") {
448
+ writer.uint32(98).string(message.vesselCallSign);
449
+ }
450
+ if (message.vesselImo !== 0) {
451
+ writer.uint32(104).uint64(message.vesselImo);
452
+ }
453
+ if (message.vesselType !== undefined) {
454
+ VesselType_1.VesselType.encode(message.vesselType, writer.uint32(114).fork()).join();
455
+ }
456
+ if (message.status !== 0) {
457
+ writer.uint32(160).int32(message.status);
458
+ }
459
+ if (message.plannedDeparture !== undefined) {
460
+ timestamp_1.Timestamp.encode(toTimestamp(message.plannedDeparture), writer.uint32(170).fork()).join();
461
+ }
462
+ if (message.plannedArrival !== undefined) {
463
+ timestamp_1.Timestamp.encode(toTimestamp(message.plannedArrival), writer.uint32(178).fork()).join();
464
+ }
465
+ if (message.startedAt !== undefined) {
466
+ timestamp_1.Timestamp.encode(toTimestamp(message.startedAt), writer.uint32(186).fork()).join();
467
+ }
468
+ if (message.completedAt !== undefined) {
469
+ timestamp_1.Timestamp.encode(toTimestamp(message.completedAt), writer.uint32(194).fork()).join();
470
+ }
471
+ if (message.departurePortLocode !== "") {
472
+ writer.uint32(322).string(message.departurePortLocode);
473
+ }
474
+ if (message.arrivalPortLocode !== "") {
475
+ writer.uint32(330).string(message.arrivalPortLocode);
476
+ }
477
+ if (message.departurePortName !== "") {
478
+ writer.uint32(338).string(message.departurePortName);
479
+ }
480
+ if (message.arrivalPortName !== "") {
481
+ writer.uint32(346).string(message.arrivalPortName);
482
+ }
483
+ if (message.actualTrackKeyExpr !== "") {
484
+ writer.uint32(402).string(message.actualTrackKeyExpr);
485
+ }
486
+ if (message.deviationCount !== 0) {
487
+ writer.uint32(480).uint32(message.deviationCount);
488
+ }
489
+ if (message.maxXtdObservedM !== 0) {
490
+ writer.uint32(489).double(message.maxXtdObservedM);
491
+ }
492
+ for (const v of message.linkedProcedureIds) {
493
+ writer.uint32(562).string(v);
494
+ }
495
+ for (const v of message.auditTrail) {
496
+ exports.VoyageAuditEntry.encode(v, writer.uint32(642).fork()).join();
497
+ }
498
+ if (message.reroutingPolicy !== undefined) {
499
+ exports.DynamicReroutingPolicy.encode(message.reroutingPolicy, writer.uint32(722).fork()).join();
500
+ }
501
+ return writer;
502
+ },
503
+ decode(input, length) {
504
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
505
+ let end = length === undefined ? reader.len : reader.pos + length;
506
+ const message = createBaseVoyage();
507
+ while (reader.pos < end) {
508
+ const tag = reader.uint32();
509
+ switch (tag >>> 3) {
510
+ case 1: {
511
+ if (tag !== 10) {
512
+ break;
513
+ }
514
+ message.version = reader.string();
515
+ continue;
516
+ }
517
+ case 2: {
518
+ if (tag !== 18) {
519
+ break;
520
+ }
521
+ message.voyageId = reader.string();
522
+ continue;
523
+ }
524
+ case 5: {
525
+ if (tag !== 42) {
526
+ break;
527
+ }
528
+ message.routeRef = Route_1.RouteRef.decode(reader, reader.uint32());
529
+ continue;
530
+ }
531
+ case 10: {
532
+ if (tag !== 80) {
533
+ break;
534
+ }
535
+ message.vesselMmsi = longToNumber(reader.uint64());
536
+ continue;
537
+ }
538
+ case 11: {
539
+ if (tag !== 90) {
540
+ break;
541
+ }
542
+ message.vesselName = reader.string();
543
+ continue;
544
+ }
545
+ case 12: {
546
+ if (tag !== 98) {
547
+ break;
548
+ }
549
+ message.vesselCallSign = reader.string();
550
+ continue;
551
+ }
552
+ case 13: {
553
+ if (tag !== 104) {
554
+ break;
555
+ }
556
+ message.vesselImo = longToNumber(reader.uint64());
557
+ continue;
558
+ }
559
+ case 14: {
560
+ if (tag !== 114) {
561
+ break;
562
+ }
563
+ message.vesselType = VesselType_1.VesselType.decode(reader, reader.uint32());
564
+ continue;
565
+ }
566
+ case 20: {
567
+ if (tag !== 160) {
568
+ break;
569
+ }
570
+ message.status = reader.int32();
571
+ continue;
572
+ }
573
+ case 21: {
574
+ if (tag !== 170) {
575
+ break;
576
+ }
577
+ message.plannedDeparture = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
578
+ continue;
579
+ }
580
+ case 22: {
581
+ if (tag !== 178) {
582
+ break;
583
+ }
584
+ message.plannedArrival = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
585
+ continue;
586
+ }
587
+ case 23: {
588
+ if (tag !== 186) {
589
+ break;
590
+ }
591
+ message.startedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
592
+ continue;
593
+ }
594
+ case 24: {
595
+ if (tag !== 194) {
596
+ break;
597
+ }
598
+ message.completedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
599
+ continue;
600
+ }
601
+ case 40: {
602
+ if (tag !== 322) {
603
+ break;
604
+ }
605
+ message.departurePortLocode = reader.string();
606
+ continue;
607
+ }
608
+ case 41: {
609
+ if (tag !== 330) {
610
+ break;
611
+ }
612
+ message.arrivalPortLocode = reader.string();
613
+ continue;
614
+ }
615
+ case 42: {
616
+ if (tag !== 338) {
617
+ break;
618
+ }
619
+ message.departurePortName = reader.string();
620
+ continue;
621
+ }
622
+ case 43: {
623
+ if (tag !== 346) {
624
+ break;
625
+ }
626
+ message.arrivalPortName = reader.string();
627
+ continue;
628
+ }
629
+ case 50: {
630
+ if (tag !== 402) {
631
+ break;
632
+ }
633
+ message.actualTrackKeyExpr = reader.string();
634
+ continue;
635
+ }
636
+ case 60: {
637
+ if (tag !== 480) {
638
+ break;
639
+ }
640
+ message.deviationCount = reader.uint32();
641
+ continue;
642
+ }
643
+ case 61: {
644
+ if (tag !== 489) {
645
+ break;
646
+ }
647
+ message.maxXtdObservedM = reader.double();
648
+ continue;
649
+ }
650
+ case 70: {
651
+ if (tag !== 562) {
652
+ break;
653
+ }
654
+ message.linkedProcedureIds.push(reader.string());
655
+ continue;
656
+ }
657
+ case 80: {
658
+ if (tag !== 642) {
659
+ break;
660
+ }
661
+ message.auditTrail.push(exports.VoyageAuditEntry.decode(reader, reader.uint32()));
662
+ continue;
663
+ }
664
+ case 90: {
665
+ if (tag !== 722) {
666
+ break;
667
+ }
668
+ message.reroutingPolicy = exports.DynamicReroutingPolicy.decode(reader, reader.uint32());
669
+ continue;
670
+ }
671
+ }
672
+ if ((tag & 7) === 4 || tag === 0) {
673
+ break;
674
+ }
675
+ reader.skip(tag & 7);
676
+ }
677
+ return message;
678
+ },
679
+ fromJSON(object) {
680
+ return {
681
+ version: isSet(object.version) ? globalThis.String(object.version) : "",
682
+ voyageId: isSet(object.voyageId) ? globalThis.String(object.voyageId) : "",
683
+ routeRef: isSet(object.routeRef) ? Route_1.RouteRef.fromJSON(object.routeRef) : undefined,
684
+ vesselMmsi: isSet(object.vesselMmsi) ? globalThis.Number(object.vesselMmsi) : 0,
685
+ vesselName: isSet(object.vesselName) ? globalThis.String(object.vesselName) : "",
686
+ vesselCallSign: isSet(object.vesselCallSign) ? globalThis.String(object.vesselCallSign) : "",
687
+ vesselImo: isSet(object.vesselImo) ? globalThis.Number(object.vesselImo) : 0,
688
+ vesselType: isSet(object.vesselType) ? VesselType_1.VesselType.fromJSON(object.vesselType) : undefined,
689
+ status: isSet(object.status) ? voyageStatusFromJSON(object.status) : 0,
690
+ plannedDeparture: isSet(object.plannedDeparture) ? fromJsonTimestamp(object.plannedDeparture) : undefined,
691
+ plannedArrival: isSet(object.plannedArrival) ? fromJsonTimestamp(object.plannedArrival) : undefined,
692
+ startedAt: isSet(object.startedAt) ? fromJsonTimestamp(object.startedAt) : undefined,
693
+ completedAt: isSet(object.completedAt) ? fromJsonTimestamp(object.completedAt) : undefined,
694
+ departurePortLocode: isSet(object.departurePortLocode) ? globalThis.String(object.departurePortLocode) : "",
695
+ arrivalPortLocode: isSet(object.arrivalPortLocode) ? globalThis.String(object.arrivalPortLocode) : "",
696
+ departurePortName: isSet(object.departurePortName) ? globalThis.String(object.departurePortName) : "",
697
+ arrivalPortName: isSet(object.arrivalPortName) ? globalThis.String(object.arrivalPortName) : "",
698
+ actualTrackKeyExpr: isSet(object.actualTrackKeyExpr) ? globalThis.String(object.actualTrackKeyExpr) : "",
699
+ deviationCount: isSet(object.deviationCount) ? globalThis.Number(object.deviationCount) : 0,
700
+ maxXtdObservedM: isSet(object.maxXtdObservedM) ? globalThis.Number(object.maxXtdObservedM) : 0,
701
+ linkedProcedureIds: globalThis.Array.isArray(object?.linkedProcedureIds)
702
+ ? object.linkedProcedureIds.map((e) => globalThis.String(e))
703
+ : [],
704
+ auditTrail: globalThis.Array.isArray(object?.auditTrail)
705
+ ? object.auditTrail.map((e) => exports.VoyageAuditEntry.fromJSON(e))
706
+ : [],
707
+ reroutingPolicy: isSet(object.reroutingPolicy)
708
+ ? exports.DynamicReroutingPolicy.fromJSON(object.reroutingPolicy)
709
+ : undefined,
710
+ };
711
+ },
712
+ toJSON(message) {
713
+ const obj = {};
714
+ if (message.version !== "") {
715
+ obj.version = message.version;
716
+ }
717
+ if (message.voyageId !== "") {
718
+ obj.voyageId = message.voyageId;
719
+ }
720
+ if (message.routeRef !== undefined) {
721
+ obj.routeRef = Route_1.RouteRef.toJSON(message.routeRef);
722
+ }
723
+ if (message.vesselMmsi !== 0) {
724
+ obj.vesselMmsi = Math.round(message.vesselMmsi);
725
+ }
726
+ if (message.vesselName !== "") {
727
+ obj.vesselName = message.vesselName;
728
+ }
729
+ if (message.vesselCallSign !== "") {
730
+ obj.vesselCallSign = message.vesselCallSign;
731
+ }
732
+ if (message.vesselImo !== 0) {
733
+ obj.vesselImo = Math.round(message.vesselImo);
734
+ }
735
+ if (message.vesselType !== undefined) {
736
+ obj.vesselType = VesselType_1.VesselType.toJSON(message.vesselType);
737
+ }
738
+ if (message.status !== 0) {
739
+ obj.status = voyageStatusToJSON(message.status);
740
+ }
741
+ if (message.plannedDeparture !== undefined) {
742
+ obj.plannedDeparture = message.plannedDeparture.toISOString();
743
+ }
744
+ if (message.plannedArrival !== undefined) {
745
+ obj.plannedArrival = message.plannedArrival.toISOString();
746
+ }
747
+ if (message.startedAt !== undefined) {
748
+ obj.startedAt = message.startedAt.toISOString();
749
+ }
750
+ if (message.completedAt !== undefined) {
751
+ obj.completedAt = message.completedAt.toISOString();
752
+ }
753
+ if (message.departurePortLocode !== "") {
754
+ obj.departurePortLocode = message.departurePortLocode;
755
+ }
756
+ if (message.arrivalPortLocode !== "") {
757
+ obj.arrivalPortLocode = message.arrivalPortLocode;
758
+ }
759
+ if (message.departurePortName !== "") {
760
+ obj.departurePortName = message.departurePortName;
761
+ }
762
+ if (message.arrivalPortName !== "") {
763
+ obj.arrivalPortName = message.arrivalPortName;
764
+ }
765
+ if (message.actualTrackKeyExpr !== "") {
766
+ obj.actualTrackKeyExpr = message.actualTrackKeyExpr;
767
+ }
768
+ if (message.deviationCount !== 0) {
769
+ obj.deviationCount = Math.round(message.deviationCount);
770
+ }
771
+ if (message.maxXtdObservedM !== 0) {
772
+ obj.maxXtdObservedM = message.maxXtdObservedM;
773
+ }
774
+ if (message.linkedProcedureIds?.length) {
775
+ obj.linkedProcedureIds = message.linkedProcedureIds;
776
+ }
777
+ if (message.auditTrail?.length) {
778
+ obj.auditTrail = message.auditTrail.map((e) => exports.VoyageAuditEntry.toJSON(e));
779
+ }
780
+ if (message.reroutingPolicy !== undefined) {
781
+ obj.reroutingPolicy = exports.DynamicReroutingPolicy.toJSON(message.reroutingPolicy);
782
+ }
783
+ return obj;
784
+ },
785
+ create(base) {
786
+ return exports.Voyage.fromPartial(base ?? {});
787
+ },
788
+ fromPartial(object) {
789
+ const message = createBaseVoyage();
790
+ message.version = object.version ?? "";
791
+ message.voyageId = object.voyageId ?? "";
792
+ message.routeRef = (object.routeRef !== undefined && object.routeRef !== null)
793
+ ? Route_1.RouteRef.fromPartial(object.routeRef)
794
+ : undefined;
795
+ message.vesselMmsi = object.vesselMmsi ?? 0;
796
+ message.vesselName = object.vesselName ?? "";
797
+ message.vesselCallSign = object.vesselCallSign ?? "";
798
+ message.vesselImo = object.vesselImo ?? 0;
799
+ message.vesselType = (object.vesselType !== undefined && object.vesselType !== null)
800
+ ? VesselType_1.VesselType.fromPartial(object.vesselType)
801
+ : undefined;
802
+ message.status = object.status ?? 0;
803
+ message.plannedDeparture = object.plannedDeparture ?? undefined;
804
+ message.plannedArrival = object.plannedArrival ?? undefined;
805
+ message.startedAt = object.startedAt ?? undefined;
806
+ message.completedAt = object.completedAt ?? undefined;
807
+ message.departurePortLocode = object.departurePortLocode ?? "";
808
+ message.arrivalPortLocode = object.arrivalPortLocode ?? "";
809
+ message.departurePortName = object.departurePortName ?? "";
810
+ message.arrivalPortName = object.arrivalPortName ?? "";
811
+ message.actualTrackKeyExpr = object.actualTrackKeyExpr ?? "";
812
+ message.deviationCount = object.deviationCount ?? 0;
813
+ message.maxXtdObservedM = object.maxXtdObservedM ?? 0;
814
+ message.linkedProcedureIds = object.linkedProcedureIds?.map((e) => e) || [];
815
+ message.auditTrail = object.auditTrail?.map((e) => exports.VoyageAuditEntry.fromPartial(e)) || [];
816
+ message.reroutingPolicy = (object.reroutingPolicy !== undefined && object.reroutingPolicy !== null)
817
+ ? exports.DynamicReroutingPolicy.fromPartial(object.reroutingPolicy)
818
+ : undefined;
819
+ return message;
820
+ },
821
+ };
822
+ function toTimestamp(date) {
823
+ const seconds = Math.trunc(date.getTime() / 1000);
824
+ const nanos = (date.getTime() % 1000) * 1000000;
825
+ return { seconds, nanos };
826
+ }
827
+ function fromTimestamp(t) {
828
+ let millis = (t.seconds || 0) * 1000;
829
+ millis += (t.nanos || 0) / 1000000;
830
+ return new globalThis.Date(millis);
831
+ }
832
+ function fromJsonTimestamp(o) {
833
+ if (o instanceof globalThis.Date) {
834
+ return o;
835
+ }
836
+ else if (typeof o === "string") {
837
+ return new globalThis.Date(o);
838
+ }
839
+ else {
840
+ return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
841
+ }
842
+ }
843
+ function longToNumber(int64) {
844
+ const num = globalThis.Number(int64.toString());
845
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
846
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
847
+ }
848
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
849
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
850
+ }
851
+ return num;
852
+ }
853
+ function isSet(value) {
854
+ return value !== null && value !== undefined;
855
+ }