Bloccs.Node (bloccs v0.11.0)

Copy Markdown View Source

use Bloccs.Node, manifest: "path/to/node.bloccs"

Reads the manifest at compile time, validates it, confirms the pure_core / effect_shell functions exist with the right arity, and exposes the parsed manifest via __bloccs_manifest__/0.

Compile-time effect checks

After compilation finishes, the macro walks the pure_core and effect_shell bodies and enforces two things:

  • Undeclared-axis use — a ctx.effects.X.* access for an axis X not declared in [effects] emits a warning (the runtime capability struct raises Bloccs.Effects.Denied either way).
  • Capability linting (Bloccs.Node.EffectLint) — a node body that reaches the world outside the declared-capability facade (direct File.write!, System.cmd, Req.get, spawn, dynamic dispatch, …) is a compile error, so the facade is the only legal path to IO. A node may opt out with [lint] effects = "off", which downgrades the error to a loud warning.

Example

defmodule MyApp.Enrich do
  use Bloccs.Node, manifest: "nodes/enrich.bloccs"

  def transform(event, ctx), do: ...
  def execute(event, ctx), do: ...
end