Usage Scenario / Introduction
Staying up-to-date with the latest features and improvements in the SAP Cloud Application Programming Model (CAP) is crucial for efficient and modern application development. Recent updates have introduced enhancements that significantly improve the development experience, application performance, and deployment capabilities within the Node.js environment. This lesson highlights these changes, providing you with the knowledge to leverage them effectively in your projects.
Tooling and Testing Improvements
The cds-dk (Development Kit) and testing framework have received major updates to streamline development workflows:
- cds test 1.0 (GA): The testing framework is now generally available, offering a stable and powerful way to write and run tests for CAP applications. It includes built-in support for vitest, allowing you to leverage modern testing features like fast execution and excellent developer experience.
- cds repl --ql: A new REPL mode that allows you to interactively execute CQL (CDS Query Language) statements against your services, making it easier to explore data and test queries during development.
- cds export: This command facilitates data migration by exporting data from your database into various formats, simplifying the process of moving data between environments or preparing test data.
- cds debug --k8s: Debugging is now supported for Kubernetes/Kyma deployments, allowing developers to step through code running in containerized environments directly from their local IDE.
Language and Compiler Updates
The CDS language and compiler have been enhanced to support more complex scenarios and improve developer productivity:
- Declarative Constraints (GA): You can now define database-level constraints (like unique or check) directly in your CDS models. These are automatically translated to the underlying database schema, ensuring data integrity at the source.
- Vector Embeddings: CAP now supports vector types and similarity searches for H2, SQLite, and PostgreSQL (via pgvector). This enables the development of AI-powered applications that require vector storage and retrieval.
- Extending Views with CQL: You can now extend existing views with additional CQL clauses like where, group by, or order by, providing greater flexibility in customizing service definitions without modifying the original source.
- Automatic Loading from app/*: The compiler now automatically loads CDS files found in the app/ directory, reducing the need for manual imports and simplifying project structure.
Service and Runtime Enhancements
The Node.js runtime has been optimized for performance and modern standards:
- Node.js v22 Support: CAP now requires Node.js v22 as the minimum version, allowing the framework to leverage the latest performance improvements and language features of the Node.js ecosystem.
- Native node:sqlite: The framework now uses the native SQLite driver provided by Node.js, reducing external dependencies and improving startup times for local development.
- Native Fetch API: The internal HTTP client has been migrated to the native Fetch API, replacing axios. This aligns with modern web standards and reduces the bundle size of applications.
- Parallel GETs in $batch: OData $batch requests containing multiple GET operations can now be processed in parallel by the runtime, significantly improving the response time for complex UI screens.
- Express 5 Support: Full support for Express 5 is available, bringing performance improvements and enhanced security features to the CAP web server.
Deployment and Extensibility
New features for enterprise-grade deployments and extensibility include:
- Change Tracking v2: A new version of the change tracking plugin uses database triggers for improved performance and reliability, ensuring that all data changes are accurately captured with minimal overhead.
- @hierarchy Annotation: Native support for hierarchical data structures is now available via the @hierarchy annotation, simplifying the modeling and querying of tree-like data.
- mtx-upgrade for Kyma: Improved tooling for upgrading multitenant applications deployed on SAP BTP, Kyma runtime, ensuring a smooth transition for tenant-specific database schemas.
Summary
- The SAP Cloud Application Programming Model (CAP) continues to evolve with a focus on developer productivity, performance, and AI readiness.
- Key updates include the GA of cds test, support for Vector Embeddings, and the adoption of Node.js v22 and native APIs.
- These enhancements streamline development workflows, improve application performance, and provide robust options for enterprise deployment on SAP BTP.