CI / test (push) Failing after 16s
compositor/session round-trips a toy snapshot of server state (counters, clients, toplevels) through EDN and edits one field by path: groundwork for persisting compositor state across a component swap. Adds the jqlssg/moonedn dependency. Builds and passes on native and wasm. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
19 lines
689 B
MoonBit
19 lines
689 B
MoonBit
///| Spike: session state as EDN (see the plan to persist compositor state across a component swap).
|
|
|
|
///| A toy snapshot with the shapes we need: ints, strings, nested maps/vectors, keywords.
|
|
pub fn sample() -> String {
|
|
"{:version 1 :server {:next-client 4 :next-serial 412 :selection [2 17]} :clients [{:id 2 :fd 11 :toplevels {5 {:title \"foot\" :min [0 0]}}}]}"
|
|
}
|
|
|
|
///| Read, change one field by path, write back.
|
|
pub fn bump_serial(text : String) -> String raise {
|
|
let v = @edn.read(text)
|
|
let next = @edn.transact(v, [
|
|
@edn.Replace(
|
|
[@edn.Key(@edn.Keyword("server")), @edn.Key(@edn.Keyword("next-serial"))],
|
|
@edn.Integer("500"),
|
|
),
|
|
])
|
|
@edn.write(next)
|
|
}
|