Skip to content

Action Point Logic Studio & Custom TypeScript

Generated CRUD pipelines, state transitions, and composite screen panels already handle persistence, validation scaffolding, tenant isolation, and routing automatically. Action Point Logic Studio lets you inject domain-specific rules — from SLA enforcement and derived calculations to relational updates and custom TypeScript algorithms — cleanly into named lifecycle hooks.


1. Lifecycle Hooks Across Backend Services, Transitions & Screens

Every service operation, state transition, and composite panel exposes predictable Action Points where your custom logic executes:

  • Backend Service Hooks (CreateOne, UpdateOne, DeleteOne, FetchOne, FetchMany, ExecuteAction):
    • Pre-Transaction: ON_REQUEST_INIT, ON_AUTHORIZE, PRE_VALIDATE, POST_VALIDATE
    • In-Transaction: PRE_CREATE, PRE_UPDATE, EXECUTE, PRE_CHILD_CREATE, POST_CREATE, POST_UPDATE
    • Post-Commit: AFTER_COMMIT, ON_SUCCESS, ON_FAILURE
  • State Transition Hooks (TransitionState): ON_REQUEST_INIT, ON_AUTHORIZE, PRE_VALIDATE_STATE, POST_VALIDATE_STATE, PRE_TRANSITION, POST_TRANSITION, PRE_EMIT_TRIGGER, POST_EMIT_TRIGGER, ON_SUCCESS, ON_FAILURE.
  • Screen & Panel Hooks: EVALUATE_ACTION_STATE (compute dynamic visibility and disabled state per record), ON_AFTER_OPEN, ON_BEFORE_CLOSE, ON_AFTER_CLOSE, and custom toolbar or row ⚡ panel actions.
Action Point Logic Studio editing WorkOrder CreateOne PRE_VALIDATE with the Add Block palette, conditional SLA rules, Literal/Variable toggles, and Code Preview drawer

Action Point Logic Studio displaying the Add Block palette, WorkOrder.CreateOne PRE_VALIDATE steps, Literal/Variable selectors, and live Code Preview.


2. Visual Add Block Palette & Schema-Aware Variable Picker

Click ⚡ Visual Editor on any hook inside Object Browser, Diagram Entity Cards, State Inspector, or Screen Stitcher to assemble flows from the Add Block palette (StudioPalette):

Construct Category Purpose
If / Else Branching Evaluates comparisons, null checks, or string checks to branch into then or else paths.
Switch / Case & Decision Matrix Branching & Lookup Dispatches multi-branch flows per value (Switch / Case) or maps structured condition tables to variables (Decision Matrix).
For Each Iteration Iterates over related collections (record.lineItems) or query results with scoped item and rowNumber bindings.
Set Variable & Append to List Data & Math Assigns fields or local variables using formulas, string helpers (+ Transform), date arithmetic, or builds mapped arrays.
Query Database & Save / Mutate Persistence Queries related entities with filters and sorting, or inserts, updates, and deletes records inside the active transaction.
Call Function & Screen / UI Action Orchestration Invokes another service method (FunctionCall) or emits signals and panel refreshes in Screen Action Points (EmitSignal).
Reject with Error, Return / Finish & Log / Audit Outcome & Trace Stops execution with structured validation errors (ExitFlow), returns early (ReturnResult), or writes diagnostic/audit trace entries (LogMessage).

Every input slot pairs Literal | Variable mode toggles with the expandable Treeview Variable Picker (+ {Var}), organizing valid references by scope (Input incoming dto payload, Record persisted fields and parent relations, Local / Saved temporary variables, Loop active loop item, User authenticated user claims, Signal active screen signals, and System date/context helpers) so references match live schemas continuously.


3. Custom TypeScript Blocks & Protected Code Weaving

Whenever a calculation requires multi-step custom algorithms, third-party SDK calls, or specialized library imports:

  1. Expand Advanced / Developer -> TypeScript Code in the Add Block palette to place an inline TypeScript Code step anywhere inside your visual flow.
  2. Inspect the live bottom Code Preview drawer inside Studio to see the exact generated TypeScript output updates as you assemble blocks.
  3. During compilation, the Perlite Compiler weaves visual flows and custom TypeScript cleanly between protected // === PERLITE_ACTION_POINT: [HOOK] === markers using AST traversal (ts-morph) — preserving every custom line whenever entities, traits, or screens recompile.

4. Guided Example — Authoring Validation & Automation Logic

Guided Build · Step 6 of 8
Visual Conditionals, Domain Validation Errors & AST Code Weaving
Previously in this build: In Step 5 you defined the WorkOrder.status statechart and DispatchPriority tiers.
✅ Checkpoint:Critical WorkOrders automatically normalize to a 2-hour SLA target, and sub-15-minute dispatches return a clear validation error before database writes.
Primary TrackEnforce Critical SLA rules automatically before saving any new WorkOrder: force slaTargetHours to 2 hours when priority equals Critical, and reject jobs shorter than 15 minutes with a structured HTTP 400 validation error.
  1. Open WorkOrder.CreateOne (PRE_VALIDATE): Expand WorkOrder -> Functions -> CreateOne -> 🎯 Action Points in Object Browser and open PRE_VALIDATE in ⚡ Visual Editor.
  2. Build or Inspect Conditional SLA & Duration Checks: Using the Add Block palette, add If / Else (dto.priority equals Literal "Critical") with + Add Step Inside -> Set Variable (dto.slaTargetHours = 2 in Number/Math mode), then a second If / Else (dto.durationMinutes < 15) nesting Reject with Error (400).
  3. Verify Compiled TypeScript & Action Point Zone: Toggle the top-right Code Preview drawer and confirm the generated checks execute right inside the PRE_VALIDATE zone ahead of database insertion.
WorkOrder.CreateOne PRE_VALIDATE logic combining SLA assignment and validation error rejection with live Code Preview.