trypost/app/Events/AutomationRunUpdated.php
Paulo Castellano 448ae73389 Add expression autocomplete, side-panel editor, and richer HTTP fetch
Automations editor:
- {{ }} expression autocomplete in CodeMirror, scoped to the braces and
  graph-aware (suggests only what upstream nodes provide + variables + now);
  migrate the Generate prompt to CodeMirror so it shares the same completions
- Expandable editors: an expand button slides out a side-by-side panel
  (matching the sidebar card), with a minimize control; the inline field
  collapses to a hint while editing in the panel
- Hover-revealed editor toolbar (expand/copy) with styled tooltips so the
  buttons no longer obscure the text while reading
- Beta badge on the Automations sidebar item
- Delete a single connection with Backspace/Delete (edge selection)
- Re-key node config so switching between same-type nodes refreshes the form

HTTP fetch node — cover every JSON response shape:
- Top-level array, object map (items_path=*), array of primitives, and NDJSON
- Key-based dedup via item_key_path (seen-set, FIFO-capped) for feeds without
  dates; first poll records a baseline and emits nothing (date path too)

Fan-out test visibility:
- root_run_id links every forked branch back to the run that started a test,
  so the test panel aggregates all branches instead of one

Fix a few pre-existing type issues (ScheduleData import, padded minute,
optional created_at).
2026-06-12 11:31:58 -03:00

54 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Events;
use App\Models\AutomationRun;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Lightweight signal that a run (or one of its node runs) advanced. Carries
* only identifiers — the client refetches the full state via the show-run
* endpoint to keep resource serialization centralized.
*/
class AutomationRunUpdated implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct(public AutomationRun $run) {}
public function broadcastAs(): string
{
return 'automation.run.updated';
}
public function broadcastOn(): array
{
return [
new PrivateChannel("automation.{$this->run->automation_id}"),
];
}
/**
* @return array<string, string>
*/
public function broadcastWith(): array
{
return [
'run_id' => $this->run->id,
'root_run_id' => $this->run->rootId(),
'automation_id' => $this->run->automation_id,
'status' => $this->run->status->value,
];
}
public function broadcastQueue(): string
{
return 'broadcasts';
}
}