CapabilityData & PersistenceNode.js, read from its artifacts

Data modelling

Defining the shape of the data before anything serves it — entities and types, aspects that carry cross-cutting concerns, associations and compositions, and the projections a service exposes. The question every CAP project answers first, and the one the rest of the corpus assumes has been answered.

Showing artifacts, examples and content with confirmed Node.js applicability. View All CAP

Overview

SAP SHIPS
@sap/cds-compiler

Compiles CDL to CSN, and CSN to the DDL of the configured database dialect, EDMX and the hdbtable and hdbview artifacts; cds deploy --dry prints the DDL without executing it.

@sap/cds

Compiles CDL from files or in-memory sources to CSN with cds.compile, and every generic handler reads the model through that CSN at runtime.

A Node.js coverage assessment has not been written. View all flavors

THE COMMUNITY ADDS
cap-user-info

Ships a reusable aspect and entity for user details: UserTracked extends managed, and UserInfo holds the record that createdBy and modifiedBy resolve to through the two associations _toCreatedUserInfo and _toModifiedUserInfo.

A Node.js coverage assessment has not been written. View all flavors

Artifacts5

5 of 5 artifacts
ArtifactSignals
Build tools1
@sap/cds-compilerCompiler from CDS models to CSN, EDMX and database schemas
Signals
none
CDS plugins2
cap-user-infoUser details and quickview links for createdBy and modifiedBy
Signals
none
cds-numberrange-pluginFills a CDS element from a database-backed number range
Signals
none
Packages2
@sap/cdsCAP Node.js runtime
Signals
none
@sap/cds-common-contentISO content for CAP's countries, languages, currencies and timezones
Signals
none

Content1

Group by
Piece, what it offers
A CAP Plugin for Flexible Number Range Management: cds-numberrange-plugin
SAP Community, abdulbasit, BlogThe reasoningRunnable code
A CAP Plugin for Flexible Number Range Management: cds-numberrange-plugin
SAP Community, abdulbasit, BlogThe reasoningRunnable code

Seen working2

ArtifactSignals
Samples2
SAP-samples/cap-cds-hands-onFive-part workshop on CDS, from a first service to constraints
none
SAP-samples/cloud-cap-hana-swapiCAP data model of many-to-many relationships on a Star Wars dataset
none

Details

What changed — and what it makes stale3
@sap/cds 9.9.0, CAP, Node.js

Declarative constraints (@assert) moved from Gamma to General Availability, and a bug in error reporting was fixed alongside it: every violation used to return the generic error code ASSERT regardless of which constraint failed; now the code returned is the one named in the constraint itself.

Makes stale:

Error-handling code or tests written against declarative constraints before April 2026 that match on a literal 'ASSERT' error code — they now see the constraint's own code instead.

@sap/cds 9.6.0, CAP, Node.js

The compiler gained a declarative validation annotation, at Gamma status. Before it, a check like 'reject if this field is missing or out of range' meant a custom before-handler in application code; after it, @assert: (<CXL expression>) on an element states the condition in the model itself and the runtime validates it on write.

Makes stale:

Advice that any conditional validation beyond @mandatory or @assert.range needs a handwritten handler. Since December 2025 a CXL expression in @assert covers much of that ground, model-side.

@sap/cds 8.0.3, CAP, Node.js

cds.compile.to.hana generates the hdbtable and hdbview artifacts and replaces cds.compile.to.hdbtable. Dated from the first 8.0 release published on npm.

Makes stale:

Build scripts and posts that call cds.compile.to.hdbtable.

Coverage
statecore and community, CAP, Node.js, derived
also inABAP
For your agent
Ref
capability:data-modelling
JSON
/capabilities/data-modelling.json
MCP
Connecting an agent