Releases: cap-js/cds-typer
Releases · cap-js/cds-typer
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
v0.25.0
Added
- Declaring a type alias on an enum in cds now also exports it on value level in the resulting type
Fixed
- Classes representing views and projections will no longer carry ancestry to avoid clashes thereof with aliases fields
Changed
- All properties are now preceeded with the
declare
modifier to pass strict tsconfigs usinguseDefineForClassFields
ornoImplicitOverride
- The static
actions
property of generated classes now includes the types from all inherited classes to also suggest actions defined in a base entity/aspect/type.
v0.24.0
Fixed
- Suppressed an error that would incorrectly point out naming clashes when an entity was named in singular inflection in the model
- CDS aspects now also generate a aspect-function in singular inflection, similar to how entities do
Changed
- Aspects generate named classes again so that tooltips will show more meaningful provenance for properties
- The TypeScript task for
cds build
no longer looks for tsconfig.json to determine if the project has TS nature and instead checks the dependencies in the project's package.json for an occurrence oftypescript
v0.23.0
Fixed
- Plurals no longer have
is_singular
attached in the resulting .js files - Properties are properly propagated beyond just one level of inheritance
v0.22.0
Fixed
- Fixed a bug where keys would sometimes inconsistently become nullable