Model stream implementation

Hierarchy

  • Stream
    • Model

Constructors

  • Parameters

    • state$: RunningStateLike
    • api: StreamReaderWriter

    Returns Model

Properties

state$: RunningStateLike
MODEL: StreamID = ...
STREAM_TYPE_ID: number = 2
STREAM_TYPE_NAME: string = 'model'
VERSION: "2.0" = '2.0'

Accessors

  • get allCommitIds(): CommitID[]
  • Returns CommitID[]

  • get anchorCommitIds(): CommitID[]
  • Returns CommitID[]

  • get api(): StreamReaderWriter
  • Returns StreamReaderWriter

  • get commitId(): CommitID
  • Returns CommitID

  • get content(): MapIn<RequiredProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"1.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>]>]>>> }>, $TypeOf> & MapIn<OptionalProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"1.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>]>]>>> }>, $TypeOf> | MapIn<RequiredProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"none"> }>>, ExactCodec<TypeCodec<{ fields: Codec<string[], string[], unknown> & {}; type: LiteralCodec<"set"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; immutableFields: OptionalCodec<Codec<string[], string[], unknown> & {}>; implements: Codec<string[], string[], unknown> & {}; interface: TrivialCodec<boolean>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"2.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationSetFrom"> }>>]>]>>> }>, $TypeOf> & MapIn<OptionalProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"none"> }>>, ExactCodec<TypeCodec<{ fields: Codec<string[], string[], unknown> & {}; type: LiteralCodec<"set"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; immutableFields: OptionalCodec<Codec<string[], string[], unknown> & {}>; implements: Codec<string[], string[], unknown> & {}; interface: TrivialCodec<boolean>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"2.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationSetFrom"> }>>]>]>>> }>, $TypeOf>
  • Returns MapIn<RequiredProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"1.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>]>]>>> }>, $TypeOf> & MapIn<OptionalProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"1.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>]>]>>> }>, $TypeOf> | MapIn<RequiredProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"none"> }>>, ExactCodec<TypeCodec<{ fields: Codec<string[], string[], unknown> & {}; type: LiteralCodec<"set"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; immutableFields: OptionalCodec<Codec<string[], string[], unknown> & {}>; implements: Codec<string[], string[], unknown> & {}; interface: TrivialCodec<boolean>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"2.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationSetFrom"> }>>]>]>>> }>, $TypeOf> & MapIn<OptionalProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"none"> }>>, ExactCodec<TypeCodec<{ fields: Codec<string[], string[], unknown> & {}; type: LiteralCodec<"set"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; immutableFields: OptionalCodec<Codec<string[], string[], unknown> & {}>; implements: Codec<string[], string[], unknown> & {}; interface: TrivialCodec<boolean>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"2.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationSetFrom"> }>>]>]>>> }>, $TypeOf>

  • get id(): StreamID
  • Returns StreamID

  • get metadata(): MapIn<{ controller: RefinementCodec<TrivialCodec<string>, string & WithOpaque<"DIDString">>; model: Type<StreamID, Uint8Array, Uint8Array> }, $TypeOf>
  • Returns MapIn<{ controller: RefinementCodec<TrivialCodec<string>, string & WithOpaque<"DIDString">>; model: Type<StreamID, Uint8Array, Uint8Array> }, $TypeOf>

  • get state(): StreamState<StreamMetadata>
  • Returns StreamState<StreamMetadata>

  • get tip(): CID<unknown, number, number, Version>
  • Returns CID<unknown, number, number, Version>

