@cap-js/cds-types
Type definitions for the CAP Node.js SDK.
Facts
Where it sits
Who is behind it
In the atlas: maintains 34@cap-jsmaintainerJohannes VogtContributes to this
In the atlas: maintains 1, contributes to 28, wrote 10@AkatuoroAndreas SchmidtContributes to this
In the atlas: contributes to 6@aschmidt93Christian GeorgiContributes to this
In the atlas: maintains 1, contributes to 53@chgeoDaniel HutzelContributes to this
In the atlas: contributes to 32, wrote 3@danjoaDaniel O'GradyContributes to this
In the atlas: contributes to 10@daogradyOlenaContributes to this
In the atlas: contributes to 11@etimrTomas RimkusContributes to this
In the atlas: contributes to 4@hakimioHeiko WitteborgContributes to this
In the atlas: contributes to 18@hm23Jörg MannContributes to this
In the atlas: contributes to 4@joergmannJohannes VogelContributes to this
In the atlas: contributes to 25@johannes-vogel23 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
Connections
Generated types that make the model visible to the compiler
Download
Install
npm add @cap-js/cds-typesDerived from the package name. No recipe recorded; the README has the configuration.
README
quoted from cap-js/cds-types under Apache-2.0, readcds-types
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.
History
Removed, Deprecated, Security, Features 2, Changed, Fixes
Notes
Added
- Added
service.schedule(...).as(<name>) - Added
cds.utils.ms4(...)
Changed
Deprecated
Removed
Fixed
Security
Removed, Deprecated, Security, Features 6, Changed 2, Fixes 1
Notes
Added
- Added types for
req.reqandreq.resincds.Request cds.Usernow has anauthInfoproperty typed against@sap/xssec'sSecurityContext.@sap/xssecis an peer dependency.cds.qlis now typed as a callable universal converter: tagged template, function accepting a CQN object, or plain string — all returningSELECT<unknown>- CXL helper functions (
ref,val,expr,columns,expand,where,orderBy) are now exported fromcds.qland can be destructured from it cds.parse.cql,cds.run, andcds.readnow accept tagged template literalsService.run(query)now proxies the entity type of the contained query through to the return type
Changed
- Bound action handlers now keep
req.subjecttyped 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.oneincludesundefined
Security
- Added types for
Removed, Deprecated, Security, Features, Changed 1, Fixes
Notes
Added
Changed
- Installing
@cap-js/cds-typesno longer executes a postinstall script that creates a symlink innode_modules/@types. Instead, use apathsentry in your tsconfig.json. This entry can be created by runningcds add typescriptin your project.
Deprecated
Removed
Fixed
Security
- Installing
Removed, Deprecated 2, Security, Features 3, Changed 4, Fixes
Notes
Added
- Types for nested
.whereand.havingpredicates - Passing events generated by cds-typer into
service.onnow offers code completion for the event's properties in the handler - Allow all events that can be used in
service.onto be used inservice.onceas well
Changed
ResultHandlernow returnsunknowninstead ofvoid, to accommodate asynchronous functions when having@typescript-eslint/strict-void-returnactivated- Documentation for
cds.test.axiosmentioning that@cap-js/cds-test@1now returns anaxiosfacade in absence ofaxios. - made
cds.context.localeoptional cds.tx(ƒ)now returns the return type ofƒ
Deprecated
cds.test.chai,cds.test.assertpointing to eithercds.test.expector a custom import ofchai.cds.test.axiosin favor ofcds.test.defaults
Removed
Fixed
Security
- Types for nested
Removed, Deprecated 2, Security, Features 3, Changed, Fixes 3
Notes
Added
- Added
Request.messages,Request.errorsandRequest.results - Types for
SELECT.stream() service.actions
Changed
Deprecated
service.operations- Undocumented
service.entities(),service.events(),service.types(), andservice.operations()
Removed
Fixed
- Types for
req.error()et al. - Types for
cds.error() - Type for
cds.middlewares.before
Security
- Added
Removed, Deprecated, Security, Features 3, Changed, Fixes
Notes
Added
- Allow array-like params in CQN.expr via
{ list: [...] }syntax - Types for
cds.error() GetRequestandPostRequesttypes
Changed
Deprecated
Removed
Fixed
Security
- Allow array-like params in CQN.expr via
Removed, Deprecated, Security, Features 3, Changed 2, Fixes 1
Notes
Added
- Types for alpha task scheduling API
- Types for
SELECT.pipeline()andSELECT.foreach() - Support deep partial
INSERT/UPDATE
Changed
req.subjectnow points to the bound entity type when implementing handlers for bound actions.service.dispatchnow also supports passing request objects, or arrays thereof.
Deprecated
Removed
Fixed
cqn.SELECT.wherenow accepts mixedrefs,vals, andstrings, as described in the documentation.
Security
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-dkis now optional, but needs to be installed explicitly in application projects.
Security
- Types for compile events:
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-dkis 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/cdsto>=9.0.0. This means starting with this version,cds-typesis supposed to be used alongside@sap/cds@9! req.paramsalways returns an array of objects
Deprecated
Removed
Fixed
Security
- Added type export for types from cds-dk. These types are only available if
Removed 1, Deprecated, Security, Features 6, Changed 3, Fixes
Notes
Added
- Syntactically allow infix filters in
SELECTclauses through tagged templates. These filters are not semantically checked for validity - Added
cds.linked.LinkedDefinitionas alias forcds.linked.classes.any_ - Added
doc?: stringtocds.linked.classes.any_ - Add overload for
Service.emitto offer improved type support when using an event type emitted by cds-typer. - Added programmatic draft actions.
- Added types for
util.path,util.fs, andutil.inspect.
Changed
- [breaking] Corrected the way the default export is generated. This also gets rid of the export
default_2that was mistakenly exposed before. - Renamed
CQNpropertyINSERT.astoINSERT.from Request.reject(…)now returnsneverinstead ofError, as its implementation always throws.
Deprecated
Removed
- Deprecated
INSERT.frommethod ofcds.qlAPI
Fixed
Security
- Syntactically allow infix filters in
Removed, Deprecated, Security, Features 4, Changed 1, Fixes
Notes
Added
- Added support for new builtin type
cds.Map - Added types for
SELECT.hints()ofcds.qlAPI - Added types for
.bind(Service)to all queries. - Added types for
i18nmodule
Changed
CHANGELOG.mdandLICENSEfiles are no longer part of the npm package.
Deprecated
Removed
Fixed
Security
- Added support for new builtin type
Removed 2, Features 4, Changed 1, Fixes 5
Notes
Added
- Added missing properties for
logincds.env - Added overload for
service.readto be called with aref - Added
HandlerFunction.parameters.reqandHandlerFunction.returnsto 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.21in favour of a peerDependency to@types/express: >=4
Removed
- [breaking] Removed type
TypedRequest<T>and replaced it with justRequest<T> - Removed deprecated
cds.FloatCSN property type
Fixed
- Use
Requiredinstead ofDeepRequiredin projection function to avoid complexity errors from TypeScript - Added missing type inference for
.set/.withofUPDATE - Added missing type inference for
.entriesofUPSERTandINSERT - Variants of
SELECT.one(T)will now returnT | null, instead ofT - Documentation link to
srv.emit
- Added missing properties for
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
.refin CQN queries - Added missing
.forUpdate,.forShareLock, and.searchincqn.SELECT - Calling
SELECT.one('...').from(Plural)now properly returns a single instance
- Added missing type for
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 SELECTreturns a single instance now when specifying a primary key
Added
cds.apptyped as express.js applicationcds.cliCLI argumentscds.requirestypes for MTX servicescds.utils.colorstypes- The CQL methods
.whereand.havingnow suggest property names for certain overloads. Service.before/on/after(event, target...)now accept also an array of typer-generated classes in thetargetparameterlocalizedvariants toSELECT
Changed
- Most
cds.requiresentries are now optionals. cds.connect.tonow 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
- Added missing type for
Removed 1, Fixes 1
Notes
Fixed
- The
@types/sap__cdslink created by thepostinstallscript now also works in monorepo setups where the target@cap-js/cds-typesmight 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.
- The
Features 4, Changed 1, Fixes 1
Notes
Added
Service.emit(...)can now also be called with custom eventsService.before(...)andService.after(...)now accept bound and unbound functions as parameterconnect.to (ServiceClass)as alternative to'service'stringconnect.to ('db')returningcds.DatabaseService
Changed
.before(...),.on(...), and.after(...)now properly infer inflection when a typer-generated class is passed as second parameter
Fixed
EACHevent has appropriately been renamedeachto reflect runtime behaviour
Fixes 1
Notes
Fixed
- Symlink
@types/sap__cdscorrectly created in case of upgrading@cap-js/cds-types.
- Symlink
Changed 1, Fixes 1
Notes
Fixed
- Scripts
postinstallandprerelease:ci-fixnow work correctly on windows.
Changed
postinstallscript now creates a relative symlink from@types/sap__cdsto allow the project to be moved/ renamed.
- Scripts
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-typesto@types/sap__cdsto benefit from the default type resolution mechanism employed by Definitely Typed.
- Wrapped all types into an augmented module declaration for
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, especiallycds.linked.LinkedCSNandcds.linked.classeswith its relevant type definitions
- Linked definitions are now available via
Fixes 1
Notes
This is a prerelease version (
next) as a preview for the upcoming release of cds 8.Fixed
- Corrected
exist(…)toexists(…)
- Corrected
Features 4, Changed 6, Fixes 3
Notes
Added
- Added signatures for
cds.outboxedandcds.unboxed - Added signature for
cds.middlewares.add - More
cds.envproperties and types - Exposed types related to
cds.linkedthrough the facade. Types describing unlinked CSN should generally not be needed, but are still available throughcds.csn.…
Changed
- Improved signatures for
cds.env.foldersandcds.env.i18nfromanyto a more descriptive type Service.prependis no longer async- All linked classes are now available via
cds.linked.classes(and partially via the facade) - Getters in
serviceinstances now return the appropriate classes. E.g.service.entitiesreturns instances oflinked.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.fromand related variants now work on the.draftsproperty and behave likeSELECT.from(<Plural>)cds.logcan now also be called with the names of log levels- Reintroduced missing
QueryAPI.txand add deprecation note forQueryAPI.transaction
- Added signatures for
Features 1, Changed 1, Fixes 6
Notes
Added
- Type for special error listener
srv.on('error')
Changed
source,column_expr, andpredicatehave 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.sendoverload to also allow optional headers- Reflected types like
cds.entity,cds.struct,cds.Associationare now properly exposed cds.builtin.typesgot a more accurate type- The
LinkedEntity.draftsproperty is now optional. At runtime, it's only set for drafted entities. cds.modelis marked as modifiable (for tests only!)SELECT.fromgot itsrefproperty back
- Type for special error listener
Changed 1, Fixes 1
Notes
Changed
- Rework of the export structure of the main
cdsfacade object, so that e.g.cds.Requestandcds.Userwork again
Fixed
- TSDoc comments have a proper structure
- Rework of the export structure of the main
Others providing
Compare all 4 on the Typing page →- com.sap.cds:cds-maven-plugincom.sap.cds:cds-maven-pluginThe Maven plugin that runs CDS build steps in a CAP Java project: compiling the model, generating typed Java accessor interfaces and adding facets to an existing project.sap official, capMaven plugin running CDS build steps in a CAP Java project
- @cap-js/cds-typer@cap-js/cds-typerGenerates TypeScript types from a CDS model.sap official, capGenerates TypeScript types from a CDS model
- cds-internal-toolcds-internal-toolReusable internals for people writing CAP extensions — annotation helpers, current cds runtime types, module resolution, reflection utilities and type assertions.independent, capReusable internals for authors of CAP extensions
Details
Sources
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
Contributors
History in the atlas
- First seen.
For your agent
- Ref
artifact:cap-js-cds-types- JSON
- /artifacts/cap-js-cds-types.json
- MCP
- Connecting an agent