@teslemetry/tesla-protocol 0.1.1
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/README.md +20 -0
- package/dist/command/car_server.cjs +11126 -0
- package/dist/command/car_server.d.cts +1281 -0
- package/dist/command/car_server.d.mts +1281 -0
- package/dist/command/car_server.mjs +10880 -0
- package/dist/command/common.cjs +1536 -0
- package/dist/command/common.d.cts +327 -0
- package/dist/command/common.d.mts +327 -0
- package/dist/command/common.mjs +1488 -0
- package/dist/command/errors.cjs +107 -0
- package/dist/command/errors.d.cts +40 -0
- package/dist/command/errors.d.mts +40 -0
- package/dist/command/errors.mjs +102 -0
- package/dist/command/google/protobuf/timestamp.cjs +71 -0
- package/dist/command/google/protobuf/timestamp.d.cts +124 -0
- package/dist/command/google/protobuf/timestamp.d.mts +124 -0
- package/dist/command/google/protobuf/timestamp.mjs +69 -0
- package/dist/command/google/protobuf/wrappers.cjs +421 -0
- package/dist/command/google/protobuf/wrappers.d.cts +134 -0
- package/dist/command/google/protobuf/wrappers.d.mts +134 -0
- package/dist/command/google/protobuf/wrappers.mjs +411 -0
- package/dist/command/keys.cjs +60 -0
- package/dist/command/keys.d.cts +23 -0
- package/dist/command/keys.d.mts +23 -0
- package/dist/command/keys.mjs +56 -0
- package/dist/command/managed_charging.cjs +435 -0
- package/dist/command/managed_charging.d.cts +86 -0
- package/dist/command/managed_charging.d.mts +86 -0
- package/dist/command/managed_charging.mjs +421 -0
- package/dist/command/session.cjs +119 -0
- package/dist/command/session.d.cts +28 -0
- package/dist/command/session.d.mts +28 -0
- package/dist/command/session.mjs +117 -0
- package/dist/command/signatures.cjs +696 -0
- package/dist/command/signatures.d.cts +107 -0
- package/dist/command/signatures.d.mts +107 -0
- package/dist/command/signatures.mjs +678 -0
- package/dist/command/universal_message.cjs +588 -0
- package/dist/command/universal_message.d.cts +141 -0
- package/dist/command/universal_message.d.mts +141 -0
- package/dist/command/universal_message.mjs +571 -0
- package/dist/command/vcsec.cjs +2281 -0
- package/dist/command/vcsec.d.cts +404 -0
- package/dist/command/vcsec.d.mts +404 -0
- package/dist/command/vcsec.mjs +2218 -0
- package/dist/command/vehicle.cjs +10332 -0
- package/dist/command/vehicle.d.cts +1429 -0
- package/dist/command/vehicle.d.mts +1429 -0
- package/dist/command/vehicle.mjs +10168 -0
- package/dist/energy_command/identifier_type.cjs +47 -0
- package/dist/energy_command/identifier_type.d.cts +19 -0
- package/dist/energy_command/identifier_type.d.mts +19 -0
- package/dist/energy_command/identifier_type.mjs +43 -0
- package/dist/energy_device/authorization_api.cjs +815 -0
- package/dist/energy_device/authorization_api.d.cts +92 -0
- package/dist/energy_device/authorization_api.d.mts +92 -0
- package/dist/energy_device/authorization_api.mjs +801 -0
- package/dist/energy_device/authorization_types.cjs +348 -0
- package/dist/energy_device/authorization_types.d.cts +79 -0
- package/dist/energy_device/authorization_types.d.mts +79 -0
- package/dist/energy_device/authorization_types.mjs +331 -0
- package/dist/energy_device/common_api.cjs +2104 -0
- package/dist/energy_device/common_api.d.cts +211 -0
- package/dist/energy_device/common_api.d.mts +211 -0
- package/dist/energy_device/common_api.mjs +2064 -0
- package/dist/energy_device/device.cjs +485 -0
- package/dist/energy_device/device.d.cts +102 -0
- package/dist/energy_device/device.d.mts +102 -0
- package/dist/energy_device/device.mjs +462 -0
- package/dist/energy_device/energy.cjs +442 -0
- package/dist/energy_device/energy.d.cts +82 -0
- package/dist/energy_device/energy.d.mts +82 -0
- package/dist/energy_device/energy.mjs +429 -0
- package/dist/energy_device/energy_site_net.cjs +235 -0
- package/dist/energy_device/energy_site_net.d.cts +69 -0
- package/dist/energy_device/energy_site_net.d.mts +69 -0
- package/dist/energy_device/energy_site_net.mjs +219 -0
- package/dist/energy_device/error.cjs +53 -0
- package/dist/energy_device/error.d.cts +27 -0
- package/dist/energy_device/error.d.mts +27 -0
- package/dist/energy_device/error.mjs +51 -0
- package/dist/energy_device/google/protobuf/timestamp.cjs +71 -0
- package/dist/energy_device/google/protobuf/timestamp.d.cts +124 -0
- package/dist/energy_device/google/protobuf/timestamp.d.mts +124 -0
- package/dist/energy_device/google/protobuf/timestamp.mjs +69 -0
- package/dist/energy_device/google/protobuf/wrappers.cjs +421 -0
- package/dist/energy_device/google/protobuf/wrappers.d.cts +134 -0
- package/dist/energy_device/google/protobuf/wrappers.d.mts +134 -0
- package/dist/energy_device/google/protobuf/wrappers.mjs +411 -0
- package/dist/energy_device/google/rpc/status.cjs +65 -0
- package/dist/energy_device/google/rpc/status.d.cts +26 -0
- package/dist/energy_device/google/rpc/status.d.mts +26 -0
- package/dist/energy_device/google/rpc/status.mjs +63 -0
- package/dist/energy_device/networking.cjs +834 -0
- package/dist/energy_device/networking.d.cts +141 -0
- package/dist/energy_device/networking.d.mts +141 -0
- package/dist/energy_device/networking.mjs +810 -0
- package/dist/energy_device/teg_api.cjs +594 -0
- package/dist/energy_device/teg_api.d.cts +140 -0
- package/dist/energy_device/teg_api.d.mts +140 -0
- package/dist/energy_device/teg_api.mjs +581 -0
- package/dist/energy_device/transport.cjs +478 -0
- package/dist/energy_device/transport.d.cts +95 -0
- package/dist/energy_device/transport.d.mts +95 -0
- package/dist/energy_device/transport.mjs +460 -0
- package/dist/energy_device/update.cjs +521 -0
- package/dist/energy_device/update.d.cts +86 -0
- package/dist/energy_device/update.d.mts +86 -0
- package/dist/energy_device/update.mjs +506 -0
- package/dist/energy_device/wall_connector.cjs +634 -0
- package/dist/energy_device/wall_connector.d.cts +182 -0
- package/dist/energy_device/wall_connector.d.mts +182 -0
- package/dist/energy_device/wall_connector.mjs +590 -0
- package/dist/telemetry/google/protobuf/timestamp.cjs +71 -0
- package/dist/telemetry/google/protobuf/timestamp.d.cts +124 -0
- package/dist/telemetry/google/protobuf/timestamp.d.mts +124 -0
- package/dist/telemetry/google/protobuf/timestamp.mjs +69 -0
- package/dist/telemetry/vehicle_alert.cjs +214 -0
- package/dist/telemetry/vehicle_alert.d.cts +48 -0
- package/dist/telemetry/vehicle_alert.d.mts +48 -0
- package/dist/telemetry/vehicle_alert.mjs +208 -0
- package/dist/telemetry/vehicle_connectivity.cjs +145 -0
- package/dist/telemetry/vehicle_connectivity.d.cts +41 -0
- package/dist/telemetry/vehicle_connectivity.d.mts +41 -0
- package/dist/telemetry/vehicle_connectivity.mjs +140 -0
- package/dist/telemetry/vehicle_data.cjs +3792 -0
- package/dist/telemetry/vehicle_data.d.cts +872 -0
- package/dist/telemetry/vehicle_data.d.mts +872 -0
- package/dist/telemetry/vehicle_data.mjs +3655 -0
- package/dist/telemetry/vehicle_error.cjs +245 -0
- package/dist/telemetry/vehicle_error.d.cts +45 -0
- package/dist/telemetry/vehicle_error.d.mts +45 -0
- package/dist/telemetry/vehicle_error.mjs +241 -0
- package/dist/telemetry/vehicle_metric.cjs +236 -0
- package/dist/telemetry/vehicle_metric.d.cts +44 -0
- package/dist/telemetry/vehicle_metric.d.mts +44 -0
- package/dist/telemetry/vehicle_metric.mjs +232 -0
- package/dist/teslapower/google/protobuf/any.cjs +84 -0
- package/dist/teslapower/google/protobuf/any.d.cts +140 -0
- package/dist/teslapower/google/protobuf/any.d.mts +140 -0
- package/dist/teslapower/google/protobuf/any.mjs +82 -0
- package/dist/teslapower/google/protobuf/timestamp.cjs +71 -0
- package/dist/teslapower/google/protobuf/timestamp.d.cts +124 -0
- package/dist/teslapower/google/protobuf/timestamp.d.mts +124 -0
- package/dist/teslapower/google/protobuf/timestamp.mjs +69 -0
- package/dist/teslapower/teslapower.cjs +5486 -0
- package/dist/teslapower/teslapower.d.cts +518 -0
- package/dist/teslapower/teslapower.d.mts +518 -0
- package/dist/teslapower/teslapower.mjs +5381 -0
- package/package.json +53 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
//#region src/teslapower/google/protobuf/any.d.ts
|
|
3
|
+
declare const protobufPackage = "google.protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
6
|
+
* URL that describes the type of the serialized message.
|
|
7
|
+
*
|
|
8
|
+
* Protobuf library provides support to pack/unpack Any values in the form
|
|
9
|
+
* of utility functions or additional generated methods of the Any type.
|
|
10
|
+
*
|
|
11
|
+
* Example 1: Pack and unpack a message in C++.
|
|
12
|
+
*
|
|
13
|
+
* Foo foo = ...;
|
|
14
|
+
* Any any;
|
|
15
|
+
* any.PackFrom(foo);
|
|
16
|
+
* ...
|
|
17
|
+
* if (any.UnpackTo(&foo)) {
|
|
18
|
+
* ...
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* Example 2: Pack and unpack a message in Java.
|
|
22
|
+
*
|
|
23
|
+
* Foo foo = ...;
|
|
24
|
+
* Any any = Any.pack(foo);
|
|
25
|
+
* ...
|
|
26
|
+
* if (any.is(Foo.class)) {
|
|
27
|
+
* foo = any.unpack(Foo.class);
|
|
28
|
+
* }
|
|
29
|
+
* // or ...
|
|
30
|
+
* if (any.isSameTypeAs(Foo.getDefaultInstance())) {
|
|
31
|
+
* foo = any.unpack(Foo.getDefaultInstance());
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* Example 3: Pack and unpack a message in Python.
|
|
35
|
+
*
|
|
36
|
+
* foo = Foo(...)
|
|
37
|
+
* any = Any()
|
|
38
|
+
* any.Pack(foo)
|
|
39
|
+
* ...
|
|
40
|
+
* if any.Is(Foo.DESCRIPTOR):
|
|
41
|
+
* any.Unpack(foo)
|
|
42
|
+
* ...
|
|
43
|
+
*
|
|
44
|
+
* Example 4: Pack and unpack a message in Go
|
|
45
|
+
*
|
|
46
|
+
* foo := &pb.Foo{...}
|
|
47
|
+
* any, err := anypb.New(foo)
|
|
48
|
+
* if err != nil {
|
|
49
|
+
* ...
|
|
50
|
+
* }
|
|
51
|
+
* ...
|
|
52
|
+
* foo := &pb.Foo{}
|
|
53
|
+
* if err := any.UnmarshalTo(foo); err != nil {
|
|
54
|
+
* ...
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* The pack methods provided by protobuf library will by default use
|
|
58
|
+
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
|
59
|
+
* methods only use the fully qualified type name after the last '/'
|
|
60
|
+
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
61
|
+
* name "y.z".
|
|
62
|
+
*
|
|
63
|
+
* JSON
|
|
64
|
+
* ====
|
|
65
|
+
* The JSON representation of an `Any` value uses the regular
|
|
66
|
+
* representation of the deserialized, embedded message, with an
|
|
67
|
+
* additional field `@type` which contains the type URL. Example:
|
|
68
|
+
*
|
|
69
|
+
* package google.profile;
|
|
70
|
+
* message Person {
|
|
71
|
+
* string first_name = 1;
|
|
72
|
+
* string last_name = 2;
|
|
73
|
+
* }
|
|
74
|
+
*
|
|
75
|
+
* {
|
|
76
|
+
* "@type": "type.googleapis.com/google.profile.Person",
|
|
77
|
+
* "firstName": <string>,
|
|
78
|
+
* "lastName": <string>
|
|
79
|
+
* }
|
|
80
|
+
*
|
|
81
|
+
* If the embedded message type is well-known and has a custom JSON
|
|
82
|
+
* representation, that representation will be embedded adding a field
|
|
83
|
+
* `value` which holds the custom JSON in addition to the `@type`
|
|
84
|
+
* field. Example (for message [google.protobuf.Duration][]):
|
|
85
|
+
*
|
|
86
|
+
* {
|
|
87
|
+
* "@type": "type.googleapis.com/google.protobuf.Duration",
|
|
88
|
+
* "value": "1.212s"
|
|
89
|
+
* }
|
|
90
|
+
*/
|
|
91
|
+
interface Any {
|
|
92
|
+
/**
|
|
93
|
+
* A URL/resource name that uniquely identifies the type of the serialized
|
|
94
|
+
* protocol buffer message. This string must contain at least
|
|
95
|
+
* one "/" character. The last segment of the URL's path must represent
|
|
96
|
+
* the fully qualified name of the type (as in
|
|
97
|
+
* `path/google.protobuf.Duration`). The name should be in a canonical form
|
|
98
|
+
* (e.g., leading "." is not accepted).
|
|
99
|
+
*
|
|
100
|
+
* In practice, teams usually precompile into the binary all types that they
|
|
101
|
+
* expect it to use in the context of Any. However, for URLs which use the
|
|
102
|
+
* scheme `http`, `https`, or no scheme, one can optionally set up a type
|
|
103
|
+
* server that maps type URLs to message definitions as follows:
|
|
104
|
+
*
|
|
105
|
+
* * If no scheme is provided, `https` is assumed.
|
|
106
|
+
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
|
107
|
+
* value in binary format, or produce an error.
|
|
108
|
+
* * Applications are allowed to cache lookup results based on the
|
|
109
|
+
* URL, or have them precompiled into a binary to avoid any
|
|
110
|
+
* lookup. Therefore, binary compatibility needs to be preserved
|
|
111
|
+
* on changes to types. (Use versioned type names to manage
|
|
112
|
+
* breaking changes.)
|
|
113
|
+
*
|
|
114
|
+
* Note: this functionality is not currently available in the official
|
|
115
|
+
* protobuf release, and it is not used for type URLs beginning with
|
|
116
|
+
* type.googleapis.com. As of May 2023, there are no widely used type server
|
|
117
|
+
* implementations and no plans to implement one.
|
|
118
|
+
*
|
|
119
|
+
* Schemes other than `http`, `https` (or the empty scheme) might be
|
|
120
|
+
* used with implementation specific semantics.
|
|
121
|
+
*/
|
|
122
|
+
typeUrl: string;
|
|
123
|
+
/** Must be a valid serialized protocol buffer of the above specified type. */
|
|
124
|
+
value: Uint8Array;
|
|
125
|
+
}
|
|
126
|
+
declare const Any: MessageFns<Any>;
|
|
127
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
128
|
+
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>;
|
|
129
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
130
|
+
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; };
|
|
131
|
+
interface MessageFns<T> {
|
|
132
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
133
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
134
|
+
fromJSON(object: any): T;
|
|
135
|
+
toJSON(message: T): unknown;
|
|
136
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
137
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
export { Any, DeepPartial, Exact, MessageFns, protobufPackage };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
//#region src/teslapower/google/protobuf/any.d.ts
|
|
3
|
+
declare const protobufPackage = "google.protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
6
|
+
* URL that describes the type of the serialized message.
|
|
7
|
+
*
|
|
8
|
+
* Protobuf library provides support to pack/unpack Any values in the form
|
|
9
|
+
* of utility functions or additional generated methods of the Any type.
|
|
10
|
+
*
|
|
11
|
+
* Example 1: Pack and unpack a message in C++.
|
|
12
|
+
*
|
|
13
|
+
* Foo foo = ...;
|
|
14
|
+
* Any any;
|
|
15
|
+
* any.PackFrom(foo);
|
|
16
|
+
* ...
|
|
17
|
+
* if (any.UnpackTo(&foo)) {
|
|
18
|
+
* ...
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* Example 2: Pack and unpack a message in Java.
|
|
22
|
+
*
|
|
23
|
+
* Foo foo = ...;
|
|
24
|
+
* Any any = Any.pack(foo);
|
|
25
|
+
* ...
|
|
26
|
+
* if (any.is(Foo.class)) {
|
|
27
|
+
* foo = any.unpack(Foo.class);
|
|
28
|
+
* }
|
|
29
|
+
* // or ...
|
|
30
|
+
* if (any.isSameTypeAs(Foo.getDefaultInstance())) {
|
|
31
|
+
* foo = any.unpack(Foo.getDefaultInstance());
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* Example 3: Pack and unpack a message in Python.
|
|
35
|
+
*
|
|
36
|
+
* foo = Foo(...)
|
|
37
|
+
* any = Any()
|
|
38
|
+
* any.Pack(foo)
|
|
39
|
+
* ...
|
|
40
|
+
* if any.Is(Foo.DESCRIPTOR):
|
|
41
|
+
* any.Unpack(foo)
|
|
42
|
+
* ...
|
|
43
|
+
*
|
|
44
|
+
* Example 4: Pack and unpack a message in Go
|
|
45
|
+
*
|
|
46
|
+
* foo := &pb.Foo{...}
|
|
47
|
+
* any, err := anypb.New(foo)
|
|
48
|
+
* if err != nil {
|
|
49
|
+
* ...
|
|
50
|
+
* }
|
|
51
|
+
* ...
|
|
52
|
+
* foo := &pb.Foo{}
|
|
53
|
+
* if err := any.UnmarshalTo(foo); err != nil {
|
|
54
|
+
* ...
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* The pack methods provided by protobuf library will by default use
|
|
58
|
+
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
|
59
|
+
* methods only use the fully qualified type name after the last '/'
|
|
60
|
+
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
61
|
+
* name "y.z".
|
|
62
|
+
*
|
|
63
|
+
* JSON
|
|
64
|
+
* ====
|
|
65
|
+
* The JSON representation of an `Any` value uses the regular
|
|
66
|
+
* representation of the deserialized, embedded message, with an
|
|
67
|
+
* additional field `@type` which contains the type URL. Example:
|
|
68
|
+
*
|
|
69
|
+
* package google.profile;
|
|
70
|
+
* message Person {
|
|
71
|
+
* string first_name = 1;
|
|
72
|
+
* string last_name = 2;
|
|
73
|
+
* }
|
|
74
|
+
*
|
|
75
|
+
* {
|
|
76
|
+
* "@type": "type.googleapis.com/google.profile.Person",
|
|
77
|
+
* "firstName": <string>,
|
|
78
|
+
* "lastName": <string>
|
|
79
|
+
* }
|
|
80
|
+
*
|
|
81
|
+
* If the embedded message type is well-known and has a custom JSON
|
|
82
|
+
* representation, that representation will be embedded adding a field
|
|
83
|
+
* `value` which holds the custom JSON in addition to the `@type`
|
|
84
|
+
* field. Example (for message [google.protobuf.Duration][]):
|
|
85
|
+
*
|
|
86
|
+
* {
|
|
87
|
+
* "@type": "type.googleapis.com/google.protobuf.Duration",
|
|
88
|
+
* "value": "1.212s"
|
|
89
|
+
* }
|
|
90
|
+
*/
|
|
91
|
+
interface Any {
|
|
92
|
+
/**
|
|
93
|
+
* A URL/resource name that uniquely identifies the type of the serialized
|
|
94
|
+
* protocol buffer message. This string must contain at least
|
|
95
|
+
* one "/" character. The last segment of the URL's path must represent
|
|
96
|
+
* the fully qualified name of the type (as in
|
|
97
|
+
* `path/google.protobuf.Duration`). The name should be in a canonical form
|
|
98
|
+
* (e.g., leading "." is not accepted).
|
|
99
|
+
*
|
|
100
|
+
* In practice, teams usually precompile into the binary all types that they
|
|
101
|
+
* expect it to use in the context of Any. However, for URLs which use the
|
|
102
|
+
* scheme `http`, `https`, or no scheme, one can optionally set up a type
|
|
103
|
+
* server that maps type URLs to message definitions as follows:
|
|
104
|
+
*
|
|
105
|
+
* * If no scheme is provided, `https` is assumed.
|
|
106
|
+
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
|
107
|
+
* value in binary format, or produce an error.
|
|
108
|
+
* * Applications are allowed to cache lookup results based on the
|
|
109
|
+
* URL, or have them precompiled into a binary to avoid any
|
|
110
|
+
* lookup. Therefore, binary compatibility needs to be preserved
|
|
111
|
+
* on changes to types. (Use versioned type names to manage
|
|
112
|
+
* breaking changes.)
|
|
113
|
+
*
|
|
114
|
+
* Note: this functionality is not currently available in the official
|
|
115
|
+
* protobuf release, and it is not used for type URLs beginning with
|
|
116
|
+
* type.googleapis.com. As of May 2023, there are no widely used type server
|
|
117
|
+
* implementations and no plans to implement one.
|
|
118
|
+
*
|
|
119
|
+
* Schemes other than `http`, `https` (or the empty scheme) might be
|
|
120
|
+
* used with implementation specific semantics.
|
|
121
|
+
*/
|
|
122
|
+
typeUrl: string;
|
|
123
|
+
/** Must be a valid serialized protocol buffer of the above specified type. */
|
|
124
|
+
value: Uint8Array;
|
|
125
|
+
}
|
|
126
|
+
declare const Any: MessageFns<Any>;
|
|
127
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
128
|
+
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>;
|
|
129
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
130
|
+
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; };
|
|
131
|
+
interface MessageFns<T> {
|
|
132
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
133
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
134
|
+
fromJSON(object: any): T;
|
|
135
|
+
toJSON(message: T): unknown;
|
|
136
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
137
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
export { Any, DeepPartial, Exact, MessageFns, protobufPackage };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
//#region src/teslapower/google/protobuf/any.ts
|
|
3
|
+
const protobufPackage = "google.protobuf";
|
|
4
|
+
function createBaseAny() {
|
|
5
|
+
return {
|
|
6
|
+
typeUrl: "",
|
|
7
|
+
value: /* @__PURE__ */ new Uint8Array(0)
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
const Any = {
|
|
11
|
+
encode(message, writer = new BinaryWriter()) {
|
|
12
|
+
if (message.typeUrl !== "") writer.uint32(10).string(message.typeUrl);
|
|
13
|
+
if (message.value.length !== 0) writer.uint32(18).bytes(message.value);
|
|
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 = createBaseAny();
|
|
20
|
+
while (reader.pos < end) {
|
|
21
|
+
const tag = reader.uint32();
|
|
22
|
+
switch (tag >>> 3) {
|
|
23
|
+
case 1:
|
|
24
|
+
if (tag !== 10) break;
|
|
25
|
+
message.typeUrl = reader.string();
|
|
26
|
+
continue;
|
|
27
|
+
case 2:
|
|
28
|
+
if (tag !== 18) break;
|
|
29
|
+
message.value = reader.bytes();
|
|
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
|
+
typeUrl: isSet(object.typeUrl) ? globalThis.String(object.typeUrl) : "",
|
|
40
|
+
value: isSet(object.value) ? bytesFromBase64(object.value) : /* @__PURE__ */ new Uint8Array(0)
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
toJSON(message) {
|
|
44
|
+
const obj = {};
|
|
45
|
+
if (message.typeUrl !== void 0) obj.typeUrl = message.typeUrl;
|
|
46
|
+
if (message.value !== void 0) obj.value = base64FromBytes(message.value);
|
|
47
|
+
return obj;
|
|
48
|
+
},
|
|
49
|
+
create(base) {
|
|
50
|
+
return Any.fromPartial(base ?? {});
|
|
51
|
+
},
|
|
52
|
+
fromPartial(object) {
|
|
53
|
+
const message = createBaseAny();
|
|
54
|
+
message.typeUrl = object.typeUrl ?? "";
|
|
55
|
+
message.value = object.value ?? /* @__PURE__ */ new Uint8Array(0);
|
|
56
|
+
return message;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
function bytesFromBase64(b64) {
|
|
60
|
+
if (globalThis.Buffer) return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
61
|
+
else {
|
|
62
|
+
const bin = globalThis.atob(b64);
|
|
63
|
+
const arr = new Uint8Array(bin.length);
|
|
64
|
+
for (let i = 0; i < bin.length; ++i) arr[i] = bin.charCodeAt(i);
|
|
65
|
+
return arr;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function base64FromBytes(arr) {
|
|
69
|
+
if (globalThis.Buffer) return globalThis.Buffer.from(arr).toString("base64");
|
|
70
|
+
else {
|
|
71
|
+
const bin = [];
|
|
72
|
+
arr.forEach((byte) => {
|
|
73
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
74
|
+
});
|
|
75
|
+
return globalThis.btoa(bin.join(""));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function isSet(value) {
|
|
79
|
+
return value !== null && value !== void 0;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { Any, protobufPackage };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _bufbuild_protobuf_wire = require("@bufbuild/protobuf/wire");
|
|
3
|
+
//#region src/teslapower/google/protobuf/timestamp.ts
|
|
4
|
+
const protobufPackage = "google.protobuf";
|
|
5
|
+
function createBaseTimestamp() {
|
|
6
|
+
return {
|
|
7
|
+
seconds: 0,
|
|
8
|
+
nanos: 0
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const Timestamp = {
|
|
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 = createBaseTimestamp();
|
|
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 Timestamp.fromPartial(base ?? {});
|
|
52
|
+
},
|
|
53
|
+
fromPartial(object) {
|
|
54
|
+
const message = createBaseTimestamp();
|
|
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.Timestamp = Timestamp;
|
|
71
|
+
exports.protobufPackage = protobufPackage;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
//#region src/teslapower/google/protobuf/timestamp.d.ts
|
|
3
|
+
declare const protobufPackage = "google.protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* A Timestamp represents a point in time independent of any time zone or local
|
|
6
|
+
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
7
|
+
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
|
8
|
+
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
|
9
|
+
* Gregorian calendar backwards to year one.
|
|
10
|
+
*
|
|
11
|
+
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
|
12
|
+
* second table is needed for interpretation, using a [24-hour linear
|
|
13
|
+
* smear](https://developers.google.com/time/smear).
|
|
14
|
+
*
|
|
15
|
+
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
|
16
|
+
* restricting to that range, we ensure that we can convert to and from [RFC
|
|
17
|
+
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
|
18
|
+
*
|
|
19
|
+
* # Examples
|
|
20
|
+
*
|
|
21
|
+
* Example 1: Compute Timestamp from POSIX `time()`.
|
|
22
|
+
*
|
|
23
|
+
* Timestamp timestamp;
|
|
24
|
+
* timestamp.set_seconds(time(NULL));
|
|
25
|
+
* timestamp.set_nanos(0);
|
|
26
|
+
*
|
|
27
|
+
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
|
28
|
+
*
|
|
29
|
+
* struct timeval tv;
|
|
30
|
+
* gettimeofday(&tv, NULL);
|
|
31
|
+
*
|
|
32
|
+
* Timestamp timestamp;
|
|
33
|
+
* timestamp.set_seconds(tv.tv_sec);
|
|
34
|
+
* timestamp.set_nanos(tv.tv_usec * 1000);
|
|
35
|
+
*
|
|
36
|
+
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
|
37
|
+
*
|
|
38
|
+
* FILETIME ft;
|
|
39
|
+
* GetSystemTimeAsFileTime(&ft);
|
|
40
|
+
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
|
41
|
+
*
|
|
42
|
+
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
|
43
|
+
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
|
44
|
+
* Timestamp timestamp;
|
|
45
|
+
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
|
46
|
+
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
|
47
|
+
*
|
|
48
|
+
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
|
49
|
+
*
|
|
50
|
+
* long millis = System.currentTimeMillis();
|
|
51
|
+
*
|
|
52
|
+
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
|
53
|
+
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
|
54
|
+
*
|
|
55
|
+
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
|
56
|
+
*
|
|
57
|
+
* Instant now = Instant.now();
|
|
58
|
+
*
|
|
59
|
+
* Timestamp timestamp =
|
|
60
|
+
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
|
61
|
+
* .setNanos(now.getNano()).build();
|
|
62
|
+
*
|
|
63
|
+
* Example 6: Compute Timestamp from current time in Python.
|
|
64
|
+
*
|
|
65
|
+
* timestamp = Timestamp()
|
|
66
|
+
* timestamp.GetCurrentTime()
|
|
67
|
+
*
|
|
68
|
+
* # JSON Mapping
|
|
69
|
+
*
|
|
70
|
+
* In JSON format, the Timestamp type is encoded as a string in the
|
|
71
|
+
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
|
72
|
+
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
|
73
|
+
* where {year} is always expressed using four digits while {month}, {day},
|
|
74
|
+
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
|
75
|
+
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
|
76
|
+
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
|
77
|
+
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
|
78
|
+
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
|
79
|
+
* able to accept both UTC and other timezones (as indicated by an offset).
|
|
80
|
+
*
|
|
81
|
+
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
|
82
|
+
* 01:30 UTC on January 15, 2017.
|
|
83
|
+
*
|
|
84
|
+
* In JavaScript, one can convert a Date object to this format using the
|
|
85
|
+
* standard
|
|
86
|
+
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
|
87
|
+
* method. In Python, a standard `datetime.datetime` object can be converted
|
|
88
|
+
* to this format using
|
|
89
|
+
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
|
90
|
+
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
|
91
|
+
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
|
92
|
+
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
|
93
|
+
* ) to obtain a formatter capable of generating timestamps in this format.
|
|
94
|
+
*/
|
|
95
|
+
interface Timestamp {
|
|
96
|
+
/**
|
|
97
|
+
* Represents seconds of UTC time since Unix epoch
|
|
98
|
+
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
99
|
+
* 9999-12-31T23:59:59Z inclusive.
|
|
100
|
+
*/
|
|
101
|
+
seconds: number;
|
|
102
|
+
/**
|
|
103
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
104
|
+
* second values with fractions must still have non-negative nanos values
|
|
105
|
+
* that count forward in time. Must be from 0 to 999,999,999
|
|
106
|
+
* inclusive.
|
|
107
|
+
*/
|
|
108
|
+
nanos: number;
|
|
109
|
+
}
|
|
110
|
+
declare const Timestamp: MessageFns<Timestamp>;
|
|
111
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
112
|
+
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>;
|
|
113
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
114
|
+
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; };
|
|
115
|
+
interface MessageFns<T> {
|
|
116
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
117
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
118
|
+
fromJSON(object: any): T;
|
|
119
|
+
toJSON(message: T): unknown;
|
|
120
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
121
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { DeepPartial, Exact, MessageFns, Timestamp, protobufPackage };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
//#region src/teslapower/google/protobuf/timestamp.d.ts
|
|
3
|
+
declare const protobufPackage = "google.protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* A Timestamp represents a point in time independent of any time zone or local
|
|
6
|
+
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
7
|
+
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
|
8
|
+
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
|
9
|
+
* Gregorian calendar backwards to year one.
|
|
10
|
+
*
|
|
11
|
+
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
|
12
|
+
* second table is needed for interpretation, using a [24-hour linear
|
|
13
|
+
* smear](https://developers.google.com/time/smear).
|
|
14
|
+
*
|
|
15
|
+
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
|
16
|
+
* restricting to that range, we ensure that we can convert to and from [RFC
|
|
17
|
+
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
|
18
|
+
*
|
|
19
|
+
* # Examples
|
|
20
|
+
*
|
|
21
|
+
* Example 1: Compute Timestamp from POSIX `time()`.
|
|
22
|
+
*
|
|
23
|
+
* Timestamp timestamp;
|
|
24
|
+
* timestamp.set_seconds(time(NULL));
|
|
25
|
+
* timestamp.set_nanos(0);
|
|
26
|
+
*
|
|
27
|
+
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
|
28
|
+
*
|
|
29
|
+
* struct timeval tv;
|
|
30
|
+
* gettimeofday(&tv, NULL);
|
|
31
|
+
*
|
|
32
|
+
* Timestamp timestamp;
|
|
33
|
+
* timestamp.set_seconds(tv.tv_sec);
|
|
34
|
+
* timestamp.set_nanos(tv.tv_usec * 1000);
|
|
35
|
+
*
|
|
36
|
+
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
|
37
|
+
*
|
|
38
|
+
* FILETIME ft;
|
|
39
|
+
* GetSystemTimeAsFileTime(&ft);
|
|
40
|
+
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
|
41
|
+
*
|
|
42
|
+
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
|
43
|
+
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
|
44
|
+
* Timestamp timestamp;
|
|
45
|
+
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
|
46
|
+
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
|
47
|
+
*
|
|
48
|
+
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
|
49
|
+
*
|
|
50
|
+
* long millis = System.currentTimeMillis();
|
|
51
|
+
*
|
|
52
|
+
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
|
53
|
+
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
|
54
|
+
*
|
|
55
|
+
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
|
56
|
+
*
|
|
57
|
+
* Instant now = Instant.now();
|
|
58
|
+
*
|
|
59
|
+
* Timestamp timestamp =
|
|
60
|
+
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
|
61
|
+
* .setNanos(now.getNano()).build();
|
|
62
|
+
*
|
|
63
|
+
* Example 6: Compute Timestamp from current time in Python.
|
|
64
|
+
*
|
|
65
|
+
* timestamp = Timestamp()
|
|
66
|
+
* timestamp.GetCurrentTime()
|
|
67
|
+
*
|
|
68
|
+
* # JSON Mapping
|
|
69
|
+
*
|
|
70
|
+
* In JSON format, the Timestamp type is encoded as a string in the
|
|
71
|
+
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
|
72
|
+
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
|
73
|
+
* where {year} is always expressed using four digits while {month}, {day},
|
|
74
|
+
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
|
75
|
+
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
|
76
|
+
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
|
77
|
+
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
|
78
|
+
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
|
79
|
+
* able to accept both UTC and other timezones (as indicated by an offset).
|
|
80
|
+
*
|
|
81
|
+
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
|
82
|
+
* 01:30 UTC on January 15, 2017.
|
|
83
|
+
*
|
|
84
|
+
* In JavaScript, one can convert a Date object to this format using the
|
|
85
|
+
* standard
|
|
86
|
+
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
|
87
|
+
* method. In Python, a standard `datetime.datetime` object can be converted
|
|
88
|
+
* to this format using
|
|
89
|
+
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
|
90
|
+
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
|
91
|
+
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
|
92
|
+
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
|
93
|
+
* ) to obtain a formatter capable of generating timestamps in this format.
|
|
94
|
+
*/
|
|
95
|
+
interface Timestamp {
|
|
96
|
+
/**
|
|
97
|
+
* Represents seconds of UTC time since Unix epoch
|
|
98
|
+
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
99
|
+
* 9999-12-31T23:59:59Z inclusive.
|
|
100
|
+
*/
|
|
101
|
+
seconds: number;
|
|
102
|
+
/**
|
|
103
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
104
|
+
* second values with fractions must still have non-negative nanos values
|
|
105
|
+
* that count forward in time. Must be from 0 to 999,999,999
|
|
106
|
+
* inclusive.
|
|
107
|
+
*/
|
|
108
|
+
nanos: number;
|
|
109
|
+
}
|
|
110
|
+
declare const Timestamp: MessageFns<Timestamp>;
|
|
111
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
112
|
+
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>;
|
|
113
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
114
|
+
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; };
|
|
115
|
+
interface MessageFns<T> {
|
|
116
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
117
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
118
|
+
fromJSON(object: any): T;
|
|
119
|
+
toJSON(message: T): unknown;
|
|
120
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
121
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { DeepPartial, Exact, MessageFns, Timestamp, protobufPackage };
|