ObjectStackObjectStack

Expression

Expression protocol schemas

Expression Protocol

Canonical wire format for all "expression"-shaped metadata across ObjectStack

(formula fields, predicates, conditions, criteria, visibility rules, seed

dynamic values, …).

The persisted form is \{ dialect, source \} (and, after `objectstack

compilenormalization,{ dialect, ast }`). String-only shorthand is

accepted at input time for developer ergonomics; build emits the canonical

envelope.

Dialects

| dialect | engine | use |

|:---|:---|:---|

| cel | @objectstack/formula (cel-js + ObjectStack stdlib) | formulas, predicates, seed dynamic values |

| js | sandboxed L2 hook bodies (isolated-vm / quickjs) | mapping, hook bodies |

| cron | cron-parser | job schedules |

SQL fragments (analytics joins, partial indexes) are intentionally not

routed through this schema — they stay driver-native because their security

posture and portability story differ.

@see content/docs/concepts/north-star.mdx §8 "No private expression DSL"

Source: packages/spec/src/shared/expression.zod.ts

TypeScript Usage

import { Expression, ExpressionDialect, ExpressionMeta, Predicate } from '@objectstack/spec/shared';
import type { Expression, ExpressionDialect, ExpressionMeta, Predicate } from '@objectstack/spec/shared';

// Validate data
const result = Expression.parse(data);

Expression

Properties

PropertyTypeRequiredDescription
dialectEnum<'cel' | 'js' | 'cron' | 'template'>
sourcestringoptional
astanyoptional
metaObjectoptional

ExpressionDialect

Allowed Values

  • cel
  • js
  • cron
  • template

ExpressionMeta

Properties

PropertyTypeRequiredDescription
rationalestringoptional
generatedBystringoptional

Predicate

Properties

PropertyTypeRequiredDescription
dialectEnum<'cel' | 'js' | 'cron' | 'template'>
sourcestringoptional
astanyoptional
metaObjectoptional

On this page