Transform

Turn captured changes into usable records.

Tapstate applies ordered, reviewable rules in the same data path. Filter, rename, enrich, or expand records before Serve makes them available to downstream systems.

Captured Change

active

user_id:u-104
status:active
spend:1280
tags:[vip, renewal]

Transform Path

Filter
status == active
Rename
JS
Unwind
user_id idspend tier: premiumtags[ ] × 2 records

Output Records

output 1

id:u-104
tier:premium
tag:vip

output 2

id:u-104
tier:premium
tag:renewal

Ordered Transforms

Each node works from the result of the one before it.

Transform nodes run in the order declared by the pipeline. Each output becomes the next node's input.

Input

active

user_id:u-104
status:active
spend:1280
tags:[vip, renewal]

inactive

user_id:u-211
status:inactive
spend:320
tags:[trial]
Filter
status == active
u-211·inactivefiltered out
Rename

user_id id

JS

spend tier: premium

Current Record

id:u-104
status:active
spend:1280
tier:premium
tags:[vip, renewal]
Unwind

tags[ ] × 2 records

Output

record 1

id:u-104
status:active
spend:1280
tier:premium
tag:vip

record 2

id:u-104
status:active
spend:1280
tier:premium
tag:renewal

Node order is part of the pipeline contract. Changing the order changes which record reaches the next node.

Reviewable Contract

The transform path stays visible in the resource.

Transforms are declared in order with the pipeline. Review the contract before deployment, then test it with representative records.

pipeline.tapstate.yml

transforms:
  - name: active-only
    filter: "record.status == 'active'"
  - name: normalize-id
    rename:
      user_id: id
  - name: add-tier
    js: |
      record.tier =
        record.spend > 1000
          ? 'premium'
          : 'standard';
      return record;
  - name: split-tags
    unwind: tags

Input Record

user_id:u-104status:activespend:1280tags:[vip, renewal]

Current State

id:u-104user_id:u-104status:activespend:1280tags:[vip, renewal]tier:premium
Filterstatus == active→ record continues
Renameuser_id → id
JS+ tier: premium
Unwindtags[2] → 2 records

Results

record 1

id:u-104
tier:premium
tag:vip

record 2

id:u-104
tier:premium
tag:renewal

CEL filters are compiled and type-checked during validation. JavaScript behavior and deployment-specific limits still require representative testing.

Combine Related Records

Build one record from changes that arrive separately.

Match related records by key, then shape the combined result before it moves to Serve.

Customer

customer_id:c-104
name:Mira Chen
segment:gold

Account

customer_id:c-104
status:active
balance:1280

Recent Order

customer_id:c-104
order_id:o-891
order_value:240

Combined Record

id:c-104

from customer

name:Mira Chen
segment:gold

from account

account_status:active
balance:1280

from recent order

last_order_id:o-891
last_order_value:240
Ready for Serve

Write or materialize the combined result.

Transform assembles and shapes the record. Serve owns writing or materializing the result.

Move the shaped record to Serve.

Transform defines the record that moves forward. Serve owns writing, materialization, and downstream access.