Registry
Registry provides type information for a set of registered types.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Registry(
pbdbValue?):Registry
Parameters
Section titled “Parameters”pbdbValue?
Section titled “pbdbValue?”Db = ...
Returns
Section titled “Returns”Registry
Methods
Section titled “Methods”copy()
Section titled “copy()”copy():
Registry
Returns
Section titled “Returns”Registry
ensureNativeTypes()
Section titled “ensureNativeTypes()”ensureNativeTypes(…
descriptors):void
ensureNativeTypes registers explicit TypeScript object descriptions, skipping any type name which is already registered with an identical description.
Registering a different description of an already registered type name remains a conflict. This is the registration a library performs, where the same type may legitimately be described again by a second copy of that library.
Parameters
Section titled “Parameters”descriptors
Section titled “descriptors”Returns
Section titled “Returns”void
enumTypes()
Section titled “enumTypes()”enumTypes():
DescEnum[]
enumTypes returns every registered protobuf enum descriptor.
Returns
Section titled “Returns”DescEnum[]
enumValue()
Section titled “enumValue()”enumValue(
enumName):Val
EnumValue returns the numeric value of the given enum value name.
Parameters
Section titled “Parameters”enumName
Section titled “enumName”string
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”enumValueOf()
Section titled “enumValueOf()”enumValueOf(
typeName,value):Val
enumValueOf creates an enum value from its signed number or declared symbolic name.
Parameters
Section titled “Parameters”typeName
Section titled “typeName”string
string | bigint
Returns
Section titled “Returns”extend()
Section titled “extend()”extend(
incoming):Registry
extend returns an independent registry containing this registry’s registrations plus those of
incoming. Neither input registry is modified, so an extended registry never observes a later
registration made against the registry it grew from.
extend adds the incoming registrations through the same registration methods a caller uses, so a duplicate registration is accepted or rejected exactly as it would be on a single registry. A native type is the one exception: registering one twice is always a conflict on a single registry, but two registries which describe it identically are combined rather than rejected.
A protobuf file already registered under the same file name keeps the registration it already has, so two different definitions of one file name are combined as the first of the two.
Parameters
Section titled “Parameters”incoming
Section titled “incoming”Registry
Returns
Section titled “Returns”Registry
findEnumType()
Section titled “findEnumType()”findEnumType(
typeName):DescEnum|undefined
findEnumType resolves a registered protobuf enum descriptor by fully qualified type name.
Parameters
Section titled “Parameters”typeName
Section titled “typeName”string
Returns
Section titled “Returns”DescEnum | undefined
findEnumValue()
Section titled “findEnumValue()”findEnumValue(
enumName):Val|undefined
FindEnumValue resolves a declared enum value by name, or undefined when the name is not one.
Callers that probe a name they expect to miss use this rather than enumValue. Err extends
the built-in Error, so constructing one captures a stack trace: fabricating an error per
missed lookup dominated checking a qualified selection.
Parameters
Section titled “Parameters”enumName
Section titled “enumName”string
Returns
Section titled “Returns”Val | undefined
findFieldType()
Section titled “findFieldType()”findFieldType(
messageType,fieldName):FieldType|undefined
FindFieldType returns the field type for a checked type value.
Parameters
Section titled “Parameters”messageType
Section titled “messageType”string
fieldName
Section titled “fieldName”string
Returns
Section titled “Returns”FieldType | undefined
Implementation of
Section titled “Implementation of”findIdent()
Section titled “findIdent()”findIdent(
identName):Val|undefined
FindIdent takes a qualified identifier name and returns a Value if one exists.
Parameters
Section titled “Parameters”identName
Section titled “identName”string
Returns
Section titled “Returns”Val | undefined
Implementation of
Section titled “Implementation of”findStructFieldNames()
Section titled “findStructFieldNames()”findStructFieldNames(
structType):string[] |undefined
Parameters
Section titled “Parameters”structType
Section titled “structType”string
Returns
Section titled “Returns”string[] | undefined
Implementation of
Section titled “Implementation of”findStructFieldType()
Section titled “findStructFieldType()”findStructFieldType(
structType,fieldName):ProviderFieldType|undefined
Parameters
Section titled “Parameters”structType
Section titled “structType”string
fieldName
Section titled “fieldName”string
Returns
Section titled “Returns”ProviderFieldType | undefined
Implementation of
Section titled “Implementation of”findStructType()
Section titled “findStructType()”findStructType(
structType):Type|undefined
Parameters
Section titled “Parameters”structType
Section titled “structType”string
Returns
Section titled “Returns”Type | undefined
Implementation of
Section titled “Implementation of”findType()
Section titled “findType()”findType(
typeName):Type|undefined
FindType looks up the Type given a qualified typeName. Returns false if not found.
Parameters
Section titled “Parameters”typeName
Section titled “typeName”string
Returns
Section titled “Returns”Type | undefined
Implementation of
Section titled “Implementation of”jsonFieldNames()
Section titled “jsonFieldNames()”jsonFieldNames():
boolean
Returns
Section titled “Returns”boolean
nativeToValue()
Section titled “nativeToValue()”nativeToValue(
value):Val
NativeToValue converts the input value to a CEL ref.Val.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”newValue()
Section titled “newValue()”newValue(
structType,fields):Val
Parameters
Section titled “Parameters”structType
Section titled “structType”string
fields
Section titled “fields”Record<string, Val>
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”registerDescriptor()
Section titled “registerDescriptor()”registerDescriptor(
fileDesc):void
RegisterDescriptor registers a protocol buffer file descriptor.
Parameters
Section titled “Parameters”fileDesc
Section titled “fileDesc”DescFile
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”TypeRegistry.registerDescriptor
registerMessage()
Section titled “registerMessage()”registerMessage(
message,schema?):void
RegisterMessage registers a protocol buffer message and its dependencies.
Parameters
Section titled “Parameters”message
Section titled “message”Message
schema?
Section titled “schema?”DescMessage
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”registerNativeTypes()
Section titled “registerNativeTypes()”registerNativeTypes(…
descriptors):void
registerNativeTypes registers explicit TypeScript object descriptions with the provider.
Parameters
Section titled “Parameters”descriptors
Section titled “descriptors”Returns
Section titled “Returns”void
registerType()
Section titled “registerType()”registerType(…
types):void
RegisterType registers a type value with the provider.
Parameters
Section titled “Parameters”…RefType[]
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”strongEnumsEnabled()
Section titled “strongEnumsEnabled()”strongEnumsEnabled():
boolean
strongEnumsEnabled reports whether protobuf enums retain their declared runtime types.
Returns
Section titled “Returns”boolean
value()
Section titled “value()”value(
typeName,fields):Val
Value creates a new type value from a qualified name and map of field name to value.
Parameters
Section titled “Parameters”typeName
Section titled “typeName”string
fields
Section titled “fields”Record<string, Val>
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”withJSONFieldNames()
Section titled “withJSONFieldNames()”withJSONFieldNames(
enabled):void
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”void
withStrongEnums()
Section titled “withStrongEnums()”withStrongEnums(
enabled):void
withStrongEnums selects whether protobuf enums retain their declared runtime types.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”void