Context
This is the final item from the progressive complexity plan. WASM sources currently implement Source (read-only). Extending them to implement WritableSource would let users build fully custom CRUD backends in TinyGo.
Progressive complexity tiers:
Task Description
Extend internal/wasm/source.go (WasmSource) to implement the WritableSource interface:
type WritableSource interface {
Source
WriteItem(ctx context.Context, action string, data map[string]interface{}) error
IsReadonly() bool
}
The WASM module would need to export a WriteItem(action, data) function (or similar) that tinkerdown calls for Add/Update/Delete operations. The TinyGo WASM SDK would need a corresponding update.
Implementation notes
WasmSource already has IsReadonly() (returns true) — change to check if the module exports a write function
- Add
WriteItem that calls the WASM module's exported write function
- Update the
wasm-source template (cmd/tinkerdown/commands/templates/wasm-source/) to show a writable example
- Update
docs/sources/wasm.md
Files to modify
internal/wasm/source.go — implement WritableSource
cmd/tinkerdown/commands/templates/wasm-source/ — update template
docs/sources/wasm.md — document writable WASM
From the progressive complexity plan (Phase C2).
Context
This is the final item from the progressive complexity plan. WASM sources currently implement
Source(read-only). Extending them to implementWritableSourcewould let users build fully custom CRUD backends in TinyGo.Progressive complexity tiers:
Task Description
Extend
internal/wasm/source.go(WasmSource) to implement theWritableSourceinterface:The WASM module would need to export a
WriteItem(action, data)function (or similar) that tinkerdown calls for Add/Update/Delete operations. The TinyGo WASM SDK would need a corresponding update.Implementation notes
WasmSourcealready hasIsReadonly()(returns true) — change to check if the module exports a write functionWriteItemthat calls the WASM module's exported write functionwasm-sourcetemplate (cmd/tinkerdown/commands/templates/wasm-source/) to show a writable exampledocs/sources/wasm.mdFiles to modify
internal/wasm/source.go— implementWritableSourcecmd/tinkerdown/commands/templates/wasm-source/— update templatedocs/sources/wasm.md— document writable WASMFrom the progressive complexity plan (Phase C2).