* Mask a materialized large value and re-offload it: handle any nested refs * first, then mask inline strings, then re-store. `redactObjectStrings` skips * refs, so the nested re-stored refs are left intact while their siblings mask.
( value: unknown, options: RedactLargeValueRefsOptions )
| 134 | * refs, so the nested re-stored refs are left intact while their siblings mask. |
| 135 | */ |
| 136 | async function maskAndReStore( |
| 137 | value: unknown, |
| 138 | options: RedactLargeValueRefsOptions |
| 139 | ): Promise<unknown> { |
| 140 | const nested = await redactValueRefs(value, options) |
| 141 | const masked = await redactObjectStrings(nested, { |
| 142 | entityTypes: options.entityTypes, |
| 143 | language: options.language, |
| 144 | onFailure: options.onFailure ?? 'scrub', |
| 145 | }) |
| 146 | return compactExecutionPayload(masked, { ...options.store, requireDurable: true }) |
| 147 | } |
| 148 | |
| 149 | /** Rethrow (as {@link PiiRedactionError}) or scrub-to-marker, per `onFailure`. */ |
| 150 | function onRefFailure( |
no test coverage detected