Releases: cap-js/cds-typer
Releases · cap-js/cds-typer
v0.33.1
v0.33.0
Added
- Support new
cds.Map
type, which is emitted as{[key:string]: unknown}
. The most appropriate type would in fact be{[key:string]: any}
, which would also allow any and all keys. But would also cause issues with strict project configurations. Therefore, to effectively usecds.Map
, users will have to cast theunknown
s to the effective type they expect. - Introduce
cds.env.typer.build_task
to allow disabling thetypescript
build task shipped with cds-typer by setting it tofalse
Changed
- [breaking] The types
cds.Binary
andcds.LargeBinary
are now generated asBuffer
andReadable
respectively to reflect the behaviour of the new database packages@cap-js/hana
and@cap-js/sqlite
. You can switch back to the old behaviour by addinglegacy_binary_types: true
to your project configuration. CHANGELOG.md
andLICENSE
files are no longer part of the npm package.
Deprecated
Removed
Fixed
Security
v0.32.1
Added
Changed
Deprecated
Removed
Fixed
- default value for
inline_declarations
in help command - entity scope and namespace are now added in the correct order to inflected type names
Security
v0.31.0
Fixed
- type-referencing a property that is a key no longer breaks the referring property
- when targeting ESM, all imports within the generated types now add a
/index.js
-suffix to conform to modern module resolution mechanisms - leaving
target_module_type
at'auto'
now properly acts on a detected"type":"module"
Added
- cds aspects now generate a synthetic plural type too, to be used in
composition of many
v0.30.0
Changed
- [breaking] when running cds-typer in a CAP project, the default for the
outputDirectory
option will be./@cds-models
instead of./
. This default takes the lowest precedence after setting it in the project'scds.env
, or explicitly as CLI argument.
Fixed
- cds-typer no longer ignores the selected
outputDirectory
, which would also cause an issue during build
v0.29.0
Added
- [breaking] cds-typer now tries to automatically detect whether it has to generate ESM or CommonJS in the emitted index.js files. This behaviour can be overridden via the
--targetModuleType
option. If you rely on these generated index.js files to be CJS despite your project being of ESM type, you need to manually tell cds-typer to generate CJS files!
Fixed
- The static
.keys
property now properly reels in key types from inherited classes.
v0.28.1
Fixed
cds build
no longer fails on Windows with anEINVAL
error.cds build
also supports custom model paths intsconfig.json
that do not end with/index.ts
. This is the case for projects running withtsx
.
v0.28.0
Added
- Schema definition for
cds.typer
options inpackage.json
and.cdsrc-*.json
files - Added a static
elements
property to all entities, which allows access to theLinkedDefinitions
instance of an entity's elements - Schema definition for
typescript
cds build task. .drafts
property of any entityE
is now of typeDraftOf<E>
, orDraftsOf<E>
for plurals, respectively. This type exposes dditional properties that are available on drafts during runtime.
Fixed
- Entity elements of named structured types are flattened when using the option
--inlineDeclarations flat
override
modifier on.kind
property is now only generated if the property is actually inherited, satisfying stricttsconfig.json
s- Properly support mandatory (
not null
) action parameters witharray of
types - Static property
.drafts
is only create for entity classes that are actually draft enabled
v0.27.0
Changed
- Any configuration variable (via CLI or
cds.env
) can now be passed in snake_case in addition to camelCase - Action parameters are now generated as optional by default, which is how the runtime treats them. Mandatory parameters have to be marked as
not null
in CDS/CDL, ornotNull
in CSN.
Fixed
- Fix build task for projects with spaces
- Fixa bug where cds-typer would produce redundant type declarations when the model contains an associations to another entity's property
v0.26.0
Added
- Added a CLI option
--useEntitiesProxy
. When set totrue
, all entities are wrapped intoProxy
objects during runtime, allowing top level imports of entity types. - Added a static
.kind
property for entities and types, which contains'entity'
or'type'
respectively - Apps need to provide
@sap/cds
version8.2
or higher. - Apps need to provide
@cap-js/cds-types
version0.6.4
or higher. - Typed methods are now generated for calls of unbound actions. Named and positional call styles are supported, e.g.
service.action({one, two})
andservice.action(one, two)
. - Action parameters can be optional in the named call style (
service.action({one:1, ...})
). - Actions for ABAP RFC modules cannot be called with positional parameters, but only with named ones. They have 'parameter categories' (import/export/changing/tables) that cannot be called in a flat order.
- Services now have their own export (named like the service itself). The current default export is not usable in some scenarios from CommonJS modules.
- Enums and operation parameters can have doc comments