mapValueToSource function exported

Last updated: 2026-03-05T10:53:28.865Z

Metrics

LOC: 20 Complexity: 4 Params: 4

Signature

mapValueToSource( recordedValue: string, fieldType: FieldType | null | undefined, params?: GeneratorParams, ): : FlowValueSource

Summary

Build a FlowValueSource for a fill step. When the field was classified with a FieldType the replay will call the generator each time (producing fresh data). Otherwise the original value is stored as a fixed literal.

Source Code

export function mapValueToSource(
  recordedValue: string,
  fieldType: FieldType | null | undefined,
  params?: GeneratorParams,
): FlowValueSource {
  if (!fieldType) {
    return { type: "fixed", value: recordedValue };
  }

  const source: FlowValueSource = {
    type: "generator",
    fieldType,
  };

  if (params && Object.keys(params).length > 0) {
    return { ...source, params };
  }

  return source;
}

Dependencies (Outgoing)

graph LR mapValueToSource["mapValueToSource"] FieldType["FieldType"] GeneratorParams["GeneratorParams"] FlowValueSource["FlowValueSource"] mapValueToSource -->|uses| FieldType mapValueToSource -->|uses| GeneratorParams mapValueToSource -->|uses| FlowValueSource style mapValueToSource fill:#dbeafe,stroke:#2563eb,stroke-width:2px click mapValueToSource "095f23c1feace9fe.html" click FieldType "e49ed8a601306673.html" click GeneratorParams "e1fda5b7991e343d.html" click FlowValueSource "c031953bbfc181d8.html"
TargetType
FieldType uses
GeneratorParams uses
FlowValueSource uses

Impact (Incoming)

graph LR mapValueToSource["mapValueToSource"] isValidFieldType["isValidFieldType"] convertSteps["convertSteps"] isValidFieldType -->|uses| mapValueToSource convertSteps -->|calls| mapValueToSource style mapValueToSource fill:#dbeafe,stroke:#2563eb,stroke-width:2px click mapValueToSource "095f23c1feace9fe.html" click isValidFieldType "a95b73445027ba7e.html" click convertSteps "9420198414a645f6.html"
SourceType
isValidFieldType uses
convertSteps calls