SAService Architect Open designer
SAService ArchitectDocumentation
Framework reference Map | Filter | FlatMap | KeyBy | Process | Join | MultiJoin | Delay | Case

TypeScript Operator functions

Operator contracts invoked by generated TypeScript streams. Implement only the contract selected by the stream type in the designer.

When to use

Use this page while implementing a generated business function or endpoint handler.

Behavior

  • Every invocation receives the current stream and input value; runtimes with explicit message contexts also pass the context separately.
  • Emission is explicit. Returning from Map, FlatMap, KeyBy, or Process without using an output intentionally produces no downstream value.
  • Process has separate normal and error outputs. Throwing or returning a runtime error is not a substitute for intentionally emitting the graph error type.
  • Join inputs are already grouped by key and retained by the configured join storage before the user callback runs.

Streams without a user callback

Input, Sink, Merge, Split, FlatMap Iterable, Cycle Link, Error, and individual When branches are primarily graph/runtime nodes. Their behavior is generated from topology and configuration; they do not all require a custom operator implementation.

Output and error semantics

Normal output follows persisted graph links. A Process error output follows the dedicated Error link. A callback can emit more than once unless the selected stream contract or downstream protocol imposes a stricter rule.

Operator contracts

User-facing methods selected by generated stream wiring.

Type or methodRoleDescription
MapFunction<T, R>.map(context, stream, value, out)Interface

Transforms one input value and emits the resulting value through the normal output.

FilterFunction<T>.filter(context, stream, value)Interface

Returns whether the current value should continue to downstream streams.

FlatMapFunction<T, R>.flatMap(context, stream, value, out)Interface

Emits zero, one, or many output values for one input value.

KeyByFunction<T, K, V>.keyBy(context, stream, value, out)Interface

Receives T and emits KeyValue<K,V> values through the collector; K must satisfy the target runtime key constraint.

ProcessFunction<T, R, E>.process(context, stream, value, out, errorOut)Interface

Runs general business logic with independent normal and error outputs.

JoinFunction<K, T1, T2, R>.join(context, stream, key, left, right, out)Interface

Receives K plus accumulated left and right arrays. Return true to complete and delete K, or false to retain both arrays for later arrivals.

MultiJoinFunction<K, T, R>.multiJoin(context, stream, key, values, out)Interface

Receives K plus ordered accumulated arrays for slots 0..N. Return true to complete and delete K, or false to retain every slot.

DelayFunction<T>.duration / delayErrorInterface

Calculates how long the value should wait; the paired error method decides what to emit when scheduling the delay fails.

BuildSwitchFunction<T>.buildSwitch(stream, whenItems)Case routing

Builds the runtime selector used by a Case stream. The returned function must choose an existing zero-based When index for each value.

Generated extension pattern

public process(context: MessageContext, stream: Stream, value: Readonly<Order>, out: Collector<Order>, errorOut: Collector<Error>): void | Promise<void> {
  return out.out(context, value);
}