IncomingEntryBuilder
class IncomingEntryBuilder
Builds an {IncomingEntry} from a request/response pair plus the per-request collector payload. This is pure entry construction: no response mutation, no recording. The recorder owns lineage/header/tag concerns and hands the result here.
Traits
Constants
| protected RAW_BODY_LIMIT |
|
Methods
Redact the values of the given keys throughout the data.
Final storage pass for entry payloads. Earlier builders redact known request surfaces, but this keeps persisted entries private if a future collector path adds sensitive data before save.
Redact the values of the given lowercase keys at every depth.
Flatten the given headers, redacting the sensitive ones and the sensitive query parameters of URL headers.
Normalize the configured sensitive keys to unique lowercase strings.
Redact sensitive query parameters from the URLs in the data.
Redact the values of sensitive query parameters. A parameter matches when its decoded
name or any of its bracketed segments (e.g. filter[secret]) is a sensitive key. The
query is not parsed and rebuilt, so every other byte of the URL is kept as recorded,
and relative or malformed URLs are redacted the same way.
Replace leaf values that cannot be stored as JSON with a marker.
Determine if the value can be stored as JSON.
Merge the collector payload recorded while rendering into the entry.
Redact the recorded prop values.
Get the given payload value when it is a string.
Get the given payload value when it is an array.
Get the normalized route from the collector payload.
Get the normalized render source from the collector payload.
Resolve the kind of request the entry records.
A non-Inertia request that rendered an Inertia page (component present in the collector payload) is the app's initial page load. One that rendered no Inertia page is a plain HTTP request the app serves alongside Inertia.
Resolve the location the response redirects to.
Capture the page object of an Inertia response.
Cast the page object to the JSON the client received. Resolved props still hold live
values here (a model, a date, the always-shared errors object), and the storage
pass would replace those object leaves with a marker.
Capture the body of a non-Inertia response (plain JSON/text endpoints the app serves alongside Inertia). Binary, streamed, and oversized bodies are omitted.
Determine if the content type is textual.
Capture the given body value when it can be encoded.
Confirm a value survives JSON encoding with the flags the repository persists it with. An un-encodable value would otherwise throw at save and drop the entry.
Replace individual leaf values that cannot be JSON encoded with a marker, keeping the surrounding structure intact. Prop values are shared verbatim by the app, so a single non-UTF-8 attribute must not fail the whole entry at save.
Capture the given body string when it is valid UTF-8.
Replace uploaded files with a lightweight summary so binary contents are never serialized into an entry.
Resolve the render source for route-defined renders (Route::inertia), which have
no user-space render call site. The definition location is captured onto the route
defaults by the Route::inertia() macro when the route is registered.
Determine if the route carries no information.
Get the keys whose values are redacted.
Details
in
RedactsSensitiveData at line 27
protected array
redact(array $data, array $keys)
Redact the values of the given keys throughout the data.
in
RedactsSensitiveData at line 46
protected array
redactSensitiveStoragePayload(array $payload)
Final storage pass for entry payloads. Earlier builders redact known request surfaces, but this keeps persisted entries private if a future collector path adds sensitive data before save.
in
RedactsSensitiveData at line 81
protected array
redactRecursive(array $data, array $loweredKeys)
Redact the values of the given lowercase keys at every depth.
in
RedactsSensitiveData at line 101
protected array
redactHeaders(array $headers)
Flatten the given headers, redacting the sensitive ones and the sensitive query parameters of URL headers.
in
RedactsSensitiveData at line 127
protected array
normalizeSensitiveKeys(array $keys)
Normalize the configured sensitive keys to unique lowercase strings.
in
RedactsSensitiveData at line 149
protected array
redactUrls(array $data, array $keys)
Redact sensitive query parameters from the URLs in the data.
in
RedactsSensitiveData at line 181
protected string
redactUrl(string $url, array $keys)
Redact the values of sensitive query parameters. A parameter matches when its decoded
name or any of its bracketed segments (e.g. filter[secret]) is a sensitive key. The
query is not parsed and rebuilt, so every other byte of the URL is kept as recorded,
and relative or malformed URLs are redacted the same way.
in
RedactsSensitiveData at line 210
protected array
sanitizeForJsonEncoding(array $data)
Replace leaf values that cannot be stored as JSON with a marker.
in
RedactsSensitiveData at line 226
protected bool
isJsonEncodable(mixed $value)
Determine if the value can be stored as JSON.
at line 28
__construct(SourceLocator $sourceLocator)
Create a new incoming entry builder instance.
at line 35
IncomingEntry
build(Request $request, Response $response, string $id, string|null $batchId, bool $isPrefetch)
Build the entry for the given request and response.
at line 71
protected void
mergeCollectorPayload(IncomingEntry $entry, Request $request)
Merge the collector payload recorded while rendering into the entry.
at line 102
protected array
redactPropValues(array $propValues)
Redact the recorded prop values.
Nested props are recorded under their dotted path, so a value is redacted when any segment of its path is a sensitive key.
at line 121
protected string|null
stringValue(array $payload, string $key)
Get the given payload value when it is a string.
at line 134
protected array|null
arrayValue(array $payload, string $key)
Get the given payload value when it is an array.
at line 147
protected array|null
routePayload(array $payload)
Get the normalized route from the collector payload.
at line 179
protected array|null
renderSourcePayload(array $payload)
Get the normalized render source from the collector payload.
at line 196
protected RequestType
resolveRequestType(Request $request, Response $response, bool|null $isPrefetch = null)
Resolve the kind of request the entry records.
at line 232
protected bool
renderedInertiaPage(Request $request)
A non-Inertia request that rendered an Inertia page (component present in the collector payload) is the app's initial page load. One that rendered no Inertia page is a plain HTTP request the app serves alongside Inertia.
at line 245
protected string|null
resolveRedirectLocation(Response $response)
Resolve the location the response redirects to.
at line 269
protected array
captureRequestBody(Request $request)
Capture the request body.
at line 299
protected array
captureResponseBody(Request $request, Response $response)
Capture the response body.
at line 315
protected array
captureInertiaResponseBody(mixed $responseBody)
Capture the page object of an Inertia response.
at line 340
protected array
normalizeResponseBody(array $responseBody)
Cast the page object to the JSON the client received. Resolved props still hold live
values here (a model, a date, the always-shared errors object), and the storage
pass would replace those object leaves with a marker.
at line 359
protected array
captureRawResponseBody(Response $response)
Capture the body of a non-Inertia response (plain JSON/text endpoints the app serves alongside Inertia). Binary, streamed, and oversized bodies are omitted.
at line 395
protected bool
isTextualContentType(string $contentType)
Determine if the content type is textual.
at line 411
protected array
captureBodyValue(mixed $value)
Capture the given body value when it can be encoded.
at line 424
protected bool
isEncodable(mixed $value)
Confirm a value survives JSON encoding with the flags the repository persists it with. An un-encodable value would otherwise throw at save and drop the entry.
at line 437
protected array
sanitizeForJson(array $data)
Replace individual leaf values that cannot be JSON encoded with a marker, keeping the surrounding structure intact. Prop values are shared verbatim by the app, so a single non-UTF-8 attribute must not fail the whole entry at save.
at line 455
protected array
captureBodyString(string|null $body)
Capture the given body string when it is valid UTF-8.
at line 475
protected array
summarizeUploads(array $input)
Replace uploaded files with a lightweight summary so binary contents are never serialized into an entry.
at line 493
protected array
summarizeUpload(UploadedFile $file)
Summarize the given uploaded file.
at line 509
protected array|null
renderSourceFromRoute(Request $request)
Resolve the render source for route-defined renders (Route::inertia), which have
no user-space render call site. The definition location is captured onto the route
defaults by the Route::inertia() macro when the route is registered.
at line 525
protected bool
routeIsEmpty(array $route)
Determine if the route carries no information.
at line 538
protected array|null
routeFromRequest(Request $request)
Get the normalized route from the request.
at line 567
protected float
elapsedMs(Request $request)
Get the milliseconds elapsed since the request started.
at line 583
protected array
redactKeys()
Get the keys whose values are redacted.