# `Tx`

> Contract 2.0.0 · package sha256 `a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e` · generated from `configurator-runtime.d.ts` by `services/onsite-scripter/scripts/build-contract-docs.mjs`; edit the source, not this file.

Interface · `import type { Tx } from '@holostep-configurators/runtime-client/contract';` · stable · since 2.0.0 · section 5. Writers, transactions, session

A transaction's scoped writer. Valid only while the transaction is open (the IndexedDB
TransactionInactiveError rule): after commit or rollback, writes through it or its handles throw
HoloTransactionClosedError; reads keep working. It takes no commit options ([`NoCommitOptions`](NoCommitOptions.md)).
It has no undo, redo, idle, on, beforeCommit, history or destroy. [`session.revision`](Session.revision.md) read in
`work` is the revision it opened at: nothing outside it commits while it is open (spec section
6.1, O2b).

## Members

| Member | Kind | Summary |
| --- | --- | --- |
| <a id="op"></a>[`op`](Tx.op.md) | property | The transaction's operation id, as in its Report and `cause.op`. |
| <a id="open"></a>[`open`](Tx.open.md) | property | False once committed, rolled back or superseded. |
| <a id="signal"></a>[`signal`](Tx.signal.md) | property | Aborts on every close that is not a commit. |
| <a id="transaction"></a>[`transaction`](Tx.transaction.md) | method | A savepoint. |

Inherited from [`Writer`](Writer.md): [`node`](Writer.node.md), [`find`](Writer.find.md), [`collection`](Writer.collection.md), [`apply`](Writer.apply.md), [`applyPatch`](Writer.applyPatch.md), [`setSceneModel`](Writer.setSceneModel.md), [`select`](Writer.select.md), [`stage`](Writer.stage.md), [`materials`](Writer.materials.md), [`assembly`](Writer.assembly.md), [`camera`](Writer.camera.md), [`animations`](Writer.animations.md), [`labs`](Writer.labs.md), [`state`](Writer.state.md), [`getSceneModel`](Writer.getSceneModel.md).

## Declaration

```ts
export interface Tx extends Writer<NoCommitOptions> {
  readonly op: OpId;
  readonly open: boolean;
  readonly signal: AbortSignal;
  transaction<T>(work: (sp: Tx) => T | Promise<T>, options?: SignalOption): Promise<TransactionReport<T>>;
}
```

## Generic-API test (spec 3.1)

| Rule | Result |
| --- | --- |
| 1. Neutral name | pass: `Tx` names no product |
| 2. A precedent | pass: [Unity AnimationClip.SampleAnimation](https://docs.unity3d.com/ScriptReference/AnimationClip.SampleAnimation.html) (row `G36`) |
| 3. Two apps, or labs | pass: 18 apps (ledger: app-f9a32142f1; fleet cross-check: app-04c2774145, app-37356bf09f, app-4762caacdc, app-4fd23bc869, app-510d750508, app-822bb9d6aa, app-8675b3225c, app-bcb7ef21da and 9 more) |
| 4. The cheaper fix first | decided per need in Appendix B: rows `G36` at tier stable (a member only where no rule, data, asset or app code serves the need) |
