Copilot
195277de45
Generate WaveEvent as a typed discriminated union with explicit null payloads for no-data events ( #2899 )
...
This updates WaveEvent typing to be event-aware instead of `data?: any`,
while keeping safe fallback behavior for unmapped events. It also
codifies known no-payload events as `null` payloads and documents event
payload expectations alongside the Go event constants.
- **Event registry + payload documentation (Go)**
- Added `AllEvents` in `pkg/wps/wpstypes.go` as the canonical list of
Wave event names.
- Added/updated inline payload annotations on `Event_*` constants.
- Marked confirmed no-payload events with `// type: none` (e.g.
`route:up`, `route:down`, `workspace:update`, `waveapp:appgoupdated`).
- **Dedicated WaveEvent TS generation path**
- Added `pkg/tsgen/tsgenevent.go` with `event -> reflect.Type` metadata
(`WaveEventDataTypes`).
- Supports three cases:
- mapped concrete type → strong TS payload type
- mapped `nil` → `data?: null` (explicit no-data contract)
- unmapped event → `data?: any` (non-breaking fallback)
- **Custom WaveEvent output and default suppression**
- Suppressed default struct-based `WaveEvent` emission in
`gotypes.d.ts`.
- Added generated `frontend/types/waveevent.d.ts` containing:
- `WaveEventName` string-literal union from `AllEvents`
- discriminated `WaveEvent` union keyed by `event`.
- **Generator wiring + focused coverage**
- Hooked custom event generation into
`cmd/generatets/main-generatets.go`.
- Added `pkg/tsgen/tsgenevent_test.go` assertions for:
- typed mapped events
- explicit `null` for known no-data events
- `any` fallback for unmapped events.
```ts
type WaveEvent = {
event: WaveEventName;
scopes?: string[];
sender?: string;
persist?: number;
data?: any;
} & (
{ event: "block:jobstatus"; data?: BlockJobStatusData } |
{ event: "route:up"; data?: null } |
{ event: "workspace:update"; data?: null } |
{ event: "some:future:event"; data?: any } // fallback if unmapped
);
```
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey ).
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Co-authored-by: sawka <mike@commandline.dev>
2026-02-20 17:04:03 -08:00
Evan Simkowitz
b51ff834b2
Happy new year! ( #1684 )
...
Update all 2024 references to 2025
2025-01-04 20:56:57 -08:00
Mike Sawka
267e40cc67
conditionally write generated files ( #890 )
2024-09-27 13:46:10 -07:00
Evan Simkowitz
3f15bfd2e4
Revert "better conditional taskfile running" ( #872 )
...
Reverts wavetermdev/waveterm#864
There's a typo here that's breaking the Taskfile
2024-09-26 14:36:47 -07:00
Mike Sawka
68dfc4ab90
better conditional taskfile running ( #864 )
...
still builds the server, but fixes the generate steps and wsh
2024-09-26 12:49:17 -07:00
Mike Sawka
3939648bbb
fe wsh router + wsh client impl ( #381 )
2024-09-16 11:59:39 -07:00
Mike Sawka
8ad84fd78a
update all gopkg imports ( #330 )
2024-09-05 14:25:45 -07:00
Evan Simkowitz
debbed7003
Remove WOS dependency from wshrpc ( #329 )
...
The frontend wshserver.ts had a weird circuitous dependency on wos.ts,
which was unnecessary. This moves the misplaced functions into wshrpc.ts
and updates the generation logic.
2024-09-05 13:17:35 -07:00
Mike Sawka
8630e23239
new config system ( #283 )
2024-08-27 18:49:49 -07:00