PackagePackagetypeA library you install and call yourself.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →

@cap-js/cds-types

Type definitions for the CAP Node.js SDK.

Facts

Latestv0.20.0ReleasedLast pushLicenceApache-2.0

Where it sits

Lives in
Provides
TypingCAPTypingcapabilityMaking the model visible to the compiler — generated types for entities and events so a rename breaks the build rather than production.
Flavors
Node.jsfrom its runtime
Requires
@sap/cds≥ 9.0.0@sap/cdsartifactThe peer range, as published.

Who is behind it

SAP Cloud Application Programming ModelSAP Cloud Application Programming ModelOrganisationMaintains this
In the atlas: maintains 34
@cap-js
maintainerJohannes VogtPersonContributes to this
In the atlas: maintains 1, contributes to 28, wrote 10
@Akatuoro
Andreas SchmidtPersonContributes to this
In the atlas: contributes to 6
@aschmidt93
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
Daniel O'GradyPersonContributes to this
In the atlas: contributes to 10
@daogrady
OlenaPersonContributes to this
In the atlas: contributes to 11
@etimr
Tomas RimkusPersonContributes to this
In the atlas: contributes to 4
@hakimio
Heiko WitteborgPersonContributes to this
In the atlas: contributes to 18
@hm23
Jörg MannPersonContributes to this
In the atlas: contributes to 4
@joergmann
Johannes VogelPersonContributes to this
In the atlas: contributes to 25
@johannes-vogel
23 contributors

What it declares

Every artifact

Type
Package
Origin
By SAP
Runtime
Node.js

As a package

Declared for
>=9.0.0
Where it runs
does not say
Distributed through
does not say

Connections1

Install

npm add @cap-js/cds-types

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

README

quoted from cap-js/cds-types under Apache-2.0, read
cap-js/cds-types/README.mdOn GitHub

cds-types

REUSE status Unit Tests passing npmjscom downloads deps

main test main integration test main lint

About this Project

Contains type definitions for the Node.js SDK of the SAP Cloud Application Programming Model (CAP).

Requirements and Setup

Just install package @sap/cds into a Javascript or Typescript project, and the types will automatically be available in modern IDEs like VS Code.

Find more information on the APIs in the Node.js SDK documentation.

Note to Microsoft Windows Users

If you rename your project after you installed the type definitions on Windows, you have to rerun npm install to correctly recreate the symlink node_modules/@types/sap__cds.

Support, Feedback, Contributing

Local Setup

After cloning, just run

npm run setup

which installs all dependencies.

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.

Security / Disclosure

If you find any bug that may be a security problem, please follow our instructions at in our security policy on how to report it. Please do not create GitHub issues for security-related doubts or problems.

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 2019-2024 SAP SE or an SAP affiliate company and cds-types 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

v0.20.0

Removed, Deprecated, Security, Features 2, Changed, Fixes

Notes
Added
  • Added service.schedule(...).as(<name>)
  • Added cds.utils.ms4(...)
Changed
Deprecated
Removed
Fixed
Security
  1. v0.19.0

    Removed, Deprecated, Security, Features 6, Changed 2, Fixes 1

    Notes
    Added
    • Added types for req.req and req.res in cds.Request
    • cds.User now has an authInfo property typed against @sap/xssec's SecurityContext. @sap/xssec is an peer dependency.
    • cds.ql is now typed as a callable universal converter: tagged template, function accepting a CQN object, or plain string — all returning SELECT<unknown>
    • CXL helper functions (ref, val, expr, columns, expand, where, orderBy) are now exported from cds.ql and can be destructured from it
    • cds.parse.cql, cds.run, and cds.read now accept tagged template literals
    • Service.run(query) now proxies the entity type of the contained query through to the return type
    Changed
    • Bound action handlers now keep req.subject typed as the bound action's instance type (__self) instead of a class/ref hybrid.
    • Subject-based query overloads (SELECT.from, SELECT.one.from, UPDATE, DELETE) now derive the entity class from the passed subject instance to preserve typed query results.
    Deprecated
    Removed
    Fixed
    • Types for SELECT.one includes undefined
    Security
  2. v0.18.0dated in the atlas

    Removed, Deprecated, Security, Features, Changed 1, Fixes

    Notes
    Added
    Changed
    • Installing @cap-js/cds-types no longer executes a postinstall script that creates a symlink in node_modules/@types. Instead, use a paths entry in your tsconfig.json. This entry can be created by running cds add typescript in your project.
    Deprecated
    Removed
    Fixed
    Security
  3. v0.17.0

    Removed, Deprecated 2, Security, Features 3, Changed 4, Fixes

    Notes
    Added
    • Types for nested .where and .having predicates
    • Passing events generated by cds-typer into service.on now offers code completion for the event's properties in the handler
    • Allow all events that can be used in service.on to be used in service.once as well
    Changed
    • ResultHandler now returns unknown instead of void, to accommodate asynchronous functions when having @typescript-eslint/strict-void-return activated
    • Documentation for cds.test.axios mentioning that @cap-js/cds-test@1 now returns an axios facade in absence of axios.
    • made cds.context.locale optional
    • cds.tx(ƒ) now returns the return type of ƒ
    Deprecated
    • cds.test.chai, cds.test.assert pointing to either cds.test.expect or a custom import of chai.
    • cds.test.axios in favor of cds.test.defaults
    Removed
    Fixed
    Security
  4. v0.16.0

    Removed, Deprecated 2, Security, Features 3, Changed, Fixes 3

    Notes
    Added
    • Added Request.messages, Request.errors and Request.results
    • Types for SELECT.stream()
    • service.actions
    Changed
    Deprecated
    • service.operations
    • Undocumented service.entities(), service.events(), service.types(), and service.operations()
    Removed
    Fixed
    • Types for req.error() et al.
    • Types for cds.error()
    • Type for cds.middlewares.before
    Security
  5. v0.15.0

    Removed, Deprecated, Security, Features 3, Changed, Fixes

    Notes
    Added
    • Allow array-like params in CQN.expr via { list: [...] } syntax
    • Types for cds.error()
    • GetRequest and PostRequest types
    Changed
    Deprecated
    Removed
    Fixed
    Security
  6. v0.14.0

    Removed, Deprecated, Security, Features 3, Changed 2, Fixes 1

    Notes
    Added
    • Types for alpha task scheduling API
    • Types for SELECT.pipeline() and SELECT.foreach()
    • Support deep partial INSERT / UPDATE
    Changed
    • req.subject now points to the bound entity type when implementing handlers for bound actions.
    • service.dispatch now also supports passing request objects, or arrays thereof.
    Deprecated
    Removed
    Fixed
    • cqn.SELECT.where now accepts mixed refs, vals, and strings, as described in the documentation.
    Security
  7. v0.13.0

    Removed, Deprecated, Security, Features 1, Changed, Fixes 1

    Notes
    Added
    • Types for compile events: compile.for.runtime, compile.to.dbx, compile.to.edmx
    Changed
    Deprecated
    Removed
    Fixed
    • The peer dependency to @sap/cds-dk is now optional, but needs to be installed explicitly in application projects.
    Security
  8. v0.12.0dated in the atlas

    Removed, Deprecated, Security, Features 2, Changed 2, Fixes

    Notes
    Added
    • Added type export for types from cds-dk. These types are only available if @sap/cds-dk is also present in the project.
    • Optional parameter 'options' in req.reply. The object can contain, for example, mimetype and/or filename.
    Changed
    • [breaking] Bump dependency to @sap/cds to >=9.0.0. This means starting with this version, cds-types is supposed to be used alongside @sap/cds@9!
    • req.params always returns an array of objects
    Deprecated
    Removed
    Fixed
    Security
  9. v0.11.0

    Removed 1, Deprecated, Security, Features 6, Changed 3, Fixes

    Notes
    Added
    • Syntactically allow infix filters in SELECT clauses through tagged templates. These filters are not semantically checked for validity
    • Added cds.linked.LinkedDefinition as alias for cds.linked.classes.any_
    • Added doc?: string to cds.linked.classes.any_
    • Add overload for Service.emit to offer improved type support when using an event type emitted by cds-typer.
    • Added programmatic draft actions.
    • Added types for util.path, util.fs, and util.inspect.
    Changed
    • [breaking] Corrected the way the default export is generated. This also gets rid of the export default_2 that was mistakenly exposed before.
    • Renamed CQN property INSERT.as to INSERT.from
    • Request.reject(…) now returns never instead of Error, as its implementation always throws.
    Deprecated
    Removed
    • Deprecated INSERT.from method of cds.ql API
    Fixed
    Security
  10. v0.10.0

    Removed, Deprecated, Security, Features 4, Changed 1, Fixes

    Notes
    Added
    • Added support for new builtin type cds.Map
    • Added types for SELECT.hints() of cds.ql API
    • Added types for .bind(Service) to all queries.
    • Added types for i18n module
    Changed
    • CHANGELOG.md and LICENSE files are no longer part of the npm package.
    Deprecated
    Removed
    Fixed
    Security
  11. v0.9.0dated in the atlas

    Removed 2, Features 4, Changed 1, Fixes 5

    Notes
    Added
    • Added missing properties for log in cds.env
    • Added overload for service.read to be called with a ref
    • Added HandlerFunction.parameters.req and HandlerFunction.returns to type handler functions that are not declared as lambdas more conveniently
    • Added types for anonymous, privileged, and default user
    Changed
    • removed dependency to @types/express: ^4.17.21 in favour of a peerDependency to @types/express: >=4
    Removed
    • [breaking] Removed type TypedRequest<T> and replaced it with just Request<T>
    • Removed deprecated cds.Float CSN property type
    Fixed
    • Use Required instead of DeepRequired in projection function to avoid complexity errors from TypeScript
    • Added missing type inference for .set/.with of UPDATE
    • Added missing type inference for .entries of UPSERT and INSERT
    • Variants of SELECT.one(T) will now return T | null, instead of T
    • Documentation link to srv.emit
  12. v0.8.0

    Fixes 6

    Notes
    Fixed
    • Added missing type for Request.before('commit', …)
    • Added missing types for Request.on('succeeded' | 'failed' | 'done', …)
    • Added missing type for cds.test.log
    • Added missing .ref in CQN queries
    • Added missing .forUpdate, .forShareLock, and .search in cqn.SELECT
    • Calling SELECT.one('...').from(Plural) now properly returns a single instance
  13. v0.7.0

    Features 7, Changed 3, Fixes 4

    Notes
    Fixed
    • Added missing type for cds.context.model
    • Added missing type for req.query.elements
    • Made constructors for query parts (SELECT, UPDATE, DELETE, ...) private, as they should only be accessed statically
    • SELECT returns a single instance now when specifying a primary key
    Added
    • cds.app typed as express.js application
    • cds.cli CLI arguments
    • cds.requires types for MTX services
    • cds.utils.colors types
    • The CQL methods .where and .having now suggest property names for certain overloads.
    • Service.before/on/after(event, target...) now accept also an array of typer-generated classes in the target parameter
    • localized variants to SELECT
    Changed
    • Most cds.requires entries are now optionals.
    • cds.connect.to now also supports using a precompiled model.
    • Properties of entities are no longer optional in projections, eliminating the need to perform optional chaining on them when using nested projections
  14. v0.6.5

    Removed 1, Fixes 1

    Notes
    Fixed
    • The @types/sap__cds link created by the postinstall script now also works in monorepo setups where the target @cap-js/cds-types might already be preinstalled (often hoisted some levels up).
    Removed
    • Removed array-like methods from model parts (.map, .find, etc.). To still use them, apply spreading to object in question first.
  15. v0.6.4

    Features 4, Changed 1, Fixes 1

    Notes
    Added
    • Service.emit(...) can now also be called with custom events
    • Service.before(...) and Service.after(...) now accept bound and unbound functions as parameter
    • connect.to (ServiceClass) as alternative to 'service' string
    • connect.to ('db') returning cds.DatabaseService
    Changed
    • .before(...), .on(...), and .after(...) now properly infer inflection when a typer-generated class is passed as second parameter
    Fixed
    • EACH event has appropriately been renamed each to reflect runtime behaviour
  16. v0.6.3

    Fixes 1

    Notes
    Fixed
    • Installation no longer fails if symlink @types/sap__cds exists
  17. v0.6.2

    Fixes 1

    Notes
    Fixed
    • Symlink @types/sap__cds correctly created in case of upgrading @cap-js/cds-types.
  18. v0.6.1

    Changed 1, Fixes 1

    Notes
    Fixed
    • Scripts postinstall and prerelease:ci-fix now work correctly on windows.
    Changed
    • postinstall script now creates a relative symlink from @types/sap__cds to allow the project to be moved/ renamed.
  19. v0.6.0

    Changed 2

    Notes

    This is a prerelease version (next) as a preview for the upcoming release of cds 8.

    Changed
    • Wrapped all types into an augmented module declaration for @sap/cds.
    • Added a postinstall script to symlink @cap-js/cds-types to @types/sap__cds to benefit from the default type resolution mechanism employed by Definitely Typed.
  20. v0.5.0

    Fixes 1

    Notes

    This is a prerelease version (next) as a preview for the upcoming release of cds 8.

    Fixed
    • Linked definitions are now available via cds.linked, especially cds.linked.LinkedCSN and cds.linked.classes with its relevant type definitions
  21. v0.4.0

    Fixes 1

    Notes

    This is a prerelease version (next) as a preview for the upcoming release of cds 8.

    Fixed
    • Corrected exist(…) to exists(…)
  22. v0.3.0-beta.1

    Features 4, Changed 6, Fixes 3

    Notes
    Added
    • Added signatures for cds.outboxed and cds.unboxed
    • Added signature for cds.middlewares.add
    • More cds.env properties and types
    • Exposed types related to cds.linked through the facade. Types describing unlinked CSN should generally not be needed, but are still available through cds.csn.…
    Changed
    • Improved signatures for cds.env.folders and cds.env.i18n from any to a more descriptive type
    • Service.prepend is no longer async
    • All linked classes are now available via cds.linked.classes (and partially via the facade)
    • Getters in service instances now return the appropriate classes. E.g. service.entities returns instances of linked.entity
    • [breaking] Linked definitions are no longer an intersection type of all possible linked classes, but more specific to their actual use (see above). This implies that users may have to narrow the type they are using explicitly, use another getter (see above), or use explicit casts.
    • [breaking] Only the .after('READ', ...) differentiates between singular and plural entities. In all other cases the plural case is assumed.
    Fixed
    • SELECT.from and related variants now work on the .drafts property and behave like SELECT.from(<Plural>)
    • cds.log can now also be called with the names of log levels
    • Reintroduced missing QueryAPI.tx and add deprecation note for QueryAPI.transaction
  23. v0.2.0

    Features 1, Changed 1, Fixes 6

    Notes
    Added
    • Type for special error listener srv.on('error')
    Changed
    • source, column_expr, and predicate have been converted to partial intersection types. This offers all possible optional properties. You will have to make sure to check their presence when accessing them
    Fixed
    • srv.send overload to also allow optional headers
    • Reflected types like cds.entity, cds.struct, cds.Association are now properly exposed
    • cds.builtin.types got a more accurate type
    • The LinkedEntity.drafts property is now optional. At runtime, it's only set for drafted entities.
    • cds.model is marked as modifiable (for tests only!)
    • SELECT.from got its ref property back
  24. v0.1.0

    Changed 1, Fixes 1

    Notes
    Changed
    • Rework of the export structure of the main cds facade object, so that e.g. cds.Request and cds.User work again
    Fixed
    • TSDoc comments have a proper structure
  25. v0.0.1

    Features 1

    Notes
    Added
    • Initial release, still with gaps though
