Runtime Guides

Package-source copy · Generated into the site so runtime docs are searchable and linkable.

Release-State Patterns for TypeScript

Use release-state helpers when a Node.js service needs an authoritative registry row plus immutable event history. The shared contract is described in the root docs/release-state-patterns.md guide; this page names the TypeScript API surface.

APIs

import { TheorydbClient, defineModel } from '@theory-cloud/tabletheory-ts';
import {
  transitionReleaseState,
  validateDeployAuthorityMetadata,
} from '@theory-cloud/tabletheory-ts/release-state';
  • Declare model-level mutation rules through write_policy in defineModel(...).
  • Use transitionReleaseState(...) to update the actual-state row and append an event row in one DynamoDB transaction.
  • Use validateDeployAuthorityMetadata(...) before persisting deploy-authoritative provenance/confidence metadata.

Guardrails

✅ Correct:

  • write_policy.mode: "write_once" for event-history models.
  • write_policy.protected_attributes for registry pin fields.
  • A single transitionReleaseState(...) call for actual-state update + event append.
  • Explicit outbox/retry/reconciliation for Lambda alias, CodePipeline, or other external side effects.

❌ Incorrect:

  • Mutating event history through generic update/save APIs.
  • Loosening model-level protected attributes in a helper call.
  • Treating Lambda alias or CodePipeline changes as if they were part of the DynamoDB transaction.
  • Persisting low-confidence or conflicting evidence as deploy authority.

See ts/examples/release-state.ts for a cross-runtime-aligned example.