PhoenixAssets.Commands (PhoenixAssets v0.1.0)

View Source

Integration plugin that generates a typed mutation client from declarations.

Reads the commands declared in the module passed as commands: (see PhoenixAssets.Commands.Definitions) and emits commands.ts -- one function per command, built on runCommand/2 from @phoenix-assets/svelte.

Where PhoenixAssets.Electric generates the read half of the boundary, this generates the write half, and it carries the part a URL builder cannot: the request body, the success payload, and the exact set of error codes the endpoint answers with. Each command returns a discriminated CommandResult, so the failure arm cannot be skipped, and each declared code becomes a string-literal union member -- removing a code from the server makes every stale call site a compile error.

Also contributes graph entries and a doctor check per command that the route exists in the router with the declared method, which catches a verb mismatch a path-only check would miss.

Summary

Functions

dev_processes(_, _)

Callback implementation for PhoenixAssets.Plugin.dev_processes/2.

name()

Callback implementation for PhoenixAssets.Plugin.name/0.

vite_config(_, _)

Callback implementation for PhoenixAssets.Plugin.vite_config/2.