App.Instance
luastra/appApp.Instance is an exported, statically checked data contract of luastra/app. Its exact declaration documents the fields or alternatives accepted at the module boundary and is erased after Luau analysis.
Before you use it
Add luastra/app to this module's dependencies in luastra.json, then import it with require("luastra/app"). Return exactly one App.compose instance from the entry module. Feature IDs must be disjoint lowercase paths, and a feature must claim each asynchronous request ID before its completion can be routed.
How it fits
App types describe the root composition contract, feature hooks, request-ownership context, diagnostics, and returned instance. Static types are erased after analysis.
When to use it
Use App.Instance when annotating values that cross the public luastra/app boundary or when exporting helpers built on that module. The type documents the exact checked shape and prevents unrelated tables from being substituted accidentally.
Fields or definition
| Parameter | Type / values | Description |
|---|---|---|
| render | () -> T | Callable render member exposed by App.Instance; invoke it through the owning contract rather than replacing internal state. |
| handle | (action: string, target: string, value: string) -> () | Callable handle member exposed by App.Instance; invoke it through the owning contract rather than replacing internal state. |
| resolve | (requestId: number, success: boolean, payload: string, errorCode: string, errorMessage: string) -> () | Callable resolve member exposed by App.Instance; invoke it through the owning contract rather than replacing internal state. |
| snapshot | () -> S | Callable snapshot member exposed by App.Instance; invoke it through the owning contract rather than replacing internal state. |
| inspect | () -> Diagnostics | Callable inspect member exposed by App.Instance; invoke it through the owning contract rather than replacing internal state. |
What happens next
A checked application-composition annotation that matches the exported contract.
Failures and fixes
Duplicate or overlapping feature IDs, invalid event bounds, duplicate request ownership, and malformed compose options fail immediately. Late, cancelled, unknown, or post-dispose completions are suppressed or delegated only through the explicitly configured root path.
Availability
Public-source alpha composition API in 0.5.0-alpha; host-independent except for the capabilities used by composed features.
Exact declaration
export type Instance<T, S> = {
render: () -> T,
handle: (action: string, target: string, value: string) -> (),
resolve: (requestId: number, success: boolean, payload: string, errorCode: string, errorMessage: string) -> (),
snapshot: () -> S,
inspect: () -> Diagnostics,
}