A datatype represents a named, standalone type definition.

Hierarchy (view full)

Implements

Constructors

Properties

asOf?: `${number}.${number}`

The first Matter specification in which this element appears.

byteSize?: ByteSize

Applies to numeric types.

default?: FieldValue

The default value for the element.

description?: string

A short summary of the element.

details?: string

A paragraph summary of the element.

errors?: DefinitionError[]
id: undefined

You can only reference a datatype by name. It does not have an ID.

isSeed?: boolean

Is this a "seed" element? These are global types and cluster elements defined in the core specification, without which we are fairly incapacitated.

isType?: boolean

Indicates that an element defines a datatype.

isTypeScope?: boolean

Indicates that an element may have type definitions as children.

metatype?: Metatype

A "metatype" provides enough semantics for us to translate a value into a native datatype. Metatype is only required on global datatypes, and only when the datatype should map directly to a specific native (JS) type.

name: string

The key used for storing this element. A "human appropriate" semantic differentiator.

operationalBase?: Model<BaseElement>

Normally base performs lookup based on type. If instead a model is installed it is used as the base.

The operational base also enables resolution from the operational base's tree. This enables resolution on operational models that are not installed in a parent hierarchy.

type?: string

If an element derives from another element, the name of the parent element goes here.

until?: `${number}.${number}`

The Matter specification revision in which this element was removed.

Reference to Matter specification document.

types: {
    [type: string]: (new (definition: any) => Model);
}

Factory support. Populated by derivatives upon definition.

Accessors

  • get access(): Access
  • Authorization limits.

    Returns Access

  • set access(definition): void
  • Authorization limits.

    Parameters

    Returns void

  • get allowedBaseTags(): ElementTag[]
  • ValueModels may derive from models of the same type or from generic Datatype models.

    Returns ElementTag[]

  • get base(): undefined | ValueModel<ValueElement>
  • ValueModels may only derive from ValueModels.

    Returns undefined | ValueModel<ValueElement>

  • get constraint(): Constraint
  • Limits on values.

    Returns Constraint

  • set constraint(definition): void
  • Limits on values.

    Parameters

    Returns void

  • get definesFields(): boolean
  • Returns boolean

  • get definingModel(): undefined | ValueModel<ValueElement>
  • Get the first derived ancestor with children, if any.

    Returns undefined | ValueModel<ValueElement>

  • get discriminator(): undefined | string
  • Obtain a discriminator that differentiates different models with the same name

    Returns undefined | string

  • get effectiveAccess(): Access
  • Returns Access

  • get effectiveConformance(): Conformance
  • Returns Conformance

  • get effectiveConstraint(): Constraint
  • Returns Constraint

  • get effectiveDefault(): any
  • The value to use as a default. The "default" field has a manually supplied value but this property decodes the default and/or generates a default from subfields.

    Returns any

  • get effectiveId(): undefined | number
  • Allows subclasses to pull a working ID from an alternate source.

    Returns undefined | number

  • get effectiveMetatype(): undefined | Metatype
  • The working metatype for this object.

    Returns undefined | Metatype

  • get effectiveQuality(): Quality
  • Returns Quality

  • get effectiveType(): undefined | string
  • The "effective type" may be inferred from context.

    Returns undefined | string

  • get effectiveXref(): undefined | CrossReference
  • A local or parent xref.

    Returns undefined | CrossReference

  • get globalBase(): undefined | Model<BaseElement>
  • Get the first global base type. This may have semantic meaning more specific than the base primitive type.

    Returns undefined | Model<BaseElement>

  • get isDeprecated(): boolean
  • Is this model deprecated?

    Returns boolean

  • get isDisallowed(): boolean
  • Is this model disallowed?

    Returns boolean

  • get isGlobal(): boolean
  • Determine if this model resides in the global namespace.

    Returns boolean

  • get key(): undefined | string
  • Get a string that uniquely identifies this model. This is normally the effective ID but some models require a generated identifier.

    Returns undefined | string

  • get listEntry(): undefined | FieldModel<FieldElement>
  • Get the entry type for lists, if any.

    Returns undefined | FieldModel<FieldElement>

  • get mandatory(): boolean
  • Is the model mandatory?

    Returns boolean

  • get members(): PropertyModel<any>[]
  • All FieldModel children}.

    Returns PropertyModel<any>[]

  • get metabase(): undefined | ValueModel<ValueElement>
  • Metatype is only present on global types with specific semantic meaning. This model is significant because it gives us information about how to manipulate the data. This accessor retrieves this model.

    Returns undefined | ValueModel<ValueElement>

  • get nullable(): boolean
  • Can this model be omitted?

    Returns boolean

  • get overridesShadow(): undefined | true
  • Determine whether this element overrides key properties of its shadow.

    Returns undefined | true

  • get parent(): undefined | Model<BaseElement>
  • The structural parent. This is the model for the element that contains this element's definition.

    Returns undefined | Model<BaseElement>

  • set parent(parent): void
  • Parameters

    Returns void

  • get path(): string
  • The path ("." delimited) in the Matter tree.

    This is informational and generally tries to adhere to JS API conventions.

    Returns string

  • get primitiveBase(): undefined | ValueModel<ValueElement>
  • Get the primitive type for this value model. This is an integer type for enums and bitmaps. Otherwise it's the metabase.

    Returns undefined | ValueModel<ValueElement>

  • get quality(): Quality
  • Other qualities not covered by conformance or access.

    Returns Quality

  • set quality(definition): void
  • Other qualities not covered by conformance or access.

    Parameters

    Returns void

  • get shadow(): undefined | Model<BaseElement>
  • Get shadow model, if any. A "shadow" is an element in my parent's inheritance hierarchy that I override.

    Returns undefined | Model<BaseElement>

  • get valid(): boolean
  • Did validation find errors?

    Returns boolean

  • get validationAspects(): Aspect<any>[]
  • Collect constraints and conformance for this type and all base types.

    Returns Aspect<any>[]

Methods

  • Retrieve all models of a specific element type from local scope.

    Type Parameters

    Parameters

    • type: Type<T>

      model class or a predicate object

    • Optionalkey: string | number

      filters to models matching a specific type

    Returns T[]

  • Determine whether this element applies to a specific revision.

    Parameters

    • revision: `${number}.${number}`

    Returns boolean

  • Clone the model. This deep copies all descendant child models but not other properties.

    Type Parameters

    Parameters

    Returns This

  • Record a validation error for this model.

    Parameters

    • code: string
    • message: string

    Returns void

  • Create an operational extension of the model. This creates a new model that inherits from this model for operational purposes.

    Type Parameters

    Parameters

    Returns This

  • Freeze the model hierarchy rooted at this model.

    When using a model as operational schema we implement various optimizations that assume the schema is immutable. This function enforces that assumption.

    To make changes to a frozen model use clone.

    Returns void

  • Retrieve a specific child by ID or name.

    Type Parameters

    Parameters

    • type: Type<T>
    • key: string | number

    Returns undefined | T

  • Search the inheritance chain for a child property.

    Parameters

    Returns undefined | Model<BaseElement>

  • Retrieve a model of a specific type from the ownership hierarchy.

    Type Parameters

    Parameters

    Returns undefined | T

  • Returns string

  • Apply a function to all tree elements.

    Parameters

    Returns undefined | boolean