Skip to content

TypeScript types

IndexKey

An opaque key used to identify records in the index.

type IndexKey = string

Index

Represents the shape of the content stored in the index.

type Index = Record<IndexKey, string>

Schema

A type representing a JSON Schema.

type Schema = Record<string, unknown>

Definition

A definition is a Ceramic stream that describes a record in the index.

type Definition<C extends Record<string, any> = Record<string, any>> = {
  name: string
  description: string
  schema: string
  url?: string
  config?: C
}

DefinitionWithID

type DefinitionWithID<
  C extends Record<string, unknown> = Record<string, unknown>,
> = Definition<C> & { id: StreamID }

Aliases

type Aliases = Record<string, string>

Entry

type Entry = {
  key: IndexKey
  id: string
  record: unknown
}

DefinitionName

Name for aliases of core IDX definitions.

type DefinitionName = 'basicProfile' | 'cryptoAccountLinks' | 'threeIdKeychain'

PublishedDefinitions

Record of definitions published to Ceramic.

type PublishedDefinitions = Record<DefinitionName, string>

SchemaName

Name for aliases of core IDX schemas.

type SchemaName =
  | 'BasicProfile'
  | 'CryptoAccounts'
  | 'Definition'
  | 'IdentityIndex'
  | 'ThreeIdKeychain'

PublishedSchemas

Record of schemas published to Ceramic.

type PublishedSchemas = Record<SchemaName, string>

PublishedConfig

Definitions and schemas published to Ceramic.

interface PublishedConfig {
  definitions: PublishedDefinitions
  schemas: PublishedSchemas
}

IDXOptions

Options used by the IDX class constructor

interface IDXOptions {
  aliases?: DefinitionsAliases
  autopin?: boolean
  ceramic: CeramicApi
}

CreateOptions

Options used by the .set method of the IDX class.

interface CreateOptions {
  pin?: boolean
}