@rise-maritime/keelson-js 0.5.2 → 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.
@@ -0,0 +1,906 @@
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: Weather.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.WeatherForecast_Step = exports.WeatherForecast = exports.WeatherAlert = exports.IceType = exports.PrecipitationType = exports.iceType_TypeToJSON = exports.iceType_TypeFromJSON = exports.IceType_Type = exports.precipitationType_TypeToJSON = exports.precipitationType_TypeFromJSON = exports.PrecipitationType_Type = void 0;
9
+ /* eslint-disable */
10
+ const wire_1 = require("@bufbuild/protobuf/wire");
11
+ const Severity_1 = require("./Severity");
12
+ const LocationFix_1 = require("./foxglove/LocationFix");
13
+ const timestamp_1 = require("./google/protobuf/timestamp");
14
+ const typeRegistry_1 = require("./typeRegistry");
15
+ var PrecipitationType_Type;
16
+ (function (PrecipitationType_Type) {
17
+ PrecipitationType_Type[PrecipitationType_Type["TYPE_UNSPECIFIED"] = 0] = "TYPE_UNSPECIFIED";
18
+ /** NONE - observed dry */
19
+ PrecipitationType_Type[PrecipitationType_Type["NONE"] = 1] = "NONE";
20
+ PrecipitationType_Type[PrecipitationType_Type["RAIN"] = 2] = "RAIN";
21
+ PrecipitationType_Type[PrecipitationType_Type["DRIZZLE"] = 3] = "DRIZZLE";
22
+ PrecipitationType_Type[PrecipitationType_Type["SNOW"] = 4] = "SNOW";
23
+ PrecipitationType_Type[PrecipitationType_Type["SLEET"] = 5] = "SLEET";
24
+ PrecipitationType_Type[PrecipitationType_Type["HAIL"] = 6] = "HAIL";
25
+ PrecipitationType_Type[PrecipitationType_Type["FREEZING_RAIN"] = 7] = "FREEZING_RAIN";
26
+ PrecipitationType_Type[PrecipitationType_Type["MIXED"] = 8] = "MIXED";
27
+ PrecipitationType_Type[PrecipitationType_Type["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
28
+ })(PrecipitationType_Type || (exports.PrecipitationType_Type = PrecipitationType_Type = {}));
29
+ function precipitationType_TypeFromJSON(object) {
30
+ switch (object) {
31
+ case 0:
32
+ case "TYPE_UNSPECIFIED":
33
+ return PrecipitationType_Type.TYPE_UNSPECIFIED;
34
+ case 1:
35
+ case "NONE":
36
+ return PrecipitationType_Type.NONE;
37
+ case 2:
38
+ case "RAIN":
39
+ return PrecipitationType_Type.RAIN;
40
+ case 3:
41
+ case "DRIZZLE":
42
+ return PrecipitationType_Type.DRIZZLE;
43
+ case 4:
44
+ case "SNOW":
45
+ return PrecipitationType_Type.SNOW;
46
+ case 5:
47
+ case "SLEET":
48
+ return PrecipitationType_Type.SLEET;
49
+ case 6:
50
+ case "HAIL":
51
+ return PrecipitationType_Type.HAIL;
52
+ case 7:
53
+ case "FREEZING_RAIN":
54
+ return PrecipitationType_Type.FREEZING_RAIN;
55
+ case 8:
56
+ case "MIXED":
57
+ return PrecipitationType_Type.MIXED;
58
+ case -1:
59
+ case "UNRECOGNIZED":
60
+ default:
61
+ return PrecipitationType_Type.UNRECOGNIZED;
62
+ }
63
+ }
64
+ exports.precipitationType_TypeFromJSON = precipitationType_TypeFromJSON;
65
+ function precipitationType_TypeToJSON(object) {
66
+ switch (object) {
67
+ case PrecipitationType_Type.TYPE_UNSPECIFIED:
68
+ return "TYPE_UNSPECIFIED";
69
+ case PrecipitationType_Type.NONE:
70
+ return "NONE";
71
+ case PrecipitationType_Type.RAIN:
72
+ return "RAIN";
73
+ case PrecipitationType_Type.DRIZZLE:
74
+ return "DRIZZLE";
75
+ case PrecipitationType_Type.SNOW:
76
+ return "SNOW";
77
+ case PrecipitationType_Type.SLEET:
78
+ return "SLEET";
79
+ case PrecipitationType_Type.HAIL:
80
+ return "HAIL";
81
+ case PrecipitationType_Type.FREEZING_RAIN:
82
+ return "FREEZING_RAIN";
83
+ case PrecipitationType_Type.MIXED:
84
+ return "MIXED";
85
+ case PrecipitationType_Type.UNRECOGNIZED:
86
+ default:
87
+ return "UNRECOGNIZED";
88
+ }
89
+ }
90
+ exports.precipitationType_TypeToJSON = precipitationType_TypeToJSON;
91
+ var IceType_Type;
92
+ (function (IceType_Type) {
93
+ IceType_Type[IceType_Type["TYPE_UNSPECIFIED"] = 0] = "TYPE_UNSPECIFIED";
94
+ IceType_Type[IceType_Type["FRAZIL"] = 1] = "FRAZIL";
95
+ IceType_Type[IceType_Type["GREASE"] = 2] = "GREASE";
96
+ IceType_Type[IceType_Type["SLUSH"] = 3] = "SLUSH";
97
+ IceType_Type[IceType_Type["SHUGA"] = 4] = "SHUGA";
98
+ IceType_Type[IceType_Type["NILAS"] = 5] = "NILAS";
99
+ IceType_Type[IceType_Type["PANCAKE"] = 6] = "PANCAKE";
100
+ IceType_Type[IceType_Type["FIRST_YEAR"] = 7] = "FIRST_YEAR";
101
+ IceType_Type[IceType_Type["MULTI_YEAR"] = 8] = "MULTI_YEAR";
102
+ IceType_Type[IceType_Type["GLACIER"] = 9] = "GLACIER";
103
+ IceType_Type[IceType_Type["ICEBERG"] = 10] = "ICEBERG";
104
+ IceType_Type[IceType_Type["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
105
+ })(IceType_Type || (exports.IceType_Type = IceType_Type = {}));
106
+ function iceType_TypeFromJSON(object) {
107
+ switch (object) {
108
+ case 0:
109
+ case "TYPE_UNSPECIFIED":
110
+ return IceType_Type.TYPE_UNSPECIFIED;
111
+ case 1:
112
+ case "FRAZIL":
113
+ return IceType_Type.FRAZIL;
114
+ case 2:
115
+ case "GREASE":
116
+ return IceType_Type.GREASE;
117
+ case 3:
118
+ case "SLUSH":
119
+ return IceType_Type.SLUSH;
120
+ case 4:
121
+ case "SHUGA":
122
+ return IceType_Type.SHUGA;
123
+ case 5:
124
+ case "NILAS":
125
+ return IceType_Type.NILAS;
126
+ case 6:
127
+ case "PANCAKE":
128
+ return IceType_Type.PANCAKE;
129
+ case 7:
130
+ case "FIRST_YEAR":
131
+ return IceType_Type.FIRST_YEAR;
132
+ case 8:
133
+ case "MULTI_YEAR":
134
+ return IceType_Type.MULTI_YEAR;
135
+ case 9:
136
+ case "GLACIER":
137
+ return IceType_Type.GLACIER;
138
+ case 10:
139
+ case "ICEBERG":
140
+ return IceType_Type.ICEBERG;
141
+ case -1:
142
+ case "UNRECOGNIZED":
143
+ default:
144
+ return IceType_Type.UNRECOGNIZED;
145
+ }
146
+ }
147
+ exports.iceType_TypeFromJSON = iceType_TypeFromJSON;
148
+ function iceType_TypeToJSON(object) {
149
+ switch (object) {
150
+ case IceType_Type.TYPE_UNSPECIFIED:
151
+ return "TYPE_UNSPECIFIED";
152
+ case IceType_Type.FRAZIL:
153
+ return "FRAZIL";
154
+ case IceType_Type.GREASE:
155
+ return "GREASE";
156
+ case IceType_Type.SLUSH:
157
+ return "SLUSH";
158
+ case IceType_Type.SHUGA:
159
+ return "SHUGA";
160
+ case IceType_Type.NILAS:
161
+ return "NILAS";
162
+ case IceType_Type.PANCAKE:
163
+ return "PANCAKE";
164
+ case IceType_Type.FIRST_YEAR:
165
+ return "FIRST_YEAR";
166
+ case IceType_Type.MULTI_YEAR:
167
+ return "MULTI_YEAR";
168
+ case IceType_Type.GLACIER:
169
+ return "GLACIER";
170
+ case IceType_Type.ICEBERG:
171
+ return "ICEBERG";
172
+ case IceType_Type.UNRECOGNIZED:
173
+ default:
174
+ return "UNRECOGNIZED";
175
+ }
176
+ }
177
+ exports.iceType_TypeToJSON = iceType_TypeToJSON;
178
+ function createBasePrecipitationType() {
179
+ return { $type: "keelson.PrecipitationType", timestamp: undefined, type: 0 };
180
+ }
181
+ exports.PrecipitationType = {
182
+ $type: "keelson.PrecipitationType",
183
+ encode(message, writer = new wire_1.BinaryWriter()) {
184
+ if (message.timestamp !== undefined) {
185
+ timestamp_1.Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).join();
186
+ }
187
+ if (message.type !== 0) {
188
+ writer.uint32(16).int32(message.type);
189
+ }
190
+ return writer;
191
+ },
192
+ decode(input, length) {
193
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
194
+ let end = length === undefined ? reader.len : reader.pos + length;
195
+ const message = createBasePrecipitationType();
196
+ while (reader.pos < end) {
197
+ const tag = reader.uint32();
198
+ switch (tag >>> 3) {
199
+ case 1: {
200
+ if (tag !== 10) {
201
+ break;
202
+ }
203
+ message.timestamp = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
204
+ continue;
205
+ }
206
+ case 2: {
207
+ if (tag !== 16) {
208
+ break;
209
+ }
210
+ message.type = reader.int32();
211
+ continue;
212
+ }
213
+ }
214
+ if ((tag & 7) === 4 || tag === 0) {
215
+ break;
216
+ }
217
+ reader.skip(tag & 7);
218
+ }
219
+ return message;
220
+ },
221
+ fromJSON(object) {
222
+ return {
223
+ $type: exports.PrecipitationType.$type,
224
+ timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
225
+ type: isSet(object.type) ? precipitationType_TypeFromJSON(object.type) : 0,
226
+ };
227
+ },
228
+ toJSON(message) {
229
+ const obj = {};
230
+ if (message.timestamp !== undefined) {
231
+ obj.timestamp = message.timestamp.toISOString();
232
+ }
233
+ if (message.type !== 0) {
234
+ obj.type = precipitationType_TypeToJSON(message.type);
235
+ }
236
+ return obj;
237
+ },
238
+ create(base) {
239
+ return exports.PrecipitationType.fromPartial(base ?? {});
240
+ },
241
+ fromPartial(object) {
242
+ const message = createBasePrecipitationType();
243
+ message.timestamp = object.timestamp ?? undefined;
244
+ message.type = object.type ?? 0;
245
+ return message;
246
+ },
247
+ };
248
+ typeRegistry_1.messageTypeRegistry.set(exports.PrecipitationType.$type, exports.PrecipitationType);
249
+ function createBaseIceType() {
250
+ return { $type: "keelson.IceType", timestamp: undefined, type: 0 };
251
+ }
252
+ exports.IceType = {
253
+ $type: "keelson.IceType",
254
+ encode(message, writer = new wire_1.BinaryWriter()) {
255
+ if (message.timestamp !== undefined) {
256
+ timestamp_1.Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).join();
257
+ }
258
+ if (message.type !== 0) {
259
+ writer.uint32(16).int32(message.type);
260
+ }
261
+ return writer;
262
+ },
263
+ decode(input, length) {
264
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
265
+ let end = length === undefined ? reader.len : reader.pos + length;
266
+ const message = createBaseIceType();
267
+ while (reader.pos < end) {
268
+ const tag = reader.uint32();
269
+ switch (tag >>> 3) {
270
+ case 1: {
271
+ if (tag !== 10) {
272
+ break;
273
+ }
274
+ message.timestamp = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
275
+ continue;
276
+ }
277
+ case 2: {
278
+ if (tag !== 16) {
279
+ break;
280
+ }
281
+ message.type = reader.int32();
282
+ continue;
283
+ }
284
+ }
285
+ if ((tag & 7) === 4 || tag === 0) {
286
+ break;
287
+ }
288
+ reader.skip(tag & 7);
289
+ }
290
+ return message;
291
+ },
292
+ fromJSON(object) {
293
+ return {
294
+ $type: exports.IceType.$type,
295
+ timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
296
+ type: isSet(object.type) ? iceType_TypeFromJSON(object.type) : 0,
297
+ };
298
+ },
299
+ toJSON(message) {
300
+ const obj = {};
301
+ if (message.timestamp !== undefined) {
302
+ obj.timestamp = message.timestamp.toISOString();
303
+ }
304
+ if (message.type !== 0) {
305
+ obj.type = iceType_TypeToJSON(message.type);
306
+ }
307
+ return obj;
308
+ },
309
+ create(base) {
310
+ return exports.IceType.fromPartial(base ?? {});
311
+ },
312
+ fromPartial(object) {
313
+ const message = createBaseIceType();
314
+ message.timestamp = object.timestamp ?? undefined;
315
+ message.type = object.type ?? 0;
316
+ return message;
317
+ },
318
+ };
319
+ typeRegistry_1.messageTypeRegistry.set(exports.IceType.$type, exports.IceType);
320
+ function createBaseWeatherAlert() {
321
+ return {
322
+ $type: "keelson.WeatherAlert",
323
+ id: "",
324
+ severity: 0,
325
+ category: "",
326
+ headline: "",
327
+ description: "",
328
+ effectiveAt: undefined,
329
+ expiresAt: undefined,
330
+ issuer: "",
331
+ affectedAreas: [],
332
+ };
333
+ }
334
+ exports.WeatherAlert = {
335
+ $type: "keelson.WeatherAlert",
336
+ encode(message, writer = new wire_1.BinaryWriter()) {
337
+ if (message.id !== "") {
338
+ writer.uint32(10).string(message.id);
339
+ }
340
+ if (message.severity !== 0) {
341
+ writer.uint32(16).int32(message.severity);
342
+ }
343
+ if (message.category !== "") {
344
+ writer.uint32(26).string(message.category);
345
+ }
346
+ if (message.headline !== "") {
347
+ writer.uint32(34).string(message.headline);
348
+ }
349
+ if (message.description !== "") {
350
+ writer.uint32(42).string(message.description);
351
+ }
352
+ if (message.effectiveAt !== undefined) {
353
+ timestamp_1.Timestamp.encode(toTimestamp(message.effectiveAt), writer.uint32(50).fork()).join();
354
+ }
355
+ if (message.expiresAt !== undefined) {
356
+ timestamp_1.Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(58).fork()).join();
357
+ }
358
+ if (message.issuer !== "") {
359
+ writer.uint32(66).string(message.issuer);
360
+ }
361
+ for (const v of message.affectedAreas) {
362
+ writer.uint32(74).string(v);
363
+ }
364
+ return writer;
365
+ },
366
+ decode(input, length) {
367
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
368
+ let end = length === undefined ? reader.len : reader.pos + length;
369
+ const message = createBaseWeatherAlert();
370
+ while (reader.pos < end) {
371
+ const tag = reader.uint32();
372
+ switch (tag >>> 3) {
373
+ case 1: {
374
+ if (tag !== 10) {
375
+ break;
376
+ }
377
+ message.id = reader.string();
378
+ continue;
379
+ }
380
+ case 2: {
381
+ if (tag !== 16) {
382
+ break;
383
+ }
384
+ message.severity = reader.int32();
385
+ continue;
386
+ }
387
+ case 3: {
388
+ if (tag !== 26) {
389
+ break;
390
+ }
391
+ message.category = reader.string();
392
+ continue;
393
+ }
394
+ case 4: {
395
+ if (tag !== 34) {
396
+ break;
397
+ }
398
+ message.headline = reader.string();
399
+ continue;
400
+ }
401
+ case 5: {
402
+ if (tag !== 42) {
403
+ break;
404
+ }
405
+ message.description = reader.string();
406
+ continue;
407
+ }
408
+ case 6: {
409
+ if (tag !== 50) {
410
+ break;
411
+ }
412
+ message.effectiveAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
413
+ continue;
414
+ }
415
+ case 7: {
416
+ if (tag !== 58) {
417
+ break;
418
+ }
419
+ message.expiresAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
420
+ continue;
421
+ }
422
+ case 8: {
423
+ if (tag !== 66) {
424
+ break;
425
+ }
426
+ message.issuer = reader.string();
427
+ continue;
428
+ }
429
+ case 9: {
430
+ if (tag !== 74) {
431
+ break;
432
+ }
433
+ message.affectedAreas.push(reader.string());
434
+ continue;
435
+ }
436
+ }
437
+ if ((tag & 7) === 4 || tag === 0) {
438
+ break;
439
+ }
440
+ reader.skip(tag & 7);
441
+ }
442
+ return message;
443
+ },
444
+ fromJSON(object) {
445
+ return {
446
+ $type: exports.WeatherAlert.$type,
447
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
448
+ severity: isSet(object.severity) ? (0, Severity_1.severityLevelFromJSON)(object.severity) : 0,
449
+ category: isSet(object.category) ? globalThis.String(object.category) : "",
450
+ headline: isSet(object.headline) ? globalThis.String(object.headline) : "",
451
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
452
+ effectiveAt: isSet(object.effectiveAt) ? fromJsonTimestamp(object.effectiveAt) : undefined,
453
+ expiresAt: isSet(object.expiresAt) ? fromJsonTimestamp(object.expiresAt) : undefined,
454
+ issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "",
455
+ affectedAreas: globalThis.Array.isArray(object?.affectedAreas)
456
+ ? object.affectedAreas.map((e) => globalThis.String(e))
457
+ : [],
458
+ };
459
+ },
460
+ toJSON(message) {
461
+ const obj = {};
462
+ if (message.id !== "") {
463
+ obj.id = message.id;
464
+ }
465
+ if (message.severity !== 0) {
466
+ obj.severity = (0, Severity_1.severityLevelToJSON)(message.severity);
467
+ }
468
+ if (message.category !== "") {
469
+ obj.category = message.category;
470
+ }
471
+ if (message.headline !== "") {
472
+ obj.headline = message.headline;
473
+ }
474
+ if (message.description !== "") {
475
+ obj.description = message.description;
476
+ }
477
+ if (message.effectiveAt !== undefined) {
478
+ obj.effectiveAt = message.effectiveAt.toISOString();
479
+ }
480
+ if (message.expiresAt !== undefined) {
481
+ obj.expiresAt = message.expiresAt.toISOString();
482
+ }
483
+ if (message.issuer !== "") {
484
+ obj.issuer = message.issuer;
485
+ }
486
+ if (message.affectedAreas?.length) {
487
+ obj.affectedAreas = message.affectedAreas;
488
+ }
489
+ return obj;
490
+ },
491
+ create(base) {
492
+ return exports.WeatherAlert.fromPartial(base ?? {});
493
+ },
494
+ fromPartial(object) {
495
+ const message = createBaseWeatherAlert();
496
+ message.id = object.id ?? "";
497
+ message.severity = object.severity ?? 0;
498
+ message.category = object.category ?? "";
499
+ message.headline = object.headline ?? "";
500
+ message.description = object.description ?? "";
501
+ message.effectiveAt = object.effectiveAt ?? undefined;
502
+ message.expiresAt = object.expiresAt ?? undefined;
503
+ message.issuer = object.issuer ?? "";
504
+ message.affectedAreas = object.affectedAreas?.map((e) => e) || [];
505
+ return message;
506
+ },
507
+ };
508
+ typeRegistry_1.messageTypeRegistry.set(exports.WeatherAlert.$type, exports.WeatherAlert);
509
+ function createBaseWeatherForecast() {
510
+ return {
511
+ $type: "keelson.WeatherForecast",
512
+ location: undefined,
513
+ issuedAt: undefined,
514
+ source: "",
515
+ steps: [],
516
+ alerts: [],
517
+ };
518
+ }
519
+ exports.WeatherForecast = {
520
+ $type: "keelson.WeatherForecast",
521
+ encode(message, writer = new wire_1.BinaryWriter()) {
522
+ if (message.location !== undefined) {
523
+ LocationFix_1.LocationFix.encode(message.location, writer.uint32(10).fork()).join();
524
+ }
525
+ if (message.issuedAt !== undefined) {
526
+ timestamp_1.Timestamp.encode(toTimestamp(message.issuedAt), writer.uint32(18).fork()).join();
527
+ }
528
+ if (message.source !== "") {
529
+ writer.uint32(26).string(message.source);
530
+ }
531
+ for (const v of message.steps) {
532
+ exports.WeatherForecast_Step.encode(v, writer.uint32(34).fork()).join();
533
+ }
534
+ for (const v of message.alerts) {
535
+ exports.WeatherAlert.encode(v, writer.uint32(42).fork()).join();
536
+ }
537
+ return writer;
538
+ },
539
+ decode(input, length) {
540
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
541
+ let end = length === undefined ? reader.len : reader.pos + length;
542
+ const message = createBaseWeatherForecast();
543
+ while (reader.pos < end) {
544
+ const tag = reader.uint32();
545
+ switch (tag >>> 3) {
546
+ case 1: {
547
+ if (tag !== 10) {
548
+ break;
549
+ }
550
+ message.location = LocationFix_1.LocationFix.decode(reader, reader.uint32());
551
+ continue;
552
+ }
553
+ case 2: {
554
+ if (tag !== 18) {
555
+ break;
556
+ }
557
+ message.issuedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
558
+ continue;
559
+ }
560
+ case 3: {
561
+ if (tag !== 26) {
562
+ break;
563
+ }
564
+ message.source = reader.string();
565
+ continue;
566
+ }
567
+ case 4: {
568
+ if (tag !== 34) {
569
+ break;
570
+ }
571
+ message.steps.push(exports.WeatherForecast_Step.decode(reader, reader.uint32()));
572
+ continue;
573
+ }
574
+ case 5: {
575
+ if (tag !== 42) {
576
+ break;
577
+ }
578
+ message.alerts.push(exports.WeatherAlert.decode(reader, reader.uint32()));
579
+ continue;
580
+ }
581
+ }
582
+ if ((tag & 7) === 4 || tag === 0) {
583
+ break;
584
+ }
585
+ reader.skip(tag & 7);
586
+ }
587
+ return message;
588
+ },
589
+ fromJSON(object) {
590
+ return {
591
+ $type: exports.WeatherForecast.$type,
592
+ location: isSet(object.location) ? LocationFix_1.LocationFix.fromJSON(object.location) : undefined,
593
+ issuedAt: isSet(object.issuedAt) ? fromJsonTimestamp(object.issuedAt) : undefined,
594
+ source: isSet(object.source) ? globalThis.String(object.source) : "",
595
+ steps: globalThis.Array.isArray(object?.steps)
596
+ ? object.steps.map((e) => exports.WeatherForecast_Step.fromJSON(e))
597
+ : [],
598
+ alerts: globalThis.Array.isArray(object?.alerts) ? object.alerts.map((e) => exports.WeatherAlert.fromJSON(e)) : [],
599
+ };
600
+ },
601
+ toJSON(message) {
602
+ const obj = {};
603
+ if (message.location !== undefined) {
604
+ obj.location = LocationFix_1.LocationFix.toJSON(message.location);
605
+ }
606
+ if (message.issuedAt !== undefined) {
607
+ obj.issuedAt = message.issuedAt.toISOString();
608
+ }
609
+ if (message.source !== "") {
610
+ obj.source = message.source;
611
+ }
612
+ if (message.steps?.length) {
613
+ obj.steps = message.steps.map((e) => exports.WeatherForecast_Step.toJSON(e));
614
+ }
615
+ if (message.alerts?.length) {
616
+ obj.alerts = message.alerts.map((e) => exports.WeatherAlert.toJSON(e));
617
+ }
618
+ return obj;
619
+ },
620
+ create(base) {
621
+ return exports.WeatherForecast.fromPartial(base ?? {});
622
+ },
623
+ fromPartial(object) {
624
+ const message = createBaseWeatherForecast();
625
+ message.location = (object.location !== undefined && object.location !== null)
626
+ ? LocationFix_1.LocationFix.fromPartial(object.location)
627
+ : undefined;
628
+ message.issuedAt = object.issuedAt ?? undefined;
629
+ message.source = object.source ?? "";
630
+ message.steps = object.steps?.map((e) => exports.WeatherForecast_Step.fromPartial(e)) || [];
631
+ message.alerts = object.alerts?.map((e) => exports.WeatherAlert.fromPartial(e)) || [];
632
+ return message;
633
+ },
634
+ };
635
+ typeRegistry_1.messageTypeRegistry.set(exports.WeatherForecast.$type, exports.WeatherForecast);
636
+ function createBaseWeatherForecast_Step() {
637
+ return {
638
+ $type: "keelson.WeatherForecast.Step",
639
+ validAt: undefined,
640
+ trueWindSpeedMps: undefined,
641
+ trueWindDirectionDeg: undefined,
642
+ trueWindGustMps: undefined,
643
+ waveHeightSignificantM: undefined,
644
+ wavePeriodS: undefined,
645
+ waveTrueDirectionDeg: undefined,
646
+ precipitationRateMmph: undefined,
647
+ precipitationProbabilityPct: undefined,
648
+ visibilityRangeM: undefined,
649
+ airTemperatureCelsius: undefined,
650
+ airPressurePa: undefined,
651
+ };
652
+ }
653
+ exports.WeatherForecast_Step = {
654
+ $type: "keelson.WeatherForecast.Step",
655
+ encode(message, writer = new wire_1.BinaryWriter()) {
656
+ if (message.validAt !== undefined) {
657
+ timestamp_1.Timestamp.encode(toTimestamp(message.validAt), writer.uint32(10).fork()).join();
658
+ }
659
+ if (message.trueWindSpeedMps !== undefined) {
660
+ writer.uint32(21).float(message.trueWindSpeedMps);
661
+ }
662
+ if (message.trueWindDirectionDeg !== undefined) {
663
+ writer.uint32(29).float(message.trueWindDirectionDeg);
664
+ }
665
+ if (message.trueWindGustMps !== undefined) {
666
+ writer.uint32(37).float(message.trueWindGustMps);
667
+ }
668
+ if (message.waveHeightSignificantM !== undefined) {
669
+ writer.uint32(45).float(message.waveHeightSignificantM);
670
+ }
671
+ if (message.wavePeriodS !== undefined) {
672
+ writer.uint32(53).float(message.wavePeriodS);
673
+ }
674
+ if (message.waveTrueDirectionDeg !== undefined) {
675
+ writer.uint32(61).float(message.waveTrueDirectionDeg);
676
+ }
677
+ if (message.precipitationRateMmph !== undefined) {
678
+ writer.uint32(69).float(message.precipitationRateMmph);
679
+ }
680
+ if (message.precipitationProbabilityPct !== undefined) {
681
+ writer.uint32(77).float(message.precipitationProbabilityPct);
682
+ }
683
+ if (message.visibilityRangeM !== undefined) {
684
+ writer.uint32(85).float(message.visibilityRangeM);
685
+ }
686
+ if (message.airTemperatureCelsius !== undefined) {
687
+ writer.uint32(93).float(message.airTemperatureCelsius);
688
+ }
689
+ if (message.airPressurePa !== undefined) {
690
+ writer.uint32(101).float(message.airPressurePa);
691
+ }
692
+ return writer;
693
+ },
694
+ decode(input, length) {
695
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
696
+ let end = length === undefined ? reader.len : reader.pos + length;
697
+ const message = createBaseWeatherForecast_Step();
698
+ while (reader.pos < end) {
699
+ const tag = reader.uint32();
700
+ switch (tag >>> 3) {
701
+ case 1: {
702
+ if (tag !== 10) {
703
+ break;
704
+ }
705
+ message.validAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
706
+ continue;
707
+ }
708
+ case 2: {
709
+ if (tag !== 21) {
710
+ break;
711
+ }
712
+ message.trueWindSpeedMps = reader.float();
713
+ continue;
714
+ }
715
+ case 3: {
716
+ if (tag !== 29) {
717
+ break;
718
+ }
719
+ message.trueWindDirectionDeg = reader.float();
720
+ continue;
721
+ }
722
+ case 4: {
723
+ if (tag !== 37) {
724
+ break;
725
+ }
726
+ message.trueWindGustMps = reader.float();
727
+ continue;
728
+ }
729
+ case 5: {
730
+ if (tag !== 45) {
731
+ break;
732
+ }
733
+ message.waveHeightSignificantM = reader.float();
734
+ continue;
735
+ }
736
+ case 6: {
737
+ if (tag !== 53) {
738
+ break;
739
+ }
740
+ message.wavePeriodS = reader.float();
741
+ continue;
742
+ }
743
+ case 7: {
744
+ if (tag !== 61) {
745
+ break;
746
+ }
747
+ message.waveTrueDirectionDeg = reader.float();
748
+ continue;
749
+ }
750
+ case 8: {
751
+ if (tag !== 69) {
752
+ break;
753
+ }
754
+ message.precipitationRateMmph = reader.float();
755
+ continue;
756
+ }
757
+ case 9: {
758
+ if (tag !== 77) {
759
+ break;
760
+ }
761
+ message.precipitationProbabilityPct = reader.float();
762
+ continue;
763
+ }
764
+ case 10: {
765
+ if (tag !== 85) {
766
+ break;
767
+ }
768
+ message.visibilityRangeM = reader.float();
769
+ continue;
770
+ }
771
+ case 11: {
772
+ if (tag !== 93) {
773
+ break;
774
+ }
775
+ message.airTemperatureCelsius = reader.float();
776
+ continue;
777
+ }
778
+ case 12: {
779
+ if (tag !== 101) {
780
+ break;
781
+ }
782
+ message.airPressurePa = reader.float();
783
+ continue;
784
+ }
785
+ }
786
+ if ((tag & 7) === 4 || tag === 0) {
787
+ break;
788
+ }
789
+ reader.skip(tag & 7);
790
+ }
791
+ return message;
792
+ },
793
+ fromJSON(object) {
794
+ return {
795
+ $type: exports.WeatherForecast_Step.$type,
796
+ validAt: isSet(object.validAt) ? fromJsonTimestamp(object.validAt) : undefined,
797
+ trueWindSpeedMps: isSet(object.trueWindSpeedMps) ? globalThis.Number(object.trueWindSpeedMps) : undefined,
798
+ trueWindDirectionDeg: isSet(object.trueWindDirectionDeg)
799
+ ? globalThis.Number(object.trueWindDirectionDeg)
800
+ : undefined,
801
+ trueWindGustMps: isSet(object.trueWindGustMps) ? globalThis.Number(object.trueWindGustMps) : undefined,
802
+ waveHeightSignificantM: isSet(object.waveHeightSignificantM)
803
+ ? globalThis.Number(object.waveHeightSignificantM)
804
+ : undefined,
805
+ wavePeriodS: isSet(object.wavePeriodS) ? globalThis.Number(object.wavePeriodS) : undefined,
806
+ waveTrueDirectionDeg: isSet(object.waveTrueDirectionDeg)
807
+ ? globalThis.Number(object.waveTrueDirectionDeg)
808
+ : undefined,
809
+ precipitationRateMmph: isSet(object.precipitationRateMmph)
810
+ ? globalThis.Number(object.precipitationRateMmph)
811
+ : undefined,
812
+ precipitationProbabilityPct: isSet(object.precipitationProbabilityPct)
813
+ ? globalThis.Number(object.precipitationProbabilityPct)
814
+ : undefined,
815
+ visibilityRangeM: isSet(object.visibilityRangeM) ? globalThis.Number(object.visibilityRangeM) : undefined,
816
+ airTemperatureCelsius: isSet(object.airTemperatureCelsius)
817
+ ? globalThis.Number(object.airTemperatureCelsius)
818
+ : undefined,
819
+ airPressurePa: isSet(object.airPressurePa) ? globalThis.Number(object.airPressurePa) : undefined,
820
+ };
821
+ },
822
+ toJSON(message) {
823
+ const obj = {};
824
+ if (message.validAt !== undefined) {
825
+ obj.validAt = message.validAt.toISOString();
826
+ }
827
+ if (message.trueWindSpeedMps !== undefined) {
828
+ obj.trueWindSpeedMps = message.trueWindSpeedMps;
829
+ }
830
+ if (message.trueWindDirectionDeg !== undefined) {
831
+ obj.trueWindDirectionDeg = message.trueWindDirectionDeg;
832
+ }
833
+ if (message.trueWindGustMps !== undefined) {
834
+ obj.trueWindGustMps = message.trueWindGustMps;
835
+ }
836
+ if (message.waveHeightSignificantM !== undefined) {
837
+ obj.waveHeightSignificantM = message.waveHeightSignificantM;
838
+ }
839
+ if (message.wavePeriodS !== undefined) {
840
+ obj.wavePeriodS = message.wavePeriodS;
841
+ }
842
+ if (message.waveTrueDirectionDeg !== undefined) {
843
+ obj.waveTrueDirectionDeg = message.waveTrueDirectionDeg;
844
+ }
845
+ if (message.precipitationRateMmph !== undefined) {
846
+ obj.precipitationRateMmph = message.precipitationRateMmph;
847
+ }
848
+ if (message.precipitationProbabilityPct !== undefined) {
849
+ obj.precipitationProbabilityPct = message.precipitationProbabilityPct;
850
+ }
851
+ if (message.visibilityRangeM !== undefined) {
852
+ obj.visibilityRangeM = message.visibilityRangeM;
853
+ }
854
+ if (message.airTemperatureCelsius !== undefined) {
855
+ obj.airTemperatureCelsius = message.airTemperatureCelsius;
856
+ }
857
+ if (message.airPressurePa !== undefined) {
858
+ obj.airPressurePa = message.airPressurePa;
859
+ }
860
+ return obj;
861
+ },
862
+ create(base) {
863
+ return exports.WeatherForecast_Step.fromPartial(base ?? {});
864
+ },
865
+ fromPartial(object) {
866
+ const message = createBaseWeatherForecast_Step();
867
+ message.validAt = object.validAt ?? undefined;
868
+ message.trueWindSpeedMps = object.trueWindSpeedMps ?? undefined;
869
+ message.trueWindDirectionDeg = object.trueWindDirectionDeg ?? undefined;
870
+ message.trueWindGustMps = object.trueWindGustMps ?? undefined;
871
+ message.waveHeightSignificantM = object.waveHeightSignificantM ?? undefined;
872
+ message.wavePeriodS = object.wavePeriodS ?? undefined;
873
+ message.waveTrueDirectionDeg = object.waveTrueDirectionDeg ?? undefined;
874
+ message.precipitationRateMmph = object.precipitationRateMmph ?? undefined;
875
+ message.precipitationProbabilityPct = object.precipitationProbabilityPct ?? undefined;
876
+ message.visibilityRangeM = object.visibilityRangeM ?? undefined;
877
+ message.airTemperatureCelsius = object.airTemperatureCelsius ?? undefined;
878
+ message.airPressurePa = object.airPressurePa ?? undefined;
879
+ return message;
880
+ },
881
+ };
882
+ typeRegistry_1.messageTypeRegistry.set(exports.WeatherForecast_Step.$type, exports.WeatherForecast_Step);
883
+ function toTimestamp(date) {
884
+ const seconds = Math.trunc(date.getTime() / 1000);
885
+ const nanos = (date.getTime() % 1000) * 1000000;
886
+ return { $type: "google.protobuf.Timestamp", seconds, nanos };
887
+ }
888
+ function fromTimestamp(t) {
889
+ let millis = (t.seconds || 0) * 1000;
890
+ millis += (t.nanos || 0) / 1000000;
891
+ return new globalThis.Date(millis);
892
+ }
893
+ function fromJsonTimestamp(o) {
894
+ if (o instanceof globalThis.Date) {
895
+ return o;
896
+ }
897
+ else if (typeof o === "string") {
898
+ return new globalThis.Date(o);
899
+ }
900
+ else {
901
+ return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
902
+ }
903
+ }
904
+ function isSet(value) {
905
+ return value !== null && value !== undefined;
906
+ }