All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning. The format is based on Keep a Changelog.
- 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
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ƒ
cds.test.chai,cds.test.assertpointing to eithercds.test.expector a custom import ofchai.cds.test.axiosin favor ofcds.test.defaults
- Added
Request.messages,Request.errorsandRequest.results - Types for
SELECT.stream() service.actions
service.operations- Undocumented
service.entities(),service.events(),service.types(), andservice.operations()
- Types for
req.error()et al. - Types for
cds.error() - Type for
cds.middlewares.before
- Allow array-like params in CQN.expr via
{ list: [...] }syntax - Types for
cds.error() GetRequestandPostRequesttypes
- Types for alpha task scheduling API
- Types for
SELECT.pipeline()andSELECT.foreach() - Support deep partial
INSERT/UPDATE
req.subjectnow points to the bound entity type when implementing handlers for bound actions.service.dispatchnow also supports passing request objects, or arrays thereof.
cqn.SELECT.wherenow accepts mixedrefs,vals, andstrings, as described in the documentation.
- Types for compile events:
compile.for.runtime,compile.to.dbx,compile.to.edmx
- The peer dependency to
@sap/cds-dkis now optional, but needs to be installed explicitly in application projects.
- 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.
- [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
- 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.
- [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
INSERT.frommethod ofcds.qlAPI
- 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
CHANGELOG.mdandLICENSEfiles are no longer part of the npm package.
- 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
- removed dependency to
@types/express: ^4.17.21in favour of a peerDependency to@types/express: >=4
- [breaking] Removed type
TypedRequest<T>and replaced it with justRequest<T> - Removed deprecated
cds.FloatCSN property type
- 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 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
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
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
- 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
- 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 array-like methods from model parts (
.map,.find, etc.). To still use them, apply spreading to object in question first.
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
.before(...),.on(...), and.after(...)now properly infer inflection when a typer-generated class is passed as second parameter
EACHevent has appropriately been renamedeachto reflect runtime behaviour
- Installation no longer fails if symlink
@types/sap__cdsexists
- Symlink
@types/sap__cdscorrectly created in case of upgrading@cap-js/cds-types.
- Scripts
postinstallandprerelease:ci-fixnow work correctly on windows.
postinstallscript now creates a relative symlink from@types/sap__cdsto allow the project to be moved/ renamed.
This is a prerelease version (next) as a preview for the upcoming release of cds 8.
- 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.
This is a prerelease version (next) as a preview for the upcoming release of cds 8.
- Linked definitions are now available via
cds.linked, especiallycds.linked.LinkedCSNandcds.linked.classeswith its relevant type definitions
This is a prerelease version (next) as a preview for the upcoming release of cds 8.
- Corrected
exist(…)toexists(…)
- 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.…
- 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.
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
- Type for special error listener
srv.on('error')
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
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
- Rework of the export structure of the main
cdsfacade object, so that e.g.cds.Requestandcds.Userwork again
- TSDoc comments have a proper structure
- Initial release, still with gaps though