From e192727ec3214fa372878343c8c00b72658ef781 Mon Sep 17 00:00:00 2001 From: Evan Tschuy Date: Thu, 28 Sep 2023 21:08:06 -0700 Subject: [PATCH] proto: add initial exec proto typescript output --- lib/exec/protobuf-ts/google/protobuf/any.ts | 255 ++++ .../protobuf-ts/google/protobuf/struct.ts | 543 +++++++++ lib/exec/protobuf-ts/google/rpc/status.ts | 134 +++ lib/exec/protobuf-ts/indent/exec/v1/exec.ts | 1055 +++++++++++++++++ 4 files changed, 1987 insertions(+) create mode 100644 lib/exec/protobuf-ts/google/protobuf/any.ts create mode 100644 lib/exec/protobuf-ts/google/protobuf/struct.ts create mode 100644 lib/exec/protobuf-ts/google/rpc/status.ts create mode 100644 lib/exec/protobuf-ts/indent/exec/v1/exec.ts diff --git a/lib/exec/protobuf-ts/google/protobuf/any.ts b/lib/exec/protobuf-ts/google/protobuf/any.ts new file mode 100644 index 0000000..042d753 --- /dev/null +++ b/lib/exec/protobuf-ts/google/protobuf/any.ts @@ -0,0 +1,255 @@ +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := anypb.New(foo) + * if err != nil { + * ... + * } + * ... + * foo := &pb.Foo{} + * if err := any.UnmarshalTo(foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface Any { + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + typeUrl: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} + +function createBaseAny(): Any { + return { typeUrl: "", value: new Uint8Array(0) }; +} + +export const Any = { + encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Any { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAny(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.typeUrl = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Any { + return { + typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Any): unknown { + const obj: any = {}; + if (message.typeUrl !== "") { + obj.typeUrl = message.typeUrl; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): Any { + return Any.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Any { + const message = createBaseAny(); + message.typeUrl = object.typeUrl ?? ""; + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/lib/exec/protobuf-ts/google/protobuf/struct.ts b/lib/exec/protobuf-ts/google/protobuf/struct.ts new file mode 100644 index 0000000..d0bbfe6 --- /dev/null +++ b/lib/exec/protobuf-ts/google/protobuf/struct.ts @@ -0,0 +1,543 @@ +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * `NullValue` is a singleton enumeration to represent the null value for the + * `Value` type union. + * + * The JSON representation for `NullValue` is JSON `null`. + */ +export enum NullValue { + /** NULL_VALUE - Null value. */ + NULL_VALUE = 0, + UNRECOGNIZED = -1, +} + +export function nullValueFromJSON(object: any): NullValue { + switch (object) { + case 0: + case "NULL_VALUE": + return NullValue.NULL_VALUE; + case -1: + case "UNRECOGNIZED": + default: + return NullValue.UNRECOGNIZED; + } +} + +export function nullValueToJSON(object: NullValue): string { + switch (object) { + case NullValue.NULL_VALUE: + return "NULL_VALUE"; + case NullValue.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * `Struct` represents a structured data value, consisting of fields + * which map to dynamically typed values. In some languages, `Struct` + * might be supported by a native representation. For example, in + * scripting languages like JS a struct is represented as an + * object. The details of that representation are described together + * with the proto support for the language. + * + * The JSON representation for `Struct` is JSON object. + */ +export interface Struct { + /** Unordered map of dynamically typed values. */ + fields: { [key: string]: any | undefined }; +} + +export interface Struct_FieldsEntry { + key: string; + value: any | undefined; +} + +/** + * `Value` represents a dynamically typed value which can be either + * null, a number, a string, a boolean, a recursive struct value, or a + * list of values. A producer of value is expected to set one of that + * variants, absence of any variant indicates an error. + * + * The JSON representation for `Value` is JSON value. + */ +export interface Value { + /** Represents a null value. */ + nullValue?: + | NullValue + | undefined; + /** Represents a double value. */ + numberValue?: + | number + | undefined; + /** Represents a string value. */ + stringValue?: + | string + | undefined; + /** Represents a boolean value. */ + boolValue?: + | boolean + | undefined; + /** Represents a structured value. */ + structValue?: + | { [key: string]: any } + | undefined; + /** Represents a repeated `Value`. */ + listValue?: Array | undefined; +} + +/** + * `ListValue` is a wrapper around a repeated field of values. + * + * The JSON representation for `ListValue` is JSON array. + */ +export interface ListValue { + /** Repeated field of dynamically typed values. */ + values: any[]; +} + +function createBaseStruct(): Struct { + return { fields: {} }; +} + +export const Struct = { + encode(message: Struct, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + Object.entries(message.fields).forEach(([key, value]) => { + if (value !== undefined) { + Struct_FieldsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).ldelim(); + } + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Struct { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStruct(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = Struct_FieldsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.fields[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Struct { + return { + fields: isObject(object.fields) + ? Object.entries(object.fields).reduce<{ [key: string]: any | undefined }>((acc, [key, value]) => { + acc[key] = value as any | undefined; + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Struct): unknown { + const obj: any = {}; + if (message.fields) { + const entries = Object.entries(message.fields); + if (entries.length > 0) { + obj.fields = {}; + entries.forEach(([k, v]) => { + obj.fields[k] = v; + }); + } + } + return obj; + }, + + create, I>>(base?: I): Struct { + return Struct.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Struct { + const message = createBaseStruct(); + message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = value; + } + return acc; + }, + {}, + ); + return message; + }, + + wrap(object: { [key: string]: any } | undefined): Struct { + const struct = createBaseStruct(); + if (object !== undefined) { + Object.keys(object).forEach((key) => { + struct.fields[key] = object[key]; + }); + } + return struct; + }, + + unwrap(message: Struct): { [key: string]: any } { + const object: { [key: string]: any } = {}; + if (message.fields) { + Object.keys(message.fields).forEach((key) => { + object[key] = message.fields[key]; + }); + } + return object; + }, +}; + +function createBaseStruct_FieldsEntry(): Struct_FieldsEntry { + return { key: "", value: undefined }; +} + +export const Struct_FieldsEntry = { + encode(message: Struct_FieldsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Struct_FieldsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStruct_FieldsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Struct_FieldsEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object?.value) ? object.value : undefined }; + }, + + toJSON(message: Struct_FieldsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): Struct_FieldsEntry { + return Struct_FieldsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Struct_FieldsEntry { + const message = createBaseStruct_FieldsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseValue(): Value { + return { + nullValue: undefined, + numberValue: undefined, + stringValue: undefined, + boolValue: undefined, + structValue: undefined, + listValue: undefined, + }; +} + +export const Value = { + encode(message: Value, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.nullValue !== undefined) { + writer.uint32(8).int32(message.nullValue); + } + if (message.numberValue !== undefined) { + writer.uint32(17).double(message.numberValue); + } + if (message.stringValue !== undefined) { + writer.uint32(26).string(message.stringValue); + } + if (message.boolValue !== undefined) { + writer.uint32(32).bool(message.boolValue); + } + if (message.structValue !== undefined) { + Struct.encode(Struct.wrap(message.structValue), writer.uint32(42).fork()).ldelim(); + } + if (message.listValue !== undefined) { + ListValue.encode(ListValue.wrap(message.listValue), writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Value { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.nullValue = reader.int32() as any; + continue; + case 2: + if (tag !== 17) { + break; + } + + message.numberValue = reader.double(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.stringValue = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.boolValue = reader.bool(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.structValue = Struct.unwrap(Struct.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.listValue = ListValue.unwrap(ListValue.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Value { + return { + nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined, + numberValue: isSet(object.numberValue) ? Number(object.numberValue) : undefined, + stringValue: isSet(object.stringValue) ? String(object.stringValue) : undefined, + boolValue: isSet(object.boolValue) ? Boolean(object.boolValue) : undefined, + structValue: isObject(object.structValue) ? object.structValue : undefined, + listValue: Array.isArray(object.listValue) ? [...object.listValue] : undefined, + }; + }, + + toJSON(message: Value): unknown { + const obj: any = {}; + if (message.nullValue !== undefined) { + obj.nullValue = nullValueToJSON(message.nullValue); + } + if (message.numberValue !== undefined) { + obj.numberValue = message.numberValue; + } + if (message.stringValue !== undefined) { + obj.stringValue = message.stringValue; + } + if (message.boolValue !== undefined) { + obj.boolValue = message.boolValue; + } + if (message.structValue !== undefined) { + obj.structValue = message.structValue; + } + if (message.listValue !== undefined) { + obj.listValue = message.listValue; + } + return obj; + }, + + create, I>>(base?: I): Value { + return Value.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Value { + const message = createBaseValue(); + message.nullValue = object.nullValue ?? undefined; + message.numberValue = object.numberValue ?? undefined; + message.stringValue = object.stringValue ?? undefined; + message.boolValue = object.boolValue ?? undefined; + message.structValue = object.structValue ?? undefined; + message.listValue = object.listValue ?? undefined; + return message; + }, + + wrap(value: any): Value { + const result = createBaseValue(); + if (value === null) { + result.nullValue = NullValue.NULL_VALUE; + } else if (typeof value === "boolean") { + result.boolValue = value; + } else if (typeof value === "number") { + result.numberValue = value; + } else if (typeof value === "string") { + result.stringValue = value; + } else if (Array.isArray(value)) { + result.listValue = value; + } else if (typeof value === "object") { + result.structValue = value; + } else if (typeof value !== "undefined") { + throw new Error("Unsupported any value type: " + typeof value); + } + return result; + }, + + unwrap(message: any): string | number | boolean | Object | null | Array | undefined { + if (message.stringValue !== undefined) { + return message.stringValue; + } else if (message?.numberValue !== undefined) { + return message.numberValue; + } else if (message?.boolValue !== undefined) { + return message.boolValue; + } else if (message?.structValue !== undefined) { + return message.structValue as any; + } else if (message?.listValue !== undefined) { + return message.listValue; + } else if (message?.nullValue !== undefined) { + return null; + } + return undefined; + }, +}; + +function createBaseListValue(): ListValue { + return { values: [] }; +} + +export const ListValue = { + encode(message: ListValue, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.values) { + Value.encode(Value.wrap(v!), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListValue { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.values.push(Value.unwrap(Value.decode(reader, reader.uint32()))); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListValue { + return { values: Array.isArray(object?.values) ? [...object.values] : [] }; + }, + + toJSON(message: ListValue): unknown { + const obj: any = {}; + if (message.values?.length) { + obj.values = message.values; + } + return obj; + }, + + create, I>>(base?: I): ListValue { + return ListValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListValue { + const message = createBaseListValue(); + message.values = object.values?.map((e) => e) || []; + return message; + }, + + wrap(array: Array | undefined): ListValue { + const result = createBaseListValue(); + result.values = array ?? []; + return result; + }, + + unwrap(message: ListValue): Array { + if (message?.hasOwnProperty("values") && Array.isArray(message.values)) { + return message.values; + } else { + return message as any; + } + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/lib/exec/protobuf-ts/google/rpc/status.ts b/lib/exec/protobuf-ts/google/rpc/status.ts new file mode 100644 index 0000000..f451b12 --- /dev/null +++ b/lib/exec/protobuf-ts/google/rpc/status.ts @@ -0,0 +1,134 @@ +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; +import { Any } from "../protobuf/any"; + +export const protobufPackage = "google.rpc"; + +/** + * The `Status` type defines a logical error model that is suitable for + * different programming environments, including REST APIs and RPC APIs. It is + * used by [gRPC](https://github.com/grpc). Each `Status` message contains + * three pieces of data: error code, error message, and error details. + * + * You can find out more about this error model and how to work with it in the + * [API Design Guide](https://cloud.google.com/apis/design/errors). + */ +export interface Status { + /** The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. */ + code: number; + /** + * A developer-facing error message, which should be in English. Any + * user-facing error message should be localized and sent in the + * [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + */ + message: string; + /** + * A list of messages that carry the error details. There is a common set of + * message types for APIs to use. + */ + details: Any[]; +} + +function createBaseStatus(): Status { + return { code: 0, message: "", details: [] }; +} + +export const Status = { + encode(message: Status, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.code !== 0) { + writer.uint32(8).int32(message.code); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + for (const v of message.details) { + Any.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Status { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.details.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Status { + return { + code: isSet(object.code) ? Number(object.code) : 0, + message: isSet(object.message) ? String(object.message) : "", + details: Array.isArray(object?.details) ? object.details.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: Status): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.details?.length) { + obj.details = message.details.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Status { + return Status.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Status { + const message = createBaseStatus(); + message.code = object.code ?? 0; + message.message = object.message ?? ""; + message.details = object.details?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/lib/exec/protobuf-ts/indent/exec/v1/exec.ts b/lib/exec/protobuf-ts/indent/exec/v1/exec.ts new file mode 100644 index 0000000..589d16d --- /dev/null +++ b/lib/exec/protobuf-ts/indent/exec/v1/exec.ts @@ -0,0 +1,1055 @@ +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; +import { Value } from "../../../google/protobuf/struct"; +import { Status } from "../../../google/rpc/status"; + +export const protobufPackage = "indent.jsonschema.draft07"; + +export enum OpType { + add = 0, + remove = 1, + replace = 2, + copy = 3, + test = 4, + UNRECOGNIZED = -1, +} + +export function opTypeFromJSON(object: any): OpType { + switch (object) { + case 0: + case "add": + return OpType.add; + case 1: + case "remove": + return OpType.remove; + case 2: + case "replace": + return OpType.replace; + case 3: + case "copy": + return OpType.copy; + case 4: + case "test": + return OpType.test; + case -1: + case "UNRECOGNIZED": + default: + return OpType.UNRECOGNIZED; + } +} + +export function opTypeToJSON(object: OpType): string { + switch (object) { + case OpType.add: + return "add"; + case OpType.remove: + return "remove"; + case OpType.replace: + return "replace"; + case OpType.copy: + return "copy"; + case OpType.test: + return "test"; + case OpType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface Executable { + imagePath?: string | undefined; + imageBody?: + | string + | undefined; + /** TODO: complex semver type? */ + version: string; +} + +export interface JsonPatch { + op: OpType; + path: string; + value: any | undefined; + from: string; +} + +export interface Event { + patchId: string; + /** + * oneof EventBody { + * TODO: other event types that aren't patch directives will defined here + */ + execMessage: string; +} + +/** send setup call */ +export interface SetupRequest { + exec: Executable | undefined; +} + +/** executable is ready */ +export interface SetupResponse { + /** + * repeated Type supported_types = 2; + * TODO: return reported compatible types + */ + status: Status | undefined; +} + +/** TODO: pass in any needed auth (use Workload identity to resolve a secret_name reference) */ +export interface Credential { + apiKey: string; +} + +/** executable has been primed */ +export interface CredentialResponse { +} + +/** for Decisions */ +export interface Query { + id: string; + input: string; +} + +export interface QueryResponse { + status: Status | undefined; + id: string; + results: string; +} + +/** + * for Actions + * repeat as necessary + */ +export interface Action { + id: string; + patch: JsonPatch | undefined; +} + +/** returned as many times as necessary FROM the executable */ +export interface Response { + status: Status | undefined; + actionId: string; + results: any[]; +} + +/** close the executor */ +export interface CloseRequest { +} + +export interface CloseResponse { +} + +function createBaseExecutable(): Executable { + return { imagePath: undefined, imageBody: undefined, version: "" }; +} + +export const Executable = { + encode(message: Executable, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.imagePath !== undefined) { + writer.uint32(10).string(message.imagePath); + } + if (message.imageBody !== undefined) { + writer.uint32(18).string(message.imageBody); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Executable { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecutable(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.imagePath = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.imageBody = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.version = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Executable { + return { + imagePath: isSet(object.imagePath) ? String(object.imagePath) : undefined, + imageBody: isSet(object.imageBody) ? String(object.imageBody) : undefined, + version: isSet(object.version) ? String(object.version) : "", + }; + }, + + toJSON(message: Executable): unknown { + const obj: any = {}; + if (message.imagePath !== undefined) { + obj.imagePath = message.imagePath; + } + if (message.imageBody !== undefined) { + obj.imageBody = message.imageBody; + } + if (message.version !== "") { + obj.version = message.version; + } + return obj; + }, + + create, I>>(base?: I): Executable { + return Executable.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Executable { + const message = createBaseExecutable(); + message.imagePath = object.imagePath ?? undefined; + message.imageBody = object.imageBody ?? undefined; + message.version = object.version ?? ""; + return message; + }, +}; + +function createBaseJsonPatch(): JsonPatch { + return { op: 0, path: "", value: undefined, from: "" }; +} + +export const JsonPatch = { + encode(message: JsonPatch, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.op !== 0) { + writer.uint32(8).int32(message.op); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.value !== undefined) { + Value.encode(Value.wrap(message.value), writer.uint32(26).fork()).ldelim(); + } + if (message.from !== "") { + writer.uint32(34).string(message.from); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): JsonPatch { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJsonPatch(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.op = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.value = Value.unwrap(Value.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.from = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): JsonPatch { + return { + op: isSet(object.op) ? opTypeFromJSON(object.op) : 0, + path: isSet(object.path) ? String(object.path) : "", + value: isSet(object?.value) ? object.value : undefined, + from: isSet(object.from) ? String(object.from) : "", + }; + }, + + toJSON(message: JsonPatch): unknown { + const obj: any = {}; + if (message.op !== 0) { + obj.op = opTypeToJSON(message.op); + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.value !== undefined) { + obj.value = message.value; + } + if (message.from !== "") { + obj.from = message.from; + } + return obj; + }, + + create, I>>(base?: I): JsonPatch { + return JsonPatch.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): JsonPatch { + const message = createBaseJsonPatch(); + message.op = object.op ?? 0; + message.path = object.path ?? ""; + message.value = object.value ?? undefined; + message.from = object.from ?? ""; + return message; + }, +}; + +function createBaseEvent(): Event { + return { patchId: "", execMessage: "" }; +} + +export const Event = { + encode(message: Event, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.patchId !== "") { + writer.uint32(10).string(message.patchId); + } + if (message.execMessage !== "") { + writer.uint32(18).string(message.execMessage); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Event { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.patchId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.execMessage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Event { + return { + patchId: isSet(object.patchId) ? String(object.patchId) : "", + execMessage: isSet(object.execMessage) ? String(object.execMessage) : "", + }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + if (message.patchId !== "") { + obj.patchId = message.patchId; + } + if (message.execMessage !== "") { + obj.execMessage = message.execMessage; + } + return obj; + }, + + create, I>>(base?: I): Event { + return Event.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Event { + const message = createBaseEvent(); + message.patchId = object.patchId ?? ""; + message.execMessage = object.execMessage ?? ""; + return message; + }, +}; + +function createBaseSetupRequest(): SetupRequest { + return { exec: undefined }; +} + +export const SetupRequest = { + encode(message: SetupRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.exec !== undefined) { + Executable.encode(message.exec, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SetupRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetupRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exec = Executable.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetupRequest { + return { exec: isSet(object.exec) ? Executable.fromJSON(object.exec) : undefined }; + }, + + toJSON(message: SetupRequest): unknown { + const obj: any = {}; + if (message.exec !== undefined) { + obj.exec = Executable.toJSON(message.exec); + } + return obj; + }, + + create, I>>(base?: I): SetupRequest { + return SetupRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SetupRequest { + const message = createBaseSetupRequest(); + message.exec = (object.exec !== undefined && object.exec !== null) + ? Executable.fromPartial(object.exec) + : undefined; + return message; + }, +}; + +function createBaseSetupResponse(): SetupResponse { + return { status: undefined }; +} + +export const SetupResponse = { + encode(message: SetupResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.status !== undefined) { + Status.encode(message.status, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SetupResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.status = Status.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetupResponse { + return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; + }, + + toJSON(message: SetupResponse): unknown { + const obj: any = {}; + if (message.status !== undefined) { + obj.status = Status.toJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): SetupResponse { + return SetupResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SetupResponse { + const message = createBaseSetupResponse(); + message.status = (object.status !== undefined && object.status !== null) + ? Status.fromPartial(object.status) + : undefined; + return message; + }, +}; + +function createBaseCredential(): Credential { + return { apiKey: "" }; +} + +export const Credential = { + encode(message: Credential, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.apiKey !== "") { + writer.uint32(10).string(message.apiKey); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Credential { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCredential(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.apiKey = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Credential { + return { apiKey: isSet(object.apiKey) ? String(object.apiKey) : "" }; + }, + + toJSON(message: Credential): unknown { + const obj: any = {}; + if (message.apiKey !== "") { + obj.apiKey = message.apiKey; + } + return obj; + }, + + create, I>>(base?: I): Credential { + return Credential.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Credential { + const message = createBaseCredential(); + message.apiKey = object.apiKey ?? ""; + return message; + }, +}; + +function createBaseCredentialResponse(): CredentialResponse { + return {}; +} + +export const CredentialResponse = { + encode(_: CredentialResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CredentialResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCredentialResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): CredentialResponse { + return {}; + }, + + toJSON(_: CredentialResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CredentialResponse { + return CredentialResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CredentialResponse { + const message = createBaseCredentialResponse(); + return message; + }, +}; + +function createBaseQuery(): Query { + return { id: "", input: "" }; +} + +export const Query = { + encode(message: Query, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Query { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.input = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Query { + return { id: isSet(object.id) ? String(object.id) : "", input: isSet(object.input) ? String(object.input) : "" }; + }, + + toJSON(message: Query): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.input !== "") { + obj.input = message.input; + } + return obj; + }, + + create, I>>(base?: I): Query { + return Query.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Query { + const message = createBaseQuery(); + message.id = object.id ?? ""; + message.input = object.input ?? ""; + return message; + }, +}; + +function createBaseQueryResponse(): QueryResponse { + return { status: undefined, id: "", results: "" }; +} + +export const QueryResponse = { + encode(message: QueryResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.status !== undefined) { + Status.encode(message.status, writer.uint32(10).fork()).ldelim(); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.results !== "") { + writer.uint32(26).string(message.results); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.status = Status.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.results = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryResponse { + return { + status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, + id: isSet(object.id) ? String(object.id) : "", + results: isSet(object.results) ? String(object.results) : "", + }; + }, + + toJSON(message: QueryResponse): unknown { + const obj: any = {}; + if (message.status !== undefined) { + obj.status = Status.toJSON(message.status); + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.results !== "") { + obj.results = message.results; + } + return obj; + }, + + create, I>>(base?: I): QueryResponse { + return QueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryResponse { + const message = createBaseQueryResponse(); + message.status = (object.status !== undefined && object.status !== null) + ? Status.fromPartial(object.status) + : undefined; + message.id = object.id ?? ""; + message.results = object.results ?? ""; + return message; + }, +}; + +function createBaseAction(): Action { + return { id: "", patch: undefined }; +} + +export const Action = { + encode(message: Action, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.patch !== undefined) { + JsonPatch.encode(message.patch, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Action { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.patch = JsonPatch.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Action { + return { + id: isSet(object.id) ? String(object.id) : "", + patch: isSet(object.patch) ? JsonPatch.fromJSON(object.patch) : undefined, + }; + }, + + toJSON(message: Action): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.patch !== undefined) { + obj.patch = JsonPatch.toJSON(message.patch); + } + return obj; + }, + + create, I>>(base?: I): Action { + return Action.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Action { + const message = createBaseAction(); + message.id = object.id ?? ""; + message.patch = (object.patch !== undefined && object.patch !== null) + ? JsonPatch.fromPartial(object.patch) + : undefined; + return message; + }, +}; + +function createBaseResponse(): Response { + return { status: undefined, actionId: "", results: [] }; +} + +export const Response = { + encode(message: Response, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.status !== undefined) { + Status.encode(message.status, writer.uint32(10).fork()).ldelim(); + } + if (message.actionId !== "") { + writer.uint32(18).string(message.actionId); + } + for (const v of message.results) { + Value.encode(Value.wrap(v!), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Response { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.status = Status.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.actionId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.results.push(Value.unwrap(Value.decode(reader, reader.uint32()))); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Response { + return { + status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, + actionId: isSet(object.actionId) ? String(object.actionId) : "", + results: Array.isArray(object?.results) ? [...object.results] : [], + }; + }, + + toJSON(message: Response): unknown { + const obj: any = {}; + if (message.status !== undefined) { + obj.status = Status.toJSON(message.status); + } + if (message.actionId !== "") { + obj.actionId = message.actionId; + } + if (message.results?.length) { + obj.results = message.results; + } + return obj; + }, + + create, I>>(base?: I): Response { + return Response.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Response { + const message = createBaseResponse(); + message.status = (object.status !== undefined && object.status !== null) + ? Status.fromPartial(object.status) + : undefined; + message.actionId = object.actionId ?? ""; + message.results = object.results?.map((e) => e) || []; + return message; + }, +}; + +function createBaseCloseRequest(): CloseRequest { + return {}; +} + +export const CloseRequest = { + encode(_: CloseRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CloseRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCloseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): CloseRequest { + return {}; + }, + + toJSON(_: CloseRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CloseRequest { + return CloseRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CloseRequest { + const message = createBaseCloseRequest(); + return message; + }, +}; + +function createBaseCloseResponse(): CloseResponse { + return {}; +} + +export const CloseResponse = { + encode(_: CloseResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CloseResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCloseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): CloseResponse { + return {}; + }, + + toJSON(_: CloseResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): CloseResponse { + return CloseResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): CloseResponse { + const message = createBaseCloseResponse(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +}