@fatehan/tsrp 1.0.12 → 1.0.14
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.
- package/dist/fatehan/models/fusion.d.ts +28 -0
- package/dist/fatehan/models/fusion.d.ts.map +1 -1
- package/dist/fatehan/models/fusion.js +427 -1
- package/dist/fatehan/models/models.d.ts +52 -1
- package/dist/fatehan/models/models.d.ts.map +1 -1
- package/dist/fatehan/models/models.js +807 -16
- package/dist/fatehan/models/operation.js +2 -2
- package/dist/fatehan/packets/dataModel.d.ts +22 -7
- package/dist/fatehan/packets/dataModel.d.ts.map +1 -1
- package/dist/fatehan/packets/dataModel.js +326 -94
- package/dist/fatehan/packets/messages.d.ts +27 -24
- package/dist/fatehan/packets/messages.d.ts.map +1 -1
- package/dist/fatehan/packets/messages.js +233 -157
- package/package.json +1 -1
|
@@ -5,121 +5,76 @@
|
|
|
5
5
|
// protoc v3.21.12
|
|
6
6
|
// source: packets/messages.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
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
|
+
const timestamp_1 = require("../google/protobuf/timestamp");
|
|
13
14
|
exports.protobufPackage = "com.fatehan.packets";
|
|
14
|
-
var
|
|
15
|
-
(function (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
var CommandStatus;
|
|
16
|
+
(function (CommandStatus) {
|
|
17
|
+
CommandStatus[CommandStatus["PENDING"] = 0] = "PENDING";
|
|
18
|
+
CommandStatus[CommandStatus["OFFLINE"] = 1] = "OFFLINE";
|
|
19
|
+
CommandStatus[CommandStatus["ERROR"] = 2] = "ERROR";
|
|
20
|
+
CommandStatus[CommandStatus["SENT"] = 3] = "SENT";
|
|
21
|
+
CommandStatus[CommandStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
22
|
+
})(CommandStatus || (exports.CommandStatus = CommandStatus = {}));
|
|
23
|
+
function commandStatusFromJSON(object) {
|
|
22
24
|
switch (object) {
|
|
23
25
|
case 0:
|
|
24
|
-
case "
|
|
25
|
-
return
|
|
26
|
+
case "PENDING":
|
|
27
|
+
return CommandStatus.PENDING;
|
|
26
28
|
case 1:
|
|
27
|
-
case "
|
|
28
|
-
return
|
|
29
|
+
case "OFFLINE":
|
|
30
|
+
return CommandStatus.OFFLINE;
|
|
29
31
|
case 2:
|
|
30
32
|
case "ERROR":
|
|
31
|
-
return
|
|
33
|
+
return CommandStatus.ERROR;
|
|
34
|
+
case 3:
|
|
35
|
+
case "SENT":
|
|
36
|
+
return CommandStatus.SENT;
|
|
32
37
|
case -1:
|
|
33
38
|
case "UNRECOGNIZED":
|
|
34
39
|
default:
|
|
35
|
-
return
|
|
40
|
+
return CommandStatus.UNRECOGNIZED;
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
|
-
function
|
|
43
|
+
function commandStatusToJSON(object) {
|
|
39
44
|
switch (object) {
|
|
40
|
-
case
|
|
45
|
+
case CommandStatus.PENDING:
|
|
46
|
+
return "PENDING";
|
|
47
|
+
case CommandStatus.OFFLINE:
|
|
41
48
|
return "OFFLINE";
|
|
42
|
-
case
|
|
43
|
-
return "SENT";
|
|
44
|
-
case DeviceCommandAkn_Status.ERROR:
|
|
49
|
+
case CommandStatus.ERROR:
|
|
45
50
|
return "ERROR";
|
|
46
|
-
case
|
|
51
|
+
case CommandStatus.SENT:
|
|
52
|
+
return "SENT";
|
|
53
|
+
case CommandStatus.UNRECOGNIZED:
|
|
47
54
|
default:
|
|
48
55
|
return "UNRECOGNIZED";
|
|
49
56
|
}
|
|
50
57
|
}
|
|
51
|
-
function
|
|
52
|
-
return {
|
|
53
|
-
}
|
|
54
|
-
exports.DeviceCommand = {
|
|
55
|
-
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
56
|
-
if (message.command !== "") {
|
|
57
|
-
writer.uint32(10).string(message.command);
|
|
58
|
-
}
|
|
59
|
-
return writer;
|
|
60
|
-
},
|
|
61
|
-
decode(input, length) {
|
|
62
|
-
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
63
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
64
|
-
const message = createBaseDeviceCommand();
|
|
65
|
-
while (reader.pos < end) {
|
|
66
|
-
const tag = reader.uint32();
|
|
67
|
-
switch (tag >>> 3) {
|
|
68
|
-
case 1: {
|
|
69
|
-
if (tag !== 10) {
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
message.command = reader.string();
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
reader.skip(tag & 7);
|
|
80
|
-
}
|
|
81
|
-
return message;
|
|
82
|
-
},
|
|
83
|
-
fromJSON(object) {
|
|
84
|
-
return { command: isSet(object.command) ? globalThis.String(object.command) : "" };
|
|
85
|
-
},
|
|
86
|
-
toJSON(message) {
|
|
87
|
-
const obj = {};
|
|
88
|
-
if (message.command !== "") {
|
|
89
|
-
obj.command = message.command;
|
|
90
|
-
}
|
|
91
|
-
return obj;
|
|
92
|
-
},
|
|
93
|
-
create(base) {
|
|
94
|
-
return exports.DeviceCommand.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
95
|
-
},
|
|
96
|
-
fromPartial(object) {
|
|
97
|
-
var _a;
|
|
98
|
-
const message = createBaseDeviceCommand();
|
|
99
|
-
message.command = (_a = object.command) !== null && _a !== void 0 ? _a : "";
|
|
100
|
-
return message;
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
function createBaseDeviceCommandAkn() {
|
|
104
|
-
return { status: 0, code: undefined, message: undefined };
|
|
58
|
+
function createBaseCommandContent() {
|
|
59
|
+
return { commandId: 0, message: undefined, params: [] };
|
|
105
60
|
}
|
|
106
|
-
exports.
|
|
61
|
+
exports.CommandContent = {
|
|
107
62
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
108
|
-
if (message.
|
|
109
|
-
writer.uint32(8).
|
|
110
|
-
}
|
|
111
|
-
if (message.code !== undefined) {
|
|
112
|
-
writer.uint32(16).sint64(message.code);
|
|
63
|
+
if (message.commandId !== 0) {
|
|
64
|
+
writer.uint32(8).uint64(message.commandId);
|
|
113
65
|
}
|
|
114
66
|
if (message.message !== undefined) {
|
|
115
|
-
writer.uint32(
|
|
67
|
+
writer.uint32(18).string(message.message);
|
|
68
|
+
}
|
|
69
|
+
for (const v of message.params) {
|
|
70
|
+
writer.uint32(26).string(v);
|
|
116
71
|
}
|
|
117
72
|
return writer;
|
|
118
73
|
},
|
|
119
74
|
decode(input, length) {
|
|
120
75
|
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
121
76
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
122
|
-
const message =
|
|
77
|
+
const message = createBaseCommandContent();
|
|
123
78
|
while (reader.pos < end) {
|
|
124
79
|
const tag = reader.uint32();
|
|
125
80
|
switch (tag >>> 3) {
|
|
@@ -127,21 +82,21 @@ exports.DeviceCommandAkn = {
|
|
|
127
82
|
if (tag !== 8) {
|
|
128
83
|
break;
|
|
129
84
|
}
|
|
130
|
-
message.
|
|
85
|
+
message.commandId = longToNumber(reader.uint64());
|
|
131
86
|
continue;
|
|
132
87
|
}
|
|
133
88
|
case 2: {
|
|
134
|
-
if (tag !==
|
|
89
|
+
if (tag !== 18) {
|
|
135
90
|
break;
|
|
136
91
|
}
|
|
137
|
-
message.
|
|
92
|
+
message.message = reader.string();
|
|
138
93
|
continue;
|
|
139
94
|
}
|
|
140
95
|
case 3: {
|
|
141
96
|
if (tag !== 26) {
|
|
142
97
|
break;
|
|
143
98
|
}
|
|
144
|
-
message.
|
|
99
|
+
message.params.push(reader.string());
|
|
145
100
|
continue;
|
|
146
101
|
}
|
|
147
102
|
}
|
|
@@ -154,58 +109,69 @@ exports.DeviceCommandAkn = {
|
|
|
154
109
|
},
|
|
155
110
|
fromJSON(object) {
|
|
156
111
|
return {
|
|
157
|
-
|
|
158
|
-
code: isSet(object.code) ? globalThis.Number(object.code) : undefined,
|
|
112
|
+
commandId: isSet(object.command_id) ? globalThis.Number(object.command_id) : 0,
|
|
159
113
|
message: isSet(object.message) ? globalThis.String(object.message) : undefined,
|
|
114
|
+
params: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.params) ? object.params.map((e) => globalThis.String(e)) : [],
|
|
160
115
|
};
|
|
161
116
|
},
|
|
162
117
|
toJSON(message) {
|
|
118
|
+
var _a;
|
|
163
119
|
const obj = {};
|
|
164
|
-
if (message.
|
|
165
|
-
obj.
|
|
166
|
-
}
|
|
167
|
-
if (message.code !== undefined) {
|
|
168
|
-
obj.code = Math.round(message.code);
|
|
120
|
+
if (message.commandId !== 0) {
|
|
121
|
+
obj.command_id = Math.round(message.commandId);
|
|
169
122
|
}
|
|
170
123
|
if (message.message !== undefined) {
|
|
171
124
|
obj.message = message.message;
|
|
172
125
|
}
|
|
126
|
+
if ((_a = message.params) === null || _a === void 0 ? void 0 : _a.length) {
|
|
127
|
+
obj.params = message.params;
|
|
128
|
+
}
|
|
173
129
|
return obj;
|
|
174
130
|
},
|
|
175
131
|
create(base) {
|
|
176
|
-
return exports.
|
|
132
|
+
return exports.CommandContent.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
177
133
|
},
|
|
178
134
|
fromPartial(object) {
|
|
179
135
|
var _a, _b, _c;
|
|
180
|
-
const message =
|
|
181
|
-
message.
|
|
182
|
-
message.
|
|
183
|
-
message.
|
|
136
|
+
const message = createBaseCommandContent();
|
|
137
|
+
message.commandId = (_a = object.commandId) !== null && _a !== void 0 ? _a : 0;
|
|
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)) || [];
|
|
184
140
|
return message;
|
|
185
141
|
},
|
|
186
142
|
};
|
|
187
|
-
function
|
|
188
|
-
return {
|
|
143
|
+
function createBaseCommandAkn() {
|
|
144
|
+
return { code: 0, message: "" };
|
|
189
145
|
}
|
|
190
|
-
exports.
|
|
146
|
+
exports.CommandAkn = {
|
|
191
147
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
192
|
-
if (message.
|
|
193
|
-
writer.uint32(
|
|
148
|
+
if (message.code !== 0) {
|
|
149
|
+
writer.uint32(8).sint32(message.code);
|
|
150
|
+
}
|
|
151
|
+
if (message.message !== "") {
|
|
152
|
+
writer.uint32(18).string(message.message);
|
|
194
153
|
}
|
|
195
154
|
return writer;
|
|
196
155
|
},
|
|
197
156
|
decode(input, length) {
|
|
198
157
|
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
199
158
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
200
|
-
const message =
|
|
159
|
+
const message = createBaseCommandAkn();
|
|
201
160
|
while (reader.pos < end) {
|
|
202
161
|
const tag = reader.uint32();
|
|
203
162
|
switch (tag >>> 3) {
|
|
204
163
|
case 1: {
|
|
205
|
-
if (tag !==
|
|
164
|
+
if (tag !== 8) {
|
|
206
165
|
break;
|
|
207
166
|
}
|
|
208
|
-
message.
|
|
167
|
+
message.code = reader.sint32();
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
case 2: {
|
|
171
|
+
if (tag !== 18) {
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
message.message = reader.string();
|
|
209
175
|
continue;
|
|
210
176
|
}
|
|
211
177
|
}
|
|
@@ -217,51 +183,84 @@ exports.DeviceAnswer = {
|
|
|
217
183
|
return message;
|
|
218
184
|
},
|
|
219
185
|
fromJSON(object) {
|
|
220
|
-
return {
|
|
186
|
+
return {
|
|
187
|
+
code: isSet(object.code) ? globalThis.Number(object.code) : 0,
|
|
188
|
+
message: isSet(object.message) ? globalThis.String(object.message) : "",
|
|
189
|
+
};
|
|
221
190
|
},
|
|
222
191
|
toJSON(message) {
|
|
223
192
|
const obj = {};
|
|
224
|
-
if (message.
|
|
225
|
-
obj.
|
|
193
|
+
if (message.code !== 0) {
|
|
194
|
+
obj.code = Math.round(message.code);
|
|
195
|
+
}
|
|
196
|
+
if (message.message !== "") {
|
|
197
|
+
obj.message = message.message;
|
|
226
198
|
}
|
|
227
199
|
return obj;
|
|
228
200
|
},
|
|
229
201
|
create(base) {
|
|
230
|
-
return exports.
|
|
202
|
+
return exports.CommandAkn.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
231
203
|
},
|
|
232
204
|
fromPartial(object) {
|
|
233
|
-
var _a;
|
|
234
|
-
const message =
|
|
235
|
-
message.
|
|
205
|
+
var _a, _b;
|
|
206
|
+
const message = createBaseCommandAkn();
|
|
207
|
+
message.code = (_a = object.code) !== null && _a !== void 0 ? _a : 0;
|
|
208
|
+
message.message = (_b = object.message) !== null && _b !== void 0 ? _b : "";
|
|
236
209
|
return message;
|
|
237
210
|
},
|
|
238
211
|
};
|
|
239
|
-
function
|
|
240
|
-
return {
|
|
212
|
+
function createBaseCommand() {
|
|
213
|
+
return {
|
|
214
|
+
id: 0,
|
|
215
|
+
deviceId: 0,
|
|
216
|
+
userId: 0,
|
|
217
|
+
commandId: 0,
|
|
218
|
+
replyId: 0,
|
|
219
|
+
status: 0,
|
|
220
|
+
command: undefined,
|
|
221
|
+
akn: undefined,
|
|
222
|
+
createdAt: undefined,
|
|
223
|
+
updatedAt: undefined,
|
|
224
|
+
};
|
|
241
225
|
}
|
|
242
|
-
exports.
|
|
226
|
+
exports.Command = {
|
|
243
227
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
228
|
+
if (message.id !== 0) {
|
|
229
|
+
writer.uint32(8).uint64(message.id);
|
|
230
|
+
}
|
|
244
231
|
if (message.deviceId !== 0) {
|
|
245
|
-
writer.uint32(
|
|
232
|
+
writer.uint32(16).uint64(message.deviceId);
|
|
233
|
+
}
|
|
234
|
+
if (message.userId !== 0) {
|
|
235
|
+
writer.uint32(24).uint64(message.userId);
|
|
246
236
|
}
|
|
247
|
-
if (message.
|
|
248
|
-
writer.uint32(
|
|
237
|
+
if (message.commandId !== 0) {
|
|
238
|
+
writer.uint32(32).uint64(message.commandId);
|
|
239
|
+
}
|
|
240
|
+
if (message.replyId !== 0) {
|
|
241
|
+
writer.uint32(40).uint64(message.replyId);
|
|
242
|
+
}
|
|
243
|
+
if (message.status !== 0) {
|
|
244
|
+
writer.uint32(48).int32(message.status);
|
|
249
245
|
}
|
|
250
246
|
if (message.command !== undefined) {
|
|
251
|
-
exports.
|
|
247
|
+
exports.CommandContent.encode(message.command, writer.uint32(58).fork()).join();
|
|
252
248
|
}
|
|
253
249
|
if (message.akn !== undefined) {
|
|
254
|
-
exports.
|
|
250
|
+
exports.CommandAkn.encode(message.akn, writer.uint32(66).fork()).join();
|
|
251
|
+
}
|
|
252
|
+
if (message.createdAt !== undefined) {
|
|
253
|
+
timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(74).fork()).join();
|
|
255
254
|
}
|
|
256
|
-
if (message.
|
|
257
|
-
|
|
255
|
+
if (message.updatedAt !== undefined) {
|
|
256
|
+
timestamp_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(82).fork()).join();
|
|
258
257
|
}
|
|
259
258
|
return writer;
|
|
260
259
|
},
|
|
261
260
|
decode(input, length) {
|
|
262
261
|
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
263
262
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
264
|
-
const message =
|
|
263
|
+
const message = createBaseCommand();
|
|
265
264
|
while (reader.pos < end) {
|
|
266
265
|
const tag = reader.uint32();
|
|
267
266
|
switch (tag >>> 3) {
|
|
@@ -269,35 +268,70 @@ exports.DeviceMessage = {
|
|
|
269
268
|
if (tag !== 8) {
|
|
270
269
|
break;
|
|
271
270
|
}
|
|
272
|
-
message.
|
|
271
|
+
message.id = longToNumber(reader.uint64());
|
|
273
272
|
continue;
|
|
274
273
|
}
|
|
275
274
|
case 2: {
|
|
276
275
|
if (tag !== 16) {
|
|
277
276
|
break;
|
|
278
277
|
}
|
|
279
|
-
message.
|
|
278
|
+
message.deviceId = longToNumber(reader.uint64());
|
|
280
279
|
continue;
|
|
281
280
|
}
|
|
282
281
|
case 3: {
|
|
283
|
-
if (tag !==
|
|
282
|
+
if (tag !== 24) {
|
|
284
283
|
break;
|
|
285
284
|
}
|
|
286
|
-
message.
|
|
285
|
+
message.userId = longToNumber(reader.uint64());
|
|
287
286
|
continue;
|
|
288
287
|
}
|
|
289
288
|
case 4: {
|
|
290
|
-
if (tag !==
|
|
289
|
+
if (tag !== 32) {
|
|
291
290
|
break;
|
|
292
291
|
}
|
|
293
|
-
message.
|
|
292
|
+
message.commandId = longToNumber(reader.uint64());
|
|
294
293
|
continue;
|
|
295
294
|
}
|
|
296
295
|
case 5: {
|
|
297
|
-
if (tag !==
|
|
296
|
+
if (tag !== 40) {
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
message.replyId = longToNumber(reader.uint64());
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
case 6: {
|
|
303
|
+
if (tag !== 48) {
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
message.status = reader.int32();
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
case 7: {
|
|
310
|
+
if (tag !== 58) {
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
message.command = exports.CommandContent.decode(reader, reader.uint32());
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
case 8: {
|
|
317
|
+
if (tag !== 66) {
|
|
298
318
|
break;
|
|
299
319
|
}
|
|
300
|
-
message.
|
|
320
|
+
message.akn = exports.CommandAkn.decode(reader, reader.uint32());
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
case 9: {
|
|
324
|
+
if (tag !== 74) {
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
case 10: {
|
|
331
|
+
if (tag !== 82) {
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
message.updatedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
|
|
301
335
|
continue;
|
|
302
336
|
}
|
|
303
337
|
}
|
|
@@ -310,52 +344,94 @@ exports.DeviceMessage = {
|
|
|
310
344
|
},
|
|
311
345
|
fromJSON(object) {
|
|
312
346
|
return {
|
|
347
|
+
id: isSet(object.id) ? globalThis.Number(object.id) : 0,
|
|
313
348
|
deviceId: isSet(object.device_id) ? globalThis.Number(object.device_id) : 0,
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
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,
|
|
352
|
+
status: isSet(object.status) ? commandStatusFromJSON(object.status) : 0,
|
|
353
|
+
command: isSet(object.command) ? exports.CommandContent.fromJSON(object.command) : undefined,
|
|
354
|
+
akn: isSet(object.akn) ? exports.CommandAkn.fromJSON(object.akn) : undefined,
|
|
355
|
+
createdAt: isSet(object.created_at) ? fromJsonTimestamp(object.created_at) : undefined,
|
|
356
|
+
updatedAt: isSet(object.updated_at) ? fromJsonTimestamp(object.updated_at) : undefined,
|
|
318
357
|
};
|
|
319
358
|
},
|
|
320
359
|
toJSON(message) {
|
|
321
360
|
const obj = {};
|
|
361
|
+
if (message.id !== 0) {
|
|
362
|
+
obj.id = Math.round(message.id);
|
|
363
|
+
}
|
|
322
364
|
if (message.deviceId !== 0) {
|
|
323
365
|
obj.device_id = Math.round(message.deviceId);
|
|
324
366
|
}
|
|
325
|
-
if (message.
|
|
326
|
-
obj.
|
|
367
|
+
if (message.userId !== 0) {
|
|
368
|
+
obj.user_id = Math.round(message.userId);
|
|
369
|
+
}
|
|
370
|
+
if (message.commandId !== 0) {
|
|
371
|
+
obj.command_id = Math.round(message.commandId);
|
|
372
|
+
}
|
|
373
|
+
if (message.replyId !== 0) {
|
|
374
|
+
obj.reply_id = Math.round(message.replyId);
|
|
375
|
+
}
|
|
376
|
+
if (message.status !== 0) {
|
|
377
|
+
obj.status = commandStatusToJSON(message.status);
|
|
327
378
|
}
|
|
328
379
|
if (message.command !== undefined) {
|
|
329
|
-
obj.command = exports.
|
|
380
|
+
obj.command = exports.CommandContent.toJSON(message.command);
|
|
330
381
|
}
|
|
331
382
|
if (message.akn !== undefined) {
|
|
332
|
-
obj.akn = exports.
|
|
383
|
+
obj.akn = exports.CommandAkn.toJSON(message.akn);
|
|
333
384
|
}
|
|
334
|
-
if (message.
|
|
335
|
-
obj.
|
|
385
|
+
if (message.createdAt !== undefined) {
|
|
386
|
+
obj.created_at = message.createdAt.toISOString();
|
|
387
|
+
}
|
|
388
|
+
if (message.updatedAt !== undefined) {
|
|
389
|
+
obj.updated_at = message.updatedAt.toISOString();
|
|
336
390
|
}
|
|
337
391
|
return obj;
|
|
338
392
|
},
|
|
339
393
|
create(base) {
|
|
340
|
-
return exports.
|
|
394
|
+
return exports.Command.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
341
395
|
},
|
|
342
396
|
fromPartial(object) {
|
|
343
|
-
var _a, _b;
|
|
344
|
-
const message =
|
|
345
|
-
message.
|
|
346
|
-
message.
|
|
397
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
398
|
+
const message = createBaseCommand();
|
|
399
|
+
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : 0;
|
|
400
|
+
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;
|
|
404
|
+
message.status = (_f = object.status) !== null && _f !== void 0 ? _f : 0;
|
|
347
405
|
message.command = (object.command !== undefined && object.command !== null)
|
|
348
|
-
? exports.
|
|
349
|
-
: undefined;
|
|
350
|
-
message.akn = (object.akn !== undefined && object.akn !== null)
|
|
351
|
-
? exports.DeviceCommandAkn.fromPartial(object.akn)
|
|
352
|
-
: undefined;
|
|
353
|
-
message.answer = (object.answer !== undefined && object.answer !== null)
|
|
354
|
-
? exports.DeviceAnswer.fromPartial(object.answer)
|
|
406
|
+
? exports.CommandContent.fromPartial(object.command)
|
|
355
407
|
: undefined;
|
|
408
|
+
message.akn = (object.akn !== undefined && object.akn !== null) ? exports.CommandAkn.fromPartial(object.akn) : undefined;
|
|
409
|
+
message.createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;
|
|
410
|
+
message.updatedAt = (_h = object.updatedAt) !== null && _h !== void 0 ? _h : undefined;
|
|
356
411
|
return message;
|
|
357
412
|
},
|
|
358
413
|
};
|
|
414
|
+
function toTimestamp(date) {
|
|
415
|
+
const seconds = Math.trunc(date.getTime() / 1000);
|
|
416
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
417
|
+
return { seconds, nanos };
|
|
418
|
+
}
|
|
419
|
+
function fromTimestamp(t) {
|
|
420
|
+
let millis = (t.seconds || 0) * 1000;
|
|
421
|
+
millis += (t.nanos || 0) / 1000000;
|
|
422
|
+
return new globalThis.Date(millis);
|
|
423
|
+
}
|
|
424
|
+
function fromJsonTimestamp(o) {
|
|
425
|
+
if (o instanceof globalThis.Date) {
|
|
426
|
+
return o;
|
|
427
|
+
}
|
|
428
|
+
else if (typeof o === "string") {
|
|
429
|
+
return new globalThis.Date(o);
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
|
|
433
|
+
}
|
|
434
|
+
}
|
|
359
435
|
function longToNumber(int64) {
|
|
360
436
|
const num = globalThis.Number(int64.toString());
|
|
361
437
|
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|