Skip to content

Releases: jetstreamapp/sf-formula-parser

Release 2.1.0

25 Mar 13:45

Choose a tag to compare

Fixed

  • Schema-based type coercion for date/datetime/time fields — when a schema is provided, field values stored as strings in the record (e.g., "2024-01-15T12:00:00.000Z" for a datetime field) are now automatically coerced to their proper types (Date for date/datetime, SfTime for time). Previously, operators like + would see two strings and concatenate instead of enforcing type rules (e.g., CreatedDate + CreatedDate + "test" returned a concatenated string instead of throwing an error)
  • Date-only values preserved through arithmetic — date-only field values (e.g., "2026-03-24") are now correctly treated as date-only even when the schema declares datetime. Date arithmetic (Date + Number) preserves date-only status, and datetime arithmetic (DateTime + Number) preserves the datetime marker on the result

Release 2.0.0

24 Mar 13:44

Choose a tag to compare

Added

  • Return type validation — new optional returnType field on EvaluationOptions validates the formula result matches the declared type (number, string, boolean, date, datetime, time). Throws a descriptive FormulaError on mismatch
  • Schema-aware validation — new optional schema field on EvaluationOptions accepts Salesforce describeSObject().fields directly for:
    • Field existence validation (throws "Field X does not exist" instead of returning null)
    • Picklist/multipicklist field restrictions (matches Salesforce behavior — picklist fields only allowed in TEXT, ISPICKVAL, CASE, ISBLANK, ISNULL, NULLVALUE, BLANKVALUE, INCLUDES, ISCHANGED, PRIORVALUE)
    • Related object and global schema — pass Record<string, FieldSchema[]> to validate fields on related objects (e.g., Account.Name) and globals (e.g., $User.FirstName). Use '$record' key for root object, relationship names for related objects, $-prefixed names for globals
  • New exported typesFormulaReturnType, FieldSchema, SalesforceFieldType, FormulaType, SchemaInput, toFormulaType()
  • Argument count validation — all 70+ functions now validate argument counts with descriptive error messages matching Salesforce format
  • GEOLOCATION range validation — latitude must be [-90, 90], longitude must be [-180, 180]
  • SfTime - Number subtractionTime - Number now works (was missing, only Time + Number was supported)

Fixed

  • Strict operator type checking — arithmetic operators (+, -, *, /, ^) now reject boolean and string operands, matching Salesforce behavior
  • Date + Date rejectionDate + Date and DateTime + DateTime now throw, matching Salesforce
  • Unary operator type checking — unary -/+ require Number, !/NOT require Boolean
  • Date/Time type guards in subtraction — invalid combinations like String - Date now throw instead of returning null

Changed

  • Argument count error messages standardized to Salesforce format: "Incorrect number of parameters for function 'NAME()'. Expected N, received M"
  • Date-time function validation uses strict equality (!== N) instead of minimum check (< N)

Release 1.1.0

22 Mar 23:22

Choose a tag to compare

  • Merge pull request #8 from jetstreamapp/feat/add-extract-fields-fn (a0d2a56)
  • feat: add extractFields and extractFieldsByCategory functions for field extraction from formulas (a239023)
  • Merge pull request #6 from jetstreamapp/docs/add-llms.txt (fcd5299)
  • chore: add docusaurus-plugin-llms for enhanced documentation support (365a416)
  • Merge pull request #5 from jetstreamapp/chore/docs-release-setup-2 (9fe38c9)
  • chore: restructure deploy workflow for clarity and organization (5a9805e)
  • Merge pull request #4 from jetstreamapp/chore/docs-release-setup (e48ddf8)
  • update docs gh action (d8ade64)

Release 1.0.0

22 Mar 21:52

Choose a tag to compare

  • Merge pull request #3 from jetstreamapp/chore/bump-node-version (7bbd373)
  • chore: remove node matrix (51f0ecd)
  • chore: bump node version to 24 in release workflow (39a8963)
  • Merge pull request #2 from jetstreamapp/chore/update-release-it-publish-command (e04d375)
  • chore: update release workflow and add alias plugin for local package resolution (9af78d4)
  • chore: ci update (8758d61)
  • chore: update release-it configuration and package registry settings (6d670df)
  • Merge pull request #1 from jetstreamapp/chore/release-setup-gh-actions (f854be8)
  • Add GH release workflow (a40e71b)
  • chore: update changelog for version 1.0.0 release (cf824f3)
  • bump docs packages (db608e5)
  • update ci (c9e3c16)
  • chore: remove agent plan (4bfe631)
  • feat: implement formula evaluation engine with lexer, parser, and function registry (6ff4168)