@fatehan/tsrp 1.0.13 → 1.0.16
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.
|
@@ -10,7 +10,9 @@ export declare enum CommandStatus {
|
|
|
10
10
|
export declare function commandStatusFromJSON(object: any): CommandStatus;
|
|
11
11
|
export declare function commandStatusToJSON(object: CommandStatus): string;
|
|
12
12
|
export interface CommandContent {
|
|
13
|
-
|
|
13
|
+
commandId?: number | undefined;
|
|
14
|
+
message?: string | undefined;
|
|
15
|
+
params: string[];
|
|
14
16
|
}
|
|
15
17
|
export interface CommandAkn {
|
|
16
18
|
code: number;
|
|
@@ -25,6 +27,8 @@ export interface Command {
|
|
|
25
27
|
status: CommandStatus;
|
|
26
28
|
command: CommandContent | undefined;
|
|
27
29
|
akn: CommandAkn | undefined;
|
|
30
|
+
createdAt: Date | undefined;
|
|
31
|
+
updatedAt: Date | undefined;
|
|
28
32
|
}
|
|
29
33
|
export declare const CommandContent: MessageFns<CommandContent>;
|
|
30
34
|
export declare const CommandAkn: MessageFns<CommandAkn>;
|
|
@@ -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;
|
|
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;AAGrE,eAAO,MAAM,eAAe,wBAAwB,CAAC;AAErD,oBAAY,aAAa;IACvB,OAAO,IAAI;IACX,OAAO,IAAI;IACX,KAAK,IAAI;IACT,IAAI,IAAI;IACR,YAAY,KAAK;CAClB;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,GAAG,GAAG,aAAa,CAmBhE;AAED,wBAAgB,mBAA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@@ -10,6 +10,7 @@ exports.commandStatusFromJSON = commandStatusFromJSON;
|
|
|
10
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
15
|
var CommandStatus;
|
|
15
16
|
(function (CommandStatus) {
|
|
@@ -55,12 +56,18 @@ function commandStatusToJSON(object) {
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
function createBaseCommandContent() {
|
|
58
|
-
return { message:
|
|
59
|
+
return { commandId: undefined, message: undefined, params: [] };
|
|
59
60
|
}
|
|
60
61
|
exports.CommandContent = {
|
|
61
62
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
62
|
-
if (message.
|
|
63
|
-
writer.uint32(
|
|
63
|
+
if (message.commandId !== undefined) {
|
|
64
|
+
writer.uint32(8).uint64(message.commandId);
|
|
65
|
+
}
|
|
66
|
+
if (message.message !== undefined) {
|
|
67
|
+
writer.uint32(18).string(message.message);
|
|
68
|
+
}
|
|
69
|
+
for (const v of message.params) {
|
|
70
|
+
writer.uint32(26).string(v);
|
|
64
71
|
}
|
|
65
72
|
return writer;
|
|
66
73
|
},
|
|
@@ -72,12 +79,26 @@ exports.CommandContent = {
|
|
|
72
79
|
const tag = reader.uint32();
|
|
73
80
|
switch (tag >>> 3) {
|
|
74
81
|
case 1: {
|
|
75
|
-
if (tag !==
|
|
82
|
+
if (tag !== 8) {
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
message.commandId = longToNumber(reader.uint64());
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
case 2: {
|
|
89
|
+
if (tag !== 18) {
|
|
76
90
|
break;
|
|
77
91
|
}
|
|
78
92
|
message.message = reader.string();
|
|
79
93
|
continue;
|
|
80
94
|
}
|
|
95
|
+
case 3: {
|
|
96
|
+
if (tag !== 26) {
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
message.params.push(reader.string());
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
81
102
|
}
|
|
82
103
|
if ((tag & 7) === 4 || tag === 0) {
|
|
83
104
|
break;
|
|
@@ -87,22 +108,35 @@ exports.CommandContent = {
|
|
|
87
108
|
return message;
|
|
88
109
|
},
|
|
89
110
|
fromJSON(object) {
|
|
90
|
-
return {
|
|
111
|
+
return {
|
|
112
|
+
commandId: isSet(object.command_id) ? globalThis.Number(object.command_id) : undefined,
|
|
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)) : [],
|
|
115
|
+
};
|
|
91
116
|
},
|
|
92
117
|
toJSON(message) {
|
|
118
|
+
var _a;
|
|
93
119
|
const obj = {};
|
|
94
|
-
if (message.
|
|
120
|
+
if (message.commandId !== undefined) {
|
|
121
|
+
obj.command_id = Math.round(message.commandId);
|
|
122
|
+
}
|
|
123
|
+
if (message.message !== undefined) {
|
|
95
124
|
obj.message = message.message;
|
|
96
125
|
}
|
|
126
|
+
if ((_a = message.params) === null || _a === void 0 ? void 0 : _a.length) {
|
|
127
|
+
obj.params = message.params;
|
|
128
|
+
}
|
|
97
129
|
return obj;
|
|
98
130
|
},
|
|
99
131
|
create(base) {
|
|
100
132
|
return exports.CommandContent.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
101
133
|
},
|
|
102
134
|
fromPartial(object) {
|
|
103
|
-
var _a;
|
|
135
|
+
var _a, _b, _c;
|
|
104
136
|
const message = createBaseCommandContent();
|
|
105
|
-
message.
|
|
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)) || [];
|
|
106
140
|
return message;
|
|
107
141
|
},
|
|
108
142
|
};
|
|
@@ -176,7 +210,18 @@ exports.CommandAkn = {
|
|
|
176
210
|
},
|
|
177
211
|
};
|
|
178
212
|
function createBaseCommand() {
|
|
179
|
-
return {
|
|
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
|
+
};
|
|
180
225
|
}
|
|
181
226
|
exports.Command = {
|
|
182
227
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
@@ -204,6 +249,12 @@ exports.Command = {
|
|
|
204
249
|
if (message.akn !== undefined) {
|
|
205
250
|
exports.CommandAkn.encode(message.akn, writer.uint32(66).fork()).join();
|
|
206
251
|
}
|
|
252
|
+
if (message.createdAt !== undefined) {
|
|
253
|
+
timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(74).fork()).join();
|
|
254
|
+
}
|
|
255
|
+
if (message.updatedAt !== undefined) {
|
|
256
|
+
timestamp_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(82).fork()).join();
|
|
257
|
+
}
|
|
207
258
|
return writer;
|
|
208
259
|
},
|
|
209
260
|
decode(input, length) {
|
|
@@ -269,6 +320,20 @@ exports.Command = {
|
|
|
269
320
|
message.akn = exports.CommandAkn.decode(reader, reader.uint32());
|
|
270
321
|
continue;
|
|
271
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()));
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
272
337
|
}
|
|
273
338
|
if ((tag & 7) === 4 || tag === 0) {
|
|
274
339
|
break;
|
|
@@ -287,6 +352,8 @@ exports.Command = {
|
|
|
287
352
|
status: isSet(object.status) ? commandStatusFromJSON(object.status) : 0,
|
|
288
353
|
command: isSet(object.command) ? exports.CommandContent.fromJSON(object.command) : undefined,
|
|
289
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,
|
|
290
357
|
};
|
|
291
358
|
},
|
|
292
359
|
toJSON(message) {
|
|
@@ -315,13 +382,19 @@ exports.Command = {
|
|
|
315
382
|
if (message.akn !== undefined) {
|
|
316
383
|
obj.akn = exports.CommandAkn.toJSON(message.akn);
|
|
317
384
|
}
|
|
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();
|
|
390
|
+
}
|
|
318
391
|
return obj;
|
|
319
392
|
},
|
|
320
393
|
create(base) {
|
|
321
394
|
return exports.Command.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
322
395
|
},
|
|
323
396
|
fromPartial(object) {
|
|
324
|
-
var _a, _b, _c, _d, _e, _f;
|
|
397
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
325
398
|
const message = createBaseCommand();
|
|
326
399
|
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : 0;
|
|
327
400
|
message.deviceId = (_b = object.deviceId) !== null && _b !== void 0 ? _b : 0;
|
|
@@ -333,9 +406,32 @@ exports.Command = {
|
|
|
333
406
|
? exports.CommandContent.fromPartial(object.command)
|
|
334
407
|
: undefined;
|
|
335
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;
|
|
336
411
|
return message;
|
|
337
412
|
},
|
|
338
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
|
+
}
|
|
339
435
|
function longToNumber(int64) {
|
|
340
436
|
const num = globalThis.Number(int64.toString());
|
|
341
437
|
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|