minca
ApiCoreInterfaces

Interface: CollectionDefinition\<N, S, L, M\>

Defined in: packages/core/src/schema/collection-def.ts:60

A collection definition as collection() takes it: its computed fields and contract built in TypeScript, typed from its own schema and name.

Extends

Type Parameters

Type ParameterDefault type
N extends stringstring
S| JsonSchema | StandardJSONSchemaV1
LReadonly<Record<string, LinkDeclaration>>
M extends ComputedResultComputedResult

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
computed?readonlyReadonly<Record<string, string>> | ((scope) => M)Values every app derives the same way from what links to its records: ({ linked }) => ({ thumbs: linked(reaction, 'on').count() }). A view of what a node holds, not a verdict (packages/core/docs/computed.md).-packages/core/src/schema/collection-def.ts:74
contract?readonlyobjectWhat a version must be to count, judged by every reader: check: ({ body }) => ({ 'Why it is refused': body.amount.gte(0) }), and whether the collection is a line (packages/core/docs/contracts.md).-packages/core/src/schema/collection-def.ts:80
contract.check?readonly| readonly Contract[] | ((scope) => Readonly<Record<string, BoolLike>>)--packages/core/src/schema/collection-def.ts:81
contract.line?readonlyLine--packages/core/src/schema/collection-def.ts:84
description?readonlystring-DefineCollection.descriptionpackages/core/src/node/types.ts:326
history?readonly"all" | "latest"all keeps every version of every record whole, hash-linked, for records.history. latest, the default, keeps the current version whole and forgets what earlier ones and deleted records saidDefineCollection.historypackages/core/src/node/types.ts:340
links?readonlyL--packages/core/src/schema/collection-def.ts:68
namereadonlyN--packages/core/src/schema/collection-def.ts:66
rules?readonlyCollectionRulesWhat must be unique, which fields are fixed, whether records are written once: every peer checks. None by defaultDefineCollection.rulespackages/core/src/node/types.ts:344
schemareadonlyS--packages/core/src/schema/collection-def.ts:67
title?readonlystring-DefineCollection.titlepackages/core/src/node/types.ts:325
topics?readonlyreadonly string[]Fields whose values are topics, like mentions, or link roles as link:<rel>, so a node that can't read the space still matches records by them. At most 8DefineCollection.topicspackages/core/src/node/types.ts:350
version?readonlynumberThe definition's version number. Default: one past the current version, or 1. This library refuses one that isn't higher than the one in force, or not below 2^53; peers don't check it (spec 02 §6.3)DefineCollection.versionpackages/core/src/node/types.ts:334

On this page