Execution Trace & Testing Verification

Step-by-step call stack execution walkthrough, enterprise edge cases, and container testing workflows.

1. The Execution Call Stack Trace

Here is what happens inside the engine when transforming a complex enterprise payload like a Tally stock item:

1. transform(food, recipe)
→ Enters traverse({ inSource, inRecipe })
→ Type is Object: Enters traverseObject
→ Recipe has "transform": Enters ifTransformFound
• Matches key "STOCKITEM" → has nested "transform"
• Recurses to traverse({ inSource: STOCKITEM, inRecipe: directive })
→ Type is Array: Enters traverseArray
• Maps item #0 → traverse({ inSource: item[0], inRecipe })
• Applies alterKey: "Name" → outputs clean name
• Applies valueKey: "#text" to BASEUNITS → extracts "kgs"
• Applies valueType: "array" to BATCHALLOCATIONS.LIST → returns clean array
← Returns mapped & filtered array
← Constructs new root object
← Returns final reshaped JSON output

2. Enterprise Quirks Handled by Design

3. Development & Test Workflow

Use the containerized environment to verify tests and build the production bundle:

1. Run Real-World Enterprise Sample

# Inside container or via wslc:
wslc exec node-dev node samples/6oct/batches/index.js

# Test simple transformation:
wslc exec node-dev node samples/new/simple/index.js

2. Build Production Bundle

wslc exec node-dev npm --prefix /workspace/json-transformer run build

Builds the minified ES bundle to docs/dist/v8/min.js and copies it to docs/dist/min.js.