Skip to content

docs(tailordb): document hook _newValue/_oldValue and _newData/_oldData#144

Closed
toiroakr wants to merge 1 commit into
mainfrom
docs/tailordb-hooks-new-old-vars
Closed

docs(tailordb): document hook _newValue/_oldValue and _newData/_oldData#144
toiroakr wants to merge 1 commit into
mainfrom
docs/tailordb-hooks-new-old-vars

Conversation

@toiroakr

Copy link
Copy Markdown
Contributor

Summary

Documents the new TailorDB hook variables that expose this request's raw input and the pre-operation value, so update hooks can tell what the user actually sent apart from the existing record.

  • _newValue / _oldValue — this field's raw input / previous value (JS + CEL)
  • _newData.{field} / _oldData.{field} — sibling fields of the request input / previous record (CEL only)

_value / _data are unchanged (still the merged state). Backed by platform-core-services#12177.

⚠️ Draft — blocked on SDK support

This is intentionally a draft. Right now the new variables are only usable via the raw expression string forms (Terraform .tf, CUE, CEL *_expr), which is what the examples here use, because those map directly to the backend script runtime.

The TypeScript SDK callback form is not yet supported: @tailor-platform/sdk's HookFn currently only destructures { value, data, user } (packages/sdk/src/configure/services/tailordb/types.ts). Before this page can show .ts examples like ({ newValue, oldValue }) => ..., the SDK needs a matching change (extend HookFn + the hook→script compiler). Tracking that as a prerequisite follow-up.

Open items before un-drafting

  • tailor-platform/sdk: expose newValue / oldValue / newData / oldData in the hook callback context, then add .ts examples to mirror the .tf ones here
  • Decide whether to also document type-level hooks / type validate (_input / _newData / _oldData / _oldData on type validate), which are currently undocumented on this page

🤖 Generated with Claude Code

Document the new hook variables exposing this request's raw input and the
pre-operation value. Uses the raw expression-string forms only; TS SDK
callback support is a prerequisite follow-up.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@toiroakr

Copy link
Copy Markdown
Contributor Author

Not needed for now: hook reference docs are synced from the SDK repo (docs/sdk/ via sdk-docs-sync). The new variables should be documented in tailor-platform/sdk alongside the HookFn change, which then syncs over. Closing; will fold into the SDK change.

@toiroakr toiroakr closed this Jun 25, 2026
@toiroakr toiroakr deleted the docs/tailordb-hooks-new-old-vars branch June 25, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant