<commit_before>
# Generation

NOTE: this feature is still in incurbation, feedback and contributions welcomed. In particular further frameworks like
Spring must be supported.

Crnk allows the generation of Typescript stubs for type-safe, client-side web development. Contributions for other
languages like iOS would be very welcomed.

## Typescript

The Typescript generator allows the generation of JSON API resources, repositories and related objects such as meta
information, links information, data objects, list types and enumeration types. Currently the generator targets the
<a href="https://github.com/abdulhaq-e/ngrx-json-api">ngrx-json-api</a> library. Support for other libraries/formats
would be fairly straightforward to add, contributions welcomed. A generated resource looks like:


[source]
----
include::../../../../crnk-gen-typescript/src/test/resources/expected_schedule_without_expressions.ts[]
----


Internally the generator has to make use of the running application to gather the necessary information for generation. This
approach not only supports the regular resources and repositories manually implemented by the application,
but also more advanced patterns like resources obtained through third-party modules or derived from JPA entities. To get the
application to a running state at built-time, the generator makes use of the JUnit setup of the application.
So far supported are a setup of JUnit with Deltaspike for JEE application. Other non-CDI integrations like Spring to follow soon.

A setup may look like:

[source]
----
buildscript {
	dependencies {
		classpath "io.crnk:crnk-gen-typescript:${version}"
	}
}

apply plugin: 'io.crnk.typescriptGen'

typescriptGen.npmPackageName = '@crnk/typescript-demo'
----

Two configurations are necessary:

- `npmPackageName` to use for publishing.
- a mapping of meta (package) ids to npm packages. Only resources are generated whose package matches the chosen `npmPackageName`.
  All other resources are imported as external NPM dependency.

katharsis-meta is used to get a meta model of the underlying resources (or a any other type of object like JPA entities).
Important to know is that every object is assigned a string-based meta id. For typical, simpler use cases this matches
the class name. But for more advanced use cases those may or can differ.

TODO show publishing setup into NPM repository


<commit_msg>rename katharsis -> crnk (#4)<commit_after>
# Generation

NOTE: this feature is still in incurbation, feedback and contributions welcomed. In particular further frameworks like
Spring must be supported.

Crnk allows the generation of Typescript stubs for type-safe, client-side web development. Contributions for other
languages like iOS would be very welcomed.

## Typescript

The Typescript generator allows the generation of JSON API resources, repositories and related objects such as meta
information, links information, data objects, list types and enumeration types. Currently the generator targets the
<a href="https://github.com/abdulhaq-e/ngrx-json-api">ngrx-json-api</a> library. Support for other libraries/formats
would be fairly straightforward to add, contributions welcomed. A generated resource looks like:


[source]
----
include::../../../../crnk-gen-typescript/src/test/resources/expected_schedule_without_expressions.ts[]
----


Internally the generator has to make use of the running application to gather the necessary information for generation. This
approach not only supports the regular resources and repositories manually implemented by the application,
but also more advanced patterns like resources obtained through third-party modules or derived from JPA entities. To get the
application to a running state at built-time, the generator makes use of the JUnit setup of the application.
So far supported are a setup of JUnit with Deltaspike for JEE application. Other non-CDI integrations like Spring to follow soon.

A setup may look like:

[source]
----
buildscript {
	dependencies {
		classpath "io.crnk:crnk-gen-typescript:${version}"
	}
}

apply plugin: 'io.crnk.typescriptGen'

typescriptGen.npmPackageName = '@crnk/typescript-demo'
----

Two configurations are necessary:

- `npmPackageName` to use for publishing.
- a mapping of meta (package) ids to npm packages. Only resources are generated whose package matches the chosen `npmPackageName`.
  All other resources are imported as external NPM dependency.

crnk-meta is used to get a meta model of the underlying resources (or a any other type of object like JPA entities).
Important to know is that every object is assigned a string-based meta id. For typical, simpler use cases this matches
the class name. But for more advanced use cases those may or can differ.

TODO show publishing setup into NPM repository



{'fraction_non_alphanumeric': 0.06188789331110648, 'fraction_numerical': 0.00020837674515524068, 'mean_word_length': 4.594405594405594, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3429815', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1165, 'n_words': 613}