Skip to content

API documentation of Agoric SDK / Exports / @agoric/store / types

Module: types

Table of contents

Interfaces

Type Aliases

Type Aliases

CopyMap

Ƭ CopyMap<K, V>: CopyTagged<"copyMap", { keys: K[] ; values: V[] }>

A Passable collection of entries with Keys that are all mutually distinguishable according to the key distributed equality semantics exposed by keyEQ, each with a corresponding Passable value.

Type parameters

NameType
Kextends unknown = any
Vextends unknown = any

Defined in

node_modules/@endo/patterns/src/types.d.ts:96


CopySet

Ƭ CopySet<K>: CopyTagged<"copySet", K[]>

A Passable collection of Keys that are all mutually distinguishable according to the key distributed equality semantics exposed by keyEQ.

Type parameters

NameType
Kextends unknown = any

Defined in

node_modules/@endo/patterns/src/types.d.ts:84


CopyTagged

Ƭ CopyTagged<Tag, Payload>: Object

A Passable "tagged record" with semantics specific to the tag identified in the [Symbol.toStringTag] property (such as 'copySet', 'copyBag', or 'copyMap'). It must have a property with key equal to the PASS_STYLE export and value 'tagged' and no other properties except [Symbol.toStringTag] and payload.

TODO But TypeScript complains about a declaration like [PASS_STYLE]: 'tagged' because importing packages do not know what PASS_STYLE is, so we appease it with a looser but less accurate definition using symbol index properties and | string.

Type parameters

NameType
Tagextends string = string
Payloadextends unknown = any

Index signature

▪ [passStyle: symbol]: string

Type declaration

NameType
[toStringTag]Tag
payloadPayload

Defined in

node_modules/@endo/pass-style/src/types.d.ts:81


Key

Ƭ Key: Passable

Keys are Passable arbitrarily-nested pass-by-copy containers (CopyArray, CopyRecord, CopySet, CopyBag, CopyMap) in which every non-container leaf is either a Passable primitive value or a Remotable (a remotely-accessible object or presence for a remote object), or such leaves in isolation with no container.

Keys are so named because they can be used as keys in CopyMaps and agoric-sdk Stores, and as elements in CopySets and CopyBags.

Keys cannot contain promises or errors, as these do not have useful distributed equality semantics. Keys also cannot contain any CopyTagged except for those recognized as CopySets, CopyBags, and CopyMaps.

Be aware that we may recognize more CopyTaggeds over time, including CopyTaggeds recognized as Keys.

Distributed equality is location independent. The same two Keys, passed to another location, will be keyEQ there iff they are keyEQ here. (keyEQ tests equality according to the key distributed equality semantics.)

Defined in

node_modules/@endo/patterns/src/types.d.ts:32


Passable

Ƭ Passable: any

A Passable is acyclic data that can be marshalled. It must be hardened to remain stable (even if some components are proxies; see PureData restriction below), and is classified by PassStyle:

  • Atomic primitive values have a PrimitiveStyle (PassStyle 'undefined' | 'null' | 'boolean' | 'number' | 'bigint' | 'string' | 'symbol').
  • Containers aggregate other Passables into
    • sequences as CopyArrays (PassStyle 'copyArray'), or
    • string-keyed dictionaries as CopyRecords (PassStyle 'copyRecord'), or
    • higher-level types as CopyTaggeds (PassStyle 'tagged').
  • PassableCaps (PassStyle 'remotable' | 'promise') expose local values to remote interaction.
  • As a special case to support system observability, error objects are Passable (PassStyle 'error').

A Passable is essentially a pass-by-copy superstructure with a pass-by-reference exit point at the site of each PassableCap (which marshalling represents using 'slots').

Defined in

node_modules/@endo/pass-style/src/types.d.ts:25


Pattern

Ƭ Pattern: Passable

Patterns are Passable arbitrarily-nested pass-by-copy containers (CopyArray, CopyRecord, CopySet, CopyBag, CopyMap) in which every non-container leaf is either a Key or a Matcher, or such leaves in isolation with no container.

A Pattern acts as a declarative total predicate over Passables, where each Passable is either matched or not matched by it. Every Key is also a Pattern that matches only "itself", i.e., Keys that are keyEQ to it according to the key distributed equality semantics.

Patterns cannot contain promises or errors, as these do not have useful distributed equality or matching semantics. Likewise, no Pattern can distinguish among promises, or distinguish among errors. Patterns also cannot contain any CopyTaggeds except for those recognized as CopySets, CopyBags, CopyMaps, or Matchers.

Be aware that we may recognize more CopyTaggeds over time, including CopyTaggeds recognized as Patterns.

Whether a Passable is matched by a given Pattern is location independent. If a given Passable and Pattern are passed to another location, the Passable will be matched by the Pattern there iff the Passable is matched by the Pattern here.

Patterns are often used in a type-like manner, to represent the category of Passables that the Pattern is intended* to match. To keep this distinction clear, we often use the suffix "Shape" rather than "Pattern" to avoid confusion when the Pattern itself represents some category of Pattern. For example, an "AmountShape" represents the category of Amounts. And "AmountPatternShape" represents the category of Patterns over Amounts.

  • We say "intended" above because Patterns, in order to be declarative and Passable, cannot have the generality of predicates written in a Turing-universal programming language. Rather, to represent the category of things intended to be a Foo, a FooShape should reliably accept all Foos and reject only non-Foos. However, a FooShape may also accept non-Foos that "look like" or "have the same shape as" genuine Foos. An accurate predicate for e.g. input validation would need to supplement the Pattern check with code to detect the residual cases. We hope the "Shape" metaphor helps remind us of this type-like imprecision of Patterns.

Defined in

node_modules/@endo/patterns/src/types.d.ts:79