Skip to content

Releases: cap-js/cds-typer

v0.30.0

02 Dec 19:36
60c4793
Compare
Choose a tag to compare

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's cds.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

20 Nov 15:10
f5523e3
Compare
Choose a tag to compare

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

07 Nov 08:45
Compare
Choose a tag to compare

Fixed

  • cds build no longer fails on Windows with an EINVAL error.
  • cds build also supports custom model paths in tsconfig.json that do not end with /index.ts. This is the case for projects running with tsx.

v0.28.0

24 Oct 14:19
42db60e
Compare
Choose a tag to compare

Added

  • Schema definition for cds.typer options in package.json and .cdsrc-*.json files
  • Added a static elements property to all entities, which allows access to the LinkedDefinitions instance of an entity's elements
  • Schema definition for typescript cds build task.
  • .drafts property of any entity E is now of type DraftOf<E>, or DraftsOf<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 strict tsconfig.jsons
  • Properly support mandatory (not null) action parameters with array of types
  • Static property .drafts is only create for entity classes that are actually draft enabled

v0.27.0

02 Oct 08:38
fdc840c
Compare
Choose a tag to compare

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, or notNull 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

11 Sep 15:42
7241dcd
Compare
Choose a tag to compare

Added

  • Added a CLI option --useEntitiesProxy. When set to true, all entities are wrapped into Proxy 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 version 8.2 or higher.
  • Apps need to provide @cap-js/cds-types version 0.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}) and service.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

13 Aug 14:11
cab05e5
Compare
Choose a tag to compare

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 using useDefineForClassFields or noImplicitOverride
  • 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

18 Jul 13:20
7a530d6
Compare
Choose a tag to compare

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 of typescript

v0.23.0

04 Jul 11:21
b74adb8
Compare
Choose a tag to compare

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

20 Jun 12:45
a36e7ae
Compare
Choose a tag to compare

Fixed

  • Fixed a bug where keys would sometimes inconsistently become nullable