@fatehan/tsrp 1.0.11 → 1.0.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/fatehan/packets/messages.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAErE,eAAO,MAAM,eAAe,wBAAwB,CAAC;AAErD,oBAAY,WAAW;IACrB,IAAI,IAAI;IACR,oBAAoB,IAAI;IACxB,uBAAuB,IAAI;IAC3B,mBAAmB,IAAI;IACvB,YAAY,KAAK;CAClB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,GAAG,WAAW,CAmB5D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAc7D;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,UAAU,CAAC;CACrB;AAMD,eAAO,MAAM,aAAa,EAAE,UAAU,CAAC,aAAa,CAsFnD,CAAC;AAMF,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,CAwFzD,CAAC;AAMF,eAAO,MAAM,YAAY,EAAE,UAAU,CAAC,YAAY,CAsEjD,CAAC;AAMF,eAAO,MAAM,aAAa,EAAE,UAAU,CAAC,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3B,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;IAC7D,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC;IACzB,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;IAC5B,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACxD,WAAW,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;CAC/D"}
@@ -5,97 +5,77 @@
5
5
  // protoc v3.21.12
6
6
  // source: packets/messages.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.BrokerMessage = exports.DeviceAnswer = exports.DeviceCommandAkn = exports.DeviceCommand = exports.MessageType = exports.protobufPackage = void 0;
9
- exports.messageTypeFromJSON = messageTypeFromJSON;
10
- exports.messageTypeToJSON = messageTypeToJSON;
8
+ exports.Command = exports.CommandAkn = exports.CommandContent = exports.CommandStatus = exports.protobufPackage = void 0;
9
+ exports.commandStatusFromJSON = commandStatusFromJSON;
10
+ exports.commandStatusToJSON = commandStatusToJSON;
11
11
  /* eslint-disable */
12
12
  const wire_1 = require("@bufbuild/protobuf/wire");
13
13
  exports.protobufPackage = "com.fatehan.packets";
14
- var MessageType;
15
- (function (MessageType) {
16
- MessageType[MessageType["None"] = 0] = "None";
17
- MessageType[MessageType["DeviceCommandMessage"] = 1] = "DeviceCommandMessage";
18
- MessageType[MessageType["DeviceCommandAknMessage"] = 2] = "DeviceCommandAknMessage";
19
- MessageType[MessageType["DeviceAnswerMessage"] = 3] = "DeviceAnswerMessage";
20
- MessageType[MessageType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
21
- })(MessageType || (exports.MessageType = MessageType = {}));
22
- function messageTypeFromJSON(object) {
14
+ var CommandStatus;
15
+ (function (CommandStatus) {
16
+ CommandStatus[CommandStatus["PENDING"] = 0] = "PENDING";
17
+ CommandStatus[CommandStatus["OFFLINE"] = 1] = "OFFLINE";
18
+ CommandStatus[CommandStatus["ERROR"] = 2] = "ERROR";
19
+ CommandStatus[CommandStatus["SENT"] = 3] = "SENT";
20
+ CommandStatus[CommandStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
21
+ })(CommandStatus || (exports.CommandStatus = CommandStatus = {}));
22
+ function commandStatusFromJSON(object) {
23
23
  switch (object) {
24
24
  case 0:
25
- case "None":
26
- return MessageType.None;
25
+ case "PENDING":
26
+ return CommandStatus.PENDING;
27
27
  case 1:
28
- case "DeviceCommandMessage":
29
- return MessageType.DeviceCommandMessage;
28
+ case "OFFLINE":
29
+ return CommandStatus.OFFLINE;
30
30
  case 2:
31
- case "DeviceCommandAknMessage":
32
- return MessageType.DeviceCommandAknMessage;
31
+ case "ERROR":
32
+ return CommandStatus.ERROR;
33
33
  case 3:
34
- case "DeviceAnswerMessage":
35
- return MessageType.DeviceAnswerMessage;
34
+ case "SENT":
35
+ return CommandStatus.SENT;
36
36
  case -1:
37
37
  case "UNRECOGNIZED":
38
38
  default:
39
- return MessageType.UNRECOGNIZED;
39
+ return CommandStatus.UNRECOGNIZED;
40
40
  }
41
41
  }
42
- function messageTypeToJSON(object) {
42
+ function commandStatusToJSON(object) {
43
43
  switch (object) {
44
- case MessageType.None:
45
- return "None";
46
- case MessageType.DeviceCommandMessage:
47
- return "DeviceCommandMessage";
48
- case MessageType.DeviceCommandAknMessage:
49
- return "DeviceCommandAknMessage";
50
- case MessageType.DeviceAnswerMessage:
51
- return "DeviceAnswerMessage";
52
- case MessageType.UNRECOGNIZED:
44
+ case CommandStatus.PENDING:
45
+ return "PENDING";
46
+ case CommandStatus.OFFLINE:
47
+ return "OFFLINE";
48
+ case CommandStatus.ERROR:
49
+ return "ERROR";
50
+ case CommandStatus.SENT:
51
+ return "SENT";
52
+ case CommandStatus.UNRECOGNIZED:
53
53
  default:
54
54
  return "UNRECOGNIZED";
55
55
  }
56
56
  }
57
- function createBaseDeviceCommand() {
58
- return { deviceId: 0, command: "", commandId: 0 };
57
+ function createBaseCommandContent() {
58
+ return { message: "" };
59
59
  }
60
- exports.DeviceCommand = {
60
+ exports.CommandContent = {
61
61
  encode(message, writer = new wire_1.BinaryWriter()) {
62
- if (message.deviceId !== 0) {
63
- writer.uint32(8).uint64(message.deviceId);
64
- }
65
- if (message.command !== "") {
66
- writer.uint32(18).string(message.command);
67
- }
68
- if (message.commandId !== 0) {
69
- writer.uint32(24).uint64(message.commandId);
62
+ if (message.message !== "") {
63
+ writer.uint32(10).string(message.message);
70
64
  }
71
65
  return writer;
72
66
  },
73
67
  decode(input, length) {
74
68
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
75
69
  let end = length === undefined ? reader.len : reader.pos + length;
76
- const message = createBaseDeviceCommand();
70
+ const message = createBaseCommandContent();
77
71
  while (reader.pos < end) {
78
72
  const tag = reader.uint32();
79
73
  switch (tag >>> 3) {
80
74
  case 1: {
81
- if (tag !== 8) {
82
- break;
83
- }
84
- message.deviceId = longToNumber(reader.uint64());
85
- continue;
86
- }
87
- case 2: {
88
- if (tag !== 18) {
89
- break;
90
- }
91
- message.command = reader.string();
92
- continue;
93
- }
94
- case 3: {
95
- if (tag !== 24) {
75
+ if (tag !== 10) {
96
76
  break;
97
77
  }
98
- message.commandId = longToNumber(reader.uint64());
78
+ message.message = reader.string();
99
79
  continue;
100
80
  }
101
81
  }
@@ -107,76 +87,54 @@ exports.DeviceCommand = {
107
87
  return message;
108
88
  },
109
89
  fromJSON(object) {
110
- return {
111
- deviceId: isSet(object.device_id) ? globalThis.Number(object.device_id) : 0,
112
- command: isSet(object.command) ? globalThis.String(object.command) : "",
113
- commandId: isSet(object.command_id) ? globalThis.Number(object.command_id) : 0,
114
- };
90
+ return { message: isSet(object.message) ? globalThis.String(object.message) : "" };
115
91
  },
116
92
  toJSON(message) {
117
93
  const obj = {};
118
- if (message.deviceId !== 0) {
119
- obj.device_id = Math.round(message.deviceId);
120
- }
121
- if (message.command !== "") {
122
- obj.command = message.command;
123
- }
124
- if (message.commandId !== 0) {
125
- obj.command_id = Math.round(message.commandId);
94
+ if (message.message !== "") {
95
+ obj.message = message.message;
126
96
  }
127
97
  return obj;
128
98
  },
129
99
  create(base) {
130
- return exports.DeviceCommand.fromPartial(base !== null && base !== void 0 ? base : {});
100
+ return exports.CommandContent.fromPartial(base !== null && base !== void 0 ? base : {});
131
101
  },
132
102
  fromPartial(object) {
133
- var _a, _b, _c;
134
- const message = createBaseDeviceCommand();
135
- message.deviceId = (_a = object.deviceId) !== null && _a !== void 0 ? _a : 0;
136
- message.command = (_b = object.command) !== null && _b !== void 0 ? _b : "";
137
- message.commandId = (_c = object.commandId) !== null && _c !== void 0 ? _c : 0;
103
+ var _a;
104
+ const message = createBaseCommandContent();
105
+ message.message = (_a = object.message) !== null && _a !== void 0 ? _a : "";
138
106
  return message;
139
107
  },
140
108
  };
141
- function createBaseDeviceCommandAkn() {
142
- return { command: undefined, status: 0, message: "" };
109
+ function createBaseCommandAkn() {
110
+ return { code: 0, message: "" };
143
111
  }
144
- exports.DeviceCommandAkn = {
112
+ exports.CommandAkn = {
145
113
  encode(message, writer = new wire_1.BinaryWriter()) {
146
- if (message.command !== undefined) {
147
- exports.DeviceCommand.encode(message.command, writer.uint32(10).fork()).join();
148
- }
149
- if (message.status !== 0) {
150
- writer.uint32(16).uint32(message.status);
114
+ if (message.code !== 0) {
115
+ writer.uint32(8).sint32(message.code);
151
116
  }
152
117
  if (message.message !== "") {
153
- writer.uint32(26).string(message.message);
118
+ writer.uint32(18).string(message.message);
154
119
  }
155
120
  return writer;
156
121
  },
157
122
  decode(input, length) {
158
123
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
159
124
  let end = length === undefined ? reader.len : reader.pos + length;
160
- const message = createBaseDeviceCommandAkn();
125
+ const message = createBaseCommandAkn();
161
126
  while (reader.pos < end) {
162
127
  const tag = reader.uint32();
163
128
  switch (tag >>> 3) {
164
129
  case 1: {
165
- if (tag !== 10) {
130
+ if (tag !== 8) {
166
131
  break;
167
132
  }
168
- message.command = exports.DeviceCommand.decode(reader, reader.uint32());
133
+ message.code = reader.sint32();
169
134
  continue;
170
135
  }
171
136
  case 2: {
172
- if (tag !== 16) {
173
- break;
174
- }
175
- message.status = reader.uint32();
176
- continue;
177
- }
178
- case 3: {
179
- if (tag !== 26) {
137
+ if (tag !== 18) {
180
138
  break;
181
139
  }
182
140
  message.message = reader.string();
@@ -192,18 +150,14 @@ exports.DeviceCommandAkn = {
192
150
  },
193
151
  fromJSON(object) {
194
152
  return {
195
- command: isSet(object.command) ? exports.DeviceCommand.fromJSON(object.command) : undefined,
196
- status: isSet(object.status) ? globalThis.Number(object.status) : 0,
153
+ code: isSet(object.code) ? globalThis.Number(object.code) : 0,
197
154
  message: isSet(object.message) ? globalThis.String(object.message) : "",
198
155
  };
199
156
  },
200
157
  toJSON(message) {
201
158
  const obj = {};
202
- if (message.command !== undefined) {
203
- obj.command = exports.DeviceCommand.toJSON(message.command);
204
- }
205
- if (message.status !== 0) {
206
- obj.status = Math.round(message.status);
159
+ if (message.code !== 0) {
160
+ obj.code = Math.round(message.code);
207
161
  }
208
162
  if (message.message !== "") {
209
163
  obj.message = message.message;
@@ -211,36 +165,51 @@ exports.DeviceCommandAkn = {
211
165
  return obj;
212
166
  },
213
167
  create(base) {
214
- return exports.DeviceCommandAkn.fromPartial(base !== null && base !== void 0 ? base : {});
168
+ return exports.CommandAkn.fromPartial(base !== null && base !== void 0 ? base : {});
215
169
  },
216
170
  fromPartial(object) {
217
171
  var _a, _b;
218
- const message = createBaseDeviceCommandAkn();
219
- message.command = (object.command !== undefined && object.command !== null)
220
- ? exports.DeviceCommand.fromPartial(object.command)
221
- : undefined;
222
- message.status = (_a = object.status) !== null && _a !== void 0 ? _a : 0;
172
+ const message = createBaseCommandAkn();
173
+ message.code = (_a = object.code) !== null && _a !== void 0 ? _a : 0;
223
174
  message.message = (_b = object.message) !== null && _b !== void 0 ? _b : "";
224
175
  return message;
225
176
  },
226
177
  };
227
- function createBaseDeviceAnswer() {
228
- return { deviceId: 0, answer: "" };
178
+ function createBaseCommand() {
179
+ return { id: 0, deviceId: 0, userId: 0, commandId: 0, replyId: 0, status: 0, command: undefined, akn: undefined };
229
180
  }
230
- exports.DeviceAnswer = {
181
+ exports.Command = {
231
182
  encode(message, writer = new wire_1.BinaryWriter()) {
183
+ if (message.id !== 0) {
184
+ writer.uint32(8).uint64(message.id);
185
+ }
232
186
  if (message.deviceId !== 0) {
233
- writer.uint32(8).uint64(message.deviceId);
187
+ writer.uint32(16).uint64(message.deviceId);
188
+ }
189
+ if (message.userId !== 0) {
190
+ writer.uint32(24).uint64(message.userId);
191
+ }
192
+ if (message.commandId !== 0) {
193
+ writer.uint32(32).uint64(message.commandId);
194
+ }
195
+ if (message.replyId !== 0) {
196
+ writer.uint32(40).uint64(message.replyId);
197
+ }
198
+ if (message.status !== 0) {
199
+ writer.uint32(48).int32(message.status);
200
+ }
201
+ if (message.command !== undefined) {
202
+ exports.CommandContent.encode(message.command, writer.uint32(58).fork()).join();
234
203
  }
235
- if (message.answer !== "") {
236
- writer.uint32(18).string(message.answer);
204
+ if (message.akn !== undefined) {
205
+ exports.CommandAkn.encode(message.akn, writer.uint32(66).fork()).join();
237
206
  }
238
207
  return writer;
239
208
  },
240
209
  decode(input, length) {
241
210
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
242
211
  let end = length === undefined ? reader.len : reader.pos + length;
243
- const message = createBaseDeviceAnswer();
212
+ const message = createBaseCommand();
244
213
  while (reader.pos < end) {
245
214
  const tag = reader.uint32();
246
215
  switch (tag >>> 3) {
@@ -248,83 +217,56 @@ exports.DeviceAnswer = {
248
217
  if (tag !== 8) {
249
218
  break;
250
219
  }
251
- message.deviceId = longToNumber(reader.uint64());
220
+ message.id = longToNumber(reader.uint64());
252
221
  continue;
253
222
  }
254
223
  case 2: {
255
- if (tag !== 18) {
224
+ if (tag !== 16) {
256
225
  break;
257
226
  }
258
- message.answer = reader.string();
227
+ message.deviceId = longToNumber(reader.uint64());
259
228
  continue;
260
229
  }
261
- }
262
- if ((tag & 7) === 4 || tag === 0) {
263
- break;
264
- }
265
- reader.skip(tag & 7);
266
- }
267
- return message;
268
- },
269
- fromJSON(object) {
270
- return {
271
- deviceId: isSet(object.device_id) ? globalThis.Number(object.device_id) : 0,
272
- answer: isSet(object.answer) ? globalThis.String(object.answer) : "",
273
- };
274
- },
275
- toJSON(message) {
276
- const obj = {};
277
- if (message.deviceId !== 0) {
278
- obj.device_id = Math.round(message.deviceId);
279
- }
280
- if (message.answer !== "") {
281
- obj.answer = message.answer;
282
- }
283
- return obj;
284
- },
285
- create(base) {
286
- return exports.DeviceAnswer.fromPartial(base !== null && base !== void 0 ? base : {});
287
- },
288
- fromPartial(object) {
289
- var _a, _b;
290
- const message = createBaseDeviceAnswer();
291
- message.deviceId = (_a = object.deviceId) !== null && _a !== void 0 ? _a : 0;
292
- message.answer = (_b = object.answer) !== null && _b !== void 0 ? _b : "";
293
- return message;
294
- },
295
- };
296
- function createBaseBrokerMessage() {
297
- return { type: 0, message: new Uint8Array(0) };
298
- }
299
- exports.BrokerMessage = {
300
- encode(message, writer = new wire_1.BinaryWriter()) {
301
- if (message.type !== 0) {
302
- writer.uint32(8).int32(message.type);
303
- }
304
- if (message.message.length !== 0) {
305
- writer.uint32(18).bytes(message.message);
306
- }
307
- return writer;
308
- },
309
- decode(input, length) {
310
- const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
311
- let end = length === undefined ? reader.len : reader.pos + length;
312
- const message = createBaseBrokerMessage();
313
- while (reader.pos < end) {
314
- const tag = reader.uint32();
315
- switch (tag >>> 3) {
316
- case 1: {
317
- if (tag !== 8) {
230
+ case 3: {
231
+ if (tag !== 24) {
318
232
  break;
319
233
  }
320
- message.type = reader.int32();
234
+ message.userId = longToNumber(reader.uint64());
321
235
  continue;
322
236
  }
323
- case 2: {
324
- if (tag !== 18) {
237
+ case 4: {
238
+ if (tag !== 32) {
325
239
  break;
326
240
  }
327
- message.message = reader.bytes();
241
+ message.commandId = longToNumber(reader.uint64());
242
+ continue;
243
+ }
244
+ case 5: {
245
+ if (tag !== 40) {
246
+ break;
247
+ }
248
+ message.replyId = longToNumber(reader.uint64());
249
+ continue;
250
+ }
251
+ case 6: {
252
+ if (tag !== 48) {
253
+ break;
254
+ }
255
+ message.status = reader.int32();
256
+ continue;
257
+ }
258
+ case 7: {
259
+ if (tag !== 58) {
260
+ break;
261
+ }
262
+ message.command = exports.CommandContent.decode(reader, reader.uint32());
263
+ continue;
264
+ }
265
+ case 8: {
266
+ if (tag !== 66) {
267
+ break;
268
+ }
269
+ message.akn = exports.CommandAkn.decode(reader, reader.uint32());
328
270
  continue;
329
271
  }
330
272
  }
@@ -337,56 +279,63 @@ exports.BrokerMessage = {
337
279
  },
338
280
  fromJSON(object) {
339
281
  return {
340
- type: isSet(object.type) ? messageTypeFromJSON(object.type) : 0,
341
- message: isSet(object.message) ? bytesFromBase64(object.message) : new Uint8Array(0),
282
+ id: isSet(object.id) ? globalThis.Number(object.id) : 0,
283
+ deviceId: isSet(object.device_id) ? globalThis.Number(object.device_id) : 0,
284
+ userId: isSet(object.user_id) ? globalThis.Number(object.user_id) : 0,
285
+ commandId: isSet(object.command_id) ? globalThis.Number(object.command_id) : 0,
286
+ replyId: isSet(object.reply_id) ? globalThis.Number(object.reply_id) : 0,
287
+ status: isSet(object.status) ? commandStatusFromJSON(object.status) : 0,
288
+ command: isSet(object.command) ? exports.CommandContent.fromJSON(object.command) : undefined,
289
+ akn: isSet(object.akn) ? exports.CommandAkn.fromJSON(object.akn) : undefined,
342
290
  };
343
291
  },
344
292
  toJSON(message) {
345
293
  const obj = {};
346
- if (message.type !== 0) {
347
- obj.type = messageTypeToJSON(message.type);
294
+ if (message.id !== 0) {
295
+ obj.id = Math.round(message.id);
348
296
  }
349
- if (message.message.length !== 0) {
350
- obj.message = base64FromBytes(message.message);
297
+ if (message.deviceId !== 0) {
298
+ obj.device_id = Math.round(message.deviceId);
299
+ }
300
+ if (message.userId !== 0) {
301
+ obj.user_id = Math.round(message.userId);
302
+ }
303
+ if (message.commandId !== 0) {
304
+ obj.command_id = Math.round(message.commandId);
305
+ }
306
+ if (message.replyId !== 0) {
307
+ obj.reply_id = Math.round(message.replyId);
308
+ }
309
+ if (message.status !== 0) {
310
+ obj.status = commandStatusToJSON(message.status);
311
+ }
312
+ if (message.command !== undefined) {
313
+ obj.command = exports.CommandContent.toJSON(message.command);
314
+ }
315
+ if (message.akn !== undefined) {
316
+ obj.akn = exports.CommandAkn.toJSON(message.akn);
351
317
  }
352
318
  return obj;
353
319
  },
354
320
  create(base) {
355
- return exports.BrokerMessage.fromPartial(base !== null && base !== void 0 ? base : {});
321
+ return exports.Command.fromPartial(base !== null && base !== void 0 ? base : {});
356
322
  },
357
323
  fromPartial(object) {
358
- var _a, _b;
359
- const message = createBaseBrokerMessage();
360
- message.type = (_a = object.type) !== null && _a !== void 0 ? _a : 0;
361
- message.message = (_b = object.message) !== null && _b !== void 0 ? _b : new Uint8Array(0);
324
+ var _a, _b, _c, _d, _e, _f;
325
+ const message = createBaseCommand();
326
+ message.id = (_a = object.id) !== null && _a !== void 0 ? _a : 0;
327
+ message.deviceId = (_b = object.deviceId) !== null && _b !== void 0 ? _b : 0;
328
+ message.userId = (_c = object.userId) !== null && _c !== void 0 ? _c : 0;
329
+ message.commandId = (_d = object.commandId) !== null && _d !== void 0 ? _d : 0;
330
+ message.replyId = (_e = object.replyId) !== null && _e !== void 0 ? _e : 0;
331
+ message.status = (_f = object.status) !== null && _f !== void 0 ? _f : 0;
332
+ message.command = (object.command !== undefined && object.command !== null)
333
+ ? exports.CommandContent.fromPartial(object.command)
334
+ : undefined;
335
+ message.akn = (object.akn !== undefined && object.akn !== null) ? exports.CommandAkn.fromPartial(object.akn) : undefined;
362
336
  return message;
363
337
  },
364
338
  };
365
- function bytesFromBase64(b64) {
366
- if (globalThis.Buffer) {
367
- return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
368
- }
369
- else {
370
- const bin = globalThis.atob(b64);
371
- const arr = new Uint8Array(bin.length);
372
- for (let i = 0; i < bin.length; ++i) {
373
- arr[i] = bin.charCodeAt(i);
374
- }
375
- return arr;
376
- }
377
- }
378
- function base64FromBytes(arr) {
379
- if (globalThis.Buffer) {
380
- return globalThis.Buffer.from(arr).toString("base64");
381
- }
382
- else {
383
- const bin = [];
384
- arr.forEach((byte) => {
385
- bin.push(globalThis.String.fromCharCode(byte));
386
- });
387
- return globalThis.btoa(bin.join(""));
388
- }
389
- }
390
339
  function longToNumber(int64) {
391
340
  const num = globalThis.Number(int64.toString());
392
341
  if (num > globalThis.Number.MAX_SAFE_INTEGER) {