Field Types

The Field types in the Cadastry Chain schema provide a flexible way to store and manage different types of data within documents. Each field type has specific properties and use cases.

Base Field

All field types extend from the BaseField interface, which includes:

PropertyTypeDescription
typeFieldTypeThe type of the field (e.g., 'string', 'number', etc.)
valueanyThe actual value stored in the field
hashstring (optional)Optional hash of the field value
encryptedboolean (optional)Indicates if the field is encrypted
isPrivateboolean (optional)Indicates if the field is private
decryptedboolean (optional)Indicates if an encrypted field has been decrypted

Field Types

The following field types are supported (FieldType):

  • string
  • number
  • boolean
  • date
  • array
  • object
  • generic
  • reference
  • resource
  • encrypted
  • select
  • image
  • url

Specific Field Types

1. StringField

PropertyTypeDescription
type'string'Indicates this is a string field
valuestringThe string value

2. UrlField

PropertyTypeDescription
type'url'Indicates this is a URL field
valuestringThe URL string value

3. NumberField

PropertyTypeDescription
type'number'Indicates this is a number field
valuenumberThe numeric value

4. BooleanField

PropertyTypeDescription
type'boolean'Indicates this is a boolean field
valuebooleanThe boolean value

5. DateField

PropertyTypeDescription
type'date'Indicates this is a date field
valuestringISO 8601 date string

6. ArrayField

PropertyTypeDescription
type'array'Indicates this is an array field
valueany[]Array of values

7. ObjectField

PropertyTypeDescription
type'object'Indicates this is an object field
value[key: string]: anyObject with string keys and any values

8. GenericField

PropertyTypeDescription
type'generic'Indicates this is a generic field
valueanyCan hold any type of value

9. ReferenceField

PropertyTypeDescription
type'reference'Indicates this is a reference field
valuestringCDID of the referenced document

10. ResourceField

PropertyTypeDescription
type'resource'Indicates this is a resource field
valuestringCDID of the referenced resource document

The Field types provide a robust system for storing and managing various types of data within the Cadastry Chain schema, allowing for flexibility and type safety. Any field can have additional properties like encrypted, isPrivate, and decrypted to handle security and privacy requirements.