develop-updateui #1
@@ -9,7 +9,10 @@
|
||||
"Bash(python -:*)",
|
||||
"Bash(bun run:*)",
|
||||
"Bash(bunx:*)",
|
||||
"Bash(bun:*)"
|
||||
"Bash(bun:*)",
|
||||
"Bash(git diff:*)",
|
||||
"Bash(git add:*)",
|
||||
"Bash(git status:*)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
type ServiceError,
|
||||
type UntypedServiceImplementation,
|
||||
} from "@grpc/grpc-js";
|
||||
import { StringValue } from "../../google/protobuf/wrappers";
|
||||
import { MessageResponse, Notification, Preferences, User } from "./common";
|
||||
|
||||
export const protobufPackage = "stream.app.v1";
|
||||
@@ -1402,6 +1403,16 @@ export const AccountServiceService = {
|
||||
responseSerialize: (value: MessageResponse): Buffer => Buffer.from(MessageResponse.encode(value).finish()),
|
||||
responseDeserialize: (value: Buffer): MessageResponse => MessageResponse.decode(value),
|
||||
},
|
||||
getUserById: {
|
||||
path: "/stream.app.v1.AccountService/GetUserById",
|
||||
requestStream: false,
|
||||
responseStream: false,
|
||||
requestSerialize: (value: string | undefined): Buffer =>
|
||||
Buffer.from(StringValue.encode({ value: value ?? "" }).finish()),
|
||||
requestDeserialize: (value: Buffer): string | undefined => StringValue.decode(value).value,
|
||||
responseSerialize: (value: User): Buffer => Buffer.from(User.encode(value).finish()),
|
||||
responseDeserialize: (value: Buffer): User => User.decode(value),
|
||||
},
|
||||
} as const;
|
||||
|
||||
export interface AccountServiceServer extends UntypedServiceImplementation {
|
||||
@@ -1409,6 +1420,7 @@ export interface AccountServiceServer extends UntypedServiceImplementation {
|
||||
updateMe: handleUnaryCall<UpdateMeRequest, UpdateMeResponse>;
|
||||
deleteMe: handleUnaryCall<DeleteMeRequest, MessageResponse>;
|
||||
clearMyData: handleUnaryCall<ClearMyDataRequest, MessageResponse>;
|
||||
getUserById: handleUnaryCall<string | undefined, User>;
|
||||
}
|
||||
|
||||
export interface AccountServiceClient extends Client {
|
||||
@@ -1472,6 +1484,21 @@ export interface AccountServiceClient extends Client {
|
||||
options: Partial<CallOptions>,
|
||||
callback: (error: ServiceError | null, response: MessageResponse) => void,
|
||||
): ClientUnaryCall;
|
||||
getUserById(
|
||||
request: string | undefined,
|
||||
callback: (error: ServiceError | null, response: User) => void,
|
||||
): ClientUnaryCall;
|
||||
getUserById(
|
||||
request: string | undefined,
|
||||
metadata: Metadata,
|
||||
callback: (error: ServiceError | null, response: User) => void,
|
||||
): ClientUnaryCall;
|
||||
getUserById(
|
||||
request: string | undefined,
|
||||
metadata: Metadata,
|
||||
options: Partial<CallOptions>,
|
||||
callback: (error: ServiceError | null, response: User) => void,
|
||||
): ClientUnaryCall;
|
||||
}
|
||||
|
||||
export const AccountServiceClient = makeGenericClientConstructor(
|
||||
|
||||
693
src/server/gen/proto/google/protobuf/wrappers.ts
Normal file
693
src/server/gen/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