← All packages

API reference

@searsuite/sear-domain-transaction

The correctly spelled public entry point for SearSuite transaction contracts.

5 exportsderived from source

functioncreateTransactionsource ↗
createTransaction<OperationType>(pluginKey: TransactionPluginKey, operations?: readonly OperationType[], meta?: Readonly<Record<string, unknown>>): Transaction<OperationType>

Creates a transaction with copied operations and metadata.

pluginKey: TransactionPluginKey
operations: readonly OperationType[]
meta: Readonly<Record<string, unknown>>
classTransactionsource ↗
class Transaction<OperationType>

Transaction public API.

propertymeta
readonly meta: Record<string, unknown>

Metadata attached to Transaction.

propertyoperations
readonly operations: OperationType[]

Operations carried by Transaction.

propertypluginKey
readonly pluginKey: TransactionPluginKey

Stable plugin key for Transaction.

methodaddOperation
addOperation(operations: OperationType[]): void

Adds the operation.

operations: OperationType[]
methodgetMeta
getMeta<T>(key: string): T | undefined

Returns the meta.

key: string
methodsetMeta
setMeta(key: string, value: unknown): this

Updates the meta.

key: string
value: unknown
variableTRANSACTION_ORIGIN_META_KEYsource ↗
TRANSACTION_ORIGIN_META_KEY: "transaction:origin"

Metadata key describing where a transaction originated.

enumTransactionOriginsource ↗
enum TransactionOrigin

Stable transaction origins observed by cross-cutting runtime features.

enum memberHistory
History: "history"
enum memberLocal
Local: "local"
enum memberRemote
Remote: "remote"
interfaceTransactionPluginKeysource ↗
interface TransactionPluginKey

Stable owner key accepted by a transaction.

propertykey
readonly key: string

String identity for the plugin or state owner receiving this transaction.