CDS pluginCDS plugintypeInstalls into a CAP project and extends the runtime. CAP loads it through cds.requires or the plugin hook.See every one →What this type is →by a community orgby a community orgoriginPublished by a community organisation, so it outlives any one maintainer.See every one →

@cap-js-community/odata-v2-adapter

Formerly@sap/cds-odata-v2-adapter-proxyuntil 2023-04

Exposes a CAP service as OData V2 for clients that cannot move to V4.

Facts

Latestv1.16.2ReleasedLast pushLicenceApache-2.0

Where it sits

Lives in
Provides
ODataCAPODatacapabilityExposing data and operations through OData, including the service model, metadata and protocol versions clients require. Version differences affect which clients can consume a service and which query features they can use.
Flavors
Node.jsfrom its runtime
Requires
@sap/cds@sap/cdsartifactthe CDS runtime whose OData V4 service the adapter translates V2 requests into

Who is behind it

cap-js-communitycap-js-communityOrganisationMaintains this
In the atlas: maintains 10
@cap-js-community
Oliver KlemenzOliver KlemenzPersonMaintains this
In the atlas: maintains 4, contributes to 6
@oklemenz2
maintainersAjinkya PatilPersonContributes to this
In the atlas: contributes to 112
@ajinkyapatil8190
Andre MeyeringPersonContributes to this
In the atlas: contributes to 10
@bugwelle
Christian GeorgiPersonContributes to this
In the atlas: maintains 1, contributes to 53
@chgeo
Daniel HutzelPersonContributes to this
In the atlas: contributes to 32, wrote 3
@danjoa
OlenaPersonContributes to this
In the atlas: contributes to 11
@etimr
Heiko WitteborgPersonContributes to this
In the atlas: contributes to 18
@hm23
Iwona HahnPersonContributes to this
In the atlas: contributes to 7
@iwonahahn
Johannes VogelPersonContributes to this
In the atlas: contributes to 25
@johannes-vogel
Nils SchnabelPersonContributes to this
In the atlas: contributes to 8
@nils
René JeglinskyPersonContributes to this
In the atlas: contributes to 20
@renejeglinsky
15 contributors

Before choosing this

Conditions

LicenceSAP Developer License Agreement 3.2 CAP§ 1, 2, 3A cds-plugin is used with SAP CAP materials, or an artifact is explicitly identified as a CAP plugin or application.
  • § 1 License. Productive customer applications are limited to SAP BTP or another SAP-licensed platform, and mass extraction to a non-SAP product is restricted except where solely required for SAP interoperability.
  • § 2 Intellectual Property. The agreement retains SAP's rights in the covered materials and limits making APIs, tools or software available to third parties, while preserving ownership of customer applications subject to SAP's underlying rights.
  • § 3 Artificial Intelligence Training. The agreement prohibits use of the covered materials and customer applications for training artificial-intelligence models or systems.
SAP Developer License Agreement 3.2 CAP →

What it declares

Every artifact

Type
CDS plugin
Origin
By a community org
Runtime
Node.js

As a CDS plugin

Distributed through
npm

For OData

Protocols
OData V2

Connections6

@cap-js-community/odata-v2-adapter connections@cap-js-community/odata-v2-adapterPROVIDES→ provides1provides authoredODataUSED BY← needed by2needed by derived The V2 endpoint SAP Fiori tools reads, put in front of the service's own V4 one; the project depends on it under its former name, @sap/cds-odata-v2-adapter-proxy. Through: inverted from its requires edge miyasuta/blog-bookshop — package.json: https://raw.githubusercontent.com/miyasuta/blog-bookshop/master/package.json Developing a Fiori elements app with CAP and Fiori Tools — SAP Community: https://community.sap.com/t5/technology-blog-posts-by-members/developing-a-fiori-elements-app-with-cap-and-fiori-tools/ba-p/13487547blog-bookshopneeded by derived The V2 endpoint the overview page reads at /v2/catalog/, put in front of the service's own V4 one; the project depends on it under its former name, @sap/cds-odata-v2-adapter-proxy. Through: inverted from its requires edge Adding a Donut Chart on top of CAP service — SAP Community: https://community.sap.com/t5/technology-blog-posts-by-members/adding-a-donut-chart-on-top-of-cap-service/ba-p/13461859 miyasuta/blog-cap-chart — package.json: https://raw.githubusercontent.com/miyasuta/blog-cap-chart/master/package.jsonblog-cap-chart← used by2used by derived Serving the CDS entities as OData V2, which is the protocol the SmartFilterBar and SmartTable in the app bind against. Through: inverted from its requires edge Simple Table Maintenance in SAP Fiori Using UI5 Smart Controls — SAP Community: https://community.sap.com/t5/technology-blog-posts-by-members/simple-table-maintenance-in-sap-fiori-using-ui5-smart-controls/ba-p/14014547fiori-table-maintenanceused by derived Through: inverted from its requires edgeforsap-s4hana-private-simulatorNEEDS→ needs1needs stated the CDS runtime whose OData V4 service the adapter translates V2 requests into cap-js-community/odata-v2-adapter — README: https://github.com/cap-js-community/odata-v2-adapter@sap/cds

Install

npm add @cap-js-community/odata-v2-adapter

Derived from the package name. No recipe recorded; the README has the configuration.

README

quoted from cap-js-community/odata-v2-adapter under Apache-2.0, read
cap-js-community/odata-v2-adapter/README.mdOn GitHub

OData V2 Adapter for CDS

npm version monthly downloads REUSE status Main CI

About this Project

Exposes a full-fledged OData V2 service, converting OData V2 requests to CDS OData V4 service calls and responses back. Runs in the context of the SAP Cloud Application Programming Model (CAP) using CDS Node.js module @sap/cds or CDS Java modules com.sap.cds.

Table of Contents

Getting Started

  • Run npm add @cap-js-community/odata-v2-adapter in @sap/cds project
  • Execute cds-serve to start server
    • OData V2 service is available at http://localhost:4004/odata/v2/<service>
    • OData V4 service is available at http://localhost:4004/odata/v4/<service>

Options

