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 also: content/docs/concepts/north-star.mdx §8 "No private expression DSL"

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

TypeScript Usage

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

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

CronExpressionInput

Union Options

This schema accepts one of the following structures:

Option 1

Type: string


Option 2

Properties

PropertyTypeRequiredDescription
dialectEnum<'cel' | 'cron' | 'template'>
sourcestringoptional
astanyoptional
meta{ rationale?: string; generatedBy?: string }optional


Expression

Properties

PropertyTypeRequiredDescription
dialectEnum<'cel' | 'cron' | 'template'>
sourcestringoptional
astanyoptional
meta{ rationale?: string; generatedBy?: string }optional

ExpressionDialect

Allowed Values

  • cel
  • cron
  • template

ExpressionInput

Union Options

This schema accepts one of the following structures:

Option 1

Type: string


Option 2

Properties

PropertyTypeRequiredDescription
dialectEnum<'cel' | 'cron' | 'template'>
sourcestringoptional
astanyoptional
meta{ rationale?: string; generatedBy?: string }optional


ExpressionMeta

Properties

PropertyTypeRequiredDescription
rationalestringoptional
generatedBystringoptional

Predicate

Properties

PropertyTypeRequiredDescription
dialectEnum<'cel' | 'cron' | 'template'>
sourcestringoptional
astanyoptional
meta{ rationale?: string; generatedBy?: string }optional

PredicateInput

Union Options

This schema accepts one of the following structures:

Option 1

Type: string


Option 2

Properties

PropertyTypeRequiredDescription
dialectEnum<'cel' | 'cron' | 'template'>
sourcestringoptional
astanyoptional
meta{ rationale?: string; generatedBy?: string }optional


TemplateExpressionInput

Union Options

This schema accepts one of the following structures:

Option 1

Type: string


Option 2

Properties

PropertyTypeRequiredDescription
dialectEnum<'cel' | 'cron' | 'template'>
sourcestringoptional
astanyoptional
meta{ rationale?: string; generatedBy?: string }optional


On this page