refactor: reorganize proto clients and settings UI
Move generated proto imports under the new server api path and align gRPC auth/client usage with the renamed clients. Polish settings UI details by adding a shared language icon and refining Ads VAST table presentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2734
src/server/api/proto/agent/v1/woodpecker.ts
Normal file
2734
src/server/api/proto/agent/v1/woodpecker.ts
Normal file
File diff suppressed because it is too large
Load Diff
1795
src/server/api/proto/app/v1/account.ts
Normal file
1795
src/server/api/proto/app/v1/account.ts
Normal file
File diff suppressed because it is too large
Load Diff
8924
src/server/api/proto/app/v1/admin.ts
Normal file
8924
src/server/api/proto/app/v1/admin.ts
Normal file
File diff suppressed because it is too large
Load Diff
1131
src/server/api/proto/app/v1/auth.ts
Normal file
1131
src/server/api/proto/app/v1/auth.ts
Normal file
File diff suppressed because it is too large
Load Diff
2483
src/server/api/proto/app/v1/catalog.ts
Normal file
2483
src/server/api/proto/app/v1/catalog.ts
Normal file
File diff suppressed because it is too large
Load Diff
7085
src/server/api/proto/app/v1/common.ts
Normal file
7085
src/server/api/proto/app/v1/common.ts
Normal file
File diff suppressed because it is too large
Load Diff
1038
src/server/api/proto/app/v1/payments.ts
Normal file
1038
src/server/api/proto/app/v1/payments.ts
Normal file
File diff suppressed because it is too large
Load Diff
1280
src/server/api/proto/app/v1/videos.ts
Normal file
1280
src/server/api/proto/app/v1/videos.ts
Normal file
File diff suppressed because it is too large
Load Diff
231
src/server/api/proto/google/protobuf/timestamp.ts
Normal file
231
src/server/api/proto/google/protobuf/timestamp.ts
Normal file
@@ -0,0 +1,231 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.4
|
||||
// protoc unknown
|
||||
// source: google/protobuf/timestamp.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
export const protobufPackage = "google.protobuf";
|
||||
|
||||
/**
|
||||
* A Timestamp represents a point in time independent of any time zone or local
|
||||
* calendar, encoded as a count of seconds and fractions of seconds at
|
||||
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
||||
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
||||
* Gregorian calendar backwards to year one.
|
||||
*
|
||||
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
||||
* second table is needed for interpretation, using a [24-hour linear
|
||||
* smear](https://developers.google.com/time/smear).
|
||||
*
|
||||
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
||||
* restricting to that range, we ensure that we can convert to and from [RFC
|
||||
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* Example 1: Compute Timestamp from POSIX `time()`.
|
||||
*
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds(time(NULL));
|
||||
* timestamp.set_nanos(0);
|
||||
*
|
||||
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
||||
*
|
||||
* struct timeval tv;
|
||||
* gettimeofday(&tv, NULL);
|
||||
*
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds(tv.tv_sec);
|
||||
* timestamp.set_nanos(tv.tv_usec * 1000);
|
||||
*
|
||||
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
||||
*
|
||||
* FILETIME ft;
|
||||
* GetSystemTimeAsFileTime(&ft);
|
||||
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
||||
*
|
||||
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
||||
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
||||
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
||||
*
|
||||
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
||||
*
|
||||
* long millis = System.currentTimeMillis();
|
||||
*
|
||||
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
||||
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
||||
*
|
||||
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
||||
*
|
||||
* Instant now = Instant.now();
|
||||
*
|
||||
* Timestamp timestamp =
|
||||
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
||||
* .setNanos(now.getNano()).build();
|
||||
*
|
||||
* Example 6: Compute Timestamp from current time in Python.
|
||||
*
|
||||
* timestamp = Timestamp()
|
||||
* timestamp.GetCurrentTime()
|
||||
*
|
||||
* # JSON Mapping
|
||||
*
|
||||
* In JSON format, the Timestamp type is encoded as a string in the
|
||||
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
||||
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
||||
* where {year} is always expressed using four digits while {month}, {day},
|
||||
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
||||
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
||||
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
||||
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
||||
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
||||
* able to accept both UTC and other timezones (as indicated by an offset).
|
||||
*
|
||||
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
||||
* 01:30 UTC on January 15, 2017.
|
||||
*
|
||||
* In JavaScript, one can convert a Date object to this format using the
|
||||
* standard
|
||||
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
||||
* method. In Python, a standard `datetime.datetime` object can be converted
|
||||
* to this format using
|
||||
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
||||
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
||||
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
||||
* ) to obtain a formatter capable of generating timestamps in this format.
|
||||
*/
|
||||
export interface Timestamp {
|
||||
/**
|
||||
* Represents seconds of UTC time since Unix epoch
|
||||
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
||||
* 9999-12-31T23:59:59Z inclusive.
|
||||
*/
|
||||
seconds?:
|
||||
| number
|
||||
| undefined;
|
||||
/**
|
||||
* Non-negative fractions of a second at nanosecond resolution. Negative
|
||||
* second values with fractions must still have non-negative nanos values
|
||||
* that count forward in time. Must be from 0 to 999,999,999
|
||||
* inclusive.
|
||||
*/
|
||||
nanos?: number | undefined;
|
||||
}
|
||||
|
||||
function createBaseTimestamp(): Timestamp {
|
||||
return { seconds: 0, nanos: 0 };
|
||||
}
|
||||
|
||||
export const Timestamp: MessageFns<Timestamp> = {
|
||||
encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.seconds !== undefined && message.seconds !== 0) {
|
||||
writer.uint32(8).int64(message.seconds);
|
||||
}
|
||||
if (message.nanos !== undefined && message.nanos !== 0) {
|
||||
writer.uint32(16).int32(message.nanos);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Timestamp {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTimestamp();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.seconds = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.nanos = reader.int32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Timestamp {
|
||||
return {
|
||||
seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0,
|
||||
nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Timestamp): unknown {
|
||||
const obj: any = {};
|
||||
if (message.seconds !== undefined && message.seconds !== 0) {
|
||||
obj.seconds = Math.round(message.seconds);
|
||||
}
|
||||
if (message.nanos !== undefined && message.nanos !== 0) {
|
||||
obj.nanos = Math.round(message.nanos);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<Timestamp>, I>>(base?: I): Timestamp {
|
||||
return Timestamp.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<Timestamp>, I>>(object: I): Timestamp {
|
||||
const message = createBaseTimestamp();
|
||||
message.seconds = object.seconds ?? 0;
|
||||
message.nanos = object.nanos ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export 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 };
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
||||
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
||||
}
|
||||
693
src/server/api/proto/google/protobuf/wrappers.ts
Normal file
693
src/server/api/proto/google/protobuf/wrappers.ts
Normal file
@@ -0,0 +1,693 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.4
|
||||
// protoc unknown
|
||||
// source: google/protobuf/wrappers.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
export const protobufPackage = "google.protobuf";
|
||||
|
||||
/**
|
||||
* Wrapper message for `double`.
|
||||
*
|
||||
* The JSON representation for `DoubleValue` is JSON number.
|
||||
*
|
||||
* Not recommended for use in new APIs, but still useful for legacy APIs and
|
||||
* has no plan to be removed.
|
||||
*/
|
||||
export interface DoubleValue {
|
||||
/** The double value. */
|
||||
value?: number | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper message for `float`.
|
||||
*
|
||||
* The JSON representation for `FloatValue` is JSON number.
|
||||
*
|
||||
* Not recommended for use in new APIs, but still useful for legacy APIs and
|
||||
* has no plan to be removed.
|
||||
*/
|
||||
export interface FloatValue {
|
||||
/** The float value. */
|
||||
value?: number | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper message for `int64`.
|
||||
*
|
||||
* The JSON representation for `Int64Value` is JSON string.
|
||||
*
|
||||
* Not recommended for use in new APIs, but still useful for legacy APIs and
|
||||
* has no plan to be removed.
|
||||
*/
|
||||
export interface Int64Value {
|
||||
/** The int64 value. */
|
||||
value?: number | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper message for `uint64`.
|
||||
*
|
||||
* The JSON representation for `UInt64Value` is JSON string.
|
||||
*
|
||||
* Not recommended for use in new APIs, but still useful for legacy APIs and
|
||||
* has no plan to be removed.
|
||||
*/
|
||||
export interface UInt64Value {
|
||||
/** The uint64 value. */
|
||||
value?: number | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper message for `int32`.
|
||||
*
|
||||
* The JSON representation for `Int32Value` is JSON number.
|
||||
*
|
||||
* Not recommended for use in new APIs, but still useful for legacy APIs and
|
||||
* has no plan to be removed.
|
||||
*/
|
||||
export interface Int32Value {
|
||||
/** The int32 value. */
|
||||
value?: number | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper message for `uint32`.
|
||||
*
|
||||
* The JSON representation for `UInt32Value` is JSON number.
|
||||
*
|
||||
* Not recommended for use in new APIs, but still useful for legacy APIs and
|
||||
* has no plan to be removed.
|
||||
*/
|
||||
export interface UInt32Value {
|
||||
/** The uint32 value. */
|
||||
value?: number | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper message for `bool`.
|
||||
*
|
||||
* The JSON representation for `BoolValue` is JSON `true` and `false`.
|
||||
*
|
||||
* Not recommended for use in new APIs, but still useful for legacy APIs and
|
||||
* has no plan to be removed.
|
||||
*/
|
||||
export interface BoolValue {
|
||||
/** The bool value. */
|
||||
value?: boolean | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper message for `string`.
|
||||
*
|
||||
* The JSON representation for `StringValue` is JSON string.
|
||||
*
|
||||
* Not recommended for use in new APIs, but still useful for legacy APIs and
|
||||
* has no plan to be removed.
|
||||
*/
|
||||
export interface StringValue {
|
||||
/** The string value. */
|
||||
value?: string | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper message for `bytes`.
|
||||
*
|
||||
* The JSON representation for `BytesValue` is JSON string.
|
||||
*
|
||||
* Not recommended for use in new APIs, but still useful for legacy APIs and
|
||||
* has no plan to be removed.
|
||||
*/
|
||||
export interface BytesValue {
|
||||
/** The bytes value. */
|
||||
value?: Buffer | undefined;
|
||||
}
|
||||
|
||||
function createBaseDoubleValue(): DoubleValue {
|
||||
return { value: 0 };
|
||||
}
|
||||
|
||||
export const DoubleValue: MessageFns<DoubleValue> = {
|
||||
encode(message: DoubleValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== undefined && message.value !== 0) {
|
||||
writer.uint32(9).double(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): DoubleValue {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseDoubleValue();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 9) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.double();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): DoubleValue {
|
||||
return { value: isSet(object.value) ? globalThis.Number(object.value) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: DoubleValue): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== undefined && message.value !== 0) {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<DoubleValue>, I>>(base?: I): DoubleValue {
|
||||
return DoubleValue.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<DoubleValue>, I>>(object: I): DoubleValue {
|
||||
const message = createBaseDoubleValue();
|
||||
message.value = object.value ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseFloatValue(): FloatValue {
|
||||
return { value: 0 };
|
||||
}
|
||||
|
||||
export const FloatValue: MessageFns<FloatValue> = {
|
||||
encode(message: FloatValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== undefined && message.value !== 0) {
|
||||
writer.uint32(13).float(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): FloatValue {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseFloatValue();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 13) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.float();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): FloatValue {
|
||||
return { value: isSet(object.value) ? globalThis.Number(object.value) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: FloatValue): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== undefined && message.value !== 0) {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<FloatValue>, I>>(base?: I): FloatValue {
|
||||
return FloatValue.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<FloatValue>, I>>(object: I): FloatValue {
|
||||
const message = createBaseFloatValue();
|
||||
message.value = object.value ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseInt64Value(): Int64Value {
|
||||
return { value: 0 };
|
||||
}
|
||||
|
||||
export const Int64Value: MessageFns<Int64Value> = {
|
||||
encode(message: Int64Value, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== undefined && message.value !== 0) {
|
||||
writer.uint32(8).int64(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Int64Value {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseInt64Value();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = longToNumber(reader.int64());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Int64Value {
|
||||
return { value: isSet(object.value) ? globalThis.Number(object.value) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: Int64Value): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== undefined && message.value !== 0) {
|
||||
obj.value = Math.round(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<Int64Value>, I>>(base?: I): Int64Value {
|
||||
return Int64Value.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<Int64Value>, I>>(object: I): Int64Value {
|
||||
const message = createBaseInt64Value();
|
||||
message.value = object.value ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseUInt64Value(): UInt64Value {
|
||||
return { value: 0 };
|
||||
}
|
||||
|
||||
export const UInt64Value: MessageFns<UInt64Value> = {
|
||||
encode(message: UInt64Value, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== undefined && message.value !== 0) {
|
||||
writer.uint32(8).uint64(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): UInt64Value {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseUInt64Value();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = longToNumber(reader.uint64());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): UInt64Value {
|
||||
return { value: isSet(object.value) ? globalThis.Number(object.value) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: UInt64Value): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== undefined && message.value !== 0) {
|
||||
obj.value = Math.round(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<UInt64Value>, I>>(base?: I): UInt64Value {
|
||||
return UInt64Value.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<UInt64Value>, I>>(object: I): UInt64Value {
|
||||
const message = createBaseUInt64Value();
|
||||
message.value = object.value ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseInt32Value(): Int32Value {
|
||||
return { value: 0 };
|
||||
}
|
||||
|
||||
export const Int32Value: MessageFns<Int32Value> = {
|
||||
encode(message: Int32Value, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== undefined && message.value !== 0) {
|
||||
writer.uint32(8).int32(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Int32Value {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseInt32Value();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.int32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Int32Value {
|
||||
return { value: isSet(object.value) ? globalThis.Number(object.value) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: Int32Value): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== undefined && message.value !== 0) {
|
||||
obj.value = Math.round(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<Int32Value>, I>>(base?: I): Int32Value {
|
||||
return Int32Value.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<Int32Value>, I>>(object: I): Int32Value {
|
||||
const message = createBaseInt32Value();
|
||||
message.value = object.value ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseUInt32Value(): UInt32Value {
|
||||
return { value: 0 };
|
||||
}
|
||||
|
||||
export const UInt32Value: MessageFns<UInt32Value> = {
|
||||
encode(message: UInt32Value, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== undefined && message.value !== 0) {
|
||||
writer.uint32(8).uint32(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): UInt32Value {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseUInt32Value();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): UInt32Value {
|
||||
return { value: isSet(object.value) ? globalThis.Number(object.value) : 0 };
|
||||
},
|
||||
|
||||
toJSON(message: UInt32Value): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== undefined && message.value !== 0) {
|
||||
obj.value = Math.round(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<UInt32Value>, I>>(base?: I): UInt32Value {
|
||||
return UInt32Value.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<UInt32Value>, I>>(object: I): UInt32Value {
|
||||
const message = createBaseUInt32Value();
|
||||
message.value = object.value ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseBoolValue(): BoolValue {
|
||||
return { value: false };
|
||||
}
|
||||
|
||||
export const BoolValue: MessageFns<BoolValue> = {
|
||||
encode(message: BoolValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== undefined && message.value !== false) {
|
||||
writer.uint32(8).bool(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): BoolValue {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseBoolValue();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.bool();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): BoolValue {
|
||||
return { value: isSet(object.value) ? globalThis.Boolean(object.value) : false };
|
||||
},
|
||||
|
||||
toJSON(message: BoolValue): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== undefined && message.value !== false) {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<BoolValue>, I>>(base?: I): BoolValue {
|
||||
return BoolValue.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<BoolValue>, I>>(object: I): BoolValue {
|
||||
const message = createBaseBoolValue();
|
||||
message.value = object.value ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseStringValue(): StringValue {
|
||||
return { value: "" };
|
||||
}
|
||||
|
||||
export const StringValue: MessageFns<StringValue> = {
|
||||
encode(message: StringValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== undefined && message.value !== "") {
|
||||
writer.uint32(10).string(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): StringValue {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseStringValue();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = reader.string();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): StringValue {
|
||||
return { value: isSet(object.value) ? globalThis.String(object.value) : "" };
|
||||
},
|
||||
|
||||
toJSON(message: StringValue): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== undefined && message.value !== "") {
|
||||
obj.value = message.value;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<StringValue>, I>>(base?: I): StringValue {
|
||||
return StringValue.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<StringValue>, I>>(object: I): StringValue {
|
||||
const message = createBaseStringValue();
|
||||
message.value = object.value ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseBytesValue(): BytesValue {
|
||||
return { value: Buffer.alloc(0) };
|
||||
}
|
||||
|
||||
export const BytesValue: MessageFns<BytesValue> = {
|
||||
encode(message: BytesValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.value !== undefined && message.value.length !== 0) {
|
||||
writer.uint32(10).bytes(message.value);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): BytesValue {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseBytesValue();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = Buffer.from(reader.bytes());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): BytesValue {
|
||||
return { value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0) };
|
||||
},
|
||||
|
||||
toJSON(message: BytesValue): unknown {
|
||||
const obj: any = {};
|
||||
if (message.value !== undefined && message.value.length !== 0) {
|
||||
obj.value = base64FromBytes(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<BytesValue>, I>>(base?: I): BytesValue {
|
||||
return BytesValue.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<BytesValue>, I>>(object: I): BytesValue {
|
||||
const message = createBaseBytesValue();
|
||||
message.value = object.value ?? Buffer.alloc(0);
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function bytesFromBase64(b64: string): Uint8Array {
|
||||
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
||||
}
|
||||
|
||||
function base64FromBytes(arr: Uint8Array): string {
|
||||
return globalThis.Buffer.from(arr).toString("base64");
|
||||
}
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export 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>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export 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 };
|
||||
|
||||
function longToNumber(int64: { toString(): string }): number {
|
||||
const num = globalThis.Number(int64.toString());
|
||||
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
||||
}
|
||||
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
||||
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
||||
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
||||
}
|
||||
Reference in New Issue
Block a user