The OData V2 adapter for CDS instantiates an Express router. The following options are available:

  • plugin: OData V2 adapter is instantiated as part of the CDS plugin. Default is true.
  • build: In case of a plugin scenario, a build step is registered to prepare the OData V2 metadata. Use 'all' to mass compile EDMX files. Default is true.
  • base: Base path under which the service is reachable. Default is ''.
  • path: Path under which the service is reachable. Default is 'odata/v2'. Default path is 'v2' for CDS < 7 or middlewares deactivated.
  • model: CDS service model (path(s) or CSN). Default is 'all'.
  • port: Target port which points to OData V4 backend port. Default is process.env.PORT or 4004.
  • target: Target which points to OData V4 backend host:port. Use 'auto' to infer the target from server url after listening. Default is e.g. 'auto'.
  • targetPath: Target path to which is redirected. Default is 'odata/v4'. Default path is '' for CDS < 7 or middlewares deactivated.
  • services: Service mapping object from url path name to service name. Default is {}.
  • mtxRemote: CDS model is retrieved remotely via MTX endpoint for a multitenant scenario (classic MTX only). Default is false.
  • mtxEndpoint: Endpoint to retrieve MTX metadata when the option 'mtxRemote' is active (classic MTX only). Default is '/mtx/v1'.
  • ieee754Compatible: Edm.Decimal and Edm.Int64 are serialized IEEE754 compatible. Default is true.
  • fileUploadSizeLimit: File upload file size limit (in bytes) for multipart/form-data requests. Default is 10485760 (10 MB).
  • continueOnError: Indicates to OData V4 backend to continue on error. Default is false.
  • isoTime: Use ISO 8601 format for type cds.Time (Edm.Time). Default is false.
  • isoDate: Use ISO 8601 format for type cds.Date (Edm.DateTime). Default is false.
  • isoDateTime: Use ISO 8601 format for type cds.DateTime (Edm.DateTimeOffset). Default is false.
  • isoTimestamp: Use ISO 8601 format for type cds.Timestamp (Edm.DateTimeOffset). Default is false.
  • isoDateTimeOffset: Use ISO 8601 format for type Edm.DateTimeOffset (cds.DateTime, cds.Timestamp). Default is false.
  • bodyParserLimit: Request and response body parser size limit. Default is cds.server.body_parser.limit or '100mb'.
  • returnCollectionNested: Collection of entity types is returned nested into a results section. Default is true.
  • returnComplexNested: Function import return structure of complex type (non collection) is nested using the function import name. Default is true.
  • returnPrimitiveNested: Function import return structure of primitive type (non collection) is nested using the function import name. Default is true.
  • returnPrimitivePlain: Function import return value of a primitive type is rendered as a plain JSON value. Default is true.
  • messageTargetDefault: Specifies the message target default, if the target is undefined. Default is '/#TRANSIENT#'.
  • caseInsensitive: Transforms search functions i.e., substringof, startswith, endswith to case-insensitive variant. Default is false.
  • propagateMessageToDetails: Propagates root error or message always to a details section. Default is false.
  • contentDisposition: Default content disposition for media streams (inline, attachment), if not available or calculated. Default is 'attachment'.
  • calcContentDisposition: Calculate content disposition for media streams even if already available. Default is false.
  • quoteSearch: Specifies if a search expression is quoted automatically. Default is true.
  • fixDraftRequests: Specifies if unsupported draft requests are converted to a working version. Default is false.
  • changesetDeviationLogLevel: Log level of batch changeset content-id deviation logs (none, debug, info, warn, error). Default is 'info'.
  • defaultFormat: Specifies the default entity response format (json, atom). Default is 'json'.
  • processForwardedHeaders: Specifies if x-forwarded headers are processed. Default is true.
  • cacheDefinitions: Specifies if the definition elements are cached. Default is true.
  • cacheMetadata: Specifies the caching and provisioning strategy of metadata (e.g., edmx) (memory, disk, stream). Default is 'memory'.
  • registerOnListening: Routes are registered on CDS listening event instead of registering routes immediately. Default is true.
  • excludeNonSelectedKeys: Excludes non-selected keys from entity response (OData V4 auto-includes keys). Default is false.
  • httpAgent: Object to be passed to http(s) request (see Node's https agent and http agent objects). Default is null.
  • jsonDateOffset: JSON date serialization includes timezone offset. Default is true.
  • toggles: Applies CDS before middlewares and feature toggle middleware, to propagate CDS toggles into req.features. Default is false.
CDS Env

All OData V2 adapter for CDS options can be specified as part of CDS project-specific configuration under section cds.cov2ap and accessed during runtime via cds.env.cov2ap.

Options can also be passed as command line environment variable, by converting the camel-cased option name to a snake-case. Underscores (_) need then to be escaped as double underscore (__) when provided via command line environment variable.

Examples:

  • path => CDS_COV2AP_PATH=odatav2
  • quoteSearch => quote_search => CDS_COV2AP_QUOTE__SEARCH=false

Documentation

Singleton

CDS OData V2 adapter is instantiated via the CDS plugin as a singleton, which is exposed at:

const cds = require("@sap/cds");
cds.cov2ap;

The singleton can also be instantiated manually and accessed in a custom server via:

const cov2ap = require("@cap-js-community/odata-v2-adapter");
cov2ap.singleton();

@sap/cds is a mandatory dependency and needs to be available as module.

Before Middlewares

Before middleware routes can be registered on the OData V2 adapter for CDS singleton, to be executed before the main route processing. The before middleware routes can be registered as a single function or as an array of route functions.

Single before route can be registered as follows:

const cds = require("@sap/cds");

cds.on("bootstrap", (app) => {
  cds.cov2ap.before = (req, res, next) => {
    // custom route processing
    next();
  };
});

Multiple before routes can be registered as follows:

const cds = require("@sap/cds");

cds.on("bootstrap", (app) => {
  cds.cov2ap.before = [
    (req, res, next) => {
      // custom route processing
      next();
    },
    (req, res, next) => {
      // custom route processing
      next();
    },
  ];
});
CDS Middlewares

The standard CDS before middlewares can be applied to the OData V2 adapter routes via the following configuration:

const cds = require("@sap/cds");

cds.on("bootstrap", (app) => {
  cds.cov2ap.before = cds.middlewares.before;
});
Dynamic HTTP Agent

Using before middlewares, a dynamic HTTP(s) agent can be registered via req.agent as follows:

const cds = require("@sap/cds");

cds.on("bootstrap", (app) => {
  cds.cov2ap.before = (req, res, next) => {
    req.agent = new https.Agent({});
    next();
  };
});
Custom Bootstrap
  • Deactivate bootstrap via CDS plugin:
    • Set cds.cov2ap.plugin: false in package.json
  • Enhance or create ./srv/server.js:
    const cds = require("@sap/cds");
    const cov2ap = require("@cap-js-community/odata-v2-adapter");
    cds.on("bootstrap", (app) => app.use(cov2ap()));
    module.exports = cds.server;

@sap/cds is a mandatory dependency and needs to be available as module.

Logging

Logging is based on cds.log, therefore, CDS logging configurations apply.

Logging Modules
ComponentModule Name(s)
OData V2 adapter for CDScov2ap
Kibana Logging

To enable Kibana friendly logging for cds.log feature toggle cds.features.kibana_formatter: true needs to be set.

Debug Mode

Debug mode can be activated to log requests and responses processed (V2) and initiated (V4) by OData V2 adapter for CDS. The following information can be retrieved for analysis:

  • Request url, headers, body
  • Response: status code/message, headers, body

Debug log level can be activated

  • via command line environment variable: CDS_LOG_LEVELS_COV2AP=debug
  • via cds.env in code: cds.env.log.levels.cov2ap = "debug"

Details on how to set a CDS environment can be found at cds.env.

Log Levels

Logging can be configured to respect the following log levels:

  • error: Error logs are written (includes warn)
  • warn: Warning logs are written (includes info)
  • info: Info logs are written (includes debug)
  • debug: Debug logs are written
  • trace: Same as debug
  • silent: No logs are written
Logging Components
cds.log.levels.cov2ap: "error"
  • [cov2ap] - Proxy: Proxy processing error
  • [cov2ap] - Cache: Metadata cache error
  • [cov2ap] - Authorization: Authorization header parsing error
  • [cov2ap] - MetadataRequest: Metadata request processing error
  • [cov2ap] - Request: Request processing error
  • [cov2ap] - Response: Response processing error
  • [cov2ap] - Batch: Batch processing error
  • [cov2ap] - AggregationKey: Aggregation key error
  • [cov2ap] - MediaStream: Media stream processing error
  • [cov2ap] - FileUpload: File upload processing error
cds.log.levels.cov2ap: "warn"
  • [cov2ap] - Service: Invalid service definition (name, path)
  • [cov2ap] - Context: Invalid (sub-)definition (name, path)
  • [cov2ap] - ContentDisposition: Content disposition warning
cds.log.levels.cov2ap: "info"
  • [cov2ap] - Batch: Changeset order deviation (req, res)
cds.log.levels.cov2ap: "debug"
  • [cov2ap] - Request: Log OData V2 client request (url, headers, body)
  • [cov2ap] - ProxyRequest: Log OData V4 proxy request (url, headers, body)
  • [cov2ap] - ProxyResponse: Log OData V4 proxy response (status code/message, headers, body)
  • [cov2ap] - Response: Log OData V2 client response (status code/message, headers, body)
http-proxy-middleware
  • [cov2ap] - [HPM]: Proxy middleware processing logs
CDS Annotations

The following OData V2 adapter for CDS-specific annotations is supported:

Service Level:

  • @protocol: [{ kind: 'odata-v2', path: '<path>' }]: Specifies an additional custom relative OData V2 protocol service path (prepending OData V2 protocol prefix)
  • @protocol: [{ kind: 'odata-v2', path: '/<path>' }]: Specifies an additional custom absolute OData V2 protocol service path (ignoring OData V2 protocol prefix)
  • @cov2ap.ignore: Exclude service from OData V2 adapter conversion (service is not exposed as OData V2 service)

Entity Level:

  • @cov2ap.analytics: false: Suppress analytics conversion for the annotated entity, if set to false.
  • @cov2ap.analytics.skipForKey: Suppress analytical conversion for the annotated entity if all dimension key elements are requested
  • @cov2ap.deltaResponse: 'timestamp': Delta response '__delta' is added to response data of annotated entity with current timestamp information.
  • @cov2ap.isoTime: Values of type cds.Time (Edm.Time) are represented in ISO 8601 format for annotated entity.
  • @cov2ap.isoDate: Values of type cds.Date (Edm.DateTime) are represented in ISO 8601 format for annotated entity.
  • @cov2ap.isoDateTime: Values of type cds.DateTime (Edm.DateTimeOffset) are represented in ISO 8601 format for annotated entity.
  • @cov2ap.isoTimestamp: Values of type cds.Timestamp (Edm.DateTimeOffset) are represented in ISO 8601 format for annotated entity.
  • @cov2ap.isoDateTimeOffset: Values of type Edm.DateTimeOffset (cds.DateTime, cds.Timestamp) are represented in ISO 8601 format for annotated entity.

Entity Element Level:

  • @Core.ContentDisposition.Filename: <element>: Specifies an entity element, representing the filename during file upload/download.
  • @Core.ContentDisposition.Type: '<value>': Controls the content disposition behavior in client/browser (inline or attachment).
  • @cov2ap.headerDecode: [...]: Array of sequential decoding procedures ('uri,' 'uriComponent,' 'base64') used for media entity upload header.
CDS Modeling Restrictions

CDS project configuration cds.odata.version shall be set to v4, as OData V2 maps to OData V4. CDS supports modeling features that are not compatible with OData V2 standard:

  • Singletons: Usage of annotation @odata.singleton is not supported in combination with OData V2
  • Structured Types: Usage of cds.odata.structs: true is not supported in combination with OData V2
  • Map Type: Usage of data type cds.Map is not supported in combination with OData V2
  • Arrayed Types: Usages of array of or many in entity element definitions lead to CDS compilation error: Element must not be an "array of" for OData V2
  • Managed Compositions: The usage of managed composition (currently) produces Format Exception in Fiori Elements V2 for Date/Time data types

To provide an OData V2 service based on the OData V2 adapter for CDS, those CDS modeling features must not be used. In general, any CDS OData API flavor must not be used in combination with OData V2 adapter for CDS.

Per default, those modeling incompatibilities are reported as Warning and will not stop the compilation. The resulting EDMX V2 may be invalid and not processable by an OData V2 client. To prevent this situation and fail early to detect modeling incompatibilities, the severity for respective codes can be increased to Error, by setting the following environment variables:

{
  "cdsc": {
    "severities": {
      "odata-spec-violation-array": "Error",
      "odata-spec-violation-param": "Error",
      "odata-spec-violation-returns": "Error",
      "odata-spec-violation-assoc": "Error",
      "odata-spec-violation-constraints": "Error"
    }
  }
}
Cloud Foundry Deployment

When deploying the OData V2 adapter for CDS to Cloud Foundry, make sure that it has access to the whole CDS model. Especially, it’s the case, that normally the Node.js server is only based on folder srv and folder db is then missing on Cloud Foundry.

To come around this situation, trigger a cds build during development time, that generates a csn.json at location gen/srv/srv/csn.json. Point your Cloud Foundry deployment of the OData V2 adapter for CDS to the folder gen/srv (using manifest.json or MTA), so that the CDS models can be found via file srv/csn.json, during runtime execution on Cloud Foundry.

Make sure that all i18n property files reside next to the csn.json in a i18n or _i18n folder, to be detected by localization.

Multitenancy, Feature Toggles and Extensibility (MTX)

OData V2 adapter for CDS supports multitenant scenarios. Basic extensibility is already supported in combination with the CDS MTX module. More advanced extensibility scenarios and feature toggles are supported in combination with the CDS Streamlined MTX services.

Ensure that cds.xt.ModelProviderService is served internally, to allow extended CSN and EDMX retrieval.

Out-of-the-box Feature Toggles

Out-of-the-box Feature Toggles support can be activated via adapter option cds.cov2ap.toggles: true. When active, all CDS before middlewares (cds.middlewares.before) are automatically applied to cds.cov2ap.before and in addition another feature toggle middleware propagates CDS feature toggles cds.context.features into req.features of OData V2 request.

For production scenarios, a custom feature toggle middleware can be registered to fill cds.context.features as follows on CDS boostrap, which is respected also by this module.

const cds = require("@sap/cds");
cds.middlewares.add(
  (req, res, next) => {
    if (cds.context.tenant === "t1") {
      cds.context.features = ["advanced"];
    }
    next();
  },
  { before: "ctx_model" },
);
Custom Feature Toggles

To provide the feature toggle vector to be used to build up the corresponding CSN and EDMX metadata documents, the Express request object req needs to enhance by feature definitions. To add support for a specific feature toggles management, you can add simple Express middleware as follows, for example, in your server.js:

const cds = require("@sap/cds");
cds.on(
  "bootstrap",
  (app) =>
    (cds.cov2ap.before = (req, res, next) => {
      req.features = ["advanced"];
      next();
    }),
);

If features are tenant-specific, apply the CDS before middlewares, so that cds.context.tenant is accessible:

const cds = require("@sap/cds");
cds.middlewares.add((req, res, next) => {
  if (cds.context.tenant === "t1") {
    req.features = ["advanced"];
  }
  next();
});
cds.cov2ap.before = cds.middlewares.before;

Details see CDS Middlewares.

Build Task

The CDS OData V2 adapter includes an CDS build task that allows preparing the OData V2 EDMX files for server and MTX sidecar app. The build task is only automatically available when the adapter is bootstrapped via the CDS plugin mechanism (default). It is then automatically active but can be deactivated using option cds.cov2ap.build: false.

Please note that when project has own cds.build.tasks configuration, the CDS OData V2 adapter build task needs to be added manually as well. Also in case of a custom server bootstrap, the build task needs to be registered manually.

The build task generates each OData V2 EDMX file one-by-one for each OData service, excluding services annotated with @cov2ap.ignore. For performance reasons all EDMX files can be compiled together, via configuration cds.cov2ap.build: "all". Please note that in case of all mode, all services are compiled including none-OData services and those annotated with @cov2ap.ignore, but only not ignored OData services are written to disk.

Unit-Tests

This repository comes with a suite of unit-tests covering the complete proxy implementation. The tests can be executed as follows:

  • SQLite-based:
  • HANA based:
    • Place HANA credentials at test-hana/_env/db/default-services.json in format:
      {
        "hana": [
          {
            "credentials": {}
          }
        ]
      }
    • Deploy HANA (root dir): npm run deploy:hana
    • Run tests (root dir): npm run test:hana (source)
  • Postgres-based:
    • Start Postgres on port 5432
    • Assure default configuration is available (user, password, database) is set to postgres
    • Deploy HANA (root dir): npm run deploy:postgres
    • Run tests (root dir): npm run test:postgres (source)
  • CI Tests (SQLite + HANA):
    • npm test

All tests are executed as part of the GitHub Actions Continuous Integration (CI) pipeline.

SAP Fiori Elements V2

The OData V2 service provided by the OData V2 adapter for CDS can be used to serve an SAP Fiori Elements V2 UI.

SAP Fiori Elements V2 examples:

  • SQLite-based:
    • Analytics: Analytical List Page app (source)
    • Basic Edit: Basic editing app (source)
    • Draft Edit: Draft supported editing app (source)
    • Hierarchy: Hierarchical display of data in a tree table (source)
    • Overview: Overview Page app (source)
    • XML: Basic app (Atom format) (source)
  • HANA based:
    • Parameters: Parameterized entity app (source)
  • Postgres-based:
    • Basic Edit: Basic editing app (source)

Examples can be tested as follows:

  • Start server:
    • SQLite based: npm run start:sqlite
    • HANA based: npm run start:hana
    • Postgres based: npm run start:postgres
  • Open Fiori Launchpad: http://localhost:4004/flp.html
Compression Support

Response compressions can be enabled, by registering the compression Node.js module in Express app at bootstrap time, e.g., in srv/server.js:

const cds = require("@sap/cds");
const compression = require("compression");

cds.on("bootstrap", (app) => {
  cds.cov2ap.before = [compression({ filter: shouldCompress })];
});

function shouldCompress(req, res) {
  const type = res.getHeader("Content-Type");
  if (type && typeof type === "string" && type.startsWith("multipart/mixed")) {
    return true;
  }
  // fallback to standard filter function
  return compression.filter(req, res);
}

The shown compression filter function enables compression including OData Batch ($batch) calls with content type multipart/mixed.

Approuter Compression

@sap/approuter now support out-of-the-box compression for OData $batch calls with multipart/mixed. It's disabled by default but can be enabled using option compressResponseMixedTypeContent.

Custom Serving

CAP Node.js Custom
  • Run npm install @cap-js-community/odata-v2-adapter -s in @sap/cds project
  • Create new file ./srv/index.js:
const express = require("express");
const cds = require("@sap/cds");
const cov2ap = require("@cap-js-community/odata-v2-adapter");

const host = "0.0.0.0";
const port = process.env.PORT || 4004;

(async () => {
  const app = express();

  // OData V2
  app.use(cov2ap());

  // OData V4
  await cds.connect.to("db");
  await cds.serve("all").in(app);

  const server = app.listen(port, host, () => console.info(`app is listing at ${host}:${port}`));
  server.on("error", (error) => console.error(error.stack));
})();
  • Run node srv/index from the project root to start the server:
    • OData V2 service will be available at http://localhost:4004/odata/v2/<service-path>
    • OData V4 service will be available at http://localhost:4004/odata/v4/<service-path>

@sap/cds is a mandatory dependency and needs to be available as module.

CAP Java Custom

For CAP Java projects prefer the Native CDS OData V2 Adapter (com.sap.cds/cds-adapter-odata-v2).

  • Run npm install @cap-js-community/odata-v2-adapter -s in @sap/cds project
  • Provide CDS models (db, srv, app) or compile a generated CSN (see details below)
  • Create new file ./srv/index.js:
const express = require("express");
const cov2ap = require("@cap-js-community/odata-v2-adapter");

const host = "0.0.0.0";
const port = process.env.PORT || 4004;

(async () => {
  const app = express();

  // OData V2
  app.use(
    cov2ap({
      target: "<odata-v4-backend-url>", // locally e.g. http://localhost:8080
      services: {
        "<odata-v4-service-path>": "<qualified.ServiceName>",
      },
      registerOnListening: false,
    }),
  );

  const server = app.listen(port, host, () => console.info(`app is listing at ${host}:${port}`));
  server.on("error", (error) => console.error(error.stack));
})();
  • Run node srv/index from the project root to start the server:
    • OData V2 service will be available at http://localhost:4004/odata/v2/<odata-v4-service-path>
    • OData V4 service shall be available e.g., at http://localhost:8080/<odata-v4-service-path>

@sap/cds is a mandatory dependency and needs to be available as module.

Additional Considerations
  • A deployed version of OData V2 adapter for CDS shall have option target set to the deployed OData V4 backend URL. This can be retrieved from the Cloud Foundry environment using process.env, for example, from the destinations environment variable. Locally, e.g., http://localhost:8080 can be used.
  • In option services, every OData V4 service URL path needs to map to the corresponding fully qualified CDS service name, e.g. "/odata/v4/MainService/": "test.MainService", to establish the backlink connection between OData URL and its CDS service.
  • Make sure that your CDS models are also available in the project. Those reside either in db, srv, add folders, or a compiled (untransformed) srv.json is provided. This can be generated by using the following command: cds srv -s all -o .
  • Alternatively, a cds build can be triggered as described in section "Cloud Foundry Deployment."
  • If not detected automatically, the model path can be set with option model (especially if csn.json/srv.json option is used).
  • Make sure that all i18n property files reside next to the csn.json in a i18n or _i18n folder, to be detected by localization.
  • In a multitenant scenario in combination with a standalone app, the CDS model can be retrieved remotely via MTX endpoint (mtxEndpoint) by setting option mtxRemote: true.
  • Option mtxEndpoint can be specified as absolute url (starting with http:// or https://), to be able to address MTX Sidecar possibly available under a target different from OData v4 backend URL. If not specified absolutely, target is prepended to mtxEndpoint.

Contributions

  • Unit Tests: npm test
  • Test Server: npm start
    • Service: http://localhost:4004/odata/v2/main
    • Metadata: http://localhost:4004/odata/v2/main/$metadata
    • Data: http://localhost:4004/odata/v2/main/Header?$expand=Items

For more details see the CONTRIBUTION guide.

Features

  • GET, POST, PUT / MERGE / PATCH, DELETE
  • Batch support
  • Actions, Functions
  • Analytical Annotations
  • Deep Expands/Selects
  • JSON, Atom (XML) format
  • Deep Structures
  • Data Type Mapping
  • IEEE754Compatible
  • Messages / Error Handling
  • Location Header
  • inlinecount/inlinecount / count / $value
  • Entity with Parameters
  • File Upload (binary, multipart/form-data)
  • Stream Support (Octet and Url)
  • Content Disposition
  • Content-ID
  • Multitenancy (mtx, mtxs)
  • Feature Toggles
  • Extensibility
  • Draft Support
  • Search Support
  • Localization
  • Temporal Data
  • Tracing Support
  • Logging Correlation
  • ETag Support (Concurrency Control)
  • Next Links (skiptoken)
  • Delta Responses (deltatoken)
  • Continue-On-Error
  • X-HTTP-Method

OData V2/V4 Delta

What’s New in OData Version 4.0

Support, Feedback, Contributing

This project is open to feature requests/suggestions, bug reports, etc. via GitHub issues. Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines.

Code of Conduct

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its Code of Conduct at all times.

Licensing

Copyright 2025 SAP SE or an SAP affiliate company and contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.

Apache-2.0, read

History

Latest

v1.16.2

Fixes 3

Notes
Fixed
  • Reduce invalid (sub-)definition log level to info
  • Multiple protocol annotations like @rest @odata are now handled correctly.
  • Resolve tenant from app_tid , if zid is missing in JWT token
  1. v1.16.1

    Fixes 2

    Notes
    Fixed
    • Migrate jest to vitest
    • Dependencies
  2. v1.16.0

    Features 1, Fixes 2

    Notes
    Added
    • CDS 10
    Fixed
    • Propagate subdomain to logs (if available)
    • Align sap-message header with the specification
  3. v1.15.12

    Features 1, Fixes 1

    Notes
    Fixed
    • Support cds.middlewares.before in adapter before middlewares
    Added
    • Adapter option cds.cov2ap.toggles: true propagates CDS toggles into OData V2 request (applying cds.middlewares.before)
  4. v1.15.11

    Fixes 1

    Notes
    Fixed
    • Fix model enhancements via features toggles (req.features)
  5. v1.15.10

    Fixes 1

    Notes
    Fixed
    • Make parameterized view ref resolution more resilient
  6. v1.15.9

    Fixes 2

    Notes
    Fixed
    • Fixes for Express 5 (with CDS 9.7)
    • Mass compile EDMX for all services on CDS build task, via env cds.cov2ap.build: "all"
  7. v1.15.8

    Fixes 1

    Notes
    Fixed
    • Express 5 (with CDS 9.7)
  8. v1.15.7

    Fixes 1

    Notes
    Fixed
    • Parse 'null' parameter string value as null for actions, when not quoted explicitly
  9. v1.15.6

    Fixes 1

    Notes
    Fixed
    • Fix metadata etag handling
  10. v1.15.5

    Fixes 1

    Notes
    Fixed
    • Trusted publishing
  11. v1.15.4

    Fixes 4

    Notes
    Fixed
    • Consume file upload stream in error case
    • Option jsonDateOffset: false to suppress timezone offset in JSON date serialization
    • Draft messages are not (yet) supported for OData V2
    • Projects using CDS OData V2 Adapter need to set cds.fiori.draft_messages: false
  12. v1.15.3

    Fixes 1

    Notes
    Fixed
    • Query parameter value undefined is not passed on
  13. v1.15.2

    Fixes 2

    Notes
    Fixed
    • Use node-fetch library to support http(s) agent
    • Allow dynamic http(s) agent via req.agent in cds.cov2ap.before middleware
  14. v1.15.1

    Fixes 2

    Notes
    Fixed
    • Paths with leading slash / are handled resiliently
    • Option httpAgent to pass http(s) agent to requests
  15. v1.15.0

    Fixes 1

    Notes
    Fixed
    • CDS 9 compatibility
  16. v1.14.4

    Fixes 1

    Notes
    Fixed
    • Body parser limit defaults to cds.server.body_parser.limit
  17. v1.14.3

    Fixes 1

    Notes
    Fixed
    • Housekeeping
  18. v1.14.2

    Fixes 5

    Notes
    Fixed
    • Specific logger component for http proxy middleware
    • Expose count in response for Atom (XML) format
    • Escape XML entities in values for Atom (XML) format
    • Option excludeNonSelectedKeys: true to exclude non-selected keys from response (OData V4 auto-includes keys)
    • Serialize date with empty value correctly
  19. v1.14.1

    Fixes 2

    Notes
    Fixed
    • Fix content-type for failing $metadata call
    • Update supported CDS types for OData V2
  20. v1.14.0

    Fixes 4

    Notes
    Fixed
    • Support deactivation of IEEE754 compatibility for OData V2
    • With ieee754Compatible: false numbers are represented as JSON numbers (not strings anymore)
      • JSON numbers may lose precision with this configuration due to number conversion
    • Make request and response data conversion more stable
    • Fix util.extend() Node 22 warning
  21. v1.13.8

    Fixes 2

    Notes
    Fixed
    • Option to disable route registration on CDS listening via registerOnListening: false
    • Document that cds.Map is not supported
  22. v1.13.7

    Fixes 1

    Notes
    Fixed
    • Update documentation
  23. v1.13.6

    Fixes 2

    Notes
    Fixed
    • Decode $ in __next link
    • Make multipart/mixed parser more robust for blank line detection
  24. v1.13.5

    Fixes 1

    Notes
    Fixed
    • Fix __next link to be url component encoded (e.g. + needs to be encoded)
  25. v1.13.4

    Fixes 1

    Notes
    Fixed
    • Tenant validation
  26. v1.13.3

    Fixes 1

    Notes
    Fixed
    • Convert Draft Administrative Data correctly in response
  27. v1.13.2

    Features 2

    Notes
    Added
    • ESLint 9
    • Hierarchy Tests
  28. v1.13.1

    Fixes 2

    Notes
    Fixed
    • CDS New OData Adapter compatibility
    • Fix action call without return value
  29. v1.13.0

    Features 2

    Notes
    Added
    • CDS 8 compatibility
    • Use base model for CDS build task
  30. v1.12.12

    Features 2, Fixes 1

    Notes
    Fixed
    • Set content-length header correctly for OData V4 request in batch mode
    Added
    • CI Matrix Test Node 22
    • Test with Postgres
  31. v1.12.11

    Fixes 5

    Notes
    Fixed
    • Improve expand/select handling and support * notation
    • Expose CDS OData V2 Adapter singleton instance from CDS plugin at cds.cov2ap
    • Allow to register before express routes for CDS OData V2 Adapter router via cds.cov2ap.before
    • Option to cache and stream generated EDMX from disk instead of keeping it in memory
    • Use new cds.build.register API version
  32. v1.12.10

    Fixes 4

    Notes
    Fixed
    • Fix expand and select of navigation properties
    • Fix error response for errors during media stream read
    • Do not log authorization header in debug traces
    • Decode request url for debug traces
  33. v1.12.9

    Fixes 3

    Notes
    Fixed
    • Adopt new http proxy middleware
    • Remove odata-version header from request
    • Remove obsolete documentation about cds.odata.v2proxy.urlpath as now derived from protocols
  34. v1.12.8

    Fixes 5

    Notes
    Fixed
    • Convert OData V2 date string more relaxed allowing optional backslashes before forward slashes
    • Fix definition element cache for prototypes
    • Freeze definition element cache to prevent modification and store it as symbol
    • Option to disable definition cache via cacheDefinitions: false
    • ESLint interface typings correctly
  35. v1.12.7

    Fixes 1

    Notes
    Fixed
    • Fix build task for projects without MTX sidecar
  36. v1.12.6

    Fixes 7

    Notes
    Fixed
    • Support OData V2 CDS protocol annotation via (@protocol: [{ kind: 'odata-v2', path: '<path>' }])
    • Expose OData V2 service at specified odata-v2 protocol path, in addition to default endpoint
    • Make pipeline stream errors only warnings as root cause is already logged
    • Serve OData V2 Adapter routes always after CDS listening (also for non-plugin case)
    • Fix build task in case of compilation errors
    • Fix build task to also include pre-compiled OData V2 EDMX files in srv
    • Fix build task for Java
  37. v1.12.5

    Fixes 2

    Notes
    Fixed
    • Make data type conversion of values more robust
    • Fix bound action call error, where action parameter name also is an entity element name
  38. v1.12.4

    Fixes 2

    Notes
    Fixed
    • Fix undefined access for message filtering
    • Remove header connection for propagation via fetch
  39. v1.12.3

    Fixes 4

    Notes
    Fixed
    • Fix definition lookup for suffixed entity names (e.g. .texts)
    • Support message target context relative to draft root
    • Support request header sap-messages: transientOnly" where state messages with target not starting with /#TRANSIENT are removed
    • Log message target context resolution issues as reduced level (debug)
  40. v1.12.2

    Fixes 2

    Notes
    Fixed
    • Build task only applicable if MTX sidecar is active
    • Use adapter singleton in CDS plugin
  41. v1.12.1

    Fixes 1

    Notes
    Fixed
    • Apply defaults in plugin build
  42. v1.12.0dated in the atlas

    Removed 2, Features 6

    Notes
    Removed
    • Drop Node.js 16 support (as out-of-maintenance)
    • Replace node-fetch by standard fetch
    Added
    • Support Node.js 20 (as new active)
    • Default of target changed to auto
    • Activate CDS plugin per default (can be disabled with option plugin: false)
    • Activate CDS build to precompile OData V2 metadata per default (can be disabled with option build: false)
    • Start CDS OData V2 adapter as CDS plugin in test setup
    • Protect against double instantiation, when loaded via CDS plugin
  43. v1.11.12

    Fixes 1

    Notes
    Fixed
    • Replace deprecated access (CDS 7.5)
  44. v1.11.11

    Fixes 1

    Notes
    Fixed
    • Convert transient message target without warning
  45. v1.11.10

    Fixes 9

    Notes
    Fixed
    • Respect return type for unbound actions/functions for message target resolution
    • Convert transient and absolute message targets correctly
    • Access prepared EDMX files if existing, otherwise compile like before
    • Register build plugin to prepare V2 metadata (enabled via adapter option build: true)
    • Skip conversion for element name only message targets
    • Check ModelProviderService before access
    • Service annotation @cov2ap.ignore to exclude service from OData V2 adapter
    • Log error with status code 400 as warning (before it was error)
    • Replace deprecated substr usages
  46. v1.11.9

    Fixes 4

    Notes
    Fixed
    • Support union queries as parameterized views
    • Fix pull requests actions for external contributions
    • Simplify plugin detection again
    • Performance improvements
  47. v1.11.8

    Fixes 2

    Notes
    Fixed
    • Automatically activate plugin, if mentioned explicitly in cds.plugins
    • Move custom server section in README under advanced section, as plugin is the preferred way to bootstrap adapter
  48. v1.11.7

    Features 1, Fixes 2

    Notes
    Added
    • Set CDS OData V2 protocol
    Fixed
    • Fix absolute service path starting with target path parts e.g. /odata
    • Fix escaping of backslashes in search phrases
  49. v1.11.6

    Features 1, Changed 1

    Notes
    Changed
    • Switch to better-sqlite3 via @cap-js/sqlite
    Added
    • Suppress analytical conversion via entity annotation @cov2ap.analytics.skipForKey, if all dimension key elements are requested
  50. v1.11.5

    Fixes 2

    Notes
    Fixed
    • Respect new service endpoints
    • Support entity names with special characters
  51. v1.11.4

    Fixes 1

    Notes
    Fixed
    • Remove support for serve_on_root. Define path explicitly to v2 to restore previous behavior
  52. v1.11.3

    Fixes 1

    Notes
    Fixed
    • Fix absolute OData V4 paths for $batch calls
  53. v1.11.2

    Fixes 1

    Notes
    Fixed
    • Fix $metadata request for absolute OData V4 paths
  54. v1.11.1

    Fixes 1

    Notes
    Fixed
    • Fix compatibility for option middlewares disabled or feature serve_on_root enabled
  55. v1.11.0

    Features 3

    Notes
    Added
    • CDS 7 support
    • Default route with CDS < 7 or option middlewares disabled or feature serve_on_root enabled stays v2
    • Default route with CDS >= 7 is /odata/v2
  56. v1.10.6

    Fixes 1

    Notes
    Fixed
    • Fix metadata type for managed composition entities and sub-entities
  57. v1.10.5

    Fixes 3

    Notes
    Fixed
    • Replace deprecated usage of req.run with cds.run
    • Update of node-fetch
    • Remove soon deprecated req.getUriInfo
  58. v1.10.4

    Fixes 1

    Notes
    Fixed
    • Fix start of cds.plugin
  59. v1.10.3

    Fixes 1

    Notes
    Fixed
    • Fix access to undefined element during data conversion
  60. v1.10.2

    Fixes 1

    Notes
    Fixed
    • Convert array structures
  61. v1.10.1

    Features 1, Fixes 1

    Notes
    Added
    • Bootstrapping via CDS plugin (cds.cov2ap.plugin: true)
    Fixed
    • Update xml2js dependency to fix security vulnerability
  62. v1.10.0

    Features 1, Fixes 1

    Notes
    Added
    • Transition to open source code
    Fixed
    • Bound entity operation result is correctly nested with entity name prefix
  63. v1.9.21

    Removed 1

    Notes
    Removed
    • Deprecation of inner source library
  64. v1.9.20

    Fixes 3

    Notes
    Fixed
    • Cache invalidation for Streamlined MTX (extensibility enabled) with CDS 6.6.1
    • Use named parameters for mtxs actions to protect against incompatible changes
    • Allow status code 304 (not modified) when reading OData V4 metadata (as success)
  65. v1.9.19

    Fixes 4

    Notes
    Fixed
    • Provide subdomain information to logs
    • Use correct correlation-id for logging (setup CDS context correctly)
    • React to incompatible change of mtxs getEdmx, to provide (internal) model parameter
    • Enhance example app to show usage of bound/unbound OData V2 actions in Fiori UI via annotation
  66. v1.9.18

    Fixes 1

    Notes
    Fixed
    • Unicode encode messages header
  67. v1.9.17

    Fixes 1

    Notes
    Fixed
    • Fix special replacement pattern in $filter conversion
  68. v1.9.16

    Fixes 4

    Notes
    Fixed
    • Reject proxy processing of non OData services
    • Use stream pipeline for result streaming
    • Proxy does not end request to target anymore after writing body
    • Document that managed compositions will not work correctly in Fiori Elements V2
  69. v1.9.15

    Fixes 2

    Notes
    Fixed
    • Keep ID__ parameter as query option for bound action/function on analytical entities
    • Remove introduced query option select for bound action calls on analytical entities again
  70. v1.9.14

    Fixes 7

    Notes
    Fixed
    • Provide value section of ID__ aggregation key as query option select to bound action handler
    • Accept aggregation annotations in lowercase and uppercase writing
    • Support @Aggregation.ReferenceElement and @Aggregation.Reference annotations to perform aggregation on different element
    • Only a single aggregation reference element is supported, specified as array with single element, e.g. ['element']
    • Cast aggregation values of #COUNT_DISTINCT to Integer type to be represented as number (not as string), if typed accordingly
    • Map default aggregation #COUNT to virtual property $count of $apply
    • Remove unneeded temporary aggregation $COUNT. Use #COUNT instead.
  71. v1.9.13

    Fixes 3

    Notes
    Fixed
    • Escape entity key value for bound action key parameter mapping
    • Support action parameters that overload bound entity key names
    • Support action/function on analytical entities via ID__ aggregation key
  72. v1.9.12

    Fixes 1

    Notes
    Fixed
    • Fix $metadata lookup with query options
  73. v1.9.11

    Fixes 5

    Notes
    Fixed
    • Support new CDS integer types
    • Fallback target auto to default target until dynamic target/port assignment is available
    • Prevent loading OData V4 $metadata when OData V2 $metadata is requested
    • Fix draft requests re-write for $filter
    • Proxy option to disable x-forwarded header processing (processForwardedHeaders: false)
  74. v1.9.10

    Fixes 3

    Notes
    Fixed
    • Atom (XML) format fixes
    • Trim spaces for filter function parameter transformations
    • Allow passing proxy options as command line env (camelCase to snake_case, escape _ by doubling)
  75. v1.9.9

    Fixes 2

    Notes
    Fixed
    • Fix logging layers and debug trace activation
    • Connect cds.log with http-proxy-middleware
  76. v1.9.8

    Fixes 5

    Notes
    Fixed
    • Fix data type conversion for single attribute value responses (incl. $value)
    • Fix response mapping of parameters for Parameters entity
    • Respect $format=json for service root document
    • Introduce proxy options to specify OData default format (default is json)
    • Atom (XML) format support
  77. v1.9.7

    Fixes 6

    Notes
    Fixed
    • Respect $select filter for deferreds structure
    • Fix definition lookup for service entities with scoped name
    • Fix definition lookup for unbound service operations (actions, functions) with scoped name
    • Improve Kibana logging even more
    • Use project specific logger
    • Document that option fileUploadSizeLimit only applies to uploads via POST using multipart/form-data requests
  78. v1.9.6

    Fixes 3

    Notes
    Fixed
    • Improve Kibana logging
    • Improve error and warning logging messages
    • Make log level of Changeset order deviation configurable via changesetDeviationLogLevel. Default is now 'info'.
  79. v1.9.5

    Fixes 4

    Notes
    Fixed
    • Fix media upload via associations/compositions using POST
    • Fix duplication of streaming request data for media entity (chunked)
    • Fix result structure for parameterized entities entry addressed by key (object or not found)
    • Update README on sample apps
  80. v1.9.4

    Fixes 3

    Notes
    Fixed
    • Remove logging library @sap/logging. Use cds.log instead.
    • Remove obsolete proxy option disableNetworkLog
    • Proxy option fixDraftRequests suppresses unsupported draft expand to SiblingEntity and injects SiblingEntity: null
  81. v1.9.3

    Fixes 1

    Notes
    Fixed
    • Fix batch handling of parameterized entities
  82. v1.9.2

    Fixes 2

    Notes
    Fixed
    • Check on cds.mtx.eventEmitter before access
    • Restructure README
  83. v1.9.1

    Fixes 7

    Notes
    Fixed
    • Compile CSN for Node.js when loaded from CDS MTX services
    • Check on cds.requires.multitenancy instead of deprecated cds.requires.db.multiTenant (compatible)
    • Support $count with parameterized entities
    • Make decoding of JWT token body more robust (error log in case of invalid JWT)
    • Synchronize parallel loading of CSN and EDMX
    • First (alpha) support for CDS Streamlined MTX (no extensibility support yet)
    • Move @types/express to devDependencies
  84. v1.9.0

    Fixes 3

    Notes
    Fixed
    • CDS 6 compatible version
    • Enhance proxy option target with mode auto to handle dynamic target/port assignment (e.g. for unit-tests)
    • Represent time component of cds.Date/Edm.DateTime with second precision (i.e. 00:00:00)
  85. v1.8.21

    Fixes 3

    Notes
    Fixed
    • Add Type suffix to fix __metadata.type for parameterized entities (datajs did skip date type conversion)
    • Fix parameterized entities navigation links
    • Enhance Fiori Elements example apps
  86. v1.8.20

    Fixes 4

    Notes
    Fixed
    • Change README on Approuter compression flag compressResponseMixedTypeContent
    • Fill and process surrogate key ID__ correctly in case of analytical queries
    • Add an example Fiori Elements applications showcasing hierarchical TreeTable usage
    • Rework UI application examples (basic, draft and hierarchy apps)
  87. v1.8.19

    Fixes 1

    Notes
    Fixed
    • Don't propagate host header to forwarded calls.
  88. v1.8.18

    Fixes 1

    Notes
    Fixed
    • Propagate all headers to forwarded calls.
  89. v1.8.17

    Fixes 3

    Notes
    Fixed
    • Filter out annotation elements in response data starting with odata. or including @odata..
    • Elements starting with @ are excluded as before.
    • Propagate special headers to forwarded calls (i.e. starting with dwc).
  90. v1.8.16

    Fixes 2

    Notes
    Fixed
    • Fix if elements are annotated with @cds.api.ignore
    • Abort file upload when limit is reached
  91. v1.8.15

    Fixes 7

    Notes
    Fixed
    • Remove internal repository reference
    • Document that Singletons are not available in OData V2
    • Ignore omitted elements annotated with @cds.api.ignore
    • Support validated for absolute context urls via cds.odata.contextAbsoluteUrl.
    • Skip aggregation for measures with aggregation #NONE and #NOP
    • Support $count aggregations for measures with aggregation #COUNT
    • Changed OData type mapping for Edm.Byte to cds.Integer
  92. v1.8.14

    Fixes 1

    Notes
    Fixed
    • Upgrade @sap/logging to fix vulnerability
  93. v1.8.13

    Fixes 1

    Notes
    Fixed
    • Remove peer dependency to prevent workspace failures
  94. v1.8.12

    Fixes 3

    Notes
    Fixed
    • Refactorings to support universal CSN
    • Refactorings to support metadata prototype layering
    • Include search in $apply aggregations
  95. v1.8.11

    Fixes 2

    Notes
    Fixed
    • Fix for falsy values during data type conversion for functions and actions
    • Add OData V2 links via link providers to HTML index page
  96. v1.8.10

    Fixes 3

    Notes
    Fixed
    • Refactor locale determination from CDS
    • Serialize body to string in case of type object before calculating content length
    • Support AnalyticalContext annotations in addition to deprecated Analytics annotations
  97. v1.8.9

    Fixes 1

    Notes
    Fixed
    • Stabilization fixes
  98. v1.8.8

    Fixes 1

    Notes
    Fixed
    • Proxy option calcContentDisposition to calculate content-disposition header even if already available
  99. v1.8.7

    Fixes 1

    Notes
    Fixed
    • Proxy option fixDraftRequests to convert unsupported draft request to a working version (default: false)
  100. v1.8.6

    Fixes 4

    Notes
    Fixed
    • Fix README for combined custom backend bootstrap
    • Allow annotation @odata.type in lower case format
    • Allow type prefix datetime in addition to datetimeoffset
    • Add peer dependency @types/express
  101. v1.8.5

    Fixes 3

    Notes
    Fixed
    • Prevent additional call to fill content-disposition, in case header is already provided with stream
    • Support OData V2 binary media upload via POST for entities with element of type Binary and without @Core.MediaType annotations
    • Return server error as response, if OData V4 server does not support media upload without @Core.MediaType annotation
      • e.g. No payload deserializer available for resource kind 'PRIMITIVE' and mime type 'image/png'
  102. v1.8.4

    Fixes 1

    Notes
    Fixed
    • Unquote action/function parameter of types cds.UUID, cds.Binary, cds.LargeBinary, cds.Date, cds.Time, cds.DateTime, cds.Timestamp
  103. v1.8.3

    Fixes 5

    Notes
    Fixed
    • Prevent parsing body for HEAD requests against $batch
    • Fix single quotes of URL parameters for request body conversion respecting line breaks
    • Introduce proxy option quoteSearch to control search expression quoting. Default is true
    • Fix bound action call to entity key having association type
    • Fix action/function parameter of types date, time, datetime
  104. v1.8.2

    Fixes 3

    Notes
    Fixed
    • Catch and handle unexpected errors during proxy request processing
    • Validate request body and content-type in request
    • Switch of internal NPM repository (Nexus -> Artifactory)
  105. v1.8.1

    Fixes 4

    Notes
    Fixed
    • Change action/function return type value representation for primitive types to include nesting to conform to OData standard
    • Introduce proxy options returnPrimitiveNested: false to keep previous action/function return value representation for primitive types
    • Introduce proxy option returnCollectionNested to control collection of entity type nesting into a results section. Default is true
    • Fill standardized x-correlation-id request header in addition to x-correlationid for proxy requests
  106. v1.8.0

    Fixes 7

    Notes
    Fixed
    • Add README documentation for annotation @Core.ContentDisposition.Type
    • Change content-disposition header default from inline to attachment
    • Proxy option contentDisposition to specify default content disposition for media streams (inline, attachment)
    • Unescape single quotes of action URL parameters for request body conversion
    • Fix action/function return type representation for cds.LargeString
    • Improve formatting of README and CHANGELOG
    • Adjust repository url
  107. v1.7.16

    Fixes 2

    Notes
    Fixed
    • Content-Disposition header filename is now url encoded
    • Annotation @Core.ContentDisposition.Type to specify content disposition type (e.g. inline, attachment (default), etc.)
  108. v1.7.15

    Fixes 1

    Notes
    Fixed
    • Quote key parts of type cds.LargeString for uri generation
  109. v1.7.14

    Fixes 1

    Notes
    Fixed
    • Decode url key values before conversion
  110. v1.7.13

    Fixes 1

    Notes
    Fixed
    • Escape quotes in search string before quoting
  111. v1.7.12

    Fixes 3

    Notes
    Fixed
    • Proxy option propagateMessageToDetails to always propagate root error or message to details section
    • Support for fetching Edmx metadata locally via cds.mtx.getEdmx
    • Support for fetching Edmx metadata remotely via MTX service url
  112. v1.7.11

    Fixes 3

    Notes
    Fixed
    • Convert ContentID for warning messages and error body and propagate to details
    • Fix batch boundary parsing from content type with charset definition
    • Functions startswith and endswith respect proxy option caseInsensitive
  113. v1.7.10

    Fixes 2

    Notes
    Fixed
    • Fix query options not part of action parameters
    • Proxy option caseInsensitive to transform search function e.g. substringof to case-insensitive variant
  114. v1.7.9

    Fixes 3

    Notes
    Fixed
    • Add metadata type of inline return type for actions and functions
    • Proxy option messageTargetDefault to specify default message target, if undefined
    • Empty proxy option messageTargetDefault leaves message target untouched
  115. v1.7.8

    Fixes 1

    Notes
    Fixed
    • Support for verb tunneling, i.e., POST with X-HTTP-Method header
  116. v1.7.7

    Fixes 4

    Notes
    Fixed
    • Support inline return type for actions and functions
    • Default undefined message target to /#TRANSIENT#
    • Return 404 for unknown service name during model compilation
    • Enhance logging to contain service name for service lookup from request
  117. v1.7.6

    Fixes 1

    Notes
    Fixed
    • Prevent exception on handling entities without keys
  118. v1.7.5

    Fixes 1

    Notes
    Fixed
    • Prevent unnecessary expensive isExtended call per request using metadata cache
  119. v1.7.4

    Fixes 3

    Notes
    Fixed
    • Support annotation @odata.Type for non-UUID CDS types
    • Set header x-cds-odata-version: v2 to indicate target OData version to CDS runtime
    • Explain usage of response compression in README
  120. v1.7.3

    Fixes 2

    Notes
    Fixed
    • Change OData V4 continue-on-error default to false
    • Proxy option continueOnError: true available to activate continue-on-error
  121. v1.7.2

    Fixes 1

    Notes
    Fixed
    • Fix content type normalization to preserve charset
  122. v1.7.1

    Fixes 1

    Notes
    Fixed
    • Fix return type determination for external services definitions
  123. v1.7.0

    Fixes 2

    Notes
    Fixed
    • Change action/function return type value representation for complex and primitive types
    • Introduce proxy options returnComplexNested and returnPrimitivePlain to keep previous action/function return value representation
  124. v1.6.3

    Fixes 3

    Notes
    Fixed
    • Convert additional targets of response messages
    • Transform leading part of locale to lower-case
    • Fix local entity name determination for scoped entities, e.g. .texts
  125. v1.6.2

    Fixes 2

    Notes
    Fixed
    • Merge headers and body of POST and PUT media entity upload calls
    • Handle error case in PUT media entity upload call
  126. v1.6.1

    Fixes 1

    Notes
    Fixed
    • Handle authorization header correctly in media upload
  127. v1.6.0

    Fixes 1

    Notes
    Fixed
    • Final CDS 5 compatibility version
  128. v1.5.11

    Fixes 3

    Notes
    Fixed
    • CDS 5 compatibility (>= 1.6.0 needed for CDS 5)
    • Support content-disposition header in media entity upload
    • Introduction of element annotation @cov2ap.headerDecode to decode header values
  129. v1.5.10

    Fixes 2

    Notes
    Fixed
    • Fix crash for bound action without return type
    • Consider bound action binding parameter for messages targets
  130. v1.5.9

    Fixes 1

    Notes
    Fixed
    • Improve TypeScript typings
  131. v1.5.8

    Fixes 1

    Notes
    Fixed
    • Update @sap/logging dependency
  132. v1.5.7

    Fixes 1

    Notes
    Fixed
    • Restore backwards compatibility with CDS 3
  133. v1.5.6

    Fixes 1

    Notes
    Fixed
    • Convert response message targets
  134. v1.5.5

    Fixes 1

    Notes
    Fixed
    • Align determination of locale including sub tags (e.g. zh-TW)
  135. v1.5.4

    Fixes 2

    Notes
    Fixed
    • Support action/function array parameter types
    • Introduce proxy option bodyParserLimit for body parser size limit
  136. v1.5.3

    Fixes 1

    Notes
    Fixed
    • Improve TypeScript typings
  137. v1.5.2

    Fixes 1

    Notes
    Fixed
    • Add TypeScript typings for proxy constructor
  138. v1.5.1

    Fixes 1

    Notes
    Fixed
    • Normalize service root path in service root xml to include trailing slash
  139. v1.5.0

    Fixes 1

    Notes
    Fixed
    • Update minor version
  140. v1.4.63

    Fixes 1

    Notes
    Fixed
    • Fix that file upload error message does not return with 500 status code
  141. v1.4.61

    Fixes 1

    Notes
    Fixed
    • Fix accept header for binary data retrieval to include application/json
  142. v1.4.60

    Fixes 10

    Notes
    Fixed
    • Respect offset for Edm.DateTimeOffset, and default to UTC offset (+0000)
    • Fix ticks and offset calculation for type DateTimeOffset to handle offset as minutes
    • Update README for custom bootstrap to give proxy() priority over cds.serve (as with cds run)
    • Make authorization header parsing more robust
    • Provide __metadata type information for function/action result
    • Data format of type cds.Time (Edm.Time) is switchable to ISO 8601 with proxy option isoTime or entity annotation @cov2ap.isoTime
    • Data format of type cds.Date (Edm.DateTime) is switchable to ISO 8601 with proxy option isoDate or entity annotation @cov2ap.isoDate
    • Data format of type cds.DateTime / Edm.DateTimeOffset is switchable to ISO 8601 with proxy option isoDateTime or entity annotation @cov2ap.isoDateTime
    • Data format of type cds.Timestamp / Edm.DateTimeOffset is switchable to ISO 8601 with proxy option isoTimestamp or entity annotation @cov2ap.isoTimestamp
    • Process DateTimeOffset always as UTC information (with Z)
  143. v1.4.59

    Fixes 3

    Notes
    Fixed
    • Change accept header to application/json, if accept xml is requested
    • Fix single service support bound to root url
    • Data format of type Edm.DateTimeOffset (cds.DateTime, cds.Timestamp) is switchable to ISO 8601 with proxy option isoDateTimeOffset or entity annotation @cov2ap.isoDateTimeOffset
  144. v1.4.58

    Fixes 3

    Notes
    Fixed
    • Support boolean header value in media entity
    • Prevent escaping of quotes in url for batch requests
    • Add media_src and content-type in __metadata for media entities
  145. v1.4.57

    Fixes 2

    Notes
    Fixed
    • Match headers case-insensitive for custom body in media entity
    • Parse header string values for non-string types in media entity
  146. v1.4.56

    Fixes 2

    Notes
    Fixed
    • Enable OData V4 continue-on-error per default
    • Add proxy option to deactivate continue-on-error
  147. v1.4.55

    Fixes 2

    Notes
    Fixed
    • Fix host port in response links
    • Handle duplication of link tokens
  148. v1.4.54

    Fixes 5

    Notes
    Fixed
    • Support mapping of __next annotation
    • Forward file upload headers to media entity POST call
    • Explain annotation @Core.ContentDisposition.Filename in README
    • Update README on OData API flavors
    • Fix links for navigation collections and query options
  149. v1.4.53

    Fixes 3

    Notes
    Fixed
    • Support custom body for binary media upload via POST
    • Set Accept header for $batch proxy request to multipart/mixed
    • Set missing response header Content-Transfer-Encoding: binary
  150. v1.4.52

    Fixes 1

    Notes
    Fixed
    • Log warning for change set order violation, instead returning an error response
  151. v1.4.51

    Fixes 3

    Notes
    Fixed
    • Support OData V2 binary media upload via POST
    • Support OData V2 multipart/form-data media upload via POST
    • Update README on logging layers
  152. v1.4.50

    Fixes 5

    Notes
    Fixed
    • Rewrite batch success status code from 200 to 202
    • Remove OData V4 header odata-entityid
    • Propagate Content-ID in response to HTTP request headers
    • Remove artificially added Content-ID header from batch response
    • Fix Content-ID order check for deviations between request and response
  153. v1.4.49

    Fixes 2

    Notes
    Fixed
    • Fix entity uris with x-forwarded-path headers for OData batch calls
    • Support of odata-entityid header rewrite
  154. v1.4.48

    Fixes 2

    Notes
    Fixed
    • Fix entity uris with x-forwarded-path headers
    • Forward x-request-id, x-correlationid for metadata request
  155. v1.4.47

    Fixes 4

    Notes
    Fixed
    • Respect Content-ID in HTTP request headers
    • Update on peer dependencies
    • Update README on OData V2 Adapter for CAP Java
    • Update README on mission statement
  156. v1.4.46

    Fixes 2

    Notes
    Fixed
    • Update README on option cds.env.odata.v2proxy.urlpath
    • Delta response annotation @cov2ap.deltaResponse: 'timestamp'
  157. v1.4.45

    Fixes 3

    Notes
    Fixed
    • Prepare Delta Responses support in proxy (not yet supported by CDS)
    • Remove metadata information in request payload deeply
    • Update README on CDS modelling restrictions
  158. v1.4.44

    Fixes 4

    Notes
    Fixed
    • Rename proxy option standalone to mtxRemote
    • Allow proxy option mtxEndpoint to be absolute http url
    • Support for cds.env for proxy options under section cds.cov2ap
    • Update README and JSDoc documentation
  159. v1.4.43

    Fixes 5

    Notes
    Fixed
    • Fix $filter function conversion
    • Fix remote CSN fetch for standalone proxy
    • Fix @sap.aggregation.role annotation detection
    • Annotation @cov2ap.analytics: false to suppress analytical conversion
    • Update README documentation
  160. v1.4.42

    Fixes 1

    Notes
    Fixed
    • Add missing Content-ID header for batch changeset
  161. v1.4.41

    Fixes 4

    Notes
    Fixed
    • CDS 4 compatibility
    • Improve logging layers
    • Update README documentation
    • Improve JWT tenant processing
  162. v1.4.40

    Fixes 2

    Notes
    Fixed
    • Fix aggregation grouping on filtered elements
    • Support sap: analytical annotations
  163. v1.4.39

    Fixes 2

    Notes
    Fixed
    • Move annotation ContentDisposition.Filename to data element
    • Improve stability of content disposition
  164. v1.4.38

    Fixes 1

    Notes
    Fixed
    • Fix base proxy option (follow-up)
  165. v1.4.37

    Fixes 4

    Notes
    Fixed
    • Replace pathRewrite option by targetPath option
    • Fix base proxy option
    • Respect OData annotation @odata.Type
    • Alternative annotation @Common.ContentDisposition.Filename
  166. v1.4.36

    Fixes 2

    Notes
    Fixed
    • Fix escaping of quote for function parameters
    • SAP Fiori Elements V2 sample app
  167. v1.4.35

    Fixes 1

    Notes
    Fixed
    • Fix reserved uri characters (follow-up)
  168. v1.4.34

    Fixes 1

    Notes
    Fixed
    • Fix entity key with (encoded) reserved uri characters
  169. v1.4.33

    Fixes 3

    Notes
    Fixed
    • Service Document in XML format (default)
    • Update dependencies
    • Disable network log per default
  170. v1.4.32

    Fixes 4

    Notes
    Fixed
    • Update dependencies
    • Update README on localization
    • Toggle switch for network logging
    • Allow HANA SYSUUID as UUID
  171. v1.4.31

    Fixes 8

    Notes
    Fixed
    • Align model resolving
    • Fix data types conversion for numbers
    • Fix data types recognition in functions
    • Support response compression
    • Prevent unnecessary data serialization for tracing
    • Performance optimization for entity key/uri calculation
    • General performance optimizations
    • Update dependencies
  172. v1.4.30

    Fixes 4

    Notes
    Fixed
    • Make function call with request body more robust
    • Fallback severity for detail messages to error
    • Keep request body for action call
    • Update README on CF deployment
  173. v1.4.29

    Fixes 2

    Notes
    Fixed
    • Fix analytics default value for all OData types
    • Fix long running data type conversion for filter elements
  174. v1.4.28

    Fixes 5

    Notes
    Fixed
    • Fix $filter in analytics query
    • Fix count for empty analytics result
    • Fix result projection for analytics query
    • Fix analytics null result values
    • Only add root error, if no details messages
  175. v1.4.27

    Fixes 2

    Notes
    Fixed
    • Add root error as first detail message
    • Error code including transition marks transition message
  176. v1.4.26

    Fixes 3

    Notes
    Fixed
    • Fix $filter for navigation elements
    • Fix OData annotations conversion for Java backends
    • Add request authorization parsing for logging
  177. v1.4.25

    Fixes 1

    Notes
    Fixed
    • Add additional messages as details
  178. v1.4.24

    Fixes 2

    Notes
    Fixed
    • Fix for metadata transfer-encoding chunked
    • Filter @ attributes
  179. v1.4.23

    Fixes 1

    Notes
    Fixed
    • Fix type conversion for le operator
  180. v1.4.22

    Fixes 2

    Notes
    Fixed
    • Fix entity uri path behind app router
    • Update dependencies
  181. v1.4.21

    Fixes 2

    Notes
    Fixed
    • Improve $metadata logging
    • Fix $metadata call headers
  182. v1.4.20

    Fixes 1

    Notes
    Fixed
    • Fix CDS backwards compatibility
  183. v1.4.19

    Fixes 9

    Notes
    Fixed
    • Fix ETag Support (Concurrency Control)
    • Support streaming from URL media
    • Adding custom path rewrite
    • Custom server.js support
    • Fix for rendering aggregation of integers
    • Fix time duration parsing
    • Misc fixes and improvements
    • General housekeeping
    • Moving from axios to node-fetch
  184. v1.4.18

    Fixes 7

    Notes
    Fixed
    • Improve $value handling for streaming
    • Fix stream filename retrieval
    • Optimize edmx localization
    • Improve logging and tracing handling
    • Fix for external services (e.g. Java backend) support
    • Re-add services configuration for external service mapping
    • Fix for search phrase
  185. v1.4.17

    Fixes 4

    Notes
    Fixed
    • Support for virtual hosts (e.g. Cloud Connector)
    • Fix decode URI for path name
    • Fix IEEE754 compatibility for single requests
    • Add IEEE754 compatibility option switch
  186. v1.4.16

    Fixes 2

    Notes
    Fixed
    • Enforce IEEE754 compatibility
    • Pin axios library
  187. v1.4.15

    Fixes 2

    Notes
    Fixed
    • Fix authentication prompt for $metadata
    • Improve trace handling
  188. v1.4.14

    Fixes 4

    Notes
    Fixed
    • Protect $metadata call
    • Fix $filter parentheses nesting
    • Fix all model loading from app, srv
    • Improve $filter handling, incl. data type and negative tests
  189. v1.4.13

    Fixes 2

    Notes
    Fixed
    • Remove services configuration, as it is obsolete
    • Fix nested functions in $filter
  190. v1.4.12

    Fixes 1

    Notes
    Fixed
    • Fix service and CSN model detection
  191. v1.4.9

    Fixes 4

    Notes
    Fixed
    • Allow CSN JSON object as model option
    • Raise error, if service not found based on path
    • Fix service paths with hyphen
    • Fix cds.Date, cds.Time data type mappings
  192. v1.4.8

    Fixes 3

    Notes
    Fixed
    • Increased body size limit
    • Fix engine config, to allow Node >= 8
    • Map cds.DateTime and cds.Timestamp to Edm.DateTimeOffset
  193. v1.4.6

    Fixes 2

    Notes
    Fixed
    • Update on README documentation
    • Minor fixes
  194. v1.4.5

    Fixes 4

    Notes
    Fixed
    • __count is now of type String
    • Aggregation values are converted according to dynamic type
    • Search support
    • Fix for converting warning messages
  195. v1.4.4

    Fixes 1

    Notes
    Fixed
    • Filter data type conversions
  196. v1.4.3

    Fixes 2

    Notes
    Fixed
    • Check CDS multitenancy/extensibility (mtx)
    • Allow options that are falsy for Javascript
  197. v1.4.2

    Fixes 1

    Notes
    Fixed
    • Looser declaration or peer dependency to be compatible with snapshots
  198. v1.4.1

    Fixes 2

    Notes
    Fixed
    • Fixed compatibility to CDS 3.17.0
    • Propagate x-request-id, x-correlationid
  199. v1.4.0

    Fixes 3

    Notes
    Fixed
    • Raise error message for not supported aggregation function (e.g. #FORMULA)
    • Fixed entity key calculation for key associations
    • Fixed DateTime representation in entity key structure
  200. v1.3.0

    Fixes 2

    Notes
    Fixed
    • Passing through responses in XML (just for errors)
    • Data-type mapping on aggregation values works for non-strings
  201. v1.2.0

    Features 1

    Notes
    Added
    • External Release
  202. v1.0.0

    Features 1

    Notes
    Added
    • Internal Release
6,402downloads per week, npm
Weekly downloads for @cap-js-community/odata-v2-adapter26 complete calendar weeks from 2026-04-20 to 2026-10-18; the latest total is 6402.20 Apr – 26 Apr: 13,64927 Apr – 3 May: 10,6344 May – 10 May: 13,58111 May – 17 May: 13,39118 May – 24 May: 14,31625 May – 31 May: 13,1281 Jun – 7 Jun: 12,5338 Jun – 14 Jun: 13,33515 Jun – 21 Jun: 14,01022 Jun – 28 Jun: 12,36329 Jun – 5 Jul: 12,9286 Jul – 12 Jul: 13,67613 Jul – 19 Jul: 13,18620 Jul – 26 Jul: 14,25127 Jul – 2 Aug: 13,6673 Aug – 9 Aug: 14,11910 Aug – 16 Aug: 11,47417 Aug – 23 Aug: 13,49824 Aug – 30 Aug: 15,13031 Aug – 6 Sept: 12,0687 Sept – 13 Sept: 8,00014 Sept – 20 Sept: 12,69121 Sept – 27 Sept: 15,91428 Sept – 4 Oct: 15,2285 Oct – 11 Oct: 9,38912 Oct – 18 Oct: 6,402
OData
  1. com.sap.cds:cds-adapter-odata-v2OData V2 protocol adapter built into the CAP Java runtime
  2. com.sap.cds:cds-adapter-odata-v4OData V4 protocol adapter for CAP Java Application Services
  3. @odatano/coreCAP plugin serving the Cardano blockchain as OData V4
  4. @odatano/nightgateCAP plugin indexing the Midnight blockchain, exposed as OData V4
  5. @root3287/cap-segwCompiler from a CDS service to SEGW model and data provider classes
  6. @sap/cdsCAP Node.js runtime

Details

Sources5
npm registrydiscovered herechecked
capirediscovered here, pluginschecked
npm registry, @cap-js-community/odata-v2-adapterversion, releases, installschecked
github.com/git+https://github.com/cap-js-community/odata-v2-adapter.gittree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
runtimesnode
latestv1.16.2
first release
releases and cadence63, ~38d median
discovered vianpm registry, capire · plugins
first seen in the atlas
ecosystem and domaincap, protocols-and-apis
Contributors15
History in the atlas2
  1. OData V2
  2. First seen.
For your agent
Ref
artifact:cap-js-community-odata-v2-adapter
JSON
/artifacts/cap-js-community-odata-v2-adapter.json
MCP
Connecting an agent