@teslemetry/tesla-protocol 0.5.0 → 0.6.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.
- package/dist/charging/charging.cjs +550 -0
- package/dist/charging/charging.d.cts +75 -0
- package/dist/charging/charging.d.mts +75 -0
- package/dist/charging/charging.mjs +543 -0
- package/dist/command/universal_message.cjs +5 -0
- package/dist/command/universal_message.d.cts +2 -0
- package/dist/command/universal_message.d.mts +2 -0
- package/dist/command/universal_message.mjs +5 -0
- package/dist/command/vcsec.cjs +87 -2
- package/dist/command/vcsec.d.cts +11 -1
- package/dist/command/vcsec.d.mts +11 -1
- package/dist/command/vcsec.mjs +86 -3
- package/dist/command/vehicle.cjs +27 -0
- package/dist/command/vehicle.d.cts +4 -0
- package/dist/command/vehicle.d.mts +4 -0
- package/dist/command/vehicle.mjs +27 -0
- package/dist/dashcam/dashcam_sei.cjs +263 -0
- package/dist/dashcam/dashcam_sei.d.cts +60 -0
- package/dist/dashcam/dashcam_sei.d.mts +60 -0
- package/dist/dashcam/dashcam_sei.mjs +255 -0
- package/dist/energy_device/common_api.cjs +604 -11
- package/dist/energy_device/common_api.d.cts +60 -3
- package/dist/energy_device/common_api.d.mts +60 -3
- package/dist/energy_device/common_api.mjs +596 -12
- package/dist/energy_device/device.cjs +129 -0
- package/dist/energy_device/device.d.cts +13 -1
- package/dist/energy_device/device.d.mts +13 -1
- package/dist/energy_device/device.mjs +127 -1
- package/dist/energy_device/energy_site_net.cjs +747 -0
- package/dist/energy_device/energy_site_net.d.cts +84 -1
- package/dist/energy_device/energy_site_net.d.mts +84 -1
- package/dist/energy_device/energy_site_net.mjs +736 -1
- package/dist/energy_device/filestore_api.cjs +575 -0
- package/dist/energy_device/filestore_api.d.cts +81 -0
- package/dist/energy_device/filestore_api.d.mts +81 -0
- package/dist/energy_device/filestore_api.mjs +563 -0
- package/dist/energy_device/google/protobuf/duration.cjs +71 -0
- package/dist/energy_device/google/protobuf/duration.d.cts +95 -0
- package/dist/energy_device/google/protobuf/duration.d.mts +95 -0
- package/dist/energy_device/google/protobuf/duration.mjs +69 -0
- package/dist/energy_device/graphql_api.cjs +449 -0
- package/dist/energy_device/graphql_api.d.cts +78 -0
- package/dist/energy_device/graphql_api.d.mts +78 -0
- package/dist/energy_device/graphql_api.mjs +434 -0
- package/dist/energy_device/intra_site_api.cjs +1698 -0
- package/dist/energy_device/intra_site_api.d.cts +227 -0
- package/dist/energy_device/intra_site_api.d.mts +227 -0
- package/dist/energy_device/intra_site_api.mjs +1644 -0
- package/dist/energy_device/local_auth_api.cjs +505 -0
- package/dist/energy_device/local_auth_api.d.cts +73 -0
- package/dist/energy_device/local_auth_api.d.mts +73 -0
- package/dist/energy_device/local_auth_api.mjs +492 -0
- package/dist/energy_device/networking.cjs +20 -2
- package/dist/energy_device/networking.d.cts +2 -0
- package/dist/energy_device/networking.d.mts +2 -0
- package/dist/energy_device/networking.mjs +20 -2
- package/dist/energy_device/neurio_meter_api.cjs +1442 -0
- package/dist/energy_device/neurio_meter_api.d.cts +202 -0
- package/dist/energy_device/neurio_meter_api.d.mts +202 -0
- package/dist/energy_device/neurio_meter_api.mjs +1401 -0
- package/dist/energy_device/pvi_api.cjs +2954 -0
- package/dist/energy_device/pvi_api.d.cts +319 -0
- package/dist/energy_device/pvi_api.d.mts +319 -0
- package/dist/energy_device/pvi_api.mjs +2892 -0
- package/dist/energy_device/teg_api.cjs +5184 -147
- package/dist/energy_device/teg_api.d.cts +492 -77
- package/dist/energy_device/teg_api.d.mts +492 -77
- package/dist/energy_device/teg_api.mjs +5064 -148
- package/dist/energy_device/transport.cjs +82 -2
- package/dist/energy_device/transport.d.cts +16 -5
- package/dist/energy_device/transport.d.mts +16 -5
- package/dist/energy_device/transport.mjs +82 -2
- package/dist/energy_device/update.cjs +33 -6
- package/dist/energy_device/update.d.cts +3 -0
- package/dist/energy_device/update.d.mts +3 -0
- package/dist/energy_device/update.mjs +33 -6
- package/dist/energy_device/wall_connector.cjs +6729 -5
- package/dist/energy_device/wall_connector.d.cts +696 -2
- package/dist/energy_device/wall_connector.d.mts +696 -2
- package/dist/energy_device/wall_connector.mjs +6591 -6
- package/package.json +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _bufbuild_protobuf_wire = require("@bufbuild/protobuf/wire");
|
|
3
|
+
//#region src/energy_device/google/protobuf/duration.ts
|
|
4
|
+
const protobufPackage = "google.protobuf";
|
|
5
|
+
function createBaseDuration() {
|
|
6
|
+
return {
|
|
7
|
+
seconds: 0,
|
|
8
|
+
nanos: 0
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const Duration = {
|
|
12
|
+
encode(message, writer = new _bufbuild_protobuf_wire.BinaryWriter()) {
|
|
13
|
+
if (message.seconds !== 0) writer.uint32(8).int64(message.seconds);
|
|
14
|
+
if (message.nanos !== 0) writer.uint32(16).int32(message.nanos);
|
|
15
|
+
return writer;
|
|
16
|
+
},
|
|
17
|
+
decode(input, length) {
|
|
18
|
+
const reader = input instanceof _bufbuild_protobuf_wire.BinaryReader ? input : new _bufbuild_protobuf_wire.BinaryReader(input);
|
|
19
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
20
|
+
const message = createBaseDuration();
|
|
21
|
+
while (reader.pos < end) {
|
|
22
|
+
const tag = reader.uint32();
|
|
23
|
+
switch (tag >>> 3) {
|
|
24
|
+
case 1:
|
|
25
|
+
if (tag !== 8) break;
|
|
26
|
+
message.seconds = longToNumber(reader.int64());
|
|
27
|
+
continue;
|
|
28
|
+
case 2:
|
|
29
|
+
if (tag !== 16) break;
|
|
30
|
+
message.nanos = reader.int32();
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
34
|
+
reader.skip(tag & 7);
|
|
35
|
+
}
|
|
36
|
+
return message;
|
|
37
|
+
},
|
|
38
|
+
fromJSON(object) {
|
|
39
|
+
return {
|
|
40
|
+
seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0,
|
|
41
|
+
nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
toJSON(message) {
|
|
45
|
+
const obj = {};
|
|
46
|
+
if (message.seconds !== void 0) obj.seconds = Math.round(message.seconds);
|
|
47
|
+
if (message.nanos !== void 0) obj.nanos = Math.round(message.nanos);
|
|
48
|
+
return obj;
|
|
49
|
+
},
|
|
50
|
+
create(base) {
|
|
51
|
+
return Duration.fromPartial(base ?? {});
|
|
52
|
+
},
|
|
53
|
+
fromPartial(object) {
|
|
54
|
+
const message = createBaseDuration();
|
|
55
|
+
message.seconds = object.seconds ?? 0;
|
|
56
|
+
message.nanos = object.nanos ?? 0;
|
|
57
|
+
return message;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
function longToNumber(int64) {
|
|
61
|
+
const num = globalThis.Number(int64.toString());
|
|
62
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
63
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
64
|
+
return num;
|
|
65
|
+
}
|
|
66
|
+
function isSet(value) {
|
|
67
|
+
return value !== null && value !== void 0;
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
exports.Duration = Duration;
|
|
71
|
+
exports.protobufPackage = protobufPackage;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
//#region src/energy_device/google/protobuf/duration.d.ts
|
|
3
|
+
declare const protobufPackage = "google.protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* A Duration represents a signed, fixed-length span of time represented
|
|
6
|
+
* as a count of seconds and fractions of seconds at nanosecond
|
|
7
|
+
* resolution. It is independent of any calendar and concepts like "day"
|
|
8
|
+
* or "month". It is related to Timestamp in that the difference between
|
|
9
|
+
* two Timestamp values is a Duration and it can be added or subtracted
|
|
10
|
+
* from a Timestamp. Range is approximately +-10,000 years.
|
|
11
|
+
*
|
|
12
|
+
* # Examples
|
|
13
|
+
*
|
|
14
|
+
* Example 1: Compute Duration from two Timestamps in pseudo code.
|
|
15
|
+
*
|
|
16
|
+
* Timestamp start = ...;
|
|
17
|
+
* Timestamp end = ...;
|
|
18
|
+
* Duration duration = ...;
|
|
19
|
+
*
|
|
20
|
+
* duration.seconds = end.seconds - start.seconds;
|
|
21
|
+
* duration.nanos = end.nanos - start.nanos;
|
|
22
|
+
*
|
|
23
|
+
* if (duration.seconds < 0 && duration.nanos > 0) {
|
|
24
|
+
* duration.seconds += 1;
|
|
25
|
+
* duration.nanos -= 1000000000;
|
|
26
|
+
* } else if (duration.seconds > 0 && duration.nanos < 0) {
|
|
27
|
+
* duration.seconds -= 1;
|
|
28
|
+
* duration.nanos += 1000000000;
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
|
32
|
+
*
|
|
33
|
+
* Timestamp start = ...;
|
|
34
|
+
* Duration duration = ...;
|
|
35
|
+
* Timestamp end = ...;
|
|
36
|
+
*
|
|
37
|
+
* end.seconds = start.seconds + duration.seconds;
|
|
38
|
+
* end.nanos = start.nanos + duration.nanos;
|
|
39
|
+
*
|
|
40
|
+
* if (end.nanos < 0) {
|
|
41
|
+
* end.seconds -= 1;
|
|
42
|
+
* end.nanos += 1000000000;
|
|
43
|
+
* } else if (end.nanos >= 1000000000) {
|
|
44
|
+
* end.seconds += 1;
|
|
45
|
+
* end.nanos -= 1000000000;
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* Example 3: Compute Duration from datetime.timedelta in Python.
|
|
49
|
+
*
|
|
50
|
+
* td = datetime.timedelta(days=3, minutes=10)
|
|
51
|
+
* duration = Duration()
|
|
52
|
+
* duration.FromTimedelta(td)
|
|
53
|
+
*
|
|
54
|
+
* # JSON Mapping
|
|
55
|
+
*
|
|
56
|
+
* In JSON format, the Duration type is encoded as a string rather than an
|
|
57
|
+
* object, where the string ends in the suffix "s" (indicating seconds) and
|
|
58
|
+
* is preceded by the number of seconds, with nanoseconds expressed as
|
|
59
|
+
* fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
|
60
|
+
* encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
|
61
|
+
* be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
|
62
|
+
* microsecond should be expressed in JSON format as "3.000001s".
|
|
63
|
+
*/
|
|
64
|
+
interface Duration {
|
|
65
|
+
/**
|
|
66
|
+
* Signed seconds of the span of time. Must be from -315,576,000,000
|
|
67
|
+
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
|
68
|
+
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
|
69
|
+
*/
|
|
70
|
+
seconds: number;
|
|
71
|
+
/**
|
|
72
|
+
* Signed fractions of a second at nanosecond resolution of the span
|
|
73
|
+
* of time. Durations less than one second are represented with a 0
|
|
74
|
+
* `seconds` field and a positive or negative `nanos` field. For durations
|
|
75
|
+
* of one second or more, a non-zero value for the `nanos` field must be
|
|
76
|
+
* of the same sign as the `seconds` field. Must be from -999,999,999
|
|
77
|
+
* to +999,999,999 inclusive.
|
|
78
|
+
*/
|
|
79
|
+
nanos: number;
|
|
80
|
+
}
|
|
81
|
+
declare const Duration: MessageFns<Duration>;
|
|
82
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
83
|
+
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]>; } : Partial<T>;
|
|
84
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
85
|
+
type Exact<P, I extends P> = P extends Builtin ? P : P & { [K in keyof P]: Exact<P[K], I[K]>; } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never; };
|
|
86
|
+
interface MessageFns<T> {
|
|
87
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
88
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
89
|
+
fromJSON(object: any): T;
|
|
90
|
+
toJSON(message: T): unknown;
|
|
91
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
92
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { DeepPartial, Duration, Exact, MessageFns, protobufPackage };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
//#region src/energy_device/google/protobuf/duration.d.ts
|
|
3
|
+
declare const protobufPackage = "google.protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* A Duration represents a signed, fixed-length span of time represented
|
|
6
|
+
* as a count of seconds and fractions of seconds at nanosecond
|
|
7
|
+
* resolution. It is independent of any calendar and concepts like "day"
|
|
8
|
+
* or "month". It is related to Timestamp in that the difference between
|
|
9
|
+
* two Timestamp values is a Duration and it can be added or subtracted
|
|
10
|
+
* from a Timestamp. Range is approximately +-10,000 years.
|
|
11
|
+
*
|
|
12
|
+
* # Examples
|
|
13
|
+
*
|
|
14
|
+
* Example 1: Compute Duration from two Timestamps in pseudo code.
|
|
15
|
+
*
|
|
16
|
+
* Timestamp start = ...;
|
|
17
|
+
* Timestamp end = ...;
|
|
18
|
+
* Duration duration = ...;
|
|
19
|
+
*
|
|
20
|
+
* duration.seconds = end.seconds - start.seconds;
|
|
21
|
+
* duration.nanos = end.nanos - start.nanos;
|
|
22
|
+
*
|
|
23
|
+
* if (duration.seconds < 0 && duration.nanos > 0) {
|
|
24
|
+
* duration.seconds += 1;
|
|
25
|
+
* duration.nanos -= 1000000000;
|
|
26
|
+
* } else if (duration.seconds > 0 && duration.nanos < 0) {
|
|
27
|
+
* duration.seconds -= 1;
|
|
28
|
+
* duration.nanos += 1000000000;
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
|
32
|
+
*
|
|
33
|
+
* Timestamp start = ...;
|
|
34
|
+
* Duration duration = ...;
|
|
35
|
+
* Timestamp end = ...;
|
|
36
|
+
*
|
|
37
|
+
* end.seconds = start.seconds + duration.seconds;
|
|
38
|
+
* end.nanos = start.nanos + duration.nanos;
|
|
39
|
+
*
|
|
40
|
+
* if (end.nanos < 0) {
|
|
41
|
+
* end.seconds -= 1;
|
|
42
|
+
* end.nanos += 1000000000;
|
|
43
|
+
* } else if (end.nanos >= 1000000000) {
|
|
44
|
+
* end.seconds += 1;
|
|
45
|
+
* end.nanos -= 1000000000;
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* Example 3: Compute Duration from datetime.timedelta in Python.
|
|
49
|
+
*
|
|
50
|
+
* td = datetime.timedelta(days=3, minutes=10)
|
|
51
|
+
* duration = Duration()
|
|
52
|
+
* duration.FromTimedelta(td)
|
|
53
|
+
*
|
|
54
|
+
* # JSON Mapping
|
|
55
|
+
*
|
|
56
|
+
* In JSON format, the Duration type is encoded as a string rather than an
|
|
57
|
+
* object, where the string ends in the suffix "s" (indicating seconds) and
|
|
58
|
+
* is preceded by the number of seconds, with nanoseconds expressed as
|
|
59
|
+
* fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
|
60
|
+
* encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
|
61
|
+
* be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
|
62
|
+
* microsecond should be expressed in JSON format as "3.000001s".
|
|
63
|
+
*/
|
|
64
|
+
interface Duration {
|
|
65
|
+
/**
|
|
66
|
+
* Signed seconds of the span of time. Must be from -315,576,000,000
|
|
67
|
+
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
|
68
|
+
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
|
69
|
+
*/
|
|
70
|
+
seconds: number;
|
|
71
|
+
/**
|
|
72
|
+
* Signed fractions of a second at nanosecond resolution of the span
|
|
73
|
+
* of time. Durations less than one second are represented with a 0
|
|
74
|
+
* `seconds` field and a positive or negative `nanos` field. For durations
|
|
75
|
+
* of one second or more, a non-zero value for the `nanos` field must be
|
|
76
|
+
* of the same sign as the `seconds` field. Must be from -999,999,999
|
|
77
|
+
* to +999,999,999 inclusive.
|
|
78
|
+
*/
|
|
79
|
+
nanos: number;
|
|
80
|
+
}
|
|
81
|
+
declare const Duration: MessageFns<Duration>;
|
|
82
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
83
|
+
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]>; } : Partial<T>;
|
|
84
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
85
|
+
type Exact<P, I extends P> = P extends Builtin ? P : P & { [K in keyof P]: Exact<P[K], I[K]>; } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never; };
|
|
86
|
+
interface MessageFns<T> {
|
|
87
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
88
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
89
|
+
fromJSON(object: any): T;
|
|
90
|
+
toJSON(message: T): unknown;
|
|
91
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
92
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { DeepPartial, Duration, Exact, MessageFns, protobufPackage };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
//#region src/energy_device/google/protobuf/duration.ts
|
|
3
|
+
const protobufPackage = "google.protobuf";
|
|
4
|
+
function createBaseDuration() {
|
|
5
|
+
return {
|
|
6
|
+
seconds: 0,
|
|
7
|
+
nanos: 0
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
const Duration = {
|
|
11
|
+
encode(message, writer = new BinaryWriter()) {
|
|
12
|
+
if (message.seconds !== 0) writer.uint32(8).int64(message.seconds);
|
|
13
|
+
if (message.nanos !== 0) writer.uint32(16).int32(message.nanos);
|
|
14
|
+
return writer;
|
|
15
|
+
},
|
|
16
|
+
decode(input, length) {
|
|
17
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
18
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
19
|
+
const message = createBaseDuration();
|
|
20
|
+
while (reader.pos < end) {
|
|
21
|
+
const tag = reader.uint32();
|
|
22
|
+
switch (tag >>> 3) {
|
|
23
|
+
case 1:
|
|
24
|
+
if (tag !== 8) break;
|
|
25
|
+
message.seconds = longToNumber(reader.int64());
|
|
26
|
+
continue;
|
|
27
|
+
case 2:
|
|
28
|
+
if (tag !== 16) break;
|
|
29
|
+
message.nanos = reader.int32();
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if ((tag & 7) === 4 || tag === 0) break;
|
|
33
|
+
reader.skip(tag & 7);
|
|
34
|
+
}
|
|
35
|
+
return message;
|
|
36
|
+
},
|
|
37
|
+
fromJSON(object) {
|
|
38
|
+
return {
|
|
39
|
+
seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0,
|
|
40
|
+
nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
toJSON(message) {
|
|
44
|
+
const obj = {};
|
|
45
|
+
if (message.seconds !== void 0) obj.seconds = Math.round(message.seconds);
|
|
46
|
+
if (message.nanos !== void 0) obj.nanos = Math.round(message.nanos);
|
|
47
|
+
return obj;
|
|
48
|
+
},
|
|
49
|
+
create(base) {
|
|
50
|
+
return Duration.fromPartial(base ?? {});
|
|
51
|
+
},
|
|
52
|
+
fromPartial(object) {
|
|
53
|
+
const message = createBaseDuration();
|
|
54
|
+
message.seconds = object.seconds ?? 0;
|
|
55
|
+
message.nanos = object.nanos ?? 0;
|
|
56
|
+
return message;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
function longToNumber(int64) {
|
|
60
|
+
const num = globalThis.Number(int64.toString());
|
|
61
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
62
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
63
|
+
return num;
|
|
64
|
+
}
|
|
65
|
+
function isSet(value) {
|
|
66
|
+
return value !== null && value !== void 0;
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { Duration, protobufPackage };
|