@miradorlabs/web-grpc 2.6.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2481 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc v3.21.12
5
+ // source: proto/gateway/web/v1/sla_gateway.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import type { Metadata } from "@grpc/grpc-js";
10
+ import { Timestamp } from "../../../../google/protobuf/timestamp";
11
+ import { ResponseStatus } from "../../common/v1/status";
12
+
13
+ export const protobufPackage = "gateway.web.v1";
14
+
15
+ export enum SlaComparator {
16
+ SLA_COMPARATOR_UNSPECIFIED = 0,
17
+ SLA_COMPARATOR_GREATER_THAN = 1,
18
+ SLA_COMPARATOR_GREATER_THAN_OR_EQUAL = 2,
19
+ SLA_COMPARATOR_LESS_THAN = 3,
20
+ SLA_COMPARATOR_LESS_THAN_OR_EQUAL = 4,
21
+ UNRECOGNIZED = -1,
22
+ }
23
+
24
+ export function slaComparatorFromJSON(object: any): SlaComparator {
25
+ switch (object) {
26
+ case 0:
27
+ case "SLA_COMPARATOR_UNSPECIFIED":
28
+ return SlaComparator.SLA_COMPARATOR_UNSPECIFIED;
29
+ case 1:
30
+ case "SLA_COMPARATOR_GREATER_THAN":
31
+ return SlaComparator.SLA_COMPARATOR_GREATER_THAN;
32
+ case 2:
33
+ case "SLA_COMPARATOR_GREATER_THAN_OR_EQUAL":
34
+ return SlaComparator.SLA_COMPARATOR_GREATER_THAN_OR_EQUAL;
35
+ case 3:
36
+ case "SLA_COMPARATOR_LESS_THAN":
37
+ return SlaComparator.SLA_COMPARATOR_LESS_THAN;
38
+ case 4:
39
+ case "SLA_COMPARATOR_LESS_THAN_OR_EQUAL":
40
+ return SlaComparator.SLA_COMPARATOR_LESS_THAN_OR_EQUAL;
41
+ case -1:
42
+ case "UNRECOGNIZED":
43
+ default:
44
+ return SlaComparator.UNRECOGNIZED;
45
+ }
46
+ }
47
+
48
+ export function slaComparatorToJSON(object: SlaComparator): string {
49
+ switch (object) {
50
+ case SlaComparator.SLA_COMPARATOR_UNSPECIFIED:
51
+ return "SLA_COMPARATOR_UNSPECIFIED";
52
+ case SlaComparator.SLA_COMPARATOR_GREATER_THAN:
53
+ return "SLA_COMPARATOR_GREATER_THAN";
54
+ case SlaComparator.SLA_COMPARATOR_GREATER_THAN_OR_EQUAL:
55
+ return "SLA_COMPARATOR_GREATER_THAN_OR_EQUAL";
56
+ case SlaComparator.SLA_COMPARATOR_LESS_THAN:
57
+ return "SLA_COMPARATOR_LESS_THAN";
58
+ case SlaComparator.SLA_COMPARATOR_LESS_THAN_OR_EQUAL:
59
+ return "SLA_COMPARATOR_LESS_THAN_OR_EQUAL";
60
+ case SlaComparator.UNRECOGNIZED:
61
+ default:
62
+ return "UNRECOGNIZED";
63
+ }
64
+ }
65
+
66
+ export enum SlaOccurrence {
67
+ SLA_OCCURRENCE_UNSPECIFIED = 0,
68
+ SLA_OCCURRENCE_EARLIEST = 1,
69
+ SLA_OCCURRENCE_LATEST = 2,
70
+ UNRECOGNIZED = -1,
71
+ }
72
+
73
+ export function slaOccurrenceFromJSON(object: any): SlaOccurrence {
74
+ switch (object) {
75
+ case 0:
76
+ case "SLA_OCCURRENCE_UNSPECIFIED":
77
+ return SlaOccurrence.SLA_OCCURRENCE_UNSPECIFIED;
78
+ case 1:
79
+ case "SLA_OCCURRENCE_EARLIEST":
80
+ return SlaOccurrence.SLA_OCCURRENCE_EARLIEST;
81
+ case 2:
82
+ case "SLA_OCCURRENCE_LATEST":
83
+ return SlaOccurrence.SLA_OCCURRENCE_LATEST;
84
+ case -1:
85
+ case "UNRECOGNIZED":
86
+ default:
87
+ return SlaOccurrence.UNRECOGNIZED;
88
+ }
89
+ }
90
+
91
+ export function slaOccurrenceToJSON(object: SlaOccurrence): string {
92
+ switch (object) {
93
+ case SlaOccurrence.SLA_OCCURRENCE_UNSPECIFIED:
94
+ return "SLA_OCCURRENCE_UNSPECIFIED";
95
+ case SlaOccurrence.SLA_OCCURRENCE_EARLIEST:
96
+ return "SLA_OCCURRENCE_EARLIEST";
97
+ case SlaOccurrence.SLA_OCCURRENCE_LATEST:
98
+ return "SLA_OCCURRENCE_LATEST";
99
+ case SlaOccurrence.UNRECOGNIZED:
100
+ default:
101
+ return "UNRECOGNIZED";
102
+ }
103
+ }
104
+
105
+ export enum SlaOutcomeStatus {
106
+ SLA_OUTCOME_STATUS_UNSPECIFIED = 0,
107
+ SLA_OUTCOME_STATUS_PASS = 1,
108
+ SLA_OUTCOME_STATUS_FAIL = 2,
109
+ SLA_OUTCOME_STATUS_NO_DATA = 3,
110
+ SLA_OUTCOME_STATUS_ERROR = 4,
111
+ UNRECOGNIZED = -1,
112
+ }
113
+
114
+ export function slaOutcomeStatusFromJSON(object: any): SlaOutcomeStatus {
115
+ switch (object) {
116
+ case 0:
117
+ case "SLA_OUTCOME_STATUS_UNSPECIFIED":
118
+ return SlaOutcomeStatus.SLA_OUTCOME_STATUS_UNSPECIFIED;
119
+ case 1:
120
+ case "SLA_OUTCOME_STATUS_PASS":
121
+ return SlaOutcomeStatus.SLA_OUTCOME_STATUS_PASS;
122
+ case 2:
123
+ case "SLA_OUTCOME_STATUS_FAIL":
124
+ return SlaOutcomeStatus.SLA_OUTCOME_STATUS_FAIL;
125
+ case 3:
126
+ case "SLA_OUTCOME_STATUS_NO_DATA":
127
+ return SlaOutcomeStatus.SLA_OUTCOME_STATUS_NO_DATA;
128
+ case 4:
129
+ case "SLA_OUTCOME_STATUS_ERROR":
130
+ return SlaOutcomeStatus.SLA_OUTCOME_STATUS_ERROR;
131
+ case -1:
132
+ case "UNRECOGNIZED":
133
+ default:
134
+ return SlaOutcomeStatus.UNRECOGNIZED;
135
+ }
136
+ }
137
+
138
+ export function slaOutcomeStatusToJSON(object: SlaOutcomeStatus): string {
139
+ switch (object) {
140
+ case SlaOutcomeStatus.SLA_OUTCOME_STATUS_UNSPECIFIED:
141
+ return "SLA_OUTCOME_STATUS_UNSPECIFIED";
142
+ case SlaOutcomeStatus.SLA_OUTCOME_STATUS_PASS:
143
+ return "SLA_OUTCOME_STATUS_PASS";
144
+ case SlaOutcomeStatus.SLA_OUTCOME_STATUS_FAIL:
145
+ return "SLA_OUTCOME_STATUS_FAIL";
146
+ case SlaOutcomeStatus.SLA_OUTCOME_STATUS_NO_DATA:
147
+ return "SLA_OUTCOME_STATUS_NO_DATA";
148
+ case SlaOutcomeStatus.SLA_OUTCOME_STATUS_ERROR:
149
+ return "SLA_OUTCOME_STATUS_ERROR";
150
+ case SlaOutcomeStatus.UNRECOGNIZED:
151
+ default:
152
+ return "UNRECOGNIZED";
153
+ }
154
+ }
155
+
156
+ export interface Sla {
157
+ id: string;
158
+ organizationId: string;
159
+ projectId: string;
160
+ name: string;
161
+ description: string;
162
+ enabled: boolean;
163
+ check: SlaCheck | undefined;
164
+ currentRevision: number;
165
+ /** Server-assigned and immutable: mirador.sla.<id>.diff — query it via MetricGatewayService. */
166
+ metricName: string;
167
+ createdAt: Date | undefined;
168
+ updatedAt: Date | undefined;
169
+ }
170
+
171
+ /** SlaCheck is the measurement: diff = side_a - side_b, compared against threshold. */
172
+ export interface SlaCheck {
173
+ sideA: SlaAttributeRef | undefined;
174
+ sideB: SlaAttributeRef | undefined;
175
+ comparator: SlaComparator;
176
+ threshold: number;
177
+ }
178
+
179
+ /**
180
+ * SlaAttributeRef addresses one numeric per-event trace attribute. Timestamps are
181
+ * addressed as ordinary numeric attributes (epoch millis), so "B within N of A" is a
182
+ * plain value diff — there is no separate latency mode.
183
+ */
184
+ export interface SlaAttributeRef {
185
+ attributeKey: string;
186
+ /** Optional: restrict the lookup to events with this name. */
187
+ eventName: string;
188
+ occurrence: SlaOccurrence;
189
+ }
190
+
191
+ export interface SlaOutcome {
192
+ slaId: string;
193
+ revision: number;
194
+ traceId: string;
195
+ terminalVersion: number;
196
+ outcome: SlaOutcomeStatus;
197
+ sideAValue?: number | undefined;
198
+ sideBValue?: number | undefined;
199
+ diff?: number | undefined;
200
+ reasonCode: string;
201
+ traceFinishedAt: Date | undefined;
202
+ evaluatedAt: Date | undefined;
203
+ }
204
+
205
+ export interface CreateSlaRequest {
206
+ organizationId: string;
207
+ projectId: string;
208
+ name: string;
209
+ description: string;
210
+ enabled: boolean;
211
+ check: SlaCheck | undefined;
212
+ }
213
+
214
+ export interface CreateSlaResponse {
215
+ status: ResponseStatus | undefined;
216
+ sla: Sla | undefined;
217
+ }
218
+
219
+ export interface GetSlaRequest {
220
+ organizationId: string;
221
+ projectId: string;
222
+ slaId: string;
223
+ }
224
+
225
+ export interface GetSlaResponse {
226
+ status: ResponseStatus | undefined;
227
+ sla: Sla | undefined;
228
+ }
229
+
230
+ export interface ListSlasRequest {
231
+ organizationId: string;
232
+ projectId: string;
233
+ }
234
+
235
+ export interface ListSlasResponse {
236
+ status: ResponseStatus | undefined;
237
+ slas: Sla[];
238
+ }
239
+
240
+ export interface UpdateSlaRequest {
241
+ organizationId: string;
242
+ projectId: string;
243
+ slaId: string;
244
+ updates: UpdateSlaRequest_SlaUpdates | undefined;
245
+ }
246
+
247
+ export interface UpdateSlaRequest_SlaUpdates {
248
+ name?: string | undefined;
249
+ description?: string | undefined;
250
+ enabled?:
251
+ | boolean
252
+ | undefined;
253
+ /** If set, replaces the whole check. */
254
+ check: SlaCheck | undefined;
255
+ }
256
+
257
+ export interface UpdateSlaResponse {
258
+ status: ResponseStatus | undefined;
259
+ sla: Sla | undefined;
260
+ }
261
+
262
+ export interface DeleteSlaRequest {
263
+ organizationId: string;
264
+ projectId: string;
265
+ slaId: string;
266
+ }
267
+
268
+ export interface DeleteSlaResponse {
269
+ status: ResponseStatus | undefined;
270
+ }
271
+
272
+ export interface ListSlaOutcomesRequest {
273
+ organizationId: string;
274
+ projectId: string;
275
+ slaId: string;
276
+ startTime: Date | undefined;
277
+ endTime:
278
+ | Date
279
+ | undefined;
280
+ /** Unspecified returns every outcome status. */
281
+ outcome: SlaOutcomeStatus;
282
+ limit: number;
283
+ offset: number;
284
+ }
285
+
286
+ export interface ListSlaOutcomesResponse {
287
+ status: ResponseStatus | undefined;
288
+ outcomes: SlaOutcome[];
289
+ }
290
+
291
+ function createBaseSla(): Sla {
292
+ return {
293
+ id: "",
294
+ organizationId: "",
295
+ projectId: "",
296
+ name: "",
297
+ description: "",
298
+ enabled: false,
299
+ check: undefined,
300
+ currentRevision: 0,
301
+ metricName: "",
302
+ createdAt: undefined,
303
+ updatedAt: undefined,
304
+ };
305
+ }
306
+
307
+ export const Sla: MessageFns<Sla> = {
308
+ encode(message: Sla, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
309
+ if (message.id !== "") {
310
+ writer.uint32(10).string(message.id);
311
+ }
312
+ if (message.organizationId !== "") {
313
+ writer.uint32(18).string(message.organizationId);
314
+ }
315
+ if (message.projectId !== "") {
316
+ writer.uint32(26).string(message.projectId);
317
+ }
318
+ if (message.name !== "") {
319
+ writer.uint32(34).string(message.name);
320
+ }
321
+ if (message.description !== "") {
322
+ writer.uint32(42).string(message.description);
323
+ }
324
+ if (message.enabled !== false) {
325
+ writer.uint32(48).bool(message.enabled);
326
+ }
327
+ if (message.check !== undefined) {
328
+ SlaCheck.encode(message.check, writer.uint32(58).fork()).join();
329
+ }
330
+ if (message.currentRevision !== 0) {
331
+ writer.uint32(64).int32(message.currentRevision);
332
+ }
333
+ if (message.metricName !== "") {
334
+ writer.uint32(74).string(message.metricName);
335
+ }
336
+ if (message.createdAt !== undefined) {
337
+ Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(82).fork()).join();
338
+ }
339
+ if (message.updatedAt !== undefined) {
340
+ Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(90).fork()).join();
341
+ }
342
+ return writer;
343
+ },
344
+
345
+ decode(input: BinaryReader | Uint8Array, length?: number): Sla {
346
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
347
+ const end = length === undefined ? reader.len : reader.pos + length;
348
+ const message = createBaseSla();
349
+ while (reader.pos < end) {
350
+ const tag = reader.uint32();
351
+ switch (tag >>> 3) {
352
+ case 1: {
353
+ if (tag !== 10) {
354
+ break;
355
+ }
356
+
357
+ message.id = reader.string();
358
+ continue;
359
+ }
360
+ case 2: {
361
+ if (tag !== 18) {
362
+ break;
363
+ }
364
+
365
+ message.organizationId = reader.string();
366
+ continue;
367
+ }
368
+ case 3: {
369
+ if (tag !== 26) {
370
+ break;
371
+ }
372
+
373
+ message.projectId = reader.string();
374
+ continue;
375
+ }
376
+ case 4: {
377
+ if (tag !== 34) {
378
+ break;
379
+ }
380
+
381
+ message.name = reader.string();
382
+ continue;
383
+ }
384
+ case 5: {
385
+ if (tag !== 42) {
386
+ break;
387
+ }
388
+
389
+ message.description = reader.string();
390
+ continue;
391
+ }
392
+ case 6: {
393
+ if (tag !== 48) {
394
+ break;
395
+ }
396
+
397
+ message.enabled = reader.bool();
398
+ continue;
399
+ }
400
+ case 7: {
401
+ if (tag !== 58) {
402
+ break;
403
+ }
404
+
405
+ message.check = SlaCheck.decode(reader, reader.uint32());
406
+ continue;
407
+ }
408
+ case 8: {
409
+ if (tag !== 64) {
410
+ break;
411
+ }
412
+
413
+ message.currentRevision = reader.int32();
414
+ continue;
415
+ }
416
+ case 9: {
417
+ if (tag !== 74) {
418
+ break;
419
+ }
420
+
421
+ message.metricName = reader.string();
422
+ continue;
423
+ }
424
+ case 10: {
425
+ if (tag !== 82) {
426
+ break;
427
+ }
428
+
429
+ message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
430
+ continue;
431
+ }
432
+ case 11: {
433
+ if (tag !== 90) {
434
+ break;
435
+ }
436
+
437
+ message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
438
+ continue;
439
+ }
440
+ }
441
+ if ((tag & 7) === 4 || tag === 0) {
442
+ break;
443
+ }
444
+ reader.skip(tag & 7);
445
+ }
446
+ return message;
447
+ },
448
+
449
+ fromJSON(object: any): Sla {
450
+ return {
451
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
452
+ organizationId: isSet(object.organizationId)
453
+ ? globalThis.String(object.organizationId)
454
+ : isSet(object.organization_id)
455
+ ? globalThis.String(object.organization_id)
456
+ : "",
457
+ projectId: isSet(object.projectId)
458
+ ? globalThis.String(object.projectId)
459
+ : isSet(object.project_id)
460
+ ? globalThis.String(object.project_id)
461
+ : "",
462
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
463
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
464
+ enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
465
+ check: isSet(object.check) ? SlaCheck.fromJSON(object.check) : undefined,
466
+ currentRevision: isSet(object.currentRevision)
467
+ ? globalThis.Number(object.currentRevision)
468
+ : isSet(object.current_revision)
469
+ ? globalThis.Number(object.current_revision)
470
+ : 0,
471
+ metricName: isSet(object.metricName)
472
+ ? globalThis.String(object.metricName)
473
+ : isSet(object.metric_name)
474
+ ? globalThis.String(object.metric_name)
475
+ : "",
476
+ createdAt: isSet(object.createdAt)
477
+ ? fromJsonTimestamp(object.createdAt)
478
+ : isSet(object.created_at)
479
+ ? fromJsonTimestamp(object.created_at)
480
+ : undefined,
481
+ updatedAt: isSet(object.updatedAt)
482
+ ? fromJsonTimestamp(object.updatedAt)
483
+ : isSet(object.updated_at)
484
+ ? fromJsonTimestamp(object.updated_at)
485
+ : undefined,
486
+ };
487
+ },
488
+
489
+ toJSON(message: Sla): unknown {
490
+ const obj: any = {};
491
+ if (message.id !== "") {
492
+ obj.id = message.id;
493
+ }
494
+ if (message.organizationId !== "") {
495
+ obj.organizationId = message.organizationId;
496
+ }
497
+ if (message.projectId !== "") {
498
+ obj.projectId = message.projectId;
499
+ }
500
+ if (message.name !== "") {
501
+ obj.name = message.name;
502
+ }
503
+ if (message.description !== "") {
504
+ obj.description = message.description;
505
+ }
506
+ if (message.enabled !== false) {
507
+ obj.enabled = message.enabled;
508
+ }
509
+ if (message.check !== undefined) {
510
+ obj.check = SlaCheck.toJSON(message.check);
511
+ }
512
+ if (message.currentRevision !== 0) {
513
+ obj.currentRevision = Math.round(message.currentRevision);
514
+ }
515
+ if (message.metricName !== "") {
516
+ obj.metricName = message.metricName;
517
+ }
518
+ if (message.createdAt !== undefined) {
519
+ obj.createdAt = message.createdAt.toISOString();
520
+ }
521
+ if (message.updatedAt !== undefined) {
522
+ obj.updatedAt = message.updatedAt.toISOString();
523
+ }
524
+ return obj;
525
+ },
526
+
527
+ create<I extends Exact<DeepPartial<Sla>, I>>(base?: I): Sla {
528
+ return Sla.fromPartial(base ?? ({} as any));
529
+ },
530
+ fromPartial<I extends Exact<DeepPartial<Sla>, I>>(object: I): Sla {
531
+ const message = createBaseSla();
532
+ message.id = object.id ?? "";
533
+ message.organizationId = object.organizationId ?? "";
534
+ message.projectId = object.projectId ?? "";
535
+ message.name = object.name ?? "";
536
+ message.description = object.description ?? "";
537
+ message.enabled = object.enabled ?? false;
538
+ message.check = (object.check !== undefined && object.check !== null)
539
+ ? SlaCheck.fromPartial(object.check)
540
+ : undefined;
541
+ message.currentRevision = object.currentRevision ?? 0;
542
+ message.metricName = object.metricName ?? "";
543
+ message.createdAt = object.createdAt ?? undefined;
544
+ message.updatedAt = object.updatedAt ?? undefined;
545
+ return message;
546
+ },
547
+ };
548
+
549
+ function createBaseSlaCheck(): SlaCheck {
550
+ return { sideA: undefined, sideB: undefined, comparator: 0, threshold: 0 };
551
+ }
552
+
553
+ export const SlaCheck: MessageFns<SlaCheck> = {
554
+ encode(message: SlaCheck, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
555
+ if (message.sideA !== undefined) {
556
+ SlaAttributeRef.encode(message.sideA, writer.uint32(10).fork()).join();
557
+ }
558
+ if (message.sideB !== undefined) {
559
+ SlaAttributeRef.encode(message.sideB, writer.uint32(18).fork()).join();
560
+ }
561
+ if (message.comparator !== 0) {
562
+ writer.uint32(24).int32(message.comparator);
563
+ }
564
+ if (message.threshold !== 0) {
565
+ writer.uint32(33).double(message.threshold);
566
+ }
567
+ return writer;
568
+ },
569
+
570
+ decode(input: BinaryReader | Uint8Array, length?: number): SlaCheck {
571
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
572
+ const end = length === undefined ? reader.len : reader.pos + length;
573
+ const message = createBaseSlaCheck();
574
+ while (reader.pos < end) {
575
+ const tag = reader.uint32();
576
+ switch (tag >>> 3) {
577
+ case 1: {
578
+ if (tag !== 10) {
579
+ break;
580
+ }
581
+
582
+ message.sideA = SlaAttributeRef.decode(reader, reader.uint32());
583
+ continue;
584
+ }
585
+ case 2: {
586
+ if (tag !== 18) {
587
+ break;
588
+ }
589
+
590
+ message.sideB = SlaAttributeRef.decode(reader, reader.uint32());
591
+ continue;
592
+ }
593
+ case 3: {
594
+ if (tag !== 24) {
595
+ break;
596
+ }
597
+
598
+ message.comparator = reader.int32() as any;
599
+ continue;
600
+ }
601
+ case 4: {
602
+ if (tag !== 33) {
603
+ break;
604
+ }
605
+
606
+ message.threshold = reader.double();
607
+ continue;
608
+ }
609
+ }
610
+ if ((tag & 7) === 4 || tag === 0) {
611
+ break;
612
+ }
613
+ reader.skip(tag & 7);
614
+ }
615
+ return message;
616
+ },
617
+
618
+ fromJSON(object: any): SlaCheck {
619
+ return {
620
+ sideA: isSet(object.sideA)
621
+ ? SlaAttributeRef.fromJSON(object.sideA)
622
+ : isSet(object.side_a)
623
+ ? SlaAttributeRef.fromJSON(object.side_a)
624
+ : undefined,
625
+ sideB: isSet(object.sideB)
626
+ ? SlaAttributeRef.fromJSON(object.sideB)
627
+ : isSet(object.side_b)
628
+ ? SlaAttributeRef.fromJSON(object.side_b)
629
+ : undefined,
630
+ comparator: isSet(object.comparator) ? slaComparatorFromJSON(object.comparator) : 0,
631
+ threshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0,
632
+ };
633
+ },
634
+
635
+ toJSON(message: SlaCheck): unknown {
636
+ const obj: any = {};
637
+ if (message.sideA !== undefined) {
638
+ obj.sideA = SlaAttributeRef.toJSON(message.sideA);
639
+ }
640
+ if (message.sideB !== undefined) {
641
+ obj.sideB = SlaAttributeRef.toJSON(message.sideB);
642
+ }
643
+ if (message.comparator !== 0) {
644
+ obj.comparator = slaComparatorToJSON(message.comparator);
645
+ }
646
+ if (message.threshold !== 0) {
647
+ obj.threshold = message.threshold;
648
+ }
649
+ return obj;
650
+ },
651
+
652
+ create<I extends Exact<DeepPartial<SlaCheck>, I>>(base?: I): SlaCheck {
653
+ return SlaCheck.fromPartial(base ?? ({} as any));
654
+ },
655
+ fromPartial<I extends Exact<DeepPartial<SlaCheck>, I>>(object: I): SlaCheck {
656
+ const message = createBaseSlaCheck();
657
+ message.sideA = (object.sideA !== undefined && object.sideA !== null)
658
+ ? SlaAttributeRef.fromPartial(object.sideA)
659
+ : undefined;
660
+ message.sideB = (object.sideB !== undefined && object.sideB !== null)
661
+ ? SlaAttributeRef.fromPartial(object.sideB)
662
+ : undefined;
663
+ message.comparator = object.comparator ?? 0;
664
+ message.threshold = object.threshold ?? 0;
665
+ return message;
666
+ },
667
+ };
668
+
669
+ function createBaseSlaAttributeRef(): SlaAttributeRef {
670
+ return { attributeKey: "", eventName: "", occurrence: 0 };
671
+ }
672
+
673
+ export const SlaAttributeRef: MessageFns<SlaAttributeRef> = {
674
+ encode(message: SlaAttributeRef, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
675
+ if (message.attributeKey !== "") {
676
+ writer.uint32(10).string(message.attributeKey);
677
+ }
678
+ if (message.eventName !== "") {
679
+ writer.uint32(18).string(message.eventName);
680
+ }
681
+ if (message.occurrence !== 0) {
682
+ writer.uint32(24).int32(message.occurrence);
683
+ }
684
+ return writer;
685
+ },
686
+
687
+ decode(input: BinaryReader | Uint8Array, length?: number): SlaAttributeRef {
688
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
689
+ const end = length === undefined ? reader.len : reader.pos + length;
690
+ const message = createBaseSlaAttributeRef();
691
+ while (reader.pos < end) {
692
+ const tag = reader.uint32();
693
+ switch (tag >>> 3) {
694
+ case 1: {
695
+ if (tag !== 10) {
696
+ break;
697
+ }
698
+
699
+ message.attributeKey = reader.string();
700
+ continue;
701
+ }
702
+ case 2: {
703
+ if (tag !== 18) {
704
+ break;
705
+ }
706
+
707
+ message.eventName = reader.string();
708
+ continue;
709
+ }
710
+ case 3: {
711
+ if (tag !== 24) {
712
+ break;
713
+ }
714
+
715
+ message.occurrence = reader.int32() as any;
716
+ continue;
717
+ }
718
+ }
719
+ if ((tag & 7) === 4 || tag === 0) {
720
+ break;
721
+ }
722
+ reader.skip(tag & 7);
723
+ }
724
+ return message;
725
+ },
726
+
727
+ fromJSON(object: any): SlaAttributeRef {
728
+ return {
729
+ attributeKey: isSet(object.attributeKey)
730
+ ? globalThis.String(object.attributeKey)
731
+ : isSet(object.attribute_key)
732
+ ? globalThis.String(object.attribute_key)
733
+ : "",
734
+ eventName: isSet(object.eventName)
735
+ ? globalThis.String(object.eventName)
736
+ : isSet(object.event_name)
737
+ ? globalThis.String(object.event_name)
738
+ : "",
739
+ occurrence: isSet(object.occurrence) ? slaOccurrenceFromJSON(object.occurrence) : 0,
740
+ };
741
+ },
742
+
743
+ toJSON(message: SlaAttributeRef): unknown {
744
+ const obj: any = {};
745
+ if (message.attributeKey !== "") {
746
+ obj.attributeKey = message.attributeKey;
747
+ }
748
+ if (message.eventName !== "") {
749
+ obj.eventName = message.eventName;
750
+ }
751
+ if (message.occurrence !== 0) {
752
+ obj.occurrence = slaOccurrenceToJSON(message.occurrence);
753
+ }
754
+ return obj;
755
+ },
756
+
757
+ create<I extends Exact<DeepPartial<SlaAttributeRef>, I>>(base?: I): SlaAttributeRef {
758
+ return SlaAttributeRef.fromPartial(base ?? ({} as any));
759
+ },
760
+ fromPartial<I extends Exact<DeepPartial<SlaAttributeRef>, I>>(object: I): SlaAttributeRef {
761
+ const message = createBaseSlaAttributeRef();
762
+ message.attributeKey = object.attributeKey ?? "";
763
+ message.eventName = object.eventName ?? "";
764
+ message.occurrence = object.occurrence ?? 0;
765
+ return message;
766
+ },
767
+ };
768
+
769
+ function createBaseSlaOutcome(): SlaOutcome {
770
+ return {
771
+ slaId: "",
772
+ revision: 0,
773
+ traceId: "",
774
+ terminalVersion: 0,
775
+ outcome: 0,
776
+ sideAValue: undefined,
777
+ sideBValue: undefined,
778
+ diff: undefined,
779
+ reasonCode: "",
780
+ traceFinishedAt: undefined,
781
+ evaluatedAt: undefined,
782
+ };
783
+ }
784
+
785
+ export const SlaOutcome: MessageFns<SlaOutcome> = {
786
+ encode(message: SlaOutcome, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
787
+ if (message.slaId !== "") {
788
+ writer.uint32(10).string(message.slaId);
789
+ }
790
+ if (message.revision !== 0) {
791
+ writer.uint32(16).int32(message.revision);
792
+ }
793
+ if (message.traceId !== "") {
794
+ writer.uint32(26).string(message.traceId);
795
+ }
796
+ if (message.terminalVersion !== 0) {
797
+ writer.uint32(32).uint64(message.terminalVersion);
798
+ }
799
+ if (message.outcome !== 0) {
800
+ writer.uint32(40).int32(message.outcome);
801
+ }
802
+ if (message.sideAValue !== undefined) {
803
+ writer.uint32(49).double(message.sideAValue);
804
+ }
805
+ if (message.sideBValue !== undefined) {
806
+ writer.uint32(57).double(message.sideBValue);
807
+ }
808
+ if (message.diff !== undefined) {
809
+ writer.uint32(65).double(message.diff);
810
+ }
811
+ if (message.reasonCode !== "") {
812
+ writer.uint32(74).string(message.reasonCode);
813
+ }
814
+ if (message.traceFinishedAt !== undefined) {
815
+ Timestamp.encode(toTimestamp(message.traceFinishedAt), writer.uint32(82).fork()).join();
816
+ }
817
+ if (message.evaluatedAt !== undefined) {
818
+ Timestamp.encode(toTimestamp(message.evaluatedAt), writer.uint32(90).fork()).join();
819
+ }
820
+ return writer;
821
+ },
822
+
823
+ decode(input: BinaryReader | Uint8Array, length?: number): SlaOutcome {
824
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
825
+ const end = length === undefined ? reader.len : reader.pos + length;
826
+ const message = createBaseSlaOutcome();
827
+ while (reader.pos < end) {
828
+ const tag = reader.uint32();
829
+ switch (tag >>> 3) {
830
+ case 1: {
831
+ if (tag !== 10) {
832
+ break;
833
+ }
834
+
835
+ message.slaId = reader.string();
836
+ continue;
837
+ }
838
+ case 2: {
839
+ if (tag !== 16) {
840
+ break;
841
+ }
842
+
843
+ message.revision = reader.int32();
844
+ continue;
845
+ }
846
+ case 3: {
847
+ if (tag !== 26) {
848
+ break;
849
+ }
850
+
851
+ message.traceId = reader.string();
852
+ continue;
853
+ }
854
+ case 4: {
855
+ if (tag !== 32) {
856
+ break;
857
+ }
858
+
859
+ message.terminalVersion = longToNumber(reader.uint64());
860
+ continue;
861
+ }
862
+ case 5: {
863
+ if (tag !== 40) {
864
+ break;
865
+ }
866
+
867
+ message.outcome = reader.int32() as any;
868
+ continue;
869
+ }
870
+ case 6: {
871
+ if (tag !== 49) {
872
+ break;
873
+ }
874
+
875
+ message.sideAValue = reader.double();
876
+ continue;
877
+ }
878
+ case 7: {
879
+ if (tag !== 57) {
880
+ break;
881
+ }
882
+
883
+ message.sideBValue = reader.double();
884
+ continue;
885
+ }
886
+ case 8: {
887
+ if (tag !== 65) {
888
+ break;
889
+ }
890
+
891
+ message.diff = reader.double();
892
+ continue;
893
+ }
894
+ case 9: {
895
+ if (tag !== 74) {
896
+ break;
897
+ }
898
+
899
+ message.reasonCode = reader.string();
900
+ continue;
901
+ }
902
+ case 10: {
903
+ if (tag !== 82) {
904
+ break;
905
+ }
906
+
907
+ message.traceFinishedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
908
+ continue;
909
+ }
910
+ case 11: {
911
+ if (tag !== 90) {
912
+ break;
913
+ }
914
+
915
+ message.evaluatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
916
+ continue;
917
+ }
918
+ }
919
+ if ((tag & 7) === 4 || tag === 0) {
920
+ break;
921
+ }
922
+ reader.skip(tag & 7);
923
+ }
924
+ return message;
925
+ },
926
+
927
+ fromJSON(object: any): SlaOutcome {
928
+ return {
929
+ slaId: isSet(object.slaId)
930
+ ? globalThis.String(object.slaId)
931
+ : isSet(object.sla_id)
932
+ ? globalThis.String(object.sla_id)
933
+ : "",
934
+ revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0,
935
+ traceId: isSet(object.traceId)
936
+ ? globalThis.String(object.traceId)
937
+ : isSet(object.trace_id)
938
+ ? globalThis.String(object.trace_id)
939
+ : "",
940
+ terminalVersion: isSet(object.terminalVersion)
941
+ ? globalThis.Number(object.terminalVersion)
942
+ : isSet(object.terminal_version)
943
+ ? globalThis.Number(object.terminal_version)
944
+ : 0,
945
+ outcome: isSet(object.outcome) ? slaOutcomeStatusFromJSON(object.outcome) : 0,
946
+ sideAValue: isSet(object.sideAValue)
947
+ ? globalThis.Number(object.sideAValue)
948
+ : isSet(object.side_a_value)
949
+ ? globalThis.Number(object.side_a_value)
950
+ : undefined,
951
+ sideBValue: isSet(object.sideBValue)
952
+ ? globalThis.Number(object.sideBValue)
953
+ : isSet(object.side_b_value)
954
+ ? globalThis.Number(object.side_b_value)
955
+ : undefined,
956
+ diff: isSet(object.diff) ? globalThis.Number(object.diff) : undefined,
957
+ reasonCode: isSet(object.reasonCode)
958
+ ? globalThis.String(object.reasonCode)
959
+ : isSet(object.reason_code)
960
+ ? globalThis.String(object.reason_code)
961
+ : "",
962
+ traceFinishedAt: isSet(object.traceFinishedAt)
963
+ ? fromJsonTimestamp(object.traceFinishedAt)
964
+ : isSet(object.trace_finished_at)
965
+ ? fromJsonTimestamp(object.trace_finished_at)
966
+ : undefined,
967
+ evaluatedAt: isSet(object.evaluatedAt)
968
+ ? fromJsonTimestamp(object.evaluatedAt)
969
+ : isSet(object.evaluated_at)
970
+ ? fromJsonTimestamp(object.evaluated_at)
971
+ : undefined,
972
+ };
973
+ },
974
+
975
+ toJSON(message: SlaOutcome): unknown {
976
+ const obj: any = {};
977
+ if (message.slaId !== "") {
978
+ obj.slaId = message.slaId;
979
+ }
980
+ if (message.revision !== 0) {
981
+ obj.revision = Math.round(message.revision);
982
+ }
983
+ if (message.traceId !== "") {
984
+ obj.traceId = message.traceId;
985
+ }
986
+ if (message.terminalVersion !== 0) {
987
+ obj.terminalVersion = Math.round(message.terminalVersion);
988
+ }
989
+ if (message.outcome !== 0) {
990
+ obj.outcome = slaOutcomeStatusToJSON(message.outcome);
991
+ }
992
+ if (message.sideAValue !== undefined) {
993
+ obj.sideAValue = message.sideAValue;
994
+ }
995
+ if (message.sideBValue !== undefined) {
996
+ obj.sideBValue = message.sideBValue;
997
+ }
998
+ if (message.diff !== undefined) {
999
+ obj.diff = message.diff;
1000
+ }
1001
+ if (message.reasonCode !== "") {
1002
+ obj.reasonCode = message.reasonCode;
1003
+ }
1004
+ if (message.traceFinishedAt !== undefined) {
1005
+ obj.traceFinishedAt = message.traceFinishedAt.toISOString();
1006
+ }
1007
+ if (message.evaluatedAt !== undefined) {
1008
+ obj.evaluatedAt = message.evaluatedAt.toISOString();
1009
+ }
1010
+ return obj;
1011
+ },
1012
+
1013
+ create<I extends Exact<DeepPartial<SlaOutcome>, I>>(base?: I): SlaOutcome {
1014
+ return SlaOutcome.fromPartial(base ?? ({} as any));
1015
+ },
1016
+ fromPartial<I extends Exact<DeepPartial<SlaOutcome>, I>>(object: I): SlaOutcome {
1017
+ const message = createBaseSlaOutcome();
1018
+ message.slaId = object.slaId ?? "";
1019
+ message.revision = object.revision ?? 0;
1020
+ message.traceId = object.traceId ?? "";
1021
+ message.terminalVersion = object.terminalVersion ?? 0;
1022
+ message.outcome = object.outcome ?? 0;
1023
+ message.sideAValue = object.sideAValue ?? undefined;
1024
+ message.sideBValue = object.sideBValue ?? undefined;
1025
+ message.diff = object.diff ?? undefined;
1026
+ message.reasonCode = object.reasonCode ?? "";
1027
+ message.traceFinishedAt = object.traceFinishedAt ?? undefined;
1028
+ message.evaluatedAt = object.evaluatedAt ?? undefined;
1029
+ return message;
1030
+ },
1031
+ };
1032
+
1033
+ function createBaseCreateSlaRequest(): CreateSlaRequest {
1034
+ return { organizationId: "", projectId: "", name: "", description: "", enabled: false, check: undefined };
1035
+ }
1036
+
1037
+ export const CreateSlaRequest: MessageFns<CreateSlaRequest> = {
1038
+ encode(message: CreateSlaRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1039
+ if (message.organizationId !== "") {
1040
+ writer.uint32(10).string(message.organizationId);
1041
+ }
1042
+ if (message.projectId !== "") {
1043
+ writer.uint32(18).string(message.projectId);
1044
+ }
1045
+ if (message.name !== "") {
1046
+ writer.uint32(26).string(message.name);
1047
+ }
1048
+ if (message.description !== "") {
1049
+ writer.uint32(34).string(message.description);
1050
+ }
1051
+ if (message.enabled !== false) {
1052
+ writer.uint32(40).bool(message.enabled);
1053
+ }
1054
+ if (message.check !== undefined) {
1055
+ SlaCheck.encode(message.check, writer.uint32(50).fork()).join();
1056
+ }
1057
+ return writer;
1058
+ },
1059
+
1060
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateSlaRequest {
1061
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1062
+ const end = length === undefined ? reader.len : reader.pos + length;
1063
+ const message = createBaseCreateSlaRequest();
1064
+ while (reader.pos < end) {
1065
+ const tag = reader.uint32();
1066
+ switch (tag >>> 3) {
1067
+ case 1: {
1068
+ if (tag !== 10) {
1069
+ break;
1070
+ }
1071
+
1072
+ message.organizationId = reader.string();
1073
+ continue;
1074
+ }
1075
+ case 2: {
1076
+ if (tag !== 18) {
1077
+ break;
1078
+ }
1079
+
1080
+ message.projectId = reader.string();
1081
+ continue;
1082
+ }
1083
+ case 3: {
1084
+ if (tag !== 26) {
1085
+ break;
1086
+ }
1087
+
1088
+ message.name = reader.string();
1089
+ continue;
1090
+ }
1091
+ case 4: {
1092
+ if (tag !== 34) {
1093
+ break;
1094
+ }
1095
+
1096
+ message.description = reader.string();
1097
+ continue;
1098
+ }
1099
+ case 5: {
1100
+ if (tag !== 40) {
1101
+ break;
1102
+ }
1103
+
1104
+ message.enabled = reader.bool();
1105
+ continue;
1106
+ }
1107
+ case 6: {
1108
+ if (tag !== 50) {
1109
+ break;
1110
+ }
1111
+
1112
+ message.check = SlaCheck.decode(reader, reader.uint32());
1113
+ continue;
1114
+ }
1115
+ }
1116
+ if ((tag & 7) === 4 || tag === 0) {
1117
+ break;
1118
+ }
1119
+ reader.skip(tag & 7);
1120
+ }
1121
+ return message;
1122
+ },
1123
+
1124
+ fromJSON(object: any): CreateSlaRequest {
1125
+ return {
1126
+ organizationId: isSet(object.organizationId)
1127
+ ? globalThis.String(object.organizationId)
1128
+ : isSet(object.organization_id)
1129
+ ? globalThis.String(object.organization_id)
1130
+ : "",
1131
+ projectId: isSet(object.projectId)
1132
+ ? globalThis.String(object.projectId)
1133
+ : isSet(object.project_id)
1134
+ ? globalThis.String(object.project_id)
1135
+ : "",
1136
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
1137
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
1138
+ enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
1139
+ check: isSet(object.check) ? SlaCheck.fromJSON(object.check) : undefined,
1140
+ };
1141
+ },
1142
+
1143
+ toJSON(message: CreateSlaRequest): unknown {
1144
+ const obj: any = {};
1145
+ if (message.organizationId !== "") {
1146
+ obj.organizationId = message.organizationId;
1147
+ }
1148
+ if (message.projectId !== "") {
1149
+ obj.projectId = message.projectId;
1150
+ }
1151
+ if (message.name !== "") {
1152
+ obj.name = message.name;
1153
+ }
1154
+ if (message.description !== "") {
1155
+ obj.description = message.description;
1156
+ }
1157
+ if (message.enabled !== false) {
1158
+ obj.enabled = message.enabled;
1159
+ }
1160
+ if (message.check !== undefined) {
1161
+ obj.check = SlaCheck.toJSON(message.check);
1162
+ }
1163
+ return obj;
1164
+ },
1165
+
1166
+ create<I extends Exact<DeepPartial<CreateSlaRequest>, I>>(base?: I): CreateSlaRequest {
1167
+ return CreateSlaRequest.fromPartial(base ?? ({} as any));
1168
+ },
1169
+ fromPartial<I extends Exact<DeepPartial<CreateSlaRequest>, I>>(object: I): CreateSlaRequest {
1170
+ const message = createBaseCreateSlaRequest();
1171
+ message.organizationId = object.organizationId ?? "";
1172
+ message.projectId = object.projectId ?? "";
1173
+ message.name = object.name ?? "";
1174
+ message.description = object.description ?? "";
1175
+ message.enabled = object.enabled ?? false;
1176
+ message.check = (object.check !== undefined && object.check !== null)
1177
+ ? SlaCheck.fromPartial(object.check)
1178
+ : undefined;
1179
+ return message;
1180
+ },
1181
+ };
1182
+
1183
+ function createBaseCreateSlaResponse(): CreateSlaResponse {
1184
+ return { status: undefined, sla: undefined };
1185
+ }
1186
+
1187
+ export const CreateSlaResponse: MessageFns<CreateSlaResponse> = {
1188
+ encode(message: CreateSlaResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1189
+ if (message.status !== undefined) {
1190
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1191
+ }
1192
+ if (message.sla !== undefined) {
1193
+ Sla.encode(message.sla, writer.uint32(18).fork()).join();
1194
+ }
1195
+ return writer;
1196
+ },
1197
+
1198
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateSlaResponse {
1199
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1200
+ const end = length === undefined ? reader.len : reader.pos + length;
1201
+ const message = createBaseCreateSlaResponse();
1202
+ while (reader.pos < end) {
1203
+ const tag = reader.uint32();
1204
+ switch (tag >>> 3) {
1205
+ case 1: {
1206
+ if (tag !== 10) {
1207
+ break;
1208
+ }
1209
+
1210
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1211
+ continue;
1212
+ }
1213
+ case 2: {
1214
+ if (tag !== 18) {
1215
+ break;
1216
+ }
1217
+
1218
+ message.sla = Sla.decode(reader, reader.uint32());
1219
+ continue;
1220
+ }
1221
+ }
1222
+ if ((tag & 7) === 4 || tag === 0) {
1223
+ break;
1224
+ }
1225
+ reader.skip(tag & 7);
1226
+ }
1227
+ return message;
1228
+ },
1229
+
1230
+ fromJSON(object: any): CreateSlaResponse {
1231
+ return {
1232
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1233
+ sla: isSet(object.sla) ? Sla.fromJSON(object.sla) : undefined,
1234
+ };
1235
+ },
1236
+
1237
+ toJSON(message: CreateSlaResponse): unknown {
1238
+ const obj: any = {};
1239
+ if (message.status !== undefined) {
1240
+ obj.status = ResponseStatus.toJSON(message.status);
1241
+ }
1242
+ if (message.sla !== undefined) {
1243
+ obj.sla = Sla.toJSON(message.sla);
1244
+ }
1245
+ return obj;
1246
+ },
1247
+
1248
+ create<I extends Exact<DeepPartial<CreateSlaResponse>, I>>(base?: I): CreateSlaResponse {
1249
+ return CreateSlaResponse.fromPartial(base ?? ({} as any));
1250
+ },
1251
+ fromPartial<I extends Exact<DeepPartial<CreateSlaResponse>, I>>(object: I): CreateSlaResponse {
1252
+ const message = createBaseCreateSlaResponse();
1253
+ message.status = (object.status !== undefined && object.status !== null)
1254
+ ? ResponseStatus.fromPartial(object.status)
1255
+ : undefined;
1256
+ message.sla = (object.sla !== undefined && object.sla !== null) ? Sla.fromPartial(object.sla) : undefined;
1257
+ return message;
1258
+ },
1259
+ };
1260
+
1261
+ function createBaseGetSlaRequest(): GetSlaRequest {
1262
+ return { organizationId: "", projectId: "", slaId: "" };
1263
+ }
1264
+
1265
+ export const GetSlaRequest: MessageFns<GetSlaRequest> = {
1266
+ encode(message: GetSlaRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1267
+ if (message.organizationId !== "") {
1268
+ writer.uint32(10).string(message.organizationId);
1269
+ }
1270
+ if (message.projectId !== "") {
1271
+ writer.uint32(18).string(message.projectId);
1272
+ }
1273
+ if (message.slaId !== "") {
1274
+ writer.uint32(26).string(message.slaId);
1275
+ }
1276
+ return writer;
1277
+ },
1278
+
1279
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSlaRequest {
1280
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1281
+ const end = length === undefined ? reader.len : reader.pos + length;
1282
+ const message = createBaseGetSlaRequest();
1283
+ while (reader.pos < end) {
1284
+ const tag = reader.uint32();
1285
+ switch (tag >>> 3) {
1286
+ case 1: {
1287
+ if (tag !== 10) {
1288
+ break;
1289
+ }
1290
+
1291
+ message.organizationId = reader.string();
1292
+ continue;
1293
+ }
1294
+ case 2: {
1295
+ if (tag !== 18) {
1296
+ break;
1297
+ }
1298
+
1299
+ message.projectId = reader.string();
1300
+ continue;
1301
+ }
1302
+ case 3: {
1303
+ if (tag !== 26) {
1304
+ break;
1305
+ }
1306
+
1307
+ message.slaId = reader.string();
1308
+ continue;
1309
+ }
1310
+ }
1311
+ if ((tag & 7) === 4 || tag === 0) {
1312
+ break;
1313
+ }
1314
+ reader.skip(tag & 7);
1315
+ }
1316
+ return message;
1317
+ },
1318
+
1319
+ fromJSON(object: any): GetSlaRequest {
1320
+ return {
1321
+ organizationId: isSet(object.organizationId)
1322
+ ? globalThis.String(object.organizationId)
1323
+ : isSet(object.organization_id)
1324
+ ? globalThis.String(object.organization_id)
1325
+ : "",
1326
+ projectId: isSet(object.projectId)
1327
+ ? globalThis.String(object.projectId)
1328
+ : isSet(object.project_id)
1329
+ ? globalThis.String(object.project_id)
1330
+ : "",
1331
+ slaId: isSet(object.slaId)
1332
+ ? globalThis.String(object.slaId)
1333
+ : isSet(object.sla_id)
1334
+ ? globalThis.String(object.sla_id)
1335
+ : "",
1336
+ };
1337
+ },
1338
+
1339
+ toJSON(message: GetSlaRequest): unknown {
1340
+ const obj: any = {};
1341
+ if (message.organizationId !== "") {
1342
+ obj.organizationId = message.organizationId;
1343
+ }
1344
+ if (message.projectId !== "") {
1345
+ obj.projectId = message.projectId;
1346
+ }
1347
+ if (message.slaId !== "") {
1348
+ obj.slaId = message.slaId;
1349
+ }
1350
+ return obj;
1351
+ },
1352
+
1353
+ create<I extends Exact<DeepPartial<GetSlaRequest>, I>>(base?: I): GetSlaRequest {
1354
+ return GetSlaRequest.fromPartial(base ?? ({} as any));
1355
+ },
1356
+ fromPartial<I extends Exact<DeepPartial<GetSlaRequest>, I>>(object: I): GetSlaRequest {
1357
+ const message = createBaseGetSlaRequest();
1358
+ message.organizationId = object.organizationId ?? "";
1359
+ message.projectId = object.projectId ?? "";
1360
+ message.slaId = object.slaId ?? "";
1361
+ return message;
1362
+ },
1363
+ };
1364
+
1365
+ function createBaseGetSlaResponse(): GetSlaResponse {
1366
+ return { status: undefined, sla: undefined };
1367
+ }
1368
+
1369
+ export const GetSlaResponse: MessageFns<GetSlaResponse> = {
1370
+ encode(message: GetSlaResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1371
+ if (message.status !== undefined) {
1372
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1373
+ }
1374
+ if (message.sla !== undefined) {
1375
+ Sla.encode(message.sla, writer.uint32(18).fork()).join();
1376
+ }
1377
+ return writer;
1378
+ },
1379
+
1380
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSlaResponse {
1381
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1382
+ const end = length === undefined ? reader.len : reader.pos + length;
1383
+ const message = createBaseGetSlaResponse();
1384
+ while (reader.pos < end) {
1385
+ const tag = reader.uint32();
1386
+ switch (tag >>> 3) {
1387
+ case 1: {
1388
+ if (tag !== 10) {
1389
+ break;
1390
+ }
1391
+
1392
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1393
+ continue;
1394
+ }
1395
+ case 2: {
1396
+ if (tag !== 18) {
1397
+ break;
1398
+ }
1399
+
1400
+ message.sla = Sla.decode(reader, reader.uint32());
1401
+ continue;
1402
+ }
1403
+ }
1404
+ if ((tag & 7) === 4 || tag === 0) {
1405
+ break;
1406
+ }
1407
+ reader.skip(tag & 7);
1408
+ }
1409
+ return message;
1410
+ },
1411
+
1412
+ fromJSON(object: any): GetSlaResponse {
1413
+ return {
1414
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1415
+ sla: isSet(object.sla) ? Sla.fromJSON(object.sla) : undefined,
1416
+ };
1417
+ },
1418
+
1419
+ toJSON(message: GetSlaResponse): unknown {
1420
+ const obj: any = {};
1421
+ if (message.status !== undefined) {
1422
+ obj.status = ResponseStatus.toJSON(message.status);
1423
+ }
1424
+ if (message.sla !== undefined) {
1425
+ obj.sla = Sla.toJSON(message.sla);
1426
+ }
1427
+ return obj;
1428
+ },
1429
+
1430
+ create<I extends Exact<DeepPartial<GetSlaResponse>, I>>(base?: I): GetSlaResponse {
1431
+ return GetSlaResponse.fromPartial(base ?? ({} as any));
1432
+ },
1433
+ fromPartial<I extends Exact<DeepPartial<GetSlaResponse>, I>>(object: I): GetSlaResponse {
1434
+ const message = createBaseGetSlaResponse();
1435
+ message.status = (object.status !== undefined && object.status !== null)
1436
+ ? ResponseStatus.fromPartial(object.status)
1437
+ : undefined;
1438
+ message.sla = (object.sla !== undefined && object.sla !== null) ? Sla.fromPartial(object.sla) : undefined;
1439
+ return message;
1440
+ },
1441
+ };
1442
+
1443
+ function createBaseListSlasRequest(): ListSlasRequest {
1444
+ return { organizationId: "", projectId: "" };
1445
+ }
1446
+
1447
+ export const ListSlasRequest: MessageFns<ListSlasRequest> = {
1448
+ encode(message: ListSlasRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1449
+ if (message.organizationId !== "") {
1450
+ writer.uint32(10).string(message.organizationId);
1451
+ }
1452
+ if (message.projectId !== "") {
1453
+ writer.uint32(18).string(message.projectId);
1454
+ }
1455
+ return writer;
1456
+ },
1457
+
1458
+ decode(input: BinaryReader | Uint8Array, length?: number): ListSlasRequest {
1459
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1460
+ const end = length === undefined ? reader.len : reader.pos + length;
1461
+ const message = createBaseListSlasRequest();
1462
+ while (reader.pos < end) {
1463
+ const tag = reader.uint32();
1464
+ switch (tag >>> 3) {
1465
+ case 1: {
1466
+ if (tag !== 10) {
1467
+ break;
1468
+ }
1469
+
1470
+ message.organizationId = reader.string();
1471
+ continue;
1472
+ }
1473
+ case 2: {
1474
+ if (tag !== 18) {
1475
+ break;
1476
+ }
1477
+
1478
+ message.projectId = reader.string();
1479
+ continue;
1480
+ }
1481
+ }
1482
+ if ((tag & 7) === 4 || tag === 0) {
1483
+ break;
1484
+ }
1485
+ reader.skip(tag & 7);
1486
+ }
1487
+ return message;
1488
+ },
1489
+
1490
+ fromJSON(object: any): ListSlasRequest {
1491
+ return {
1492
+ organizationId: isSet(object.organizationId)
1493
+ ? globalThis.String(object.organizationId)
1494
+ : isSet(object.organization_id)
1495
+ ? globalThis.String(object.organization_id)
1496
+ : "",
1497
+ projectId: isSet(object.projectId)
1498
+ ? globalThis.String(object.projectId)
1499
+ : isSet(object.project_id)
1500
+ ? globalThis.String(object.project_id)
1501
+ : "",
1502
+ };
1503
+ },
1504
+
1505
+ toJSON(message: ListSlasRequest): unknown {
1506
+ const obj: any = {};
1507
+ if (message.organizationId !== "") {
1508
+ obj.organizationId = message.organizationId;
1509
+ }
1510
+ if (message.projectId !== "") {
1511
+ obj.projectId = message.projectId;
1512
+ }
1513
+ return obj;
1514
+ },
1515
+
1516
+ create<I extends Exact<DeepPartial<ListSlasRequest>, I>>(base?: I): ListSlasRequest {
1517
+ return ListSlasRequest.fromPartial(base ?? ({} as any));
1518
+ },
1519
+ fromPartial<I extends Exact<DeepPartial<ListSlasRequest>, I>>(object: I): ListSlasRequest {
1520
+ const message = createBaseListSlasRequest();
1521
+ message.organizationId = object.organizationId ?? "";
1522
+ message.projectId = object.projectId ?? "";
1523
+ return message;
1524
+ },
1525
+ };
1526
+
1527
+ function createBaseListSlasResponse(): ListSlasResponse {
1528
+ return { status: undefined, slas: [] };
1529
+ }
1530
+
1531
+ export const ListSlasResponse: MessageFns<ListSlasResponse> = {
1532
+ encode(message: ListSlasResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1533
+ if (message.status !== undefined) {
1534
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1535
+ }
1536
+ for (const v of message.slas) {
1537
+ Sla.encode(v!, writer.uint32(18).fork()).join();
1538
+ }
1539
+ return writer;
1540
+ },
1541
+
1542
+ decode(input: BinaryReader | Uint8Array, length?: number): ListSlasResponse {
1543
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1544
+ const end = length === undefined ? reader.len : reader.pos + length;
1545
+ const message = createBaseListSlasResponse();
1546
+ while (reader.pos < end) {
1547
+ const tag = reader.uint32();
1548
+ switch (tag >>> 3) {
1549
+ case 1: {
1550
+ if (tag !== 10) {
1551
+ break;
1552
+ }
1553
+
1554
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1555
+ continue;
1556
+ }
1557
+ case 2: {
1558
+ if (tag !== 18) {
1559
+ break;
1560
+ }
1561
+
1562
+ message.slas.push(Sla.decode(reader, reader.uint32()));
1563
+ continue;
1564
+ }
1565
+ }
1566
+ if ((tag & 7) === 4 || tag === 0) {
1567
+ break;
1568
+ }
1569
+ reader.skip(tag & 7);
1570
+ }
1571
+ return message;
1572
+ },
1573
+
1574
+ fromJSON(object: any): ListSlasResponse {
1575
+ return {
1576
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1577
+ slas: globalThis.Array.isArray(object?.slas) ? object.slas.map((e: any) => Sla.fromJSON(e)) : [],
1578
+ };
1579
+ },
1580
+
1581
+ toJSON(message: ListSlasResponse): unknown {
1582
+ const obj: any = {};
1583
+ if (message.status !== undefined) {
1584
+ obj.status = ResponseStatus.toJSON(message.status);
1585
+ }
1586
+ if (message.slas?.length) {
1587
+ obj.slas = message.slas.map((e) => Sla.toJSON(e));
1588
+ }
1589
+ return obj;
1590
+ },
1591
+
1592
+ create<I extends Exact<DeepPartial<ListSlasResponse>, I>>(base?: I): ListSlasResponse {
1593
+ return ListSlasResponse.fromPartial(base ?? ({} as any));
1594
+ },
1595
+ fromPartial<I extends Exact<DeepPartial<ListSlasResponse>, I>>(object: I): ListSlasResponse {
1596
+ const message = createBaseListSlasResponse();
1597
+ message.status = (object.status !== undefined && object.status !== null)
1598
+ ? ResponseStatus.fromPartial(object.status)
1599
+ : undefined;
1600
+ message.slas = object.slas?.map((e) => Sla.fromPartial(e)) || [];
1601
+ return message;
1602
+ },
1603
+ };
1604
+
1605
+ function createBaseUpdateSlaRequest(): UpdateSlaRequest {
1606
+ return { organizationId: "", projectId: "", slaId: "", updates: undefined };
1607
+ }
1608
+
1609
+ export const UpdateSlaRequest: MessageFns<UpdateSlaRequest> = {
1610
+ encode(message: UpdateSlaRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1611
+ if (message.organizationId !== "") {
1612
+ writer.uint32(10).string(message.organizationId);
1613
+ }
1614
+ if (message.projectId !== "") {
1615
+ writer.uint32(18).string(message.projectId);
1616
+ }
1617
+ if (message.slaId !== "") {
1618
+ writer.uint32(26).string(message.slaId);
1619
+ }
1620
+ if (message.updates !== undefined) {
1621
+ UpdateSlaRequest_SlaUpdates.encode(message.updates, writer.uint32(34).fork()).join();
1622
+ }
1623
+ return writer;
1624
+ },
1625
+
1626
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateSlaRequest {
1627
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1628
+ const end = length === undefined ? reader.len : reader.pos + length;
1629
+ const message = createBaseUpdateSlaRequest();
1630
+ while (reader.pos < end) {
1631
+ const tag = reader.uint32();
1632
+ switch (tag >>> 3) {
1633
+ case 1: {
1634
+ if (tag !== 10) {
1635
+ break;
1636
+ }
1637
+
1638
+ message.organizationId = reader.string();
1639
+ continue;
1640
+ }
1641
+ case 2: {
1642
+ if (tag !== 18) {
1643
+ break;
1644
+ }
1645
+
1646
+ message.projectId = reader.string();
1647
+ continue;
1648
+ }
1649
+ case 3: {
1650
+ if (tag !== 26) {
1651
+ break;
1652
+ }
1653
+
1654
+ message.slaId = reader.string();
1655
+ continue;
1656
+ }
1657
+ case 4: {
1658
+ if (tag !== 34) {
1659
+ break;
1660
+ }
1661
+
1662
+ message.updates = UpdateSlaRequest_SlaUpdates.decode(reader, reader.uint32());
1663
+ continue;
1664
+ }
1665
+ }
1666
+ if ((tag & 7) === 4 || tag === 0) {
1667
+ break;
1668
+ }
1669
+ reader.skip(tag & 7);
1670
+ }
1671
+ return message;
1672
+ },
1673
+
1674
+ fromJSON(object: any): UpdateSlaRequest {
1675
+ return {
1676
+ organizationId: isSet(object.organizationId)
1677
+ ? globalThis.String(object.organizationId)
1678
+ : isSet(object.organization_id)
1679
+ ? globalThis.String(object.organization_id)
1680
+ : "",
1681
+ projectId: isSet(object.projectId)
1682
+ ? globalThis.String(object.projectId)
1683
+ : isSet(object.project_id)
1684
+ ? globalThis.String(object.project_id)
1685
+ : "",
1686
+ slaId: isSet(object.slaId)
1687
+ ? globalThis.String(object.slaId)
1688
+ : isSet(object.sla_id)
1689
+ ? globalThis.String(object.sla_id)
1690
+ : "",
1691
+ updates: isSet(object.updates) ? UpdateSlaRequest_SlaUpdates.fromJSON(object.updates) : undefined,
1692
+ };
1693
+ },
1694
+
1695
+ toJSON(message: UpdateSlaRequest): unknown {
1696
+ const obj: any = {};
1697
+ if (message.organizationId !== "") {
1698
+ obj.organizationId = message.organizationId;
1699
+ }
1700
+ if (message.projectId !== "") {
1701
+ obj.projectId = message.projectId;
1702
+ }
1703
+ if (message.slaId !== "") {
1704
+ obj.slaId = message.slaId;
1705
+ }
1706
+ if (message.updates !== undefined) {
1707
+ obj.updates = UpdateSlaRequest_SlaUpdates.toJSON(message.updates);
1708
+ }
1709
+ return obj;
1710
+ },
1711
+
1712
+ create<I extends Exact<DeepPartial<UpdateSlaRequest>, I>>(base?: I): UpdateSlaRequest {
1713
+ return UpdateSlaRequest.fromPartial(base ?? ({} as any));
1714
+ },
1715
+ fromPartial<I extends Exact<DeepPartial<UpdateSlaRequest>, I>>(object: I): UpdateSlaRequest {
1716
+ const message = createBaseUpdateSlaRequest();
1717
+ message.organizationId = object.organizationId ?? "";
1718
+ message.projectId = object.projectId ?? "";
1719
+ message.slaId = object.slaId ?? "";
1720
+ message.updates = (object.updates !== undefined && object.updates !== null)
1721
+ ? UpdateSlaRequest_SlaUpdates.fromPartial(object.updates)
1722
+ : undefined;
1723
+ return message;
1724
+ },
1725
+ };
1726
+
1727
+ function createBaseUpdateSlaRequest_SlaUpdates(): UpdateSlaRequest_SlaUpdates {
1728
+ return { name: undefined, description: undefined, enabled: undefined, check: undefined };
1729
+ }
1730
+
1731
+ export const UpdateSlaRequest_SlaUpdates: MessageFns<UpdateSlaRequest_SlaUpdates> = {
1732
+ encode(message: UpdateSlaRequest_SlaUpdates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1733
+ if (message.name !== undefined) {
1734
+ writer.uint32(10).string(message.name);
1735
+ }
1736
+ if (message.description !== undefined) {
1737
+ writer.uint32(18).string(message.description);
1738
+ }
1739
+ if (message.enabled !== undefined) {
1740
+ writer.uint32(24).bool(message.enabled);
1741
+ }
1742
+ if (message.check !== undefined) {
1743
+ SlaCheck.encode(message.check, writer.uint32(34).fork()).join();
1744
+ }
1745
+ return writer;
1746
+ },
1747
+
1748
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateSlaRequest_SlaUpdates {
1749
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1750
+ const end = length === undefined ? reader.len : reader.pos + length;
1751
+ const message = createBaseUpdateSlaRequest_SlaUpdates();
1752
+ while (reader.pos < end) {
1753
+ const tag = reader.uint32();
1754
+ switch (tag >>> 3) {
1755
+ case 1: {
1756
+ if (tag !== 10) {
1757
+ break;
1758
+ }
1759
+
1760
+ message.name = reader.string();
1761
+ continue;
1762
+ }
1763
+ case 2: {
1764
+ if (tag !== 18) {
1765
+ break;
1766
+ }
1767
+
1768
+ message.description = reader.string();
1769
+ continue;
1770
+ }
1771
+ case 3: {
1772
+ if (tag !== 24) {
1773
+ break;
1774
+ }
1775
+
1776
+ message.enabled = reader.bool();
1777
+ continue;
1778
+ }
1779
+ case 4: {
1780
+ if (tag !== 34) {
1781
+ break;
1782
+ }
1783
+
1784
+ message.check = SlaCheck.decode(reader, reader.uint32());
1785
+ continue;
1786
+ }
1787
+ }
1788
+ if ((tag & 7) === 4 || tag === 0) {
1789
+ break;
1790
+ }
1791
+ reader.skip(tag & 7);
1792
+ }
1793
+ return message;
1794
+ },
1795
+
1796
+ fromJSON(object: any): UpdateSlaRequest_SlaUpdates {
1797
+ return {
1798
+ name: isSet(object.name) ? globalThis.String(object.name) : undefined,
1799
+ description: isSet(object.description) ? globalThis.String(object.description) : undefined,
1800
+ enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : undefined,
1801
+ check: isSet(object.check) ? SlaCheck.fromJSON(object.check) : undefined,
1802
+ };
1803
+ },
1804
+
1805
+ toJSON(message: UpdateSlaRequest_SlaUpdates): unknown {
1806
+ const obj: any = {};
1807
+ if (message.name !== undefined) {
1808
+ obj.name = message.name;
1809
+ }
1810
+ if (message.description !== undefined) {
1811
+ obj.description = message.description;
1812
+ }
1813
+ if (message.enabled !== undefined) {
1814
+ obj.enabled = message.enabled;
1815
+ }
1816
+ if (message.check !== undefined) {
1817
+ obj.check = SlaCheck.toJSON(message.check);
1818
+ }
1819
+ return obj;
1820
+ },
1821
+
1822
+ create<I extends Exact<DeepPartial<UpdateSlaRequest_SlaUpdates>, I>>(base?: I): UpdateSlaRequest_SlaUpdates {
1823
+ return UpdateSlaRequest_SlaUpdates.fromPartial(base ?? ({} as any));
1824
+ },
1825
+ fromPartial<I extends Exact<DeepPartial<UpdateSlaRequest_SlaUpdates>, I>>(object: I): UpdateSlaRequest_SlaUpdates {
1826
+ const message = createBaseUpdateSlaRequest_SlaUpdates();
1827
+ message.name = object.name ?? undefined;
1828
+ message.description = object.description ?? undefined;
1829
+ message.enabled = object.enabled ?? undefined;
1830
+ message.check = (object.check !== undefined && object.check !== null)
1831
+ ? SlaCheck.fromPartial(object.check)
1832
+ : undefined;
1833
+ return message;
1834
+ },
1835
+ };
1836
+
1837
+ function createBaseUpdateSlaResponse(): UpdateSlaResponse {
1838
+ return { status: undefined, sla: undefined };
1839
+ }
1840
+
1841
+ export const UpdateSlaResponse: MessageFns<UpdateSlaResponse> = {
1842
+ encode(message: UpdateSlaResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1843
+ if (message.status !== undefined) {
1844
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1845
+ }
1846
+ if (message.sla !== undefined) {
1847
+ Sla.encode(message.sla, writer.uint32(18).fork()).join();
1848
+ }
1849
+ return writer;
1850
+ },
1851
+
1852
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateSlaResponse {
1853
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1854
+ const end = length === undefined ? reader.len : reader.pos + length;
1855
+ const message = createBaseUpdateSlaResponse();
1856
+ while (reader.pos < end) {
1857
+ const tag = reader.uint32();
1858
+ switch (tag >>> 3) {
1859
+ case 1: {
1860
+ if (tag !== 10) {
1861
+ break;
1862
+ }
1863
+
1864
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1865
+ continue;
1866
+ }
1867
+ case 2: {
1868
+ if (tag !== 18) {
1869
+ break;
1870
+ }
1871
+
1872
+ message.sla = Sla.decode(reader, reader.uint32());
1873
+ continue;
1874
+ }
1875
+ }
1876
+ if ((tag & 7) === 4 || tag === 0) {
1877
+ break;
1878
+ }
1879
+ reader.skip(tag & 7);
1880
+ }
1881
+ return message;
1882
+ },
1883
+
1884
+ fromJSON(object: any): UpdateSlaResponse {
1885
+ return {
1886
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1887
+ sla: isSet(object.sla) ? Sla.fromJSON(object.sla) : undefined,
1888
+ };
1889
+ },
1890
+
1891
+ toJSON(message: UpdateSlaResponse): unknown {
1892
+ const obj: any = {};
1893
+ if (message.status !== undefined) {
1894
+ obj.status = ResponseStatus.toJSON(message.status);
1895
+ }
1896
+ if (message.sla !== undefined) {
1897
+ obj.sla = Sla.toJSON(message.sla);
1898
+ }
1899
+ return obj;
1900
+ },
1901
+
1902
+ create<I extends Exact<DeepPartial<UpdateSlaResponse>, I>>(base?: I): UpdateSlaResponse {
1903
+ return UpdateSlaResponse.fromPartial(base ?? ({} as any));
1904
+ },
1905
+ fromPartial<I extends Exact<DeepPartial<UpdateSlaResponse>, I>>(object: I): UpdateSlaResponse {
1906
+ const message = createBaseUpdateSlaResponse();
1907
+ message.status = (object.status !== undefined && object.status !== null)
1908
+ ? ResponseStatus.fromPartial(object.status)
1909
+ : undefined;
1910
+ message.sla = (object.sla !== undefined && object.sla !== null) ? Sla.fromPartial(object.sla) : undefined;
1911
+ return message;
1912
+ },
1913
+ };
1914
+
1915
+ function createBaseDeleteSlaRequest(): DeleteSlaRequest {
1916
+ return { organizationId: "", projectId: "", slaId: "" };
1917
+ }
1918
+
1919
+ export const DeleteSlaRequest: MessageFns<DeleteSlaRequest> = {
1920
+ encode(message: DeleteSlaRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1921
+ if (message.organizationId !== "") {
1922
+ writer.uint32(10).string(message.organizationId);
1923
+ }
1924
+ if (message.projectId !== "") {
1925
+ writer.uint32(18).string(message.projectId);
1926
+ }
1927
+ if (message.slaId !== "") {
1928
+ writer.uint32(26).string(message.slaId);
1929
+ }
1930
+ return writer;
1931
+ },
1932
+
1933
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteSlaRequest {
1934
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1935
+ const end = length === undefined ? reader.len : reader.pos + length;
1936
+ const message = createBaseDeleteSlaRequest();
1937
+ while (reader.pos < end) {
1938
+ const tag = reader.uint32();
1939
+ switch (tag >>> 3) {
1940
+ case 1: {
1941
+ if (tag !== 10) {
1942
+ break;
1943
+ }
1944
+
1945
+ message.organizationId = reader.string();
1946
+ continue;
1947
+ }
1948
+ case 2: {
1949
+ if (tag !== 18) {
1950
+ break;
1951
+ }
1952
+
1953
+ message.projectId = reader.string();
1954
+ continue;
1955
+ }
1956
+ case 3: {
1957
+ if (tag !== 26) {
1958
+ break;
1959
+ }
1960
+
1961
+ message.slaId = reader.string();
1962
+ continue;
1963
+ }
1964
+ }
1965
+ if ((tag & 7) === 4 || tag === 0) {
1966
+ break;
1967
+ }
1968
+ reader.skip(tag & 7);
1969
+ }
1970
+ return message;
1971
+ },
1972
+
1973
+ fromJSON(object: any): DeleteSlaRequest {
1974
+ return {
1975
+ organizationId: isSet(object.organizationId)
1976
+ ? globalThis.String(object.organizationId)
1977
+ : isSet(object.organization_id)
1978
+ ? globalThis.String(object.organization_id)
1979
+ : "",
1980
+ projectId: isSet(object.projectId)
1981
+ ? globalThis.String(object.projectId)
1982
+ : isSet(object.project_id)
1983
+ ? globalThis.String(object.project_id)
1984
+ : "",
1985
+ slaId: isSet(object.slaId)
1986
+ ? globalThis.String(object.slaId)
1987
+ : isSet(object.sla_id)
1988
+ ? globalThis.String(object.sla_id)
1989
+ : "",
1990
+ };
1991
+ },
1992
+
1993
+ toJSON(message: DeleteSlaRequest): unknown {
1994
+ const obj: any = {};
1995
+ if (message.organizationId !== "") {
1996
+ obj.organizationId = message.organizationId;
1997
+ }
1998
+ if (message.projectId !== "") {
1999
+ obj.projectId = message.projectId;
2000
+ }
2001
+ if (message.slaId !== "") {
2002
+ obj.slaId = message.slaId;
2003
+ }
2004
+ return obj;
2005
+ },
2006
+
2007
+ create<I extends Exact<DeepPartial<DeleteSlaRequest>, I>>(base?: I): DeleteSlaRequest {
2008
+ return DeleteSlaRequest.fromPartial(base ?? ({} as any));
2009
+ },
2010
+ fromPartial<I extends Exact<DeepPartial<DeleteSlaRequest>, I>>(object: I): DeleteSlaRequest {
2011
+ const message = createBaseDeleteSlaRequest();
2012
+ message.organizationId = object.organizationId ?? "";
2013
+ message.projectId = object.projectId ?? "";
2014
+ message.slaId = object.slaId ?? "";
2015
+ return message;
2016
+ },
2017
+ };
2018
+
2019
+ function createBaseDeleteSlaResponse(): DeleteSlaResponse {
2020
+ return { status: undefined };
2021
+ }
2022
+
2023
+ export const DeleteSlaResponse: MessageFns<DeleteSlaResponse> = {
2024
+ encode(message: DeleteSlaResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2025
+ if (message.status !== undefined) {
2026
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2027
+ }
2028
+ return writer;
2029
+ },
2030
+
2031
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteSlaResponse {
2032
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2033
+ const end = length === undefined ? reader.len : reader.pos + length;
2034
+ const message = createBaseDeleteSlaResponse();
2035
+ while (reader.pos < end) {
2036
+ const tag = reader.uint32();
2037
+ switch (tag >>> 3) {
2038
+ case 1: {
2039
+ if (tag !== 10) {
2040
+ break;
2041
+ }
2042
+
2043
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2044
+ continue;
2045
+ }
2046
+ }
2047
+ if ((tag & 7) === 4 || tag === 0) {
2048
+ break;
2049
+ }
2050
+ reader.skip(tag & 7);
2051
+ }
2052
+ return message;
2053
+ },
2054
+
2055
+ fromJSON(object: any): DeleteSlaResponse {
2056
+ return { status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined };
2057
+ },
2058
+
2059
+ toJSON(message: DeleteSlaResponse): unknown {
2060
+ const obj: any = {};
2061
+ if (message.status !== undefined) {
2062
+ obj.status = ResponseStatus.toJSON(message.status);
2063
+ }
2064
+ return obj;
2065
+ },
2066
+
2067
+ create<I extends Exact<DeepPartial<DeleteSlaResponse>, I>>(base?: I): DeleteSlaResponse {
2068
+ return DeleteSlaResponse.fromPartial(base ?? ({} as any));
2069
+ },
2070
+ fromPartial<I extends Exact<DeepPartial<DeleteSlaResponse>, I>>(object: I): DeleteSlaResponse {
2071
+ const message = createBaseDeleteSlaResponse();
2072
+ message.status = (object.status !== undefined && object.status !== null)
2073
+ ? ResponseStatus.fromPartial(object.status)
2074
+ : undefined;
2075
+ return message;
2076
+ },
2077
+ };
2078
+
2079
+ function createBaseListSlaOutcomesRequest(): ListSlaOutcomesRequest {
2080
+ return {
2081
+ organizationId: "",
2082
+ projectId: "",
2083
+ slaId: "",
2084
+ startTime: undefined,
2085
+ endTime: undefined,
2086
+ outcome: 0,
2087
+ limit: 0,
2088
+ offset: 0,
2089
+ };
2090
+ }
2091
+
2092
+ export const ListSlaOutcomesRequest: MessageFns<ListSlaOutcomesRequest> = {
2093
+ encode(message: ListSlaOutcomesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2094
+ if (message.organizationId !== "") {
2095
+ writer.uint32(10).string(message.organizationId);
2096
+ }
2097
+ if (message.projectId !== "") {
2098
+ writer.uint32(18).string(message.projectId);
2099
+ }
2100
+ if (message.slaId !== "") {
2101
+ writer.uint32(26).string(message.slaId);
2102
+ }
2103
+ if (message.startTime !== undefined) {
2104
+ Timestamp.encode(toTimestamp(message.startTime), writer.uint32(34).fork()).join();
2105
+ }
2106
+ if (message.endTime !== undefined) {
2107
+ Timestamp.encode(toTimestamp(message.endTime), writer.uint32(42).fork()).join();
2108
+ }
2109
+ if (message.outcome !== 0) {
2110
+ writer.uint32(48).int32(message.outcome);
2111
+ }
2112
+ if (message.limit !== 0) {
2113
+ writer.uint32(56).int32(message.limit);
2114
+ }
2115
+ if (message.offset !== 0) {
2116
+ writer.uint32(64).int32(message.offset);
2117
+ }
2118
+ return writer;
2119
+ },
2120
+
2121
+ decode(input: BinaryReader | Uint8Array, length?: number): ListSlaOutcomesRequest {
2122
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2123
+ const end = length === undefined ? reader.len : reader.pos + length;
2124
+ const message = createBaseListSlaOutcomesRequest();
2125
+ while (reader.pos < end) {
2126
+ const tag = reader.uint32();
2127
+ switch (tag >>> 3) {
2128
+ case 1: {
2129
+ if (tag !== 10) {
2130
+ break;
2131
+ }
2132
+
2133
+ message.organizationId = reader.string();
2134
+ continue;
2135
+ }
2136
+ case 2: {
2137
+ if (tag !== 18) {
2138
+ break;
2139
+ }
2140
+
2141
+ message.projectId = reader.string();
2142
+ continue;
2143
+ }
2144
+ case 3: {
2145
+ if (tag !== 26) {
2146
+ break;
2147
+ }
2148
+
2149
+ message.slaId = reader.string();
2150
+ continue;
2151
+ }
2152
+ case 4: {
2153
+ if (tag !== 34) {
2154
+ break;
2155
+ }
2156
+
2157
+ message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2158
+ continue;
2159
+ }
2160
+ case 5: {
2161
+ if (tag !== 42) {
2162
+ break;
2163
+ }
2164
+
2165
+ message.endTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2166
+ continue;
2167
+ }
2168
+ case 6: {
2169
+ if (tag !== 48) {
2170
+ break;
2171
+ }
2172
+
2173
+ message.outcome = reader.int32() as any;
2174
+ continue;
2175
+ }
2176
+ case 7: {
2177
+ if (tag !== 56) {
2178
+ break;
2179
+ }
2180
+
2181
+ message.limit = reader.int32();
2182
+ continue;
2183
+ }
2184
+ case 8: {
2185
+ if (tag !== 64) {
2186
+ break;
2187
+ }
2188
+
2189
+ message.offset = reader.int32();
2190
+ continue;
2191
+ }
2192
+ }
2193
+ if ((tag & 7) === 4 || tag === 0) {
2194
+ break;
2195
+ }
2196
+ reader.skip(tag & 7);
2197
+ }
2198
+ return message;
2199
+ },
2200
+
2201
+ fromJSON(object: any): ListSlaOutcomesRequest {
2202
+ return {
2203
+ organizationId: isSet(object.organizationId)
2204
+ ? globalThis.String(object.organizationId)
2205
+ : isSet(object.organization_id)
2206
+ ? globalThis.String(object.organization_id)
2207
+ : "",
2208
+ projectId: isSet(object.projectId)
2209
+ ? globalThis.String(object.projectId)
2210
+ : isSet(object.project_id)
2211
+ ? globalThis.String(object.project_id)
2212
+ : "",
2213
+ slaId: isSet(object.slaId)
2214
+ ? globalThis.String(object.slaId)
2215
+ : isSet(object.sla_id)
2216
+ ? globalThis.String(object.sla_id)
2217
+ : "",
2218
+ startTime: isSet(object.startTime)
2219
+ ? fromJsonTimestamp(object.startTime)
2220
+ : isSet(object.start_time)
2221
+ ? fromJsonTimestamp(object.start_time)
2222
+ : undefined,
2223
+ endTime: isSet(object.endTime)
2224
+ ? fromJsonTimestamp(object.endTime)
2225
+ : isSet(object.end_time)
2226
+ ? fromJsonTimestamp(object.end_time)
2227
+ : undefined,
2228
+ outcome: isSet(object.outcome) ? slaOutcomeStatusFromJSON(object.outcome) : 0,
2229
+ limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0,
2230
+ offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0,
2231
+ };
2232
+ },
2233
+
2234
+ toJSON(message: ListSlaOutcomesRequest): unknown {
2235
+ const obj: any = {};
2236
+ if (message.organizationId !== "") {
2237
+ obj.organizationId = message.organizationId;
2238
+ }
2239
+ if (message.projectId !== "") {
2240
+ obj.projectId = message.projectId;
2241
+ }
2242
+ if (message.slaId !== "") {
2243
+ obj.slaId = message.slaId;
2244
+ }
2245
+ if (message.startTime !== undefined) {
2246
+ obj.startTime = message.startTime.toISOString();
2247
+ }
2248
+ if (message.endTime !== undefined) {
2249
+ obj.endTime = message.endTime.toISOString();
2250
+ }
2251
+ if (message.outcome !== 0) {
2252
+ obj.outcome = slaOutcomeStatusToJSON(message.outcome);
2253
+ }
2254
+ if (message.limit !== 0) {
2255
+ obj.limit = Math.round(message.limit);
2256
+ }
2257
+ if (message.offset !== 0) {
2258
+ obj.offset = Math.round(message.offset);
2259
+ }
2260
+ return obj;
2261
+ },
2262
+
2263
+ create<I extends Exact<DeepPartial<ListSlaOutcomesRequest>, I>>(base?: I): ListSlaOutcomesRequest {
2264
+ return ListSlaOutcomesRequest.fromPartial(base ?? ({} as any));
2265
+ },
2266
+ fromPartial<I extends Exact<DeepPartial<ListSlaOutcomesRequest>, I>>(object: I): ListSlaOutcomesRequest {
2267
+ const message = createBaseListSlaOutcomesRequest();
2268
+ message.organizationId = object.organizationId ?? "";
2269
+ message.projectId = object.projectId ?? "";
2270
+ message.slaId = object.slaId ?? "";
2271
+ message.startTime = object.startTime ?? undefined;
2272
+ message.endTime = object.endTime ?? undefined;
2273
+ message.outcome = object.outcome ?? 0;
2274
+ message.limit = object.limit ?? 0;
2275
+ message.offset = object.offset ?? 0;
2276
+ return message;
2277
+ },
2278
+ };
2279
+
2280
+ function createBaseListSlaOutcomesResponse(): ListSlaOutcomesResponse {
2281
+ return { status: undefined, outcomes: [] };
2282
+ }
2283
+
2284
+ export const ListSlaOutcomesResponse: MessageFns<ListSlaOutcomesResponse> = {
2285
+ encode(message: ListSlaOutcomesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2286
+ if (message.status !== undefined) {
2287
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2288
+ }
2289
+ for (const v of message.outcomes) {
2290
+ SlaOutcome.encode(v!, writer.uint32(18).fork()).join();
2291
+ }
2292
+ return writer;
2293
+ },
2294
+
2295
+ decode(input: BinaryReader | Uint8Array, length?: number): ListSlaOutcomesResponse {
2296
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2297
+ const end = length === undefined ? reader.len : reader.pos + length;
2298
+ const message = createBaseListSlaOutcomesResponse();
2299
+ while (reader.pos < end) {
2300
+ const tag = reader.uint32();
2301
+ switch (tag >>> 3) {
2302
+ case 1: {
2303
+ if (tag !== 10) {
2304
+ break;
2305
+ }
2306
+
2307
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2308
+ continue;
2309
+ }
2310
+ case 2: {
2311
+ if (tag !== 18) {
2312
+ break;
2313
+ }
2314
+
2315
+ message.outcomes.push(SlaOutcome.decode(reader, reader.uint32()));
2316
+ continue;
2317
+ }
2318
+ }
2319
+ if ((tag & 7) === 4 || tag === 0) {
2320
+ break;
2321
+ }
2322
+ reader.skip(tag & 7);
2323
+ }
2324
+ return message;
2325
+ },
2326
+
2327
+ fromJSON(object: any): ListSlaOutcomesResponse {
2328
+ return {
2329
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2330
+ outcomes: globalThis.Array.isArray(object?.outcomes)
2331
+ ? object.outcomes.map((e: any) => SlaOutcome.fromJSON(e))
2332
+ : [],
2333
+ };
2334
+ },
2335
+
2336
+ toJSON(message: ListSlaOutcomesResponse): unknown {
2337
+ const obj: any = {};
2338
+ if (message.status !== undefined) {
2339
+ obj.status = ResponseStatus.toJSON(message.status);
2340
+ }
2341
+ if (message.outcomes?.length) {
2342
+ obj.outcomes = message.outcomes.map((e) => SlaOutcome.toJSON(e));
2343
+ }
2344
+ return obj;
2345
+ },
2346
+
2347
+ create<I extends Exact<DeepPartial<ListSlaOutcomesResponse>, I>>(base?: I): ListSlaOutcomesResponse {
2348
+ return ListSlaOutcomesResponse.fromPartial(base ?? ({} as any));
2349
+ },
2350
+ fromPartial<I extends Exact<DeepPartial<ListSlaOutcomesResponse>, I>>(object: I): ListSlaOutcomesResponse {
2351
+ const message = createBaseListSlaOutcomesResponse();
2352
+ message.status = (object.status !== undefined && object.status !== null)
2353
+ ? ResponseStatus.fromPartial(object.status)
2354
+ : undefined;
2355
+ message.outcomes = object.outcomes?.map((e) => SlaOutcome.fromPartial(e)) || [];
2356
+ return message;
2357
+ },
2358
+ };
2359
+
2360
+ /** SlaGatewayService provides web client access to SLA definitions and outcomes. */
2361
+ export interface SlaGatewayService {
2362
+ CreateSla(request: CreateSlaRequest, metadata?: Metadata): Promise<CreateSlaResponse>;
2363
+ GetSla(request: GetSlaRequest, metadata?: Metadata): Promise<GetSlaResponse>;
2364
+ ListSlas(request: ListSlasRequest, metadata?: Metadata): Promise<ListSlasResponse>;
2365
+ UpdateSla(request: UpdateSlaRequest, metadata?: Metadata): Promise<UpdateSlaResponse>;
2366
+ DeleteSla(request: DeleteSlaRequest, metadata?: Metadata): Promise<DeleteSlaResponse>;
2367
+ ListSlaOutcomes(request: ListSlaOutcomesRequest, metadata?: Metadata): Promise<ListSlaOutcomesResponse>;
2368
+ }
2369
+
2370
+ export const SlaGatewayServiceServiceName = "gateway.web.v1.SlaGatewayService";
2371
+ export class SlaGatewayServiceClientImpl implements SlaGatewayService {
2372
+ private readonly rpc: Rpc;
2373
+ private readonly service: string;
2374
+ constructor(rpc: Rpc, opts?: { service?: string }) {
2375
+ this.service = opts?.service || SlaGatewayServiceServiceName;
2376
+ this.rpc = rpc;
2377
+ this.CreateSla = this.CreateSla.bind(this);
2378
+ this.GetSla = this.GetSla.bind(this);
2379
+ this.ListSlas = this.ListSlas.bind(this);
2380
+ this.UpdateSla = this.UpdateSla.bind(this);
2381
+ this.DeleteSla = this.DeleteSla.bind(this);
2382
+ this.ListSlaOutcomes = this.ListSlaOutcomes.bind(this);
2383
+ }
2384
+ CreateSla(request: CreateSlaRequest, metadata?: Metadata): Promise<CreateSlaResponse> {
2385
+ const data = CreateSlaRequest.encode(request).finish();
2386
+ const promise = this.rpc.request(this.service, "CreateSla", data, metadata);
2387
+ return promise.then((data) => CreateSlaResponse.decode(new BinaryReader(data)));
2388
+ }
2389
+
2390
+ GetSla(request: GetSlaRequest, metadata?: Metadata): Promise<GetSlaResponse> {
2391
+ const data = GetSlaRequest.encode(request).finish();
2392
+ const promise = this.rpc.request(this.service, "GetSla", data, metadata);
2393
+ return promise.then((data) => GetSlaResponse.decode(new BinaryReader(data)));
2394
+ }
2395
+
2396
+ ListSlas(request: ListSlasRequest, metadata?: Metadata): Promise<ListSlasResponse> {
2397
+ const data = ListSlasRequest.encode(request).finish();
2398
+ const promise = this.rpc.request(this.service, "ListSlas", data, metadata);
2399
+ return promise.then((data) => ListSlasResponse.decode(new BinaryReader(data)));
2400
+ }
2401
+
2402
+ UpdateSla(request: UpdateSlaRequest, metadata?: Metadata): Promise<UpdateSlaResponse> {
2403
+ const data = UpdateSlaRequest.encode(request).finish();
2404
+ const promise = this.rpc.request(this.service, "UpdateSla", data, metadata);
2405
+ return promise.then((data) => UpdateSlaResponse.decode(new BinaryReader(data)));
2406
+ }
2407
+
2408
+ DeleteSla(request: DeleteSlaRequest, metadata?: Metadata): Promise<DeleteSlaResponse> {
2409
+ const data = DeleteSlaRequest.encode(request).finish();
2410
+ const promise = this.rpc.request(this.service, "DeleteSla", data, metadata);
2411
+ return promise.then((data) => DeleteSlaResponse.decode(new BinaryReader(data)));
2412
+ }
2413
+
2414
+ ListSlaOutcomes(request: ListSlaOutcomesRequest, metadata?: Metadata): Promise<ListSlaOutcomesResponse> {
2415
+ const data = ListSlaOutcomesRequest.encode(request).finish();
2416
+ const promise = this.rpc.request(this.service, "ListSlaOutcomes", data, metadata);
2417
+ return promise.then((data) => ListSlaOutcomesResponse.decode(new BinaryReader(data)));
2418
+ }
2419
+ }
2420
+
2421
+ interface Rpc {
2422
+ request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise<Uint8Array>;
2423
+ }
2424
+
2425
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
2426
+
2427
+ export type DeepPartial<T> = T extends Builtin ? T
2428
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
2429
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
2430
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
2431
+ : Partial<T>;
2432
+
2433
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
2434
+ export type Exact<P, I extends P> = P extends Builtin ? P
2435
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
2436
+
2437
+ function toTimestamp(date: Date): Timestamp {
2438
+ const seconds = Math.trunc(date.getTime() / 1_000);
2439
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
2440
+ return { seconds, nanos };
2441
+ }
2442
+
2443
+ function fromTimestamp(t: Timestamp): Date {
2444
+ let millis = (t.seconds || 0) * 1_000;
2445
+ millis += (t.nanos || 0) / 1_000_000;
2446
+ return new globalThis.Date(millis);
2447
+ }
2448
+
2449
+ function fromJsonTimestamp(o: any): Date {
2450
+ if (o instanceof globalThis.Date) {
2451
+ return o;
2452
+ } else if (typeof o === "string") {
2453
+ return new globalThis.Date(o);
2454
+ } else {
2455
+ return fromTimestamp(Timestamp.fromJSON(o));
2456
+ }
2457
+ }
2458
+
2459
+ function longToNumber(int64: { toString(): string }): number {
2460
+ const num = globalThis.Number(int64.toString());
2461
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
2462
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
2463
+ }
2464
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
2465
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
2466
+ }
2467
+ return num;
2468
+ }
2469
+
2470
+ function isSet(value: any): boolean {
2471
+ return value !== null && value !== undefined;
2472
+ }
2473
+
2474
+ export interface MessageFns<T> {
2475
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
2476
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
2477
+ fromJSON(object: any): T;
2478
+ toJSON(message: T): unknown;
2479
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
2480
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
2481
+ }