npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@genesislcap/event-type-codegen

v15.112.1

Published

Build-time TypeScript codegen from Kotlin event handler DTOs

Readme

@genesislcap/event-type-codegen

Build-time TypeScript interfaces for Genesis event DETAILS payloads, discovered from Kotlin PAL event handlers without a running server.

Configuration

Enable via genx.config.* or the genx / genesis key in package.json:

{
  "genx": {
    "eventTypes": {
      "enabled": true,
      "serverModule": "../server/my-app",
      "kotlinSources": [
        "src/main/kotlin/**/dto/**/*.kt",
        "src/main/genesis/scripts/**/*.kts"
      ],
      "generatedDaoSources": [
        "build/internal-modules/**/*-generated-dao/build/generated/sources/dao/global/genesis/gen/dao/**/*.kt"
      ],
      "handlerScan": [
        "src/main/kotlin/**/*.kt",
        "src/main/genesis/scripts/**/*.kts"
      ],
      "output": "src/generated/genesis-event-types.ts",
      "runOnBuild": true
    }
  }
}

When enabled is false or the block is omitted, codegen is skipped.

generatedDaoSources globs are resolved against both the app module (serverModule) and its parent Gradle server/ directory (where dictionary-cache DAOs usually live). Defaults cover common monorepo layouts after ./gradlew … has generated DAO sources. Custom data class DTOs always override a generated DAO with the same class name.

CLI

From a client app directory:

genx generate event-types

genx build runs codegen first when eventTypes.enabled and runOnBuild (default true when enabled).

In the showcase server Gradle build, generateDao is finalizedBy generateEventTypes, which runs genx generate event-types in react-client when genx is available (after monorepo bootstrap). Disable with -PenableEventTypeCodegen=false.

Limitations (v1)

  • Discovery uses Kotlin source parsing, not the compiler or live JSON Schema.
  • Only handlers with a resolvable DETAILS shape (custom DTO or generated table/index from generatedDaoSources) get *Details types and EventDetailsMap entries. Anything else is listed in a comment at the top of the generated file.
  • Full table DAO handlers (e.g. eventHandler<Trade>("TRADE_INSERT")) and index handlers (e.g. eventHandler<Trade.ById>("TRADE_DELETE")) are mapped when generated DAO .kt sources are present under generatedDaoSources.
  • Class-based handler sources named *EventHandler.kt under a dto/ path are skipped. The dto/** glob is for input data classes only; those files are usually SyncValidatingEventHandler implementations and are not PAL eventHandler { } scripts. PAL handlers in *-eventhandler.kts (and other handlerScan paths) are still discovered.
  • Generate DAO sources (Gradle) before client codegen in CI if the trees are not committed.
  • Dictionary ENUM fields: string literal unions when enum class and/or companion Field.Type.ENUM values = "…" appear under generatedDaoSources (gen/dao/**/*.kt).
  • Enum exports are named after the Kotlin enum, and are qualified with the owning table only when declarations disagree. Genesis emits an enum either unscoped, in the flat global.genesis.gen.dao.enums, or table-scoped, in …enums.<dictionary>.<table> — so several declarations can share a simple name. Identical value sets share one export; differing ones are qualified (AxeStatus / RfqStatus / OrderStatus) so no table's fields point at another's values. Where an unscoped declaration is among them it keeps the bare name, because that is the one a PAL script's default import resolves to.
  • A field's enum is resolved the way Kotlin resolves the name, against the file that wrote it: a type the file declares itself, then an explicit import, then the file's own package, then star imports. Each rung shadows those below it — an explicit import that names something outside the generated tree yields unknown, never a same-named generated enum.
  • PAL scripts (.kts under genesis/scripts/) additionally carry the default imports the Genesis compiler supplies (…gen.dao.enums.*, …gen.dao.* and the generated config/view packages), which is why val feeType: FeeType resolves there with no import line. Star imports do not recurse, so a table-scoped enum named with no import in a script still resolves to unknown: Genesis does supply those as explicit default imports via tables-info.json, but that tier is not modelled yet. A plain .kt source, and anything under genesis/cfg/, gets no defaults.

Typed commits

  • *Details interfaces — DETAILS payload from Kotlin DTOs.
  • GenesisEvent (from @genesislcap/foundation-comms) — abstract base; subclass sets MESSAGE_TYPE.
  • Per-handler classes — e.g. EventAqsCounterpartyInsert.
import { commitGenesisEvent } from '@genesislcap/foundation-comms';
import { EventAqsCounterpartyInsert } from './generated/genesis-event-types';

await commitGenesisEvent(
  connect,
  new EventAqsCounterpartyInsert({ COUNTERPARTY_ID: 'x' }),
);

Metadata dump path (FUI-2608)

Generate from a live-server snapshot instead of (or in addition to) Kotlin source scan:

  1. In a connected app with foundation-header, press Ctrl/Cmd+Shift+E (dev builds only) to download event-metadata.json.
  2. Run:
genx generate event-types --from-metadata event-metadata.json

This uses inbound JSON Schema DETAILS (field names, JSON_TYPE, requiredness) as the contract — useful for comparing against the Kotlin-scan output and for handlers the source scanner misses.

Wire field naming for the Kotlin path matches genesis-server toUpperUnderscoreWithAcronyms (e.g. addressLine1 → ADDRESS_LINE_1). Date/DateTime Kotlin types map to TypeScript number (epoch millis / JSON_TYPE: integer).

Migration

| App | Action | | --- | --- | | New genx template | Enable eventTypes, commit or gitignore generated output | | Legacy | Add config, run genx generate event-types, adopt typed commits incrementally | | No Kotlin DTOs | Leave disabled |