mezon-js-protobuf 1.7.17 → 1.7.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,223 +1,223 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v1.181.2
4
- // protoc v4.25.2
5
- // source: google/protobuf/timestamp.proto
6
-
7
- /* eslint-disable */
8
- import Long from "long";
9
- import _m0 from "protobufjs/minimal";
10
-
11
- export const protobufPackage = "google.protobuf";
12
-
13
- /**
14
- * A Timestamp represents a point in time independent of any time zone or local
15
- * calendar, encoded as a count of seconds and fractions of seconds at
16
- * nanosecond resolution. The count is relative to an epoch at UTC midnight on
17
- * January 1, 1970, in the proleptic Gregorian calendar which extends the
18
- * Gregorian calendar backwards to year one.
19
- *
20
- * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
21
- * second table is needed for interpretation, using a [24-hour linear
22
- * smear](https://developers.google.com/time/smear).
23
- *
24
- * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
25
- * restricting to that range, we ensure that we can convert to and from [RFC
26
- * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
27
- *
28
- * # Examples
29
- *
30
- * Example 1: Compute Timestamp from POSIX `time()`.
31
- *
32
- * Timestamp timestamp;
33
- * timestamp.set_seconds(time(NULL));
34
- * timestamp.set_nanos(0);
35
- *
36
- * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
37
- *
38
- * struct timeval tv;
39
- * gettimeofday(&tv, NULL);
40
- *
41
- * Timestamp timestamp;
42
- * timestamp.set_seconds(tv.tv_sec);
43
- * timestamp.set_nanos(tv.tv_usec * 1000);
44
- *
45
- * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
46
- *
47
- * FILETIME ft;
48
- * GetSystemTimeAsFileTime(&ft);
49
- * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
50
- *
51
- * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
52
- * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
53
- * Timestamp timestamp;
54
- * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
55
- * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
56
- *
57
- * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
58
- *
59
- * long millis = System.currentTimeMillis();
60
- *
61
- * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
62
- * .setNanos((int) ((millis % 1000) * 1000000)).build();
63
- *
64
- * Example 5: Compute Timestamp from Java `Instant.now()`.
65
- *
66
- * Instant now = Instant.now();
67
- *
68
- * Timestamp timestamp =
69
- * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
70
- * .setNanos(now.getNano()).build();
71
- *
72
- * Example 6: Compute Timestamp from current time in Python.
73
- *
74
- * timestamp = Timestamp()
75
- * timestamp.GetCurrentTime()
76
- *
77
- * # JSON Mapping
78
- *
79
- * In JSON format, the Timestamp type is encoded as a string in the
80
- * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
81
- * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
82
- * where {year} is always expressed using four digits while {month}, {day},
83
- * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
84
- * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
85
- * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
86
- * is required. A proto3 JSON serializer should always use UTC (as indicated by
87
- * "Z") when printing the Timestamp type and a proto3 JSON parser should be
88
- * able to accept both UTC and other timezones (as indicated by an offset).
89
- *
90
- * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
91
- * 01:30 UTC on January 15, 2017.
92
- *
93
- * In JavaScript, one can convert a Date object to this format using the
94
- * standard
95
- * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
96
- * method. In Python, a standard `datetime.datetime` object can be converted
97
- * to this format using
98
- * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
99
- * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
100
- * the Joda Time's [`ISODateTimeFormat.dateTime()`](
101
- * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
102
- * ) to obtain a formatter capable of generating timestamps in this format.
103
- */
104
- export interface Timestamp {
105
- /**
106
- * Represents seconds of UTC time since Unix epoch
107
- * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
108
- * 9999-12-31T23:59:59Z inclusive.
109
- */
110
- seconds: number;
111
- /**
112
- * Non-negative fractions of a second at nanosecond resolution. Negative
113
- * second values with fractions must still have non-negative nanos values
114
- * that count forward in time. Must be from 0 to 999,999,999
115
- * inclusive.
116
- */
117
- nanos: number;
118
- }
119
-
120
- function createBaseTimestamp(): Timestamp {
121
- return { seconds: 0, nanos: 0 };
122
- }
123
-
124
- export const Timestamp = {
125
- encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
126
- if (message.seconds !== 0) {
127
- writer.uint32(8).int64(message.seconds);
128
- }
129
- if (message.nanos !== 0) {
130
- writer.uint32(16).int32(message.nanos);
131
- }
132
- return writer;
133
- },
134
-
135
- decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp {
136
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
137
- let end = length === undefined ? reader.len : reader.pos + length;
138
- const message = createBaseTimestamp();
139
- while (reader.pos < end) {
140
- const tag = reader.uint32();
141
- switch (tag >>> 3) {
142
- case 1:
143
- if (tag !== 8) {
144
- break;
145
- }
146
-
147
- message.seconds = longToNumber(reader.int64() as Long);
148
- continue;
149
- case 2:
150
- if (tag !== 16) {
151
- break;
152
- }
153
-
154
- message.nanos = reader.int32();
155
- continue;
156
- }
157
- if ((tag & 7) === 4 || tag === 0) {
158
- break;
159
- }
160
- reader.skipType(tag & 7);
161
- }
162
- return message;
163
- },
164
-
165
- fromJSON(object: any): Timestamp {
166
- return {
167
- seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0,
168
- nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0,
169
- };
170
- },
171
-
172
- toJSON(message: Timestamp): unknown {
173
- const obj: any = {};
174
- if (message.seconds !== 0) {
175
- obj.seconds = Math.round(message.seconds);
176
- }
177
- if (message.nanos !== 0) {
178
- obj.nanos = Math.round(message.nanos);
179
- }
180
- return obj;
181
- },
182
-
183
- create<I extends Exact<DeepPartial<Timestamp>, I>>(base?: I): Timestamp {
184
- return Timestamp.fromPartial(base ?? ({} as any));
185
- },
186
- fromPartial<I extends Exact<DeepPartial<Timestamp>, I>>(object: I): Timestamp {
187
- const message = createBaseTimestamp();
188
- message.seconds = object.seconds ?? 0;
189
- message.nanos = object.nanos ?? 0;
190
- return message;
191
- },
192
- };
193
-
194
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
195
-
196
- export type DeepPartial<T> = T extends Builtin ? T
197
- : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
198
- : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
199
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
200
- : Partial<T>;
201
-
202
- type KeysOfUnion<T> = T extends T ? keyof T : never;
203
- export type Exact<P, I extends P> = P extends Builtin ? P
204
- : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
205
-
206
- function longToNumber(long: Long): number {
207
- if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) {
208
- throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
209
- }
210
- if (long.lt(globalThis.Number.MIN_SAFE_INTEGER)) {
211
- throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
212
- }
213
- return long.toNumber();
214
- }
215
-
216
- if (_m0.util.Long !== Long) {
217
- _m0.util.Long = Long as any;
218
- _m0.configure();
219
- }
220
-
221
- function isSet(value: any): boolean {
222
- return value !== null && value !== undefined;
223
- }
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v1.181.2
4
+ // protoc v3.20.3
5
+ // source: google/protobuf/timestamp.proto
6
+
7
+ /* eslint-disable */
8
+ import Long from "long";
9
+ import _m0 from "protobufjs/minimal";
10
+
11
+ export const protobufPackage = "google.protobuf";
12
+
13
+ /**
14
+ * A Timestamp represents a point in time independent of any time zone or local
15
+ * calendar, encoded as a count of seconds and fractions of seconds at
16
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
17
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
18
+ * Gregorian calendar backwards to year one.
19
+ *
20
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
21
+ * second table is needed for interpretation, using a [24-hour linear
22
+ * smear](https://developers.google.com/time/smear).
23
+ *
24
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
25
+ * restricting to that range, we ensure that we can convert to and from [RFC
26
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
27
+ *
28
+ * # Examples
29
+ *
30
+ * Example 1: Compute Timestamp from POSIX `time()`.
31
+ *
32
+ * Timestamp timestamp;
33
+ * timestamp.set_seconds(time(NULL));
34
+ * timestamp.set_nanos(0);
35
+ *
36
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
37
+ *
38
+ * struct timeval tv;
39
+ * gettimeofday(&tv, NULL);
40
+ *
41
+ * Timestamp timestamp;
42
+ * timestamp.set_seconds(tv.tv_sec);
43
+ * timestamp.set_nanos(tv.tv_usec * 1000);
44
+ *
45
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
46
+ *
47
+ * FILETIME ft;
48
+ * GetSystemTimeAsFileTime(&ft);
49
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
50
+ *
51
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
52
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
53
+ * Timestamp timestamp;
54
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
55
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
56
+ *
57
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
58
+ *
59
+ * long millis = System.currentTimeMillis();
60
+ *
61
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
62
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
63
+ *
64
+ * Example 5: Compute Timestamp from Java `Instant.now()`.
65
+ *
66
+ * Instant now = Instant.now();
67
+ *
68
+ * Timestamp timestamp =
69
+ * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
70
+ * .setNanos(now.getNano()).build();
71
+ *
72
+ * Example 6: Compute Timestamp from current time in Python.
73
+ *
74
+ * timestamp = Timestamp()
75
+ * timestamp.GetCurrentTime()
76
+ *
77
+ * # JSON Mapping
78
+ *
79
+ * In JSON format, the Timestamp type is encoded as a string in the
80
+ * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
81
+ * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
82
+ * where {year} is always expressed using four digits while {month}, {day},
83
+ * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
84
+ * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
85
+ * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
86
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
87
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
88
+ * able to accept both UTC and other timezones (as indicated by an offset).
89
+ *
90
+ * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
91
+ * 01:30 UTC on January 15, 2017.
92
+ *
93
+ * In JavaScript, one can convert a Date object to this format using the
94
+ * standard
95
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
96
+ * method. In Python, a standard `datetime.datetime` object can be converted
97
+ * to this format using
98
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
99
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
100
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
101
+ * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
102
+ * ) to obtain a formatter capable of generating timestamps in this format.
103
+ */
104
+ export interface Timestamp {
105
+ /**
106
+ * Represents seconds of UTC time since Unix epoch
107
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
108
+ * 9999-12-31T23:59:59Z inclusive.
109
+ */
110
+ seconds: number;
111
+ /**
112
+ * Non-negative fractions of a second at nanosecond resolution. Negative
113
+ * second values with fractions must still have non-negative nanos values
114
+ * that count forward in time. Must be from 0 to 999,999,999
115
+ * inclusive.
116
+ */
117
+ nanos: number;
118
+ }
119
+
120
+ function createBaseTimestamp(): Timestamp {
121
+ return { seconds: 0, nanos: 0 };
122
+ }
123
+
124
+ export const Timestamp = {
125
+ encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
126
+ if (message.seconds !== 0) {
127
+ writer.uint32(8).int64(message.seconds);
128
+ }
129
+ if (message.nanos !== 0) {
130
+ writer.uint32(16).int32(message.nanos);
131
+ }
132
+ return writer;
133
+ },
134
+
135
+ decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp {
136
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
137
+ let end = length === undefined ? reader.len : reader.pos + length;
138
+ const message = createBaseTimestamp();
139
+ while (reader.pos < end) {
140
+ const tag = reader.uint32();
141
+ switch (tag >>> 3) {
142
+ case 1:
143
+ if (tag !== 8) {
144
+ break;
145
+ }
146
+
147
+ message.seconds = longToNumber(reader.int64() as Long);
148
+ continue;
149
+ case 2:
150
+ if (tag !== 16) {
151
+ break;
152
+ }
153
+
154
+ message.nanos = reader.int32();
155
+ continue;
156
+ }
157
+ if ((tag & 7) === 4 || tag === 0) {
158
+ break;
159
+ }
160
+ reader.skipType(tag & 7);
161
+ }
162
+ return message;
163
+ },
164
+
165
+ fromJSON(object: any): Timestamp {
166
+ return {
167
+ seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0,
168
+ nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0,
169
+ };
170
+ },
171
+
172
+ toJSON(message: Timestamp): unknown {
173
+ const obj: any = {};
174
+ if (message.seconds !== 0) {
175
+ obj.seconds = Math.round(message.seconds);
176
+ }
177
+ if (message.nanos !== 0) {
178
+ obj.nanos = Math.round(message.nanos);
179
+ }
180
+ return obj;
181
+ },
182
+
183
+ create<I extends Exact<DeepPartial<Timestamp>, I>>(base?: I): Timestamp {
184
+ return Timestamp.fromPartial(base ?? ({} as any));
185
+ },
186
+ fromPartial<I extends Exact<DeepPartial<Timestamp>, I>>(object: I): Timestamp {
187
+ const message = createBaseTimestamp();
188
+ message.seconds = object.seconds ?? 0;
189
+ message.nanos = object.nanos ?? 0;
190
+ return message;
191
+ },
192
+ };
193
+
194
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
195
+
196
+ export type DeepPartial<T> = T extends Builtin ? T
197
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
198
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
199
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
200
+ : Partial<T>;
201
+
202
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
203
+ export type Exact<P, I extends P> = P extends Builtin ? P
204
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
205
+
206
+ function longToNumber(long: Long): number {
207
+ if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) {
208
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
209
+ }
210
+ if (long.lt(globalThis.Number.MIN_SAFE_INTEGER)) {
211
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
212
+ }
213
+ return long.toNumber();
214
+ }
215
+
216
+ if (_m0.util.Long !== Long) {
217
+ _m0.util.Long = Long as any;
218
+ _m0.configure();
219
+ }
220
+
221
+ function isSet(value: any): boolean {
222
+ return value !== null && value !== undefined;
223
+ }