28,339downloads per week, npm
Weekly downloads for @cap-js/cds-types26 complete calendar weeks from 2026-04-20 to 2026-10-18; the latest total is 28339.20 Apr – 26 Apr: 51,03927 Apr – 3 May: 45,1874 May – 10 May: 49,85611 May – 17 May: 48,78818 May – 24 May: 50,29825 May – 31 May: 49,3461 Jun – 7 Jun: 47,5158 Jun – 14 Jun: 48,79115 Jun – 21 Jun: 48,63322 Jun – 28 Jun: 45,59329 Jun – 5 Jul: 45,7266 Jul – 12 Jul: 44,45613 Jul – 19 Jul: 47,45720 Jul – 26 Jul: 51,73327 Jul – 2 Aug: 49,9693 Aug – 9 Aug: 48,41710 Aug – 16 Aug: 40,35317 Aug – 23 Aug: 48,38724 Aug – 30 Aug: 47,77831 Aug – 6 Sept: 40,4967 Sept – 13 Sept: 35,55414 Sept – 20 Sept: 43,09621 Sept – 27 Sept: 49,63828 Sept – 4 Oct: 49,9325 Oct – 11 Oct: 42,67412 Oct – 18 Oct: 28,339
Typing
  1. com.sap.cds:cds-maven-pluginMaven plugin running CDS build steps in a CAP Java project
  2. @cap-js/cds-typerGenerates TypeScript types from a CDS model
  3. cds-internal-toolReusable internals for authors of CAP extensions

Details

Sources5
npm registrydiscovered herechecked
GitHub APIdiscovered here, cap-jschecked
npm registry, @cap-js/cds-typesversion, releases, installschecked
github.com/git+https://github.com/cap-js/cds-types.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
declared for>=9.0.0
latestv0.20.0
first release
releases and cadence26, ~42d median
discovered vianpm registry, GitHub API · cap-js
first seen in the atlas
ecosystem and domaincap, operations-and-runtime
Contributors23
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:cap-js-cds-types
JSON
/artifacts/cap-js-cds-types.json
MCP
Connecting an agent