# `BeforeCommitContext`

> 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 { BeforeCommitContext } from '@holostep-configurators/runtime-client/contract';` · labs, `@experimental` · since 2.0.0 · section 5. Writers, transactions, session

What a [`beforeCommit`](Session.beforeCommit.md) function receives. Valid only during that commit.

## Members

| Member | Kind | Summary |
| --- | --- | --- |
| <a id="tx"></a>[`tx`](BeforeCommitContext.tx.md) | property | Bound to the commit being prepared. |
| <a id="cause"></a>[`cause`](BeforeCommitContext.cause.md) | property | The commit being prepared: who made it, its `origin` and its kind (undo and redo included). |

## Declaration

```ts
export interface BeforeCommitContext {
  readonly tx: Tx;
  readonly cause: Cause;
}
```

## Generic-API test (spec 3.1)

| Rule | Result |
| --- | --- |
| 1. Neutral name | pass: `BeforeCommitContext` names no product |
| 2. A precedent | pass: [Unity AnimationClip.SampleAnimation](https://docs.unity3d.com/ScriptReference/AnimationClip.SampleAnimation.html) (row `G36`); [Lexical registerNodeTransform](https://lexical.dev/docs/concepts/transforms) (row `G4`); [ProseMirror PluginSpec.appendTransaction](https://prosemirror.net/docs/ref/#state.PluginSpec.appendTransaction) (row `G4`) |
| 3. Two apps, or labs | labs (`@experimental` at a stable path, reached through `has()` or `supports()`): it graduates when a second app uses it; apps today: app-04c2774145, app-0c773a4ee3, app-378d190f1b, app-4762caacdc, app-4f16d2f6da, app-510d750508, app-59c5b5751e, app-b362a81c85, app-b4ae2fce25, app-bcb7ef21da, app-ceb4eccc72, app-ddfb017681, app-f9a32142f1, app-fc07850558, app-fc306ec3dc, app-fd09090420 |
| 4. The cheaper fix first | decided per need in Appendix B: rows `G36`, `G4` at tier labs, stable (a member only where no rule, data, asset or app code serves the need) |
