JSON Model-to-Model Projection (JM2MP) Documentation

JSON Model-to-Model Projection (JM2MP) Documentation

Module

jm2mp/adapters/native

The module native implements the QueryAdapter interface to use native query language part of the JM2MP syntax.

By compliance with JM2MP, the QueryAdapter created by module:jm2mp/adapters/native.createNativeAdapter is the reference for the expected behaviour that any other external adapter must replicate.

Native query language offers two different but equivalent syntaxes:

  • A text string path in compliance with native EBNF rules (e.g. "@.users[0].name").
  • An array with literal accessors (e.g. ["users", 0, "name"]).

It is important to note that, although this adapter is synchronous internally (it does not involve I/O or async libraries), its evaluate function is marked as async just to comply with the registry's uniform contract. The overhead of wrapping it in Promise.resolve() is negligible and is offset by architectural consistency (because other adapters are async, all of them would be async).

Source

Methods