Skip to content

protoObj

protoObj returns an object based on a proto.Message value which handles conversion between protobuf type values and expression type values. Objects support indexing and iteration.

Note: the type value is pulled from the list of registered types within the type provider. If the proto type is not registered within the type provider, then this will result in an error within the type adapter / provider.

new protoObj(adapter, typeDesc, typeValue, pbValue, reflectedValue): protoObj

TypeAdapter

DescMessage

Val

Message

ReflectMessage

protoObj

aggregateSize(sizer): number

aggregateSize implements AggregateSizeVisitor by summing the set fields of the message.

AggregateSizer

number


convertToNative(typeDesc): unknown

ConvertToNative converts the Value to a native TypeScript value according to the provided type description, or throws if the conversion is not feasible.

unknown

unknown

Val.convertToNative


convertToType(typeVal): Val

ConvertToType supports type conversions between CEL value types supported by the expression language.

RefType

Val

Val.convertToType


equal(other): Val

Equal returns true if the other value has the same type and content as the implementing value.

Val

Val

Val.equal


format(sb): void

format implements formattable.

string[]

void


get(index): Val

Get returns the field value by name.

Val

Val

Indexer.get


isSet(field): Val

IsSet tests whether a field which is defined is set to a non-default value.

Val

Val

TraitFieldTester.isSet


isZeroValue(): boolean

IsZeroValue returns true if the protobuf object is empty.

boolean


toString(): string

String returns the human-readable formatted value.

string


type(): RefType

Type returns the TypeValue of the value.

RefType

Val.type


value(): unknown

Value returns the raw value of the instance which may not be directly compatible with the expression language types.

unknown

Val.value