Methods

  • Makes this document read-only. After this has been called any future attempts to call mutation methods on the instance will throw.

    Returns void

  • Returns Promise<AnchorStatus>

  • Parameters

    • Optional opts: LoadOpts

    Returns Promise<void>

  • Asserts that all the required fields for the Model are set, and throws an error if not.

    Parameters

    • content: MapIn<RequiredProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"1.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>]>]>>> }>, $TypeOf> & MapIn<OptionalProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"1.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>]>]>>> }>, $TypeOf> | MapIn<RequiredProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"none"> }>>, ExactCodec<TypeCodec<{ fields: Codec<string[], string[], unknown> & {}; type: LiteralCodec<"set"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; immutableFields: OptionalCodec<Codec<string[], string[], unknown> & {}>; implements: Codec<string[], string[], unknown> & {}; interface: TrivialCodec<boolean>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"2.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationSetFrom"> }>>]>]>>> }>, $TypeOf> & MapIn<OptionalProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"none"> }>>, ExactCodec<TypeCodec<{ fields: Codec<string[], string[], unknown> & {}; type: LiteralCodec<"set"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; immutableFields: OptionalCodec<Codec<string[], string[], unknown> & {}>; implements: Codec<string[], string[], unknown> & {}; interface: TrivialCodec<boolean>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"2.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationSetFrom"> }>>]>]>>> }>, $TypeOf>
    • Optional _streamId: string | StreamID | CommitID

    Returns void

  • Asserts that the relations properties of the given ModelDefinition are well formed, and throws an error if not.

    Parameters

    • content: MapIn<RequiredProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"1.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>]>]>>> }>, $TypeOf> & MapIn<OptionalProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"1.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>]>]>>> }>, $TypeOf> | MapIn<RequiredProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"none"> }>>, ExactCodec<TypeCodec<{ fields: Codec<string[], string[], unknown> & {}; type: LiteralCodec<"set"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; immutableFields: OptionalCodec<Codec<string[], string[], unknown> & {}>; implements: Codec<string[], string[], unknown> & {}; interface: TrivialCodec<boolean>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"2.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationSetFrom"> }>>]>]>>> }>, $TypeOf> & MapIn<OptionalProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"none"> }>>, ExactCodec<TypeCodec<{ fields: Codec<string[], string[], unknown> & {}; type: LiteralCodec<"set"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; immutableFields: OptionalCodec<Codec<string[], string[], unknown> & {}>; implements: Codec<string[], string[], unknown> & {}; interface: TrivialCodec<boolean>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"2.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationSetFrom"> }>>]>]>>> }>, $TypeOf>

    Returns void

  • Asserts that the version of the model definition is supported.

    Parameters

    • content: MapIn<RequiredProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"1.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>]>]>>> }>, $TypeOf> & MapIn<OptionalProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"1.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>]>]>>> }>, $TypeOf> | MapIn<RequiredProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"none"> }>>, ExactCodec<TypeCodec<{ fields: Codec<string[], string[], unknown> & {}; type: LiteralCodec<"set"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; immutableFields: OptionalCodec<Codec<string[], string[], unknown> & {}>; implements: Codec<string[], string[], unknown> & {}; interface: TrivialCodec<boolean>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"2.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationSetFrom"> }>>]>]>>> }>, $TypeOf> & MapIn<OptionalProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"none"> }>>, ExactCodec<TypeCodec<{ fields: Codec<string[], string[], unknown> & {}; type: LiteralCodec<"set"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; immutableFields: OptionalCodec<Codec<string[], string[], unknown> & {}>; implements: Codec<string[], string[], unknown> & {}; interface: TrivialCodec<boolean>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"2.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationSetFrom"> }>>]>]>>> }>, $TypeOf>

      Model definition object

    • satisfies: ValidVersionSatisfies = 'minor'

      Version range to satisfy

    Returns void

  • Creates a Model.

    Parameters

    • ceramic: StreamWriter

      Interface for writing models to ceramic network

    • content: MapIn<RequiredProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"1.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>]>]>>> }>, $TypeOf> & MapIn<OptionalProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"1.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>]>]>>> }>, $TypeOf> | MapIn<RequiredProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"none"> }>>, ExactCodec<TypeCodec<{ fields: Codec<string[], string[], unknown> & {}; type: LiteralCodec<"set"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; immutableFields: OptionalCodec<Codec<string[], string[], unknown> & {}>; implements: Codec<string[], string[], unknown> & {}; interface: TrivialCodec<boolean>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"2.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationSetFrom"> }>>]>]>>> }>, $TypeOf> & MapIn<OptionalProps<{ accountRelation: UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"list"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"single"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"none"> }>>, ExactCodec<TypeCodec<{ fields: Codec<string[], string[], unknown> & {}; type: LiteralCodec<"set"> }>>]>; description: OptionalCodec<TrivialCodec<string>>; immutableFields: OptionalCodec<Codec<string[], string[], unknown> & {}>; implements: Codec<string[], string[], unknown> & {}; interface: TrivialCodec<boolean>; name: TrivialCodec<string>; relations: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"account"> }>>, ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; type: LiteralCodec<"document"> }>>]>>>; schema: Type<Object<any>, Object<any>, unknown>; version: LiteralCodec<"2.0">; views: OptionalCodec<NonEnumerableRecordCodec<TrivialCodec<string>, UnionCodec<[UnionCodec<[ExactCodec<TypeCodec<{ type: LiteralCodec<"documentAccount"> }>>, ExactCodec<TypeCodec<{ type: LiteralCodec<"documentVersion"> }>>]>, UnionCodec<[ExactCodec<TypeCodec<{ model: UnionCodec<[RefinementCodec<TrivialCodec<string>, string>, TrivialCodec<null>]>; property: TrivialCodec<string>; type: LiteralCodec<"relationDocument"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationCountFrom"> }>>, ExactCodec<TypeCodec<{ model: RefinementCodec<TrivialCodec<string>, string>; property: TrivialCodec<string>; type: LiteralCodec<"relationSetFrom"> }>>]>]>>> }>, $TypeOf>

      contents of the model to create

    • Optional metadata: ModelMetadataArgs

    Returns Promise<Model>

  • Loads a Model from a given StreamID

    Parameters

    • ceramic: StreamReader

      Interface for reading streams from ceramic network

    • streamId: string | StreamID | CommitID

      StreamID to load. Must correspond to a Model

    • opts: LoadOpts = {}

      Additional options

    Returns Promise<Model>