@fatehan/tsrp 1.0.16 → 1.0.18

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.
@@ -2,10 +2,10 @@
2
2
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
3
  // versions:
4
4
  // protoc-gen-ts_proto v2.7.0
5
- // protoc v3.21.12
5
+ // protoc v6.31.1
6
6
  // source: packets/messages.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.Command = exports.CommandAkn = exports.CommandContent = exports.CommandStatus = exports.protobufPackage = void 0;
8
+ exports.CommandStruct = exports.CommandFormat = exports.CommandValidation = exports.Command = exports.CommandAkn = exports.CommandContent = exports.CommandStatus = exports.protobufPackage = void 0;
9
9
  exports.commandStatusFromJSON = commandStatusFromJSON;
10
10
  exports.commandStatusToJSON = commandStatusToJSON;
11
11
  /* eslint-disable */
@@ -56,18 +56,34 @@ function commandStatusToJSON(object) {
56
56
  }
57
57
  }
58
58
  function createBaseCommandContent() {
59
- return { commandId: undefined, message: undefined, params: [] };
59
+ return {
60
+ deviceId: 0,
61
+ commandId: undefined,
62
+ message: undefined,
63
+ params: [],
64
+ rawCommand: undefined,
65
+ command: new Uint8Array(0),
66
+ };
60
67
  }
61
68
  exports.CommandContent = {
62
69
  encode(message, writer = new wire_1.BinaryWriter()) {
70
+ if (message.deviceId !== 0) {
71
+ writer.uint32(8).uint64(message.deviceId);
72
+ }
63
73
  if (message.commandId !== undefined) {
64
- writer.uint32(8).uint64(message.commandId);
74
+ writer.uint32(16).uint64(message.commandId);
65
75
  }
66
76
  if (message.message !== undefined) {
67
- writer.uint32(18).string(message.message);
77
+ writer.uint32(26).string(message.message);
68
78
  }
69
79
  for (const v of message.params) {
70
- writer.uint32(26).string(v);
80
+ writer.uint32(34).string(v);
81
+ }
82
+ if (message.rawCommand !== undefined) {
83
+ writer.uint32(42).string(message.rawCommand);
84
+ }
85
+ if (message.command.length !== 0) {
86
+ writer.uint32(50).bytes(message.command);
71
87
  }
72
88
  return writer;
73
89
  },
@@ -82,23 +98,44 @@ exports.CommandContent = {
82
98
  if (tag !== 8) {
83
99
  break;
84
100
  }
85
- message.commandId = longToNumber(reader.uint64());
101
+ message.deviceId = longToNumber(reader.uint64());
86
102
  continue;
87
103
  }
88
104
  case 2: {
89
- if (tag !== 18) {
105
+ if (tag !== 16) {
90
106
  break;
91
107
  }
92
- message.message = reader.string();
108
+ message.commandId = longToNumber(reader.uint64());
93
109
  continue;
94
110
  }
95
111
  case 3: {
96
112
  if (tag !== 26) {
97
113
  break;
98
114
  }
115
+ message.message = reader.string();
116
+ continue;
117
+ }
118
+ case 4: {
119
+ if (tag !== 34) {
120
+ break;
121
+ }
99
122
  message.params.push(reader.string());
100
123
  continue;
101
124
  }
125
+ case 5: {
126
+ if (tag !== 42) {
127
+ break;
128
+ }
129
+ message.rawCommand = reader.string();
130
+ continue;
131
+ }
132
+ case 6: {
133
+ if (tag !== 50) {
134
+ break;
135
+ }
136
+ message.command = reader.bytes();
137
+ continue;
138
+ }
102
139
  }
103
140
  if ((tag & 7) === 4 || tag === 0) {
104
141
  break;
@@ -109,14 +146,20 @@ exports.CommandContent = {
109
146
  },
110
147
  fromJSON(object) {
111
148
  return {
149
+ deviceId: isSet(object.device_id) ? globalThis.Number(object.device_id) : 0,
112
150
  commandId: isSet(object.command_id) ? globalThis.Number(object.command_id) : undefined,
113
151
  message: isSet(object.message) ? globalThis.String(object.message) : undefined,
114
152
  params: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.params) ? object.params.map((e) => globalThis.String(e)) : [],
153
+ rawCommand: isSet(object.raw_command) ? globalThis.String(object.raw_command) : undefined,
154
+ command: isSet(object.command) ? bytesFromBase64(object.command) : new Uint8Array(0),
115
155
  };
116
156
  },
117
157
  toJSON(message) {
118
158
  var _a;
119
159
  const obj = {};
160
+ if (message.deviceId !== 0) {
161
+ obj.device_id = Math.round(message.deviceId);
162
+ }
120
163
  if (message.commandId !== undefined) {
121
164
  obj.command_id = Math.round(message.commandId);
122
165
  }
@@ -126,17 +169,26 @@ exports.CommandContent = {
126
169
  if ((_a = message.params) === null || _a === void 0 ? void 0 : _a.length) {
127
170
  obj.params = message.params;
128
171
  }
172
+ if (message.rawCommand !== undefined) {
173
+ obj.raw_command = message.rawCommand;
174
+ }
175
+ if (message.command.length !== 0) {
176
+ obj.command = base64FromBytes(message.command);
177
+ }
129
178
  return obj;
130
179
  },
131
180
  create(base) {
132
181
  return exports.CommandContent.fromPartial(base !== null && base !== void 0 ? base : {});
133
182
  },
134
183
  fromPartial(object) {
135
- var _a, _b, _c;
184
+ var _a, _b, _c, _d, _e, _f;
136
185
  const message = createBaseCommandContent();
137
- message.commandId = (_a = object.commandId) !== null && _a !== void 0 ? _a : undefined;
138
- message.message = (_b = object.message) !== null && _b !== void 0 ? _b : undefined;
139
- message.params = ((_c = object.params) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
186
+ message.deviceId = (_a = object.deviceId) !== null && _a !== void 0 ? _a : 0;
187
+ message.commandId = (_b = object.commandId) !== null && _b !== void 0 ? _b : undefined;
188
+ message.message = (_c = object.message) !== null && _c !== void 0 ? _c : undefined;
189
+ message.params = ((_d = object.params) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || [];
190
+ message.rawCommand = (_e = object.rawCommand) !== null && _e !== void 0 ? _e : undefined;
191
+ message.command = (_f = object.command) !== null && _f !== void 0 ? _f : new Uint8Array(0);
140
192
  return message;
141
193
  },
142
194
  };
@@ -213,9 +265,9 @@ function createBaseCommand() {
213
265
  return {
214
266
  id: 0,
215
267
  deviceId: 0,
216
- userId: 0,
217
- commandId: 0,
218
- replyId: 0,
268
+ userId: undefined,
269
+ commandId: undefined,
270
+ replyId: undefined,
219
271
  status: 0,
220
272
  command: undefined,
221
273
  akn: undefined,
@@ -231,13 +283,13 @@ exports.Command = {
231
283
  if (message.deviceId !== 0) {
232
284
  writer.uint32(16).uint64(message.deviceId);
233
285
  }
234
- if (message.userId !== 0) {
286
+ if (message.userId !== undefined) {
235
287
  writer.uint32(24).uint64(message.userId);
236
288
  }
237
- if (message.commandId !== 0) {
289
+ if (message.commandId !== undefined) {
238
290
  writer.uint32(32).uint64(message.commandId);
239
291
  }
240
- if (message.replyId !== 0) {
292
+ if (message.replyId !== undefined) {
241
293
  writer.uint32(40).uint64(message.replyId);
242
294
  }
243
295
  if (message.status !== 0) {
@@ -346,9 +398,9 @@ exports.Command = {
346
398
  return {
347
399
  id: isSet(object.id) ? globalThis.Number(object.id) : 0,
348
400
  deviceId: isSet(object.device_id) ? globalThis.Number(object.device_id) : 0,
349
- userId: isSet(object.user_id) ? globalThis.Number(object.user_id) : 0,
350
- commandId: isSet(object.command_id) ? globalThis.Number(object.command_id) : 0,
351
- replyId: isSet(object.reply_id) ? globalThis.Number(object.reply_id) : 0,
401
+ userId: isSet(object.user_id) ? globalThis.Number(object.user_id) : undefined,
402
+ commandId: isSet(object.command_id) ? globalThis.Number(object.command_id) : undefined,
403
+ replyId: isSet(object.reply_id) ? globalThis.Number(object.reply_id) : undefined,
352
404
  status: isSet(object.status) ? commandStatusFromJSON(object.status) : 0,
353
405
  command: isSet(object.command) ? exports.CommandContent.fromJSON(object.command) : undefined,
354
406
  akn: isSet(object.akn) ? exports.CommandAkn.fromJSON(object.akn) : undefined,
@@ -364,13 +416,13 @@ exports.Command = {
364
416
  if (message.deviceId !== 0) {
365
417
  obj.device_id = Math.round(message.deviceId);
366
418
  }
367
- if (message.userId !== 0) {
419
+ if (message.userId !== undefined) {
368
420
  obj.user_id = Math.round(message.userId);
369
421
  }
370
- if (message.commandId !== 0) {
422
+ if (message.commandId !== undefined) {
371
423
  obj.command_id = Math.round(message.commandId);
372
424
  }
373
- if (message.replyId !== 0) {
425
+ if (message.replyId !== undefined) {
374
426
  obj.reply_id = Math.round(message.replyId);
375
427
  }
376
428
  if (message.status !== 0) {
@@ -398,9 +450,9 @@ exports.Command = {
398
450
  const message = createBaseCommand();
399
451
  message.id = (_a = object.id) !== null && _a !== void 0 ? _a : 0;
400
452
  message.deviceId = (_b = object.deviceId) !== null && _b !== void 0 ? _b : 0;
401
- message.userId = (_c = object.userId) !== null && _c !== void 0 ? _c : 0;
402
- message.commandId = (_d = object.commandId) !== null && _d !== void 0 ? _d : 0;
403
- message.replyId = (_e = object.replyId) !== null && _e !== void 0 ? _e : 0;
453
+ message.userId = (_c = object.userId) !== null && _c !== void 0 ? _c : undefined;
454
+ message.commandId = (_d = object.commandId) !== null && _d !== void 0 ? _d : undefined;
455
+ message.replyId = (_e = object.replyId) !== null && _e !== void 0 ? _e : undefined;
404
456
  message.status = (_f = object.status) !== null && _f !== void 0 ? _f : 0;
405
457
  message.command = (object.command !== undefined && object.command !== null)
406
458
  ? exports.CommandContent.fromPartial(object.command)
@@ -411,6 +463,482 @@ exports.Command = {
411
463
  return message;
412
464
  },
413
465
  };
466
+ function createBaseCommandValidation() {
467
+ return { max: 0, min: 0, name: "", type: "", description: "", isRequired: false };
468
+ }
469
+ exports.CommandValidation = {
470
+ encode(message, writer = new wire_1.BinaryWriter()) {
471
+ if (message.max !== 0) {
472
+ writer.uint32(8).sint64(message.max);
473
+ }
474
+ if (message.min !== 0) {
475
+ writer.uint32(16).sint64(message.min);
476
+ }
477
+ if (message.name !== "") {
478
+ writer.uint32(26).string(message.name);
479
+ }
480
+ if (message.type !== "") {
481
+ writer.uint32(34).string(message.type);
482
+ }
483
+ if (message.description !== "") {
484
+ writer.uint32(42).string(message.description);
485
+ }
486
+ if (message.isRequired !== false) {
487
+ writer.uint32(48).bool(message.isRequired);
488
+ }
489
+ return writer;
490
+ },
491
+ decode(input, length) {
492
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
493
+ let end = length === undefined ? reader.len : reader.pos + length;
494
+ const message = createBaseCommandValidation();
495
+ while (reader.pos < end) {
496
+ const tag = reader.uint32();
497
+ switch (tag >>> 3) {
498
+ case 1: {
499
+ if (tag !== 8) {
500
+ break;
501
+ }
502
+ message.max = longToNumber(reader.sint64());
503
+ continue;
504
+ }
505
+ case 2: {
506
+ if (tag !== 16) {
507
+ break;
508
+ }
509
+ message.min = longToNumber(reader.sint64());
510
+ continue;
511
+ }
512
+ case 3: {
513
+ if (tag !== 26) {
514
+ break;
515
+ }
516
+ message.name = reader.string();
517
+ continue;
518
+ }
519
+ case 4: {
520
+ if (tag !== 34) {
521
+ break;
522
+ }
523
+ message.type = reader.string();
524
+ continue;
525
+ }
526
+ case 5: {
527
+ if (tag !== 42) {
528
+ break;
529
+ }
530
+ message.description = reader.string();
531
+ continue;
532
+ }
533
+ case 6: {
534
+ if (tag !== 48) {
535
+ break;
536
+ }
537
+ message.isRequired = reader.bool();
538
+ continue;
539
+ }
540
+ }
541
+ if ((tag & 7) === 4 || tag === 0) {
542
+ break;
543
+ }
544
+ reader.skip(tag & 7);
545
+ }
546
+ return message;
547
+ },
548
+ fromJSON(object) {
549
+ return {
550
+ max: isSet(object.max) ? globalThis.Number(object.max) : 0,
551
+ min: isSet(object.min) ? globalThis.Number(object.min) : 0,
552
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
553
+ type: isSet(object.type) ? globalThis.String(object.type) : "",
554
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
555
+ isRequired: isSet(object.is_required) ? globalThis.Boolean(object.is_required) : false,
556
+ };
557
+ },
558
+ toJSON(message) {
559
+ const obj = {};
560
+ if (message.max !== 0) {
561
+ obj.max = Math.round(message.max);
562
+ }
563
+ if (message.min !== 0) {
564
+ obj.min = Math.round(message.min);
565
+ }
566
+ if (message.name !== "") {
567
+ obj.name = message.name;
568
+ }
569
+ if (message.type !== "") {
570
+ obj.type = message.type;
571
+ }
572
+ if (message.description !== "") {
573
+ obj.description = message.description;
574
+ }
575
+ if (message.isRequired !== false) {
576
+ obj.is_required = message.isRequired;
577
+ }
578
+ return obj;
579
+ },
580
+ create(base) {
581
+ return exports.CommandValidation.fromPartial(base !== null && base !== void 0 ? base : {});
582
+ },
583
+ fromPartial(object) {
584
+ var _a, _b, _c, _d, _e, _f;
585
+ const message = createBaseCommandValidation();
586
+ message.max = (_a = object.max) !== null && _a !== void 0 ? _a : 0;
587
+ message.min = (_b = object.min) !== null && _b !== void 0 ? _b : 0;
588
+ message.name = (_c = object.name) !== null && _c !== void 0 ? _c : "";
589
+ message.type = (_d = object.type) !== null && _d !== void 0 ? _d : "";
590
+ message.description = (_e = object.description) !== null && _e !== void 0 ? _e : "";
591
+ message.isRequired = (_f = object.isRequired) !== null && _f !== void 0 ? _f : false;
592
+ return message;
593
+ },
594
+ };
595
+ function createBaseCommandFormat() {
596
+ return { structure: "", parameters: [] };
597
+ }
598
+ exports.CommandFormat = {
599
+ encode(message, writer = new wire_1.BinaryWriter()) {
600
+ if (message.structure !== "") {
601
+ writer.uint32(10).string(message.structure);
602
+ }
603
+ for (const v of message.parameters) {
604
+ exports.CommandValidation.encode(v, writer.uint32(18).fork()).join();
605
+ }
606
+ return writer;
607
+ },
608
+ decode(input, length) {
609
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
610
+ let end = length === undefined ? reader.len : reader.pos + length;
611
+ const message = createBaseCommandFormat();
612
+ while (reader.pos < end) {
613
+ const tag = reader.uint32();
614
+ switch (tag >>> 3) {
615
+ case 1: {
616
+ if (tag !== 10) {
617
+ break;
618
+ }
619
+ message.structure = reader.string();
620
+ continue;
621
+ }
622
+ case 2: {
623
+ if (tag !== 18) {
624
+ break;
625
+ }
626
+ message.parameters.push(exports.CommandValidation.decode(reader, reader.uint32()));
627
+ continue;
628
+ }
629
+ }
630
+ if ((tag & 7) === 4 || tag === 0) {
631
+ break;
632
+ }
633
+ reader.skip(tag & 7);
634
+ }
635
+ return message;
636
+ },
637
+ fromJSON(object) {
638
+ return {
639
+ structure: isSet(object.structure) ? globalThis.String(object.structure) : "",
640
+ parameters: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.parameters)
641
+ ? object.parameters.map((e) => exports.CommandValidation.fromJSON(e))
642
+ : [],
643
+ };
644
+ },
645
+ toJSON(message) {
646
+ var _a;
647
+ const obj = {};
648
+ if (message.structure !== "") {
649
+ obj.structure = message.structure;
650
+ }
651
+ if ((_a = message.parameters) === null || _a === void 0 ? void 0 : _a.length) {
652
+ obj.parameters = message.parameters.map((e) => exports.CommandValidation.toJSON(e));
653
+ }
654
+ return obj;
655
+ },
656
+ create(base) {
657
+ return exports.CommandFormat.fromPartial(base !== null && base !== void 0 ? base : {});
658
+ },
659
+ fromPartial(object) {
660
+ var _a, _b;
661
+ const message = createBaseCommandFormat();
662
+ message.structure = (_a = object.structure) !== null && _a !== void 0 ? _a : "";
663
+ message.parameters = ((_b = object.parameters) === null || _b === void 0 ? void 0 : _b.map((e) => exports.CommandValidation.fromPartial(e))) || [];
664
+ return message;
665
+ },
666
+ };
667
+ function createBaseCommandStruct() {
668
+ return {
669
+ id: 0,
670
+ trackerId: 0,
671
+ userCreatedId: undefined,
672
+ userUpdatedId: undefined,
673
+ organizationId: undefined,
674
+ name: "",
675
+ sortOrder: 0,
676
+ visible: 0,
677
+ description: undefined,
678
+ sms: undefined,
679
+ grpc: undefined,
680
+ createdAt: undefined,
681
+ updatedAt: undefined,
682
+ };
683
+ }
684
+ exports.CommandStruct = {
685
+ encode(message, writer = new wire_1.BinaryWriter()) {
686
+ if (message.id !== 0) {
687
+ writer.uint32(8).uint64(message.id);
688
+ }
689
+ if (message.trackerId !== 0) {
690
+ writer.uint32(16).uint64(message.trackerId);
691
+ }
692
+ if (message.userCreatedId !== undefined) {
693
+ writer.uint32(24).uint64(message.userCreatedId);
694
+ }
695
+ if (message.userUpdatedId !== undefined) {
696
+ writer.uint32(32).uint64(message.userUpdatedId);
697
+ }
698
+ if (message.organizationId !== undefined) {
699
+ writer.uint32(40).uint64(message.organizationId);
700
+ }
701
+ if (message.name !== "") {
702
+ writer.uint32(50).string(message.name);
703
+ }
704
+ if (message.sortOrder !== 0) {
705
+ writer.uint32(56).uint64(message.sortOrder);
706
+ }
707
+ if (message.visible !== 0) {
708
+ writer.uint32(64).uint64(message.visible);
709
+ }
710
+ if (message.description !== undefined) {
711
+ writer.uint32(74).string(message.description);
712
+ }
713
+ if (message.sms !== undefined) {
714
+ exports.CommandFormat.encode(message.sms, writer.uint32(82).fork()).join();
715
+ }
716
+ if (message.grpc !== undefined) {
717
+ exports.CommandFormat.encode(message.grpc, writer.uint32(90).fork()).join();
718
+ }
719
+ if (message.createdAt !== undefined) {
720
+ timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(98).fork()).join();
721
+ }
722
+ if (message.updatedAt !== undefined) {
723
+ timestamp_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(106).fork()).join();
724
+ }
725
+ return writer;
726
+ },
727
+ decode(input, length) {
728
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
729
+ let end = length === undefined ? reader.len : reader.pos + length;
730
+ const message = createBaseCommandStruct();
731
+ while (reader.pos < end) {
732
+ const tag = reader.uint32();
733
+ switch (tag >>> 3) {
734
+ case 1: {
735
+ if (tag !== 8) {
736
+ break;
737
+ }
738
+ message.id = longToNumber(reader.uint64());
739
+ continue;
740
+ }
741
+ case 2: {
742
+ if (tag !== 16) {
743
+ break;
744
+ }
745
+ message.trackerId = longToNumber(reader.uint64());
746
+ continue;
747
+ }
748
+ case 3: {
749
+ if (tag !== 24) {
750
+ break;
751
+ }
752
+ message.userCreatedId = longToNumber(reader.uint64());
753
+ continue;
754
+ }
755
+ case 4: {
756
+ if (tag !== 32) {
757
+ break;
758
+ }
759
+ message.userUpdatedId = longToNumber(reader.uint64());
760
+ continue;
761
+ }
762
+ case 5: {
763
+ if (tag !== 40) {
764
+ break;
765
+ }
766
+ message.organizationId = longToNumber(reader.uint64());
767
+ continue;
768
+ }
769
+ case 6: {
770
+ if (tag !== 50) {
771
+ break;
772
+ }
773
+ message.name = reader.string();
774
+ continue;
775
+ }
776
+ case 7: {
777
+ if (tag !== 56) {
778
+ break;
779
+ }
780
+ message.sortOrder = longToNumber(reader.uint64());
781
+ continue;
782
+ }
783
+ case 8: {
784
+ if (tag !== 64) {
785
+ break;
786
+ }
787
+ message.visible = longToNumber(reader.uint64());
788
+ continue;
789
+ }
790
+ case 9: {
791
+ if (tag !== 74) {
792
+ break;
793
+ }
794
+ message.description = reader.string();
795
+ continue;
796
+ }
797
+ case 10: {
798
+ if (tag !== 82) {
799
+ break;
800
+ }
801
+ message.sms = exports.CommandFormat.decode(reader, reader.uint32());
802
+ continue;
803
+ }
804
+ case 11: {
805
+ if (tag !== 90) {
806
+ break;
807
+ }
808
+ message.grpc = exports.CommandFormat.decode(reader, reader.uint32());
809
+ continue;
810
+ }
811
+ case 12: {
812
+ if (tag !== 98) {
813
+ break;
814
+ }
815
+ message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
816
+ continue;
817
+ }
818
+ case 13: {
819
+ if (tag !== 106) {
820
+ break;
821
+ }
822
+ message.updatedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
823
+ continue;
824
+ }
825
+ }
826
+ if ((tag & 7) === 4 || tag === 0) {
827
+ break;
828
+ }
829
+ reader.skip(tag & 7);
830
+ }
831
+ return message;
832
+ },
833
+ fromJSON(object) {
834
+ return {
835
+ id: isSet(object.id) ? globalThis.Number(object.id) : 0,
836
+ trackerId: isSet(object.tracker_id) ? globalThis.Number(object.tracker_id) : 0,
837
+ userCreatedId: isSet(object.created_by) ? globalThis.Number(object.created_by) : undefined,
838
+ userUpdatedId: isSet(object.updated_by) ? globalThis.Number(object.updated_by) : undefined,
839
+ organizationId: isSet(object.organization_id) ? globalThis.Number(object.organization_id) : undefined,
840
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
841
+ sortOrder: isSet(object.sord) ? globalThis.Number(object.sord) : 0,
842
+ visible: isSet(object.visible) ? globalThis.Number(object.visible) : 0,
843
+ description: isSet(object.description) ? globalThis.String(object.description) : undefined,
844
+ sms: isSet(object.sms) ? exports.CommandFormat.fromJSON(object.sms) : undefined,
845
+ grpc: isSet(object.grpc) ? exports.CommandFormat.fromJSON(object.grpc) : undefined,
846
+ createdAt: isSet(object.created_at) ? fromJsonTimestamp(object.created_at) : undefined,
847
+ updatedAt: isSet(object.updated_at) ? fromJsonTimestamp(object.updated_at) : undefined,
848
+ };
849
+ },
850
+ toJSON(message) {
851
+ const obj = {};
852
+ if (message.id !== 0) {
853
+ obj.id = Math.round(message.id);
854
+ }
855
+ if (message.trackerId !== 0) {
856
+ obj.tracker_id = Math.round(message.trackerId);
857
+ }
858
+ if (message.userCreatedId !== undefined) {
859
+ obj.created_by = Math.round(message.userCreatedId);
860
+ }
861
+ if (message.userUpdatedId !== undefined) {
862
+ obj.updated_by = Math.round(message.userUpdatedId);
863
+ }
864
+ if (message.organizationId !== undefined) {
865
+ obj.organization_id = Math.round(message.organizationId);
866
+ }
867
+ if (message.name !== "") {
868
+ obj.name = message.name;
869
+ }
870
+ if (message.sortOrder !== 0) {
871
+ obj.sord = Math.round(message.sortOrder);
872
+ }
873
+ if (message.visible !== 0) {
874
+ obj.visible = Math.round(message.visible);
875
+ }
876
+ if (message.description !== undefined) {
877
+ obj.description = message.description;
878
+ }
879
+ if (message.sms !== undefined) {
880
+ obj.sms = exports.CommandFormat.toJSON(message.sms);
881
+ }
882
+ if (message.grpc !== undefined) {
883
+ obj.grpc = exports.CommandFormat.toJSON(message.grpc);
884
+ }
885
+ if (message.createdAt !== undefined) {
886
+ obj.created_at = message.createdAt.toISOString();
887
+ }
888
+ if (message.updatedAt !== undefined) {
889
+ obj.updated_at = message.updatedAt.toISOString();
890
+ }
891
+ return obj;
892
+ },
893
+ create(base) {
894
+ return exports.CommandStruct.fromPartial(base !== null && base !== void 0 ? base : {});
895
+ },
896
+ fromPartial(object) {
897
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
898
+ const message = createBaseCommandStruct();
899
+ message.id = (_a = object.id) !== null && _a !== void 0 ? _a : 0;
900
+ message.trackerId = (_b = object.trackerId) !== null && _b !== void 0 ? _b : 0;
901
+ message.userCreatedId = (_c = object.userCreatedId) !== null && _c !== void 0 ? _c : undefined;
902
+ message.userUpdatedId = (_d = object.userUpdatedId) !== null && _d !== void 0 ? _d : undefined;
903
+ message.organizationId = (_e = object.organizationId) !== null && _e !== void 0 ? _e : undefined;
904
+ message.name = (_f = object.name) !== null && _f !== void 0 ? _f : "";
905
+ message.sortOrder = (_g = object.sortOrder) !== null && _g !== void 0 ? _g : 0;
906
+ message.visible = (_h = object.visible) !== null && _h !== void 0 ? _h : 0;
907
+ message.description = (_j = object.description) !== null && _j !== void 0 ? _j : undefined;
908
+ message.sms = (object.sms !== undefined && object.sms !== null) ? exports.CommandFormat.fromPartial(object.sms) : undefined;
909
+ message.grpc = (object.grpc !== undefined && object.grpc !== null)
910
+ ? exports.CommandFormat.fromPartial(object.grpc)
911
+ : undefined;
912
+ message.createdAt = (_k = object.createdAt) !== null && _k !== void 0 ? _k : undefined;
913
+ message.updatedAt = (_l = object.updatedAt) !== null && _l !== void 0 ? _l : undefined;
914
+ return message;
915
+ },
916
+ };
917
+ function bytesFromBase64(b64) {
918
+ if (globalThis.Buffer) {
919
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
920
+ }
921
+ else {
922
+ const bin = globalThis.atob(b64);
923
+ const arr = new Uint8Array(bin.length);
924
+ for (let i = 0; i < bin.length; ++i) {
925
+ arr[i] = bin.charCodeAt(i);
926
+ }
927
+ return arr;
928
+ }
929
+ }
930
+ function base64FromBytes(arr) {
931
+ if (globalThis.Buffer) {
932
+ return globalThis.Buffer.from(arr).toString("base64");
933
+ }
934
+ else {
935
+ const bin = [];
936
+ arr.forEach((byte) => {
937
+ bin.push(globalThis.String.fromCharCode(byte));
938
+ });
939
+ return globalThis.btoa(bin.join(""));
940
+ }
941
+ }
414
942
  function toTimestamp(date) {
415
943
  const seconds = Math.trunc(date.getTime() / 1000);
416
944
  const nanos = (date.getTime() % 1000) * 1000000;