@genesislcap/event-type-codegen 15.28.0 → 15.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -4
- package/dist/kotlin-parse-utils.d.ts +51 -1
- package/dist/kotlin-parse-utils.d.ts.map +1 -1
- package/dist/kotlin-parse-utils.js +85 -4
- package/dist/kotlin-parse-utils.js.map +1 -1
- package/dist/parse-enums.d.ts +16 -7
- package/dist/parse-enums.d.ts.map +1 -1
- package/dist/parse-enums.js +72 -12
- package/dist/parse-enums.js.map +1 -1
- package/dist/parse-kotlin.d.ts.map +1 -1
- package/dist/parse-kotlin.js +10 -2
- package/dist/parse-kotlin.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/test/fixtures/golden/genesis-event-types.ts +32 -0
- package/test/fixtures/mini-server/generated-dao/global/genesis/gen/dao/enums/FeeType.kt +11 -0
- package/test/fixtures/mini-server/generated-dao/global/genesis/gen/dao/enums/Status.kt +11 -0
- package/test/fixtures/client-out/genesis-event-types.ts +0 -214
package/README.md
CHANGED
|
@@ -55,10 +55,23 @@ In the showcase server Gradle build, `generateDao` is `finalizedBy` `generateEve
|
|
|
55
55
|
- Generate DAO sources (Gradle) before client codegen in CI if the trees are not committed.
|
|
56
56
|
- Dictionary **ENUM** fields: string literal unions when `enum class` and/or companion `Field.Type.ENUM` `values = "…"` appear under `generatedDaoSources` (`gen/dao/**/*.kt`).
|
|
57
57
|
- Enum exports are named after the Kotlin enum, and are qualified with the owning table only
|
|
58
|
-
when
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
when declarations disagree. Genesis emits an enum either **unscoped**, in the flat
|
|
59
|
+
`global.genesis.gen.dao.enums`, or **table-scoped**, in `…enums.<dictionary>.<table>` — so
|
|
60
|
+
several declarations can share a simple name. Identical value sets share one export;
|
|
61
|
+
differing ones are qualified (`AxeStatus` / `RfqStatus` / `OrderStatus`) so no table's fields
|
|
62
|
+
point at another's values. Where an unscoped declaration is among them it keeps the bare name,
|
|
63
|
+
because that is the one a PAL script's default import resolves to.
|
|
64
|
+
- A field's enum is resolved the way Kotlin resolves the name, against the file that wrote it:
|
|
65
|
+
a type the file declares itself, then an explicit `import`, then the file's own package, then
|
|
66
|
+
star imports. Each rung shadows those below it — an explicit `import` that names something
|
|
67
|
+
outside the generated tree yields `unknown`, never a same-named generated enum.
|
|
68
|
+
- **PAL scripts (`.kts` under `genesis/scripts/`) additionally carry the default imports the
|
|
69
|
+
Genesis compiler supplies** (`…gen.dao.enums.*`, `…gen.dao.*` and the generated config/view
|
|
70
|
+
packages), which is why `val feeType: FeeType` resolves there with no `import` line. Star
|
|
71
|
+
imports do not recurse, so a **table-scoped** enum named with no import in a script still
|
|
72
|
+
resolves to `unknown`: Genesis does supply those as explicit default imports via
|
|
73
|
+
`tables-info.json`, but that tier is not modelled yet. A plain `.kt` source, and anything
|
|
74
|
+
under `genesis/cfg/`, gets no defaults.
|
|
62
75
|
|
|
63
76
|
## Typed commits
|
|
64
77
|
|
|
@@ -1,11 +1,61 @@
|
|
|
1
1
|
import type { KotlinFileScope, KotlinProperty } from './types';
|
|
2
2
|
/** Strip Kotlin line and block comments from source before structural parsing. */
|
|
3
3
|
export declare const stripKotlinComments: (content: string) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Star imports every Genesis PAL script gets for free, from genesis-server's
|
|
6
|
+
* `genesisApplicationScriptConfig` (genesis-pal-execution, `GenesisApplicationScriptConfig.kt`).
|
|
7
|
+
* A PAL DETAILS data class can name `FeeType` with no import line of its own because the
|
|
8
|
+
* compiler already holds `global.genesis.gen.dao.enums.*` open for it.
|
|
9
|
+
*
|
|
10
|
+
* Star imports do not recurse, so this reaches the flat `…gen.dao.enums.FeeType` and not the
|
|
11
|
+
* table-scoped `…gen.dao.enums.<dictionary>.<table>.Status`. That is NOT the whole story about
|
|
12
|
+
* table-scoped enums, though: the same config calls `addLocalImports()`, which reads `localEnums`
|
|
13
|
+
* out of `META-INF/…/tables-info.json` and registers each as an EXPLICIT default import
|
|
14
|
+
* (`TableInformation.kt`), and `DaoRunner.kt` writes exactly one entry per enum field with a
|
|
15
|
+
* non-null scope — i.e. precisely the table-scoped ones. So a script CAN name a table-scoped
|
|
16
|
+
* enum with no import, and kotlinc rejects the reference only when two tables supply the same
|
|
17
|
+
* simple name. We do not model that tier, so such a name resolves to `null` and emits `unknown`:
|
|
18
|
+
* a miss rather than a wrong type, and one that cannot reopen the cross-table collision.
|
|
19
|
+
*
|
|
20
|
+
* ORDER IS LOAD-BEARING. `resolveKotlinEnum` walks these in sequence and `defaultImportOwner`
|
|
21
|
+
* ranks by position, so `…gen.dao.enums` preceding `…gen.dao` decides which declaration owns a
|
|
22
|
+
* bare name when both packages hold it — kotlinc would call that reference ambiguous, we take
|
|
23
|
+
* the first.
|
|
24
|
+
*
|
|
25
|
+
* Only the two `gen.dao` entries can currently contribute anything: `parseGeneratedEnumsFromSources`
|
|
26
|
+
* drops any file failing `isGeneratedDaoTreeFile`, which wants `/gen/dao/` in the path, and both
|
|
27
|
+
* default `generatedDaoSources` globs end in `gen/dao/**`. An enum under `gen.config.tables`,
|
|
28
|
+
* `gen.config.view` or `gen.view.entity` therefore never enters the map at all — listing them
|
|
29
|
+
* mirrors the compiler config, but widening the DAO-tree filter is what would actually be
|
|
30
|
+
* needed to pick such an enum up.
|
|
31
|
+
*/
|
|
32
|
+
export declare const PAL_SCRIPT_DEFAULT_STAR_IMPORTS: readonly string[];
|
|
33
|
+
/**
|
|
34
|
+
* PAL scripts compile with the default imports above; a plain `.kt` source does not, so it only
|
|
35
|
+
* ever resolves through the imports it actually writes.
|
|
36
|
+
*
|
|
37
|
+
* Not every `.kts` is a PAL APPLICATION script, which is what supplies these: dictionary and
|
|
38
|
+
* system-definition scripts get `TablesScriptCompilationConfiguration` and friends, with no
|
|
39
|
+
* `gen.dao.enums.*` anywhere. Those live under `genesis/cfg/` while everything that does get
|
|
40
|
+
* this config (eventhandler, dataserver, reqrep, consolidator, streamer, pipelines) lives under
|
|
41
|
+
* `genesis/scripts/`, so the default `kotlinSources` glob already separates them — but that glob
|
|
42
|
+
* is consumer-configurable, so the directory is checked rather than assumed. A file under
|
|
43
|
+
* neither is taken at its extension: missing a default import only costs an `unknown`, whereas
|
|
44
|
+
* handing one to a `cfg/` script could bind a name the compiler never offered it.
|
|
45
|
+
*/
|
|
46
|
+
export declare const isPalScriptFile: (filePath: string) => boolean;
|
|
47
|
+
export declare const extractDeclaredTypeNames: (content: string) => string[];
|
|
48
|
+
export type ParseKotlinFileScopeOptions = {
|
|
49
|
+
/** Star imports the compiler supplies that the file itself never writes (see PAL defaults). */
|
|
50
|
+
defaultStarImports?: readonly string[];
|
|
51
|
+
/** Type names declared in this file, which shadow anything imported under the same name. */
|
|
52
|
+
declaredTypeNames?: Iterable<string>;
|
|
53
|
+
};
|
|
4
54
|
/**
|
|
5
55
|
* Read a file's `package` and `import` header. Genesis generates one enum package per table, so
|
|
6
56
|
* the imports are what tell `Status` in Axe.kt apart from `Status` in Rfq.kt.
|
|
7
57
|
*/
|
|
8
|
-
export declare const parseKotlinFileScope: (content: string) => KotlinFileScope;
|
|
58
|
+
export declare const parseKotlinFileScope: (content: string, options?: ParseKotlinFileScopeOptions) => KotlinFileScope;
|
|
9
59
|
/**
|
|
10
60
|
* Strip annotations including use-site targets (field:/param:/get: prefixes).
|
|
11
61
|
* Nested call args in annotations are not fully balanced (secondary limitation).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kotlin-parse-utils.d.ts","sourceRoot":"","sources":["../src/kotlin-parse-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE/D,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,MACa,CAAC;AAOpE;;;GAGG;AACH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"kotlin-parse-utils.d.ts","sourceRoot":"","sources":["../src/kotlin-parse-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE/D,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,MACa,CAAC;AAOpE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,+BAA+B,EAAE,SAAS,MAAM,EAM5D,CAAC;AAKF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,KAAG,OAGlD,CAAC;AAeF,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,KAAG,MAAM,EAQhE,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,+FAA+F;IAC/F,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,4FAA4F;IAC5F,iBAAiB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACtC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,EACf,UAAS,2BAAgC,KACxC,eAyBF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM,KAAG,MAI9C,CAAC;AAEZ,2FAA2F;AAC3F,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MAAM,EAgBtD,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,gFAAgF;IAChF,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAcF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,EACf,UAAS,0BAA+B,KACvC,cAAc,GAAG,IAcnB,CAAC"}
|
|
@@ -1,18 +1,95 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseKotlinProperty = exports.splitTopLevelArgs = exports.stripKotlinAnnotations = exports.parseKotlinFileScope = exports.stripKotlinComments = void 0;
|
|
3
|
+
exports.parseKotlinProperty = exports.splitTopLevelArgs = exports.stripKotlinAnnotations = exports.parseKotlinFileScope = exports.extractDeclaredTypeNames = exports.isPalScriptFile = exports.PAL_SCRIPT_DEFAULT_STAR_IMPORTS = exports.stripKotlinComments = void 0;
|
|
4
4
|
/** Strip Kotlin line and block comments from source before structural parsing. */
|
|
5
5
|
const stripKotlinComments = (content) => content.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\/\/.*$/gm, '');
|
|
6
6
|
exports.stripKotlinComments = stripKotlinComments;
|
|
7
7
|
const STAR_IMPORT_SUFFIX = '.*';
|
|
8
8
|
const PACKAGE_REGEX = /(?:^|\n)\s*package\s+([\w.]+)/;
|
|
9
9
|
const IMPORT_REGEX = /(?:^|\n)\s*import\s+((?:\w+\.)*(?:\w+|\*))(?:\s+as\s+(\w+))?/g;
|
|
10
|
+
/**
|
|
11
|
+
* Star imports every Genesis PAL script gets for free, from genesis-server's
|
|
12
|
+
* `genesisApplicationScriptConfig` (genesis-pal-execution, `GenesisApplicationScriptConfig.kt`).
|
|
13
|
+
* A PAL DETAILS data class can name `FeeType` with no import line of its own because the
|
|
14
|
+
* compiler already holds `global.genesis.gen.dao.enums.*` open for it.
|
|
15
|
+
*
|
|
16
|
+
* Star imports do not recurse, so this reaches the flat `…gen.dao.enums.FeeType` and not the
|
|
17
|
+
* table-scoped `…gen.dao.enums.<dictionary>.<table>.Status`. That is NOT the whole story about
|
|
18
|
+
* table-scoped enums, though: the same config calls `addLocalImports()`, which reads `localEnums`
|
|
19
|
+
* out of `META-INF/…/tables-info.json` and registers each as an EXPLICIT default import
|
|
20
|
+
* (`TableInformation.kt`), and `DaoRunner.kt` writes exactly one entry per enum field with a
|
|
21
|
+
* non-null scope — i.e. precisely the table-scoped ones. So a script CAN name a table-scoped
|
|
22
|
+
* enum with no import, and kotlinc rejects the reference only when two tables supply the same
|
|
23
|
+
* simple name. We do not model that tier, so such a name resolves to `null` and emits `unknown`:
|
|
24
|
+
* a miss rather than a wrong type, and one that cannot reopen the cross-table collision.
|
|
25
|
+
*
|
|
26
|
+
* ORDER IS LOAD-BEARING. `resolveKotlinEnum` walks these in sequence and `defaultImportOwner`
|
|
27
|
+
* ranks by position, so `…gen.dao.enums` preceding `…gen.dao` decides which declaration owns a
|
|
28
|
+
* bare name when both packages hold it — kotlinc would call that reference ambiguous, we take
|
|
29
|
+
* the first.
|
|
30
|
+
*
|
|
31
|
+
* Only the two `gen.dao` entries can currently contribute anything: `parseGeneratedEnumsFromSources`
|
|
32
|
+
* drops any file failing `isGeneratedDaoTreeFile`, which wants `/gen/dao/` in the path, and both
|
|
33
|
+
* default `generatedDaoSources` globs end in `gen/dao/**`. An enum under `gen.config.tables`,
|
|
34
|
+
* `gen.config.view` or `gen.view.entity` therefore never enters the map at all — listing them
|
|
35
|
+
* mirrors the compiler config, but widening the DAO-tree filter is what would actually be
|
|
36
|
+
* needed to pick such an enum up.
|
|
37
|
+
*/
|
|
38
|
+
exports.PAL_SCRIPT_DEFAULT_STAR_IMPORTS = [
|
|
39
|
+
'global.genesis.gen.dao.enums',
|
|
40
|
+
'global.genesis.gen.dao',
|
|
41
|
+
'global.genesis.gen.config.tables',
|
|
42
|
+
'global.genesis.gen.config.view',
|
|
43
|
+
'global.genesis.gen.view.entity',
|
|
44
|
+
];
|
|
45
|
+
/** Dictionary / system-definition scripts live here and are compiled with a different config. */
|
|
46
|
+
const NON_PAL_SCRIPT_DIR = '/genesis/cfg/';
|
|
47
|
+
/**
|
|
48
|
+
* PAL scripts compile with the default imports above; a plain `.kt` source does not, so it only
|
|
49
|
+
* ever resolves through the imports it actually writes.
|
|
50
|
+
*
|
|
51
|
+
* Not every `.kts` is a PAL APPLICATION script, which is what supplies these: dictionary and
|
|
52
|
+
* system-definition scripts get `TablesScriptCompilationConfiguration` and friends, with no
|
|
53
|
+
* `gen.dao.enums.*` anywhere. Those live under `genesis/cfg/` while everything that does get
|
|
54
|
+
* this config (eventhandler, dataserver, reqrep, consolidator, streamer, pipelines) lives under
|
|
55
|
+
* `genesis/scripts/`, so the default `kotlinSources` glob already separates them — but that glob
|
|
56
|
+
* is consumer-configurable, so the directory is checked rather than assumed. A file under
|
|
57
|
+
* neither is taken at its extension: missing a default import only costs an `unknown`, whereas
|
|
58
|
+
* handing one to a `cfg/` script could bind a name the compiler never offered it.
|
|
59
|
+
*/
|
|
60
|
+
const isPalScriptFile = (filePath) => {
|
|
61
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
62
|
+
return normalized.endsWith('.kts') && !normalized.includes(NON_PAL_SCRIPT_DIR);
|
|
63
|
+
};
|
|
64
|
+
exports.isPalScriptFile = isPalScriptFile;
|
|
65
|
+
/**
|
|
66
|
+
* Every type name the file declares, whatever the declaration kind: `data class`, `enum class`,
|
|
67
|
+
* `sealed class`, plain `class`, `interface`, `object`, `typealias`. Matching on the keyword rather than on
|
|
68
|
+
* any one extractor keeps the set complete — `extractDataClasses` only sees declarations with a
|
|
69
|
+
* constructor parameter list, so an `enum class Grade` or an `object Tier` sitting next to a
|
|
70
|
+
* DETAILS class would otherwise be invisible and let a same-named generated enum win.
|
|
71
|
+
*
|
|
72
|
+
* Over-matching is the safe direction here: an extra name means a bare reference resolves to
|
|
73
|
+
* nothing and the field emits `unknown`, where missing one means it silently binds to a
|
|
74
|
+
* generated enum the file never meant.
|
|
75
|
+
*/
|
|
76
|
+
const TYPE_DECLARATION_REGEX = /\b(?:class|interface|object|typealias)\s+(\w+)/g;
|
|
77
|
+
const extractDeclaredTypeNames = (content) => {
|
|
78
|
+
const names = [];
|
|
79
|
+
TYPE_DECLARATION_REGEX.lastIndex = 0;
|
|
80
|
+
let match;
|
|
81
|
+
while ((match = TYPE_DECLARATION_REGEX.exec(content)) !== null) {
|
|
82
|
+
names.push(match[1]);
|
|
83
|
+
}
|
|
84
|
+
return names;
|
|
85
|
+
};
|
|
86
|
+
exports.extractDeclaredTypeNames = extractDeclaredTypeNames;
|
|
10
87
|
/**
|
|
11
88
|
* Read a file's `package` and `import` header. Genesis generates one enum package per table, so
|
|
12
89
|
* the imports are what tell `Status` in Axe.kt apart from `Status` in Rfq.kt.
|
|
13
90
|
*/
|
|
14
|
-
const parseKotlinFileScope = (content) => {
|
|
15
|
-
var _a, _b, _c;
|
|
91
|
+
const parseKotlinFileScope = (content, options = {}) => {
|
|
92
|
+
var _a, _b, _c, _d, _e;
|
|
16
93
|
const imports = new Map();
|
|
17
94
|
const starImports = [];
|
|
18
95
|
IMPORT_REGEX.lastIndex = 0;
|
|
@@ -29,7 +106,11 @@ const parseKotlinFileScope = (content) => {
|
|
|
29
106
|
return {
|
|
30
107
|
packageName: (_c = (_b = content.match(PACKAGE_REGEX)) === null || _b === void 0 ? void 0 : _b[1]) !== null && _c !== void 0 ? _c : '',
|
|
31
108
|
imports,
|
|
32
|
-
|
|
109
|
+
// The file's own star imports come first: a compiler-supplied default is the last thing
|
|
110
|
+
// consulted, after everything the file said out loud. Order is load-bearing — see
|
|
111
|
+
// `resolveKotlinEnum`, which walks these in sequence.
|
|
112
|
+
starImports: [...starImports, ...((_d = options.defaultStarImports) !== null && _d !== void 0 ? _d : [])],
|
|
113
|
+
declaredTypeNames: new Set((_e = options.declaredTypeNames) !== null && _e !== void 0 ? _e : []),
|
|
33
114
|
};
|
|
34
115
|
};
|
|
35
116
|
exports.parseKotlinFileScope = parseKotlinFileScope;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kotlin-parse-utils.js","sourceRoot":"","sources":["../src/kotlin-parse-utils.ts"],"names":[],"mappings":";;;AAEA,kFAAkF;AAC3E,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAU,EAAE,CAC7D,OAAO,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AADvD,QAA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AAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACnE,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAElD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AACxC,CAAC,CAAC;AAjBW,QAAA,mBAAmB,uBAiB9B"}
|
package/dist/parse-enums.d.ts
CHANGED
|
@@ -34,13 +34,22 @@ export declare const extractCompanionFieldEnumValues: (content: string, scope?:
|
|
|
34
34
|
export declare const parseGeneratedEnumsFromSources: (files: string[]) => KotlinEnumMap;
|
|
35
35
|
/**
|
|
36
36
|
* Resolve a type name AS WRITTEN in the file described by `scope` to the enum it declares.
|
|
37
|
-
*
|
|
38
|
-
* is
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
37
|
+
*
|
|
38
|
+
* Kotlin resolution is a precedence ladder, not a fallback chain, and each rung SHADOWS the
|
|
39
|
+
* ones below it rather than deferring to them when it comes up empty:
|
|
40
|
+
*
|
|
41
|
+
* 1. a type the file declares itself
|
|
42
|
+
* 2. an explicit import (incl. aliases), which may be one the compiler supplied
|
|
43
|
+
* 3. the file's own package
|
|
44
|
+
* 4. a star import — the file's own first, then a PAL script's compiler-supplied defaults
|
|
45
|
+
*
|
|
46
|
+
* Rungs 1 and 2 therefore return `null` on a miss instead of falling through. Binding `FeeGrade`
|
|
47
|
+
* to a generated enum because the `com.acme.billing.FeeGrade` the file actually imported is not
|
|
48
|
+
* in our map would be a wrong type, not a near miss, and it type-checks — nobody finds out until
|
|
49
|
+
* a payload is wrong at runtime. An unresolved name becomes `unknown`, which is loud.
|
|
50
|
+
*
|
|
51
|
+
* `scope` is required rather than optional: every real `KotlinDto` carries its declaring file's
|
|
52
|
+
* scope, so a caller with none to give us would itself be a bug worth surfacing at the call site.
|
|
44
53
|
*/
|
|
45
54
|
export declare const resolveKotlinEnum: (kotlinType: string, enums: KotlinEnumMap, scope: KotlinFileScope) => KotlinEnumDef | null;
|
|
46
55
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-enums.d.ts","sourceRoot":"","sources":["../src/parse-enums.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-enums.d.ts","sourceRoot":"","sources":["../src/parse-enums.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,mFAAmF;AACnF,MAAM,MAAM,aAAa,GAAG;IAC1B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,6FAA6F;IAC7F,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAcvD,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,KAAG,OAGzD,CAAC;AASF,gEAAgE;AAChE,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAO,eAA6B,KACnC,aAeF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,+BAA+B,GAC1C,SAAS,MAAM,EACf,QAAO,eAA6B,KACnC,aAgCF,CAAC;AAUF,eAAO,MAAM,8BAA8B,GAAI,OAAO,MAAM,EAAE,KAAG,aAmBhE,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iBAAiB,GAC5B,YAAY,MAAM,EAClB,OAAO,aAAa,EACpB,OAAO,eAAe,KACrB,aAAa,GAAG,IA4BlB,CAAC;AAkCF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,aAAa,KAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAyD/E,CAAC"}
|
package/dist/parse-enums.js
CHANGED
|
@@ -5,7 +5,12 @@ const node_fs_1 = require("node:fs");
|
|
|
5
5
|
const kotlin_parse_utils_1 = require("./kotlin-parse-utils");
|
|
6
6
|
const naming_1 = require("./naming");
|
|
7
7
|
const KOTLIN_FILE_EXTENSION = '.kt';
|
|
8
|
-
const EMPTY_SCOPE = {
|
|
8
|
+
const EMPTY_SCOPE = {
|
|
9
|
+
packageName: '',
|
|
10
|
+
imports: new Map(),
|
|
11
|
+
starImports: [],
|
|
12
|
+
declaredTypeNames: new Set(),
|
|
13
|
+
};
|
|
9
14
|
const qualify = (packageName, name) => packageName ? `${packageName}.${name}` : name;
|
|
10
15
|
/** Any generated DAO tree Kotlin (entities, enums, xref, etc.). */
|
|
11
16
|
const isGeneratedDaoTreeFile = (filePath) => {
|
|
@@ -103,29 +108,47 @@ const parseGeneratedEnumsFromSources = (files) => {
|
|
|
103
108
|
exports.parseGeneratedEnumsFromSources = parseGeneratedEnumsFromSources;
|
|
104
109
|
/**
|
|
105
110
|
* Resolve a type name AS WRITTEN in the file described by `scope` to the enum it declares.
|
|
106
|
-
*
|
|
107
|
-
* is
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
111
|
+
*
|
|
112
|
+
* Kotlin resolution is a precedence ladder, not a fallback chain, and each rung SHADOWS the
|
|
113
|
+
* ones below it rather than deferring to them when it comes up empty:
|
|
114
|
+
*
|
|
115
|
+
* 1. a type the file declares itself
|
|
116
|
+
* 2. an explicit import (incl. aliases), which may be one the compiler supplied
|
|
117
|
+
* 3. the file's own package
|
|
118
|
+
* 4. a star import — the file's own first, then a PAL script's compiler-supplied defaults
|
|
119
|
+
*
|
|
120
|
+
* Rungs 1 and 2 therefore return `null` on a miss instead of falling through. Binding `FeeGrade`
|
|
121
|
+
* to a generated enum because the `com.acme.billing.FeeGrade` the file actually imported is not
|
|
122
|
+
* in our map would be a wrong type, not a near miss, and it type-checks — nobody finds out until
|
|
123
|
+
* a payload is wrong at runtime. An unresolved name becomes `unknown`, which is loud.
|
|
124
|
+
*
|
|
125
|
+
* `scope` is required rather than optional: every real `KotlinDto` carries its declaring file's
|
|
126
|
+
* scope, so a caller with none to give us would itself be a bug worth surfacing at the call site.
|
|
113
127
|
*/
|
|
114
128
|
const resolveKotlinEnum = (kotlinType, enums, scope) => {
|
|
115
|
-
var _a;
|
|
129
|
+
var _a, _b;
|
|
116
130
|
const bare = kotlinType.replace(/\?$/, '').trim();
|
|
117
131
|
if (!bare)
|
|
118
132
|
return null;
|
|
119
133
|
if (bare.includes('.')) {
|
|
120
134
|
return (_a = enums.get(bare)) !== null && _a !== void 0 ? _a : null;
|
|
121
135
|
}
|
|
136
|
+
// 1. The file's own declarations win outright — a `data class Currency` here is what a bare
|
|
137
|
+
// `Currency` in this file means, whatever any import offers under that name.
|
|
138
|
+
if (scope.declaredTypeNames.has(bare))
|
|
139
|
+
return null;
|
|
140
|
+
// 2. An explicit import BINDS the name. If the target isn't an enum we know about, the answer
|
|
141
|
+
// is "not an enum", not "keep looking".
|
|
142
|
+
const imported = scope.imports.get(bare);
|
|
143
|
+
if (imported)
|
|
144
|
+
return (_b = enums.get(imported)) !== null && _b !== void 0 ? _b : null;
|
|
145
|
+
// 3-4. Same package, then star imports in precedence order.
|
|
122
146
|
const candidates = [
|
|
123
|
-
scope.imports.get(bare),
|
|
124
147
|
qualify(scope.packageName, bare),
|
|
125
148
|
...scope.starImports.map((pkg) => `${pkg}.${bare}`),
|
|
126
149
|
];
|
|
127
150
|
for (const fqn of candidates) {
|
|
128
|
-
const hit =
|
|
151
|
+
const hit = enums.get(fqn);
|
|
129
152
|
if (hit)
|
|
130
153
|
return hit;
|
|
131
154
|
}
|
|
@@ -138,6 +161,30 @@ exports.resolveKotlinEnum = resolveKotlinEnum;
|
|
|
138
161
|
* TypeScript, so qualifying them apart would be churn with nothing behind it.
|
|
139
162
|
*/
|
|
140
163
|
const valuesKey = (values) => [...values].sort().join('\0');
|
|
164
|
+
/**
|
|
165
|
+
* The member of a disagreeing group that a bare reference in a PAL script actually binds to —
|
|
166
|
+
* the one sitting in the earliest of `PAL_SCRIPT_DEFAULT_STAR_IMPORTS`, since `resolveKotlinEnum`
|
|
167
|
+
* walks those in order. That declaration is the rightful owner of the bare export name; every
|
|
168
|
+
* other member gets qualified.
|
|
169
|
+
*
|
|
170
|
+
* Keyed on the default-import list itself rather than on package nesting, so the rule is exactly
|
|
171
|
+
* as wide as the reason for it. Nesting was both too wide and too narrow: `…gen.dao` encloses
|
|
172
|
+
* `…gen.dao.enums`, so a `Trade.kt`-style enum declared in the former would take the bare name
|
|
173
|
+
* off the flat enum a script really resolves to, and `…enums.tam` would take it off
|
|
174
|
+
* `…enums.tam.axe` though `enums.*` does not recurse and nothing binds either.
|
|
175
|
+
*
|
|
176
|
+
* Null when no member is in a default-import package, or when several share the earliest one —
|
|
177
|
+
* in both cases nothing singles one out, so they all stay qualified.
|
|
178
|
+
*/
|
|
179
|
+
const defaultImportOwner = (group) => {
|
|
180
|
+
const rank = (def) => kotlin_parse_utils_1.PAL_SCRIPT_DEFAULT_STAR_IMPORTS.indexOf(def.packageName);
|
|
181
|
+
const reachable = group.filter((def) => rank(def) !== -1);
|
|
182
|
+
if (reachable.length === 0)
|
|
183
|
+
return null;
|
|
184
|
+
const best = Math.min(...reachable.map(rank));
|
|
185
|
+
const winners = reachable.filter((def) => rank(def) === best);
|
|
186
|
+
return winners.length === 1 ? winners[0] : null;
|
|
187
|
+
};
|
|
141
188
|
/**
|
|
142
189
|
* Assign every declared enum the name it is exported under.
|
|
143
190
|
*
|
|
@@ -171,9 +218,22 @@ const resolveEnumExportNames = (enums) => {
|
|
|
171
218
|
for (const def of group)
|
|
172
219
|
exportNames.set(def.fqn, simpleName);
|
|
173
220
|
taken.add(simpleName);
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
taken.add(simpleName);
|
|
224
|
+
// One member can still be the rightful owner of the bare name: the one a bare reference in
|
|
225
|
+
// a PAL script actually binds to. Genesis puts unscoped dictionary fields in the flat
|
|
226
|
+
// `…gen.dao.enums`, which a script reaches through its default imports, and scoped ones in
|
|
227
|
+
// `…gen.dao.enums.<dictionary>.<table>`, which it does not. Giving the reachable one that
|
|
228
|
+
// name beats numbering it `TradeStatus2` while its table-scoped sibling reads
|
|
229
|
+
// `ClientTradeReportTradeStatus`. Only that one is spared — every other member is still
|
|
230
|
+
// qualified, so nothing can silently stand in for another table's values.
|
|
231
|
+
const owner = defaultImportOwner(group);
|
|
232
|
+
if (owner) {
|
|
233
|
+
exportNames.set(owner.fqn, simpleName);
|
|
234
|
+
ambiguous.push(group.filter((def) => def !== owner));
|
|
174
235
|
}
|
|
175
236
|
else {
|
|
176
|
-
taken.add(simpleName);
|
|
177
237
|
ambiguous.push(group);
|
|
178
238
|
}
|
|
179
239
|
}
|
package/dist/parse-enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-enums.js","sourceRoot":"","sources":["../src/parse-enums.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,
|
|
1
|
+
{"version":3,"file":"parse-enums.js","sourceRoot":"","sources":["../src/parse-enums.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,6DAI8B;AAC9B,qCAAyC;AAqBzC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAEpC,MAAM,WAAW,GAAoB;IACnC,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,IAAI,GAAG,EAAE;IAClB,WAAW,EAAE,EAAE;IACf,iBAAiB,EAAE,IAAI,GAAG,EAAE;CAC7B,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,WAAmB,EAAE,IAAY,EAAU,EAAE,CAC5D,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAEhD,mEAAmE;AAC5D,MAAM,sBAAsB,GAAG,CAAC,QA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,CAAC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAzDW,QAAA,sBAAsB,0BAyDjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-kotlin.d.ts","sourceRoot":"","sources":["../src/parse-kotlin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-kotlin.d.ts","sourceRoot":"","sources":["../src/parse-kotlin.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EAChB,MAAM,SAAS,CAAC;AAmBjB,QAAA,MAAM,gBAAgB,QAAsE,CAAC;AAE7F,QAAA,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,cAAc,EAAE,CAAA;CAAE,EAkC3F,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,OAAO,MAAM,EAAE,KAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAyB3E,CAAC;AAeF,eAAO,MAAM,wBAAwB,GACnC,OAAO,MAAM,EAAE,EACf,MAAM,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,KAC3B;IAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IAAC,QAAQ,EAAE,eAAe,EAAE,CAAA;CAwDxD,CAAC;AAEF,kGAAkG;AAClG,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,8FAA8F;IAC9F,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,4DAA4D;IAC5D,SAAS,EAAE,eAAe,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,MAAM,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAC5B,cAAc,cAAc,KAC3B,MAuBF,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/parse-kotlin.js
CHANGED
|
@@ -61,8 +61,16 @@ const parseDtosFromSources = (files) => {
|
|
|
61
61
|
const dtos = new Map();
|
|
62
62
|
for (const filePath of files) {
|
|
63
63
|
const content = (0, kotlin_parse_utils_1.stripKotlinComments)((0, node_fs_1.readFileSync)(filePath, 'utf8'));
|
|
64
|
-
const
|
|
65
|
-
|
|
64
|
+
const declared = extractDataClasses(content);
|
|
65
|
+
// A DETAILS data class declared in a PAL script resolves against the compiler's default
|
|
66
|
+
// imports as well as its own — that is how `val feeType: FeeType` compiles with no import.
|
|
67
|
+
// The file's own declarations go in too, so they shadow a same-named generated enum —
|
|
68
|
+
// every declaration kind, not just the data classes we pull properties from.
|
|
69
|
+
const fileScope = (0, kotlin_parse_utils_1.parseKotlinFileScope)(content, {
|
|
70
|
+
defaultStarImports: (0, kotlin_parse_utils_1.isPalScriptFile)(filePath) ? kotlin_parse_utils_1.PAL_SCRIPT_DEFAULT_STAR_IMPORTS : undefined,
|
|
71
|
+
declaredTypeNames: (0, kotlin_parse_utils_1.extractDeclaredTypeNames)(content),
|
|
72
|
+
});
|
|
73
|
+
for (const parsed of declared) {
|
|
66
74
|
dtos.set(parsed.name, {
|
|
67
75
|
name: parsed.name,
|
|
68
76
|
properties: parsed.properties,
|
package/dist/parse-kotlin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-kotlin.js","sourceRoot":"","sources":["../src/parse-kotlin.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,
|
|
1
|
+
{"version":3,"file":"parse-kotlin.js","sourceRoot":"","sources":["../src/parse-kotlin.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,6DAQ8B;AAC9B,qCAA8D;AAC9D,+CAAkD;AAUlD,MAAM,YAAY,GAA2B;IAC3C,MAAM,EAAE,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c,kBA2BzB"}
|
package/dist/types.d.ts
CHANGED
|
@@ -36,6 +36,11 @@ export type KotlinFileScope = {
|
|
|
36
36
|
imports: Map<string, string>;
|
|
37
37
|
/** Packages brought in wholesale by `import pkg.*`. */
|
|
38
38
|
starImports: string[];
|
|
39
|
+
/**
|
|
40
|
+
* Type names the file declares itself. These shadow every import: a `data class Currency`
|
|
41
|
+
* here is what a bare `Currency` in this file means, whatever an import offers under it.
|
|
42
|
+
*/
|
|
43
|
+
declaredTypeNames: ReadonlySet<string>;
|
|
39
44
|
};
|
|
40
45
|
export type KotlinDto = {
|
|
41
46
|
name: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;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W,EAAE,MAAM,EAAE,CAAC;IACtB;;;OAGG;IACH,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,SAAS,EAAE,eAAe,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/event-type-codegen",
|
|
3
3
|
"description": "Build-time TypeScript codegen from Kotlin event handler DTOs",
|
|
4
|
-
"version": "15.28.
|
|
4
|
+
"version": "15.28.1",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"consola": "^3.0.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@genesislcap/foundation-testing": "15.28.
|
|
24
|
+
"@genesislcap/foundation-testing": "15.28.1",
|
|
25
25
|
"@types/node": "^22.10.2",
|
|
26
26
|
"tsx": "^4.7.0",
|
|
27
27
|
"uvu": "0.5.4"
|
|
@@ -23,6 +23,14 @@ export const Direction = {
|
|
|
23
23
|
|
|
24
24
|
export type Direction = (typeof Direction)[keyof typeof Direction];
|
|
25
25
|
|
|
26
|
+
export const FeeType = {
|
|
27
|
+
BROKERAGE: 'BROKERAGE',
|
|
28
|
+
STAMP: 'STAMP',
|
|
29
|
+
TAX: 'TAX',
|
|
30
|
+
} as const;
|
|
31
|
+
|
|
32
|
+
export type FeeType = (typeof FeeType)[keyof typeof FeeType];
|
|
33
|
+
|
|
26
34
|
export const Priority = {
|
|
27
35
|
LOW: 'LOW',
|
|
28
36
|
HIGH: 'HIGH',
|
|
@@ -47,6 +55,13 @@ export const Side = {
|
|
|
47
55
|
|
|
48
56
|
export type Side = (typeof Side)[keyof typeof Side];
|
|
49
57
|
|
|
58
|
+
export const Status = {
|
|
59
|
+
DRAFT: 'DRAFT',
|
|
60
|
+
SETTLED: 'SETTLED',
|
|
61
|
+
} as const;
|
|
62
|
+
|
|
63
|
+
export type Status = (typeof Status)[keyof typeof Status];
|
|
64
|
+
|
|
50
65
|
export interface AmendCellInputDetails {
|
|
51
66
|
MAX_SIZE: number;
|
|
52
67
|
MAX_INSTRUMENT_SCORE: number;
|
|
@@ -74,6 +89,14 @@ export interface ChargeAmendInputDetails {
|
|
|
74
89
|
CELLS: AmendCellInputDetails[];
|
|
75
90
|
}
|
|
76
91
|
|
|
92
|
+
export interface FeeEventInputDetails {
|
|
93
|
+
FEE_ID?: string;
|
|
94
|
+
FEE_TYPE: FeeType;
|
|
95
|
+
STATUS: Status;
|
|
96
|
+
DIRECTION: unknown;
|
|
97
|
+
AXE_STATUS: AxeStatus;
|
|
98
|
+
}
|
|
99
|
+
|
|
77
100
|
export interface FooInputDetails {
|
|
78
101
|
FOO_ID: string;
|
|
79
102
|
BAR_ID?: string;
|
|
@@ -117,6 +140,7 @@ export interface EventDetailsMap {
|
|
|
117
140
|
EVENT_CHARGE_AMEND: ChargeAmendInputDetails;
|
|
118
141
|
EVENT_CONTEXT_FOO: FooInputDetails;
|
|
119
142
|
EVENT_DAO_HANDLER: InstrumentByIdDetails;
|
|
143
|
+
EVENT_FEE_INSERT: FeeEventInputDetails;
|
|
120
144
|
EVENT_FOO: FooInputDetails;
|
|
121
145
|
EVENT_RFQ_INSERT: RfqDetails;
|
|
122
146
|
EVENT_TRADE_DELETE: TradeByIdDetails;
|
|
@@ -181,6 +205,14 @@ export class EventDaoHandler extends GenesisEvent<'EVENT_DAO_HANDLER', Instrumen
|
|
|
181
205
|
}
|
|
182
206
|
}
|
|
183
207
|
|
|
208
|
+
export class EventFeeInsert extends GenesisEvent<'EVENT_FEE_INSERT', FeeEventInputDetails> {
|
|
209
|
+
readonly MESSAGE_TYPE = 'EVENT_FEE_INSERT' as const;
|
|
210
|
+
|
|
211
|
+
constructor(details: FeeEventInputDetails) {
|
|
212
|
+
super(details);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
184
216
|
export class EventFoo extends GenesisEvent<'EVENT_FOO', FooInputDetails> {
|
|
185
217
|
readonly MESSAGE_TYPE = 'EVENT_FOO' as const;
|
|
186
218
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package global.genesis.gen.dao.enums
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fixture stand-in for a dictionary field with no scope: Genesis puts those in the flat
|
|
5
|
+
* `…gen.dao.enums` package, which is what PAL scripts reach through their default imports.
|
|
6
|
+
*/
|
|
7
|
+
public enum class FeeType {
|
|
8
|
+
BROKERAGE,
|
|
9
|
+
STAMP,
|
|
10
|
+
TAX,
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package global.genesis.gen.dao.enums
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An UNSCOPED dictionary field's enum, sharing a simple name with the two table-scoped ones and
|
|
5
|
+
* disagreeing with both. A PAL script's default import reaches this and not those, so this is
|
|
6
|
+
* the declaration a bare `Status` binds to — and the one that keeps the bare export name.
|
|
7
|
+
*/
|
|
8
|
+
public enum class Status {
|
|
9
|
+
DRAFT,
|
|
10
|
+
SETTLED,
|
|
11
|
+
}
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
// AUTO-GENERATED — do not edit
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Unmapped handlers (not included in EventDetailsMap):
|
|
5
|
-
* - NOOP (Unit): Unit input [Handlers.kt]
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { GenesisEvent } from '@genesislcap/foundation-comms';
|
|
9
|
-
|
|
10
|
-
export const AxeStatus = {
|
|
11
|
-
LIVE: 'LIVE',
|
|
12
|
-
TRADED: 'TRADED',
|
|
13
|
-
WITHDRAWN: 'WITHDRAWN',
|
|
14
|
-
EXPIRED: 'EXPIRED',
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
export type AxeStatus = (typeof AxeStatus)[keyof typeof AxeStatus];
|
|
18
|
-
|
|
19
|
-
export const Direction = {
|
|
20
|
-
BUY: 'BUY',
|
|
21
|
-
SELL: 'SELL',
|
|
22
|
-
} as const;
|
|
23
|
-
|
|
24
|
-
export type Direction = (typeof Direction)[keyof typeof Direction];
|
|
25
|
-
|
|
26
|
-
export const Priority = {
|
|
27
|
-
LOW: 'LOW',
|
|
28
|
-
HIGH: 'HIGH',
|
|
29
|
-
} as const;
|
|
30
|
-
|
|
31
|
-
export type Priority = (typeof Priority)[keyof typeof Priority];
|
|
32
|
-
|
|
33
|
-
export const RfqStatus = {
|
|
34
|
-
PRICE_REQUEST: 'PRICE_REQUEST',
|
|
35
|
-
LIVE_PRICE: 'LIVE_PRICE',
|
|
36
|
-
EXECUTED: 'EXECUTED',
|
|
37
|
-
PASSED: 'PASSED',
|
|
38
|
-
EXPIRED: 'EXPIRED',
|
|
39
|
-
} as const;
|
|
40
|
-
|
|
41
|
-
export type RfqStatus = (typeof RfqStatus)[keyof typeof RfqStatus];
|
|
42
|
-
|
|
43
|
-
export const Side = {
|
|
44
|
-
BUY: 'BUY',
|
|
45
|
-
SELL: 'SELL',
|
|
46
|
-
} as const;
|
|
47
|
-
|
|
48
|
-
export type Side = (typeof Side)[keyof typeof Side];
|
|
49
|
-
|
|
50
|
-
export interface AmendCellInputDetails {
|
|
51
|
-
MAX_SIZE: number;
|
|
52
|
-
MAX_INSTRUMENT_SCORE: number;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface AnnotatedInputDetails {
|
|
56
|
-
COUNTERPARTY_ID: string;
|
|
57
|
-
NAME: string;
|
|
58
|
-
IGNORED_HINT?: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface AxeDetails {
|
|
62
|
-
AXE_ID?: string;
|
|
63
|
-
INSTRUMENT_ID: string;
|
|
64
|
-
DIRECTION?: Direction;
|
|
65
|
-
STATUS?: AxeStatus;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface BulkSideInputDetails {
|
|
69
|
-
PRIORITIES: Priority[];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface ChargeAmendInputDetails {
|
|
73
|
-
CHARGE_ADDITION_ID: string;
|
|
74
|
-
CELLS: AmendCellInputDetails[];
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface FooInputDetails {
|
|
78
|
-
FOO_ID: string;
|
|
79
|
-
BAR_ID?: string;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface InstrumentByIdDetails {
|
|
83
|
-
INSTRUMENT_ID: string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface NestedInputDetails {
|
|
87
|
-
ITEMS: FooInputDetails[];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface RfqDetails {
|
|
91
|
-
RFQ_ID?: string;
|
|
92
|
-
INSTRUMENT_ID: string;
|
|
93
|
-
DIRECTION?: Direction;
|
|
94
|
-
STATUS?: RfqStatus;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface TradeDetails {
|
|
98
|
-
TRADE_ID?: string;
|
|
99
|
-
INSTRUMENT_ID: string;
|
|
100
|
-
COUNTERPARTY_ID: string;
|
|
101
|
-
QUANTITY: number;
|
|
102
|
-
SIDE?: Side;
|
|
103
|
-
PRICE: number;
|
|
104
|
-
COMMISSION?: string;
|
|
105
|
-
CREATED_AT?: number;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface TradeByIdDetails {
|
|
109
|
-
TRADE_ID: string;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export interface EventDetailsMap {
|
|
113
|
-
EVENT_ANNOTATED: AnnotatedInputDetails;
|
|
114
|
-
EVENT_AXE_INSERT: AxeDetails;
|
|
115
|
-
EVENT_BAR_BAZ: NestedInputDetails;
|
|
116
|
-
EVENT_BULK_SIDE: BulkSideInputDetails;
|
|
117
|
-
EVENT_CHARGE_AMEND: ChargeAmendInputDetails;
|
|
118
|
-
EVENT_CONTEXT_FOO: FooInputDetails;
|
|
119
|
-
EVENT_DAO_HANDLER: InstrumentByIdDetails;
|
|
120
|
-
EVENT_FOO: FooInputDetails;
|
|
121
|
-
EVENT_RFQ_INSERT: RfqDetails;
|
|
122
|
-
EVENT_TRADE_DELETE: TradeByIdDetails;
|
|
123
|
-
EVENT_TRADE_INSERT: TradeDetails;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export type GenesisEventName = keyof EventDetailsMap;
|
|
127
|
-
|
|
128
|
-
export class EventAnnotated extends GenesisEvent<'EVENT_ANNOTATED', AnnotatedInputDetails> {
|
|
129
|
-
readonly MESSAGE_TYPE = 'EVENT_ANNOTATED' as const;
|
|
130
|
-
|
|
131
|
-
constructor(details: AnnotatedInputDetails) {
|
|
132
|
-
super(details);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export class EventAxeInsert extends GenesisEvent<'EVENT_AXE_INSERT', AxeDetails> {
|
|
137
|
-
readonly MESSAGE_TYPE = 'EVENT_AXE_INSERT' as const;
|
|
138
|
-
|
|
139
|
-
constructor(details: AxeDetails) {
|
|
140
|
-
super(details);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export class EventBarBaz extends GenesisEvent<'EVENT_BAR_BAZ', NestedInputDetails> {
|
|
145
|
-
readonly MESSAGE_TYPE = 'EVENT_BAR_BAZ' as const;
|
|
146
|
-
|
|
147
|
-
constructor(details: NestedInputDetails) {
|
|
148
|
-
super(details);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export class EventBulkSide extends GenesisEvent<'EVENT_BULK_SIDE', BulkSideInputDetails> {
|
|
153
|
-
readonly MESSAGE_TYPE = 'EVENT_BULK_SIDE' as const;
|
|
154
|
-
|
|
155
|
-
constructor(details: BulkSideInputDetails) {
|
|
156
|
-
super(details);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export class EventChargeAmend extends GenesisEvent<'EVENT_CHARGE_AMEND', ChargeAmendInputDetails> {
|
|
161
|
-
readonly MESSAGE_TYPE = 'EVENT_CHARGE_AMEND' as const;
|
|
162
|
-
|
|
163
|
-
constructor(details: ChargeAmendInputDetails) {
|
|
164
|
-
super(details);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export class EventContextFoo extends GenesisEvent<'EVENT_CONTEXT_FOO', FooInputDetails> {
|
|
169
|
-
readonly MESSAGE_TYPE = 'EVENT_CONTEXT_FOO' as const;
|
|
170
|
-
|
|
171
|
-
constructor(details: FooInputDetails) {
|
|
172
|
-
super(details);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export class EventDaoHandler extends GenesisEvent<'EVENT_DAO_HANDLER', InstrumentByIdDetails> {
|
|
177
|
-
readonly MESSAGE_TYPE = 'EVENT_DAO_HANDLER' as const;
|
|
178
|
-
|
|
179
|
-
constructor(details: InstrumentByIdDetails) {
|
|
180
|
-
super(details);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export class EventFoo extends GenesisEvent<'EVENT_FOO', FooInputDetails> {
|
|
185
|
-
readonly MESSAGE_TYPE = 'EVENT_FOO' as const;
|
|
186
|
-
|
|
187
|
-
constructor(details: FooInputDetails) {
|
|
188
|
-
super(details);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export class EventRfqInsert extends GenesisEvent<'EVENT_RFQ_INSERT', RfqDetails> {
|
|
193
|
-
readonly MESSAGE_TYPE = 'EVENT_RFQ_INSERT' as const;
|
|
194
|
-
|
|
195
|
-
constructor(details: RfqDetails) {
|
|
196
|
-
super(details);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export class EventTradeDelete extends GenesisEvent<'EVENT_TRADE_DELETE', TradeByIdDetails> {
|
|
201
|
-
readonly MESSAGE_TYPE = 'EVENT_TRADE_DELETE' as const;
|
|
202
|
-
|
|
203
|
-
constructor(details: TradeByIdDetails) {
|
|
204
|
-
super(details);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export class EventTradeInsert extends GenesisEvent<'EVENT_TRADE_INSERT', TradeDetails> {
|
|
209
|
-
readonly MESSAGE_TYPE = 'EVENT_TRADE_INSERT' as const;
|
|
210
|
-
|
|
211
|
-
constructor(details: TradeDetails) {
|
|
212
|
-
super(details);
|
|
213
|
-
}
|
|
214
|
-
}
|