diff --git a/src/JobResult.php b/src/JobResult.php index cdde08f..30b45b4 100644 --- a/src/JobResult.php +++ b/src/JobResult.php @@ -30,6 +30,16 @@ class JobResult */ public $originalJob; + /** + * @var array + */ + public $meta; + + /** + * @var float + */ + public $duration; + /** * @param $serverResult * @param \WF\Hypernova\Job $originalJob @@ -47,6 +57,8 @@ public static function fromServerResult($serverResult, \WF\Hypernova\Job $origin $res->error = $serverResult['error']; $res->html = $serverResult['html']; $res->success = $serverResult['success']; + $res->meta = isset($serverResult['meta']) ? $serverResult['meta'] : []; + $res->duration = isset($serverResult['duration']) ? $serverResult['duration'] : null; $res->originalJob = $originalJob; return $res; diff --git a/src/Renderer.php b/src/Renderer.php index 289ee71..a940b24 100644 --- a/src/Renderer.php +++ b/src/Renderer.php @@ -198,7 +198,10 @@ protected function fallback($topLevelError, $jobs) $result->error = $topLevelError; $result->results = array_map(function (\WF\Hypernova\Job $job) { $jobResult = new JobResult(); - $jobResult->html = $this->getFallbackHTML($job->name, $job->data); + $uuid = \Ramsey\Uuid\Uuid::uuid4(); + $jobResult->html = $this->getFallbackHTML($job->name, $job->data, $uuid); + $jobResult->meta = ['uuid' => (string) $uuid]; + $jobResult->originalJob = $job; return $jobResult; }, $jobs); @@ -209,10 +212,11 @@ protected function fallback($topLevelError, $jobs) /** * @param string $moduleName * @param array $data + * @param \Ramsey\Uuid\UuidInterface $uuid * * @return string */ - protected function getFallbackHTML($moduleName, $data) + protected function getFallbackHTML($moduleName, $data, $uuid) { $uuid = \Ramsey\Uuid\Uuid::uuid4(); return sprintf(