Package-level declarations

Functions

Link copied to clipboard
fun currentDateTime(): LocalDateTime

The current date/time in UTC — used wherever the framework needs "now" without depending on the device's local timezone (e.g. comparing against a screen/graph's cached-until ttl).

Link copied to clipboard
fun <T, R> Collection<T>.immutableMapTo(map: (T) -> R): PersistentList<R>

Maps this collection with map directly into a kotlinx.collections.immutable PersistentList, avoiding an intermediate mutable List — the usual way a TileHolder/ EventHolder's getTileSchema()/getEventSchema() converts its child holders (events.map { it.get() }) back into the immutable list shape a schema's own events/tiles field expects.

Link copied to clipboard
fun <K, V, R> Map<K, V>.immutableMapValuesTo(map: (V) -> R): PersistentMap<K, R>

Maps this map's values with map directly into a kotlinx.collections.immutable PersistentMap, keys unchanged, avoiding an intermediate mutable Map.

Link copied to clipboard

Generates a random UUID string — the default every schema's id field falls back to in the server DSL when a call site doesn't pass one explicitly, and the pattern AGENTS.md recommends for any programmatically-generated event id in a reusable composition.

Link copied to clipboard
inline fun runSafely(onError: (Throwable) -> Unit = {}, block: () -> Unit)

Runs block, routing any thrown Throwable to onError instead of letting it propagate — the standard try/catch idiom every built-in EventRunner's real work is wrapped in, so a runner's own failure always turns into that event's own onFailure trigger rather than crashing the caller.

Link copied to clipboard
fun JsonElement.toAny(): Any?

Converts a JsonElement tree into plain Kotlin values — null, List<Any?>, Map<String, Any?>, or a primitive (String, Boolean, Int, Long, Double, tried in that order for a numeric-looking string, falling back to the raw string content if none match). This is how a network response body or incomingData ends up as ordinary maps/lists an event chain can navigate with EvaluateData/GetData, rather than staying a typed JsonElement tree the DSL author would otherwise have to unwrap by hand.

Link copied to clipboard
fun Any?.toJsonElement(json: Json? = null): JsonElement

Converts an arbitrary Kotlin value into a JsonElement — the inverse of toAny, and the general mechanism behind AnySerializable fields (an event's body, data, etc.) getting encoded onto the wire without the schema declaring a concrete type for them. Map/Iterable/Array/Pair/ Triple are converted structurally, primitives directly; anything else is only convertible when either json is supplied and its serializersModule has that type registered polymorphically, or the type itself has a @Serializable-generated serializer discoverable via serializerOrNull() — otherwise this throws, since there's no safe way to serialize an arbitrary object in Kotlin Multiplatform without one of those two.

Link copied to clipboard
fun String.toSafeLocalDateTime(format: DateTimeFormat<LocalDateTime> = LocalDateTime.Formats.ISO): LocalDateTime?

Parses this string as a LocalDateTime using format, returning null instead of throwing on a malformed string.

Link copied to clipboard
inline fun <T, R> withNotNull(receiver: T?, scopeBlock: T.() -> R): R?

Runs scopeBlock with receiver as its own receiver, only if receiver is non-null — a let-style scope function whose Kotlin contract makes the smart-cast explicit at the call site. Used, for instance, by TextFieldTileSchema.keyboardOptions() to build a KeyboardOptions only when the schema's own nested keyboardOptions field is non-null.