# Data flow — pact-foundation/pact-js

> Canonical page: https://codevetter.com/unpack/pact-js/data-flow

# Data flow — pact-foundation/pact-js

Scanned commit 18f30a1aa44a948b3249a72879da3cff26c42d12 (2026-10-02). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Consumer inputs become native interaction declarations rather than a JavaScript implementation of contract matching. Native mock servers or reified messages feed application callbacks, and successful orchestration writes contracts to disk. Provider verification routes native requests through JavaScript middleware, state callbacks, and message producers before returning results to the caller.
- matcherValueOrString preserves string inputs and JSON-stringifies other values; RequestBuilder translates query/header arrays into indexed native withQuery/withRequestHeader calls and serializes JSON bodies. — [src/v3/matchers.ts#L631-L635](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/v3/matchers.ts#L631-L635) [src/v4/http/requestBuilder.ts#L13-L52](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/v4/http/requestBuilder.ts#L13-L52)
- Status matchers split into a concrete example passed to withStatus and status matching rules passed to withResponseMatchingRules; ordinary matcher reification recursively extracts examples. — [src/v4/http/interactionWithRequest.ts#L26-L35](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/v4/http/interactionWithRequest.ts#L26-L35) [src/common/matchingRules.ts#L31-L45](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/common/matchingRules.ts#L31-L45) [src/v3/matchers.ts#L649-L678](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/v3/matchers.ts#L649-L678)
- Explicit Rules inputs are checked for recognized parts and rule-array/path structure, then converted to part/path/matchers maps; conversion removes pact:generator:type and emits entries only for truthy rule.path. — [src/common/matchingRules.ts#L8-L24](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/common/matchingRules.ts#L8-L24) [src/common/matchingRules.ts#L53-L90](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/common/matchingRules.ts#L53-L90) [src/common/matchingRules.ts#L98-L120](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/common/matchingRules.ts#L98-L120)
- V4 HTTP executeTest captures callback errors, reads native mismatches and match success, and on its normal success branch writes a pact before mock-server cleanup, plugin cleanup, and parent reset. — [src/v4/http/index.ts#L25-L37](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/v4/http/index.ts#L25-L37) [src/v4/http/index.ts#L65-L104](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/v4/http/index.ts#L65-L104) [src/v4/index.ts#L36-L46](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/v4/index.ts#L36-L46)
- Asynchronous reification parses native JSON into contents.content plus metadata and base64-decodes content when the builder marked it binary; synchronous callbacks receive native request and response contents directly. — [src/v4/message/asynchronousMessage.ts#L215-L218](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/v4/message/asynchronousMessage.ts#L215-L218) [src/v4/message/asynchronousMessage.ts#L414-L428](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/v4/message/asynchronousMessage.ts#L414-L428) [src/v4/message/index.ts#L455-L465](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/v4/message/index.ts#L455-L465)
- Provider-state POST bodies become ProviderState values; setupStates selects stateHandlers[state.state], invokes setup or teardown with params, and returns callback data as JSON for native verification. — [src/dsl/verifier/proxy/stateHandler/stateHandler.ts#L20-L29](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/dsl/verifier/proxy/stateHandler/stateHandler.ts#L20-L29) [src/dsl/verifier/proxy/stateHandler/setupStates.ts#L21-L56](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/dsl/verifier/proxy/stateHandler/setupStates.ts#L21-L56) [src/dsl/verifier/proxy/types.ts#L19-L35](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/dsl/verifier/proxy/types.ts#L19-L35)
- The verification proxy parses JSON, form, and raw bodies before requestFilter; forwarding reconstructs Buffers or JSON objects into a readable body stream and uses providerBaseUrl, TLS options, and HTTPS_PROXY/HTTP_PROXY. — [src/dsl/verifier/proxy/proxy.ts#L35-L45](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/dsl/verifier/proxy/proxy.ts#L35-L45) [src/dsl/verifier/proxy/proxy.ts#L68-L84](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/dsl/verifier/proxy/proxy.ts#L68-L84) [src/dsl/verifier/proxy/parseBody.ts#L7-L20](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/dsl/verifier/proxy/parseBody.ts#L7-L20) [src/dsl/verifier/proxy/proxyRequest.ts#L14-L36](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/dsl/verifier/proxy/proxyRequest.ts#L14-L36)
- /_messages dispatches by description, copies request metadata, decodes encoded synchronous content, and invokes the producer; metadata-bearing outputs become base64 JSON headers plus a content-type-aware response, while errors return HTTP 500. — [src/dsl/verifier/proxy/messages.ts#L13-L32](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/dsl/verifier/proxy/messages.ts#L13-L32) [src/dsl/verifier/proxy/messages.ts#L96-L144](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/dsl/verifier/proxy/messages.ts#L96-L144) [src/dsl/verifier/proxy/proxy.ts#L76-L78](https://github.com/pact-foundation/pact-js/blob/18f30a1aa44a948b3249a72879da3cff26c42d12/src/dsl/verifier/proxy/proxy.ts#L76-L78)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
