@genesislcap/event-type-codegen 14.489.0-canary.FUI-2574-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 +80 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +58 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/naming.d.ts +9 -0
- package/dist/naming.d.ts.map +1 -0
- package/dist/naming.js +26 -0
- package/dist/naming.js.map +1 -0
- package/dist/parse-dao.d.ts +18 -0
- package/dist/parse-dao.d.ts.map +1 -0
- package/dist/parse-dao.js +175 -0
- package/dist/parse-dao.js.map +1 -0
- package/dist/parse-enums.d.ts +16 -0
- package/dist/parse-enums.d.ts.map +1 -0
- package/dist/parse-enums.js +98 -0
- package/dist/parse-enums.js.map +1 -0
- package/dist/parse-kotlin.d.ts +15 -0
- package/dist/parse-kotlin.d.ts.map +1 -0
- package/dist/parse-kotlin.js +190 -0
- package/dist/parse-kotlin.js.map +1 -0
- package/dist/render.d.ts +4 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +89 -0
- package/dist/render.js.map +1 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/license.txt +46 -0
- package/package.json +38 -0
- package/src/config.ts +67 -0
- package/src/index.ts +118 -0
- package/src/naming.ts +24 -0
- package/src/parse-dao.ts +186 -0
- package/src/parse-enums.ts +105 -0
- package/src/parse-kotlin.ts +216 -0
- package/src/render.ts +118 -0
- package/src/types.ts +56 -0
- package/test/fixtures/client-out/genesis-event-types.ts +102 -0
- package/test/fixtures/golden/genesis-event-types.ts +102 -0
- package/test/fixtures/mini-server/generated-dao/global/genesis/gen/dao/Instrument.kt +13 -0
- package/test/fixtures/mini-server/generated-dao/global/genesis/gen/dao/Trade.kt +51 -0
- package/test/fixtures/mini-server/src/main/kotlin/com/example/Handlers.kt +16 -0
- package/test/fixtures/mini-server/src/main/kotlin/com/example/dto/Samples.kt +10 -0
- package/test/generate.test.ts +88 -0
- package/tsconfig.json +12 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kotlinEnumTypeRef = exports.kotlinEnumTypeToTs = exports.kotlinEnumSimpleName = exports.parseGeneratedEnumsFromSources = exports.extractCompanionFieldEnumValues = exports.extractEnumClassesFromContent = exports.isGeneratedDaoTreeFile = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const KOTLIN_FILE_EXTENSION = '.kt';
|
|
6
|
+
/** Any generated DAO tree Kotlin (entities, enums, xref, etc.). */
|
|
7
|
+
const isGeneratedDaoTreeFile = (filePath) => {
|
|
8
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
9
|
+
return /\/gen\/dao\//i.test(normalized) && normalized.endsWith(KOTLIN_FILE_EXTENSION);
|
|
10
|
+
};
|
|
11
|
+
exports.isGeneratedDaoTreeFile = isGeneratedDaoTreeFile;
|
|
12
|
+
const parseEnumMembers = (body) => body
|
|
13
|
+
.split(',')
|
|
14
|
+
.map((part) => part.replace(/\/\/.*$/, '').trim())
|
|
15
|
+
.map((part) => { var _a, _b; return (_b = (_a = part.split(/\s+/)[0]) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : ''; })
|
|
16
|
+
.filter((name) => /^\w+$/.test(name));
|
|
17
|
+
/** `enum class Side { BUY, SELL }` in generated DAO sources. */
|
|
18
|
+
const extractEnumClassesFromContent = (content) => {
|
|
19
|
+
const enums = new Map();
|
|
20
|
+
const enumRegex = /(?:^|\n)\s*(?:public\s+)?enum\s+class\s+(\w+)\s*\{([^}]*)\}/gm;
|
|
21
|
+
let match;
|
|
22
|
+
while ((match = enumRegex.exec(content)) !== null) {
|
|
23
|
+
const name = match[1];
|
|
24
|
+
const members = parseEnumMembers(match[2]);
|
|
25
|
+
if (members.length > 0) {
|
|
26
|
+
enums.set(name, members);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return enums;
|
|
30
|
+
};
|
|
31
|
+
exports.extractEnumClassesFromContent = extractEnumClassesFromContent;
|
|
32
|
+
/**
|
|
33
|
+
* Companion `Field` metadata on generated entities, e.g.
|
|
34
|
+
* `values = "STANDARD PREMIUM TRIAL"` on `NonNullable<Tier>(Field(… type = Field.Type.ENUM …))`.
|
|
35
|
+
*/
|
|
36
|
+
const extractCompanionFieldEnumValues = (content) => {
|
|
37
|
+
const enums = new Map();
|
|
38
|
+
const blockRegex = /public\s+val\s+\w+:\s*NonNullable<(\w+)>\s*=\s*NonNullable<\1>\(Field\(([\s\S]*?)\)\)/g;
|
|
39
|
+
let match;
|
|
40
|
+
while ((match = blockRegex.exec(content)) !== null) {
|
|
41
|
+
const enumTypeName = match[1];
|
|
42
|
+
const fieldBody = match[2];
|
|
43
|
+
if (!fieldBody.includes('Field.Type.ENUM'))
|
|
44
|
+
continue;
|
|
45
|
+
const valuesMatch = fieldBody.match(/values\s*=\s*"([^"]+)"/);
|
|
46
|
+
if (!valuesMatch)
|
|
47
|
+
continue;
|
|
48
|
+
const literals = valuesMatch[1]
|
|
49
|
+
.trim()
|
|
50
|
+
.split(/\s+/)
|
|
51
|
+
.filter((value) => value.length > 0);
|
|
52
|
+
if (literals.length > 0) {
|
|
53
|
+
enums.set(enumTypeName, literals);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return enums;
|
|
57
|
+
};
|
|
58
|
+
exports.extractCompanionFieldEnumValues = extractCompanionFieldEnumValues;
|
|
59
|
+
const mergeEnumMaps = (into, from) => {
|
|
60
|
+
for (const [name, values] of from) {
|
|
61
|
+
if (!into.has(name)) {
|
|
62
|
+
into.set(name, values);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const parseGeneratedEnumsFromSources = (files) => {
|
|
67
|
+
const enums = new Map();
|
|
68
|
+
for (const filePath of files) {
|
|
69
|
+
if (!(0, exports.isGeneratedDaoTreeFile)(filePath))
|
|
70
|
+
continue;
|
|
71
|
+
const content = (0, node_fs_1.readFileSync)(filePath, 'utf8');
|
|
72
|
+
mergeEnumMaps(enums, (0, exports.extractEnumClassesFromContent)(content));
|
|
73
|
+
mergeEnumMaps(enums, (0, exports.extractCompanionFieldEnumValues)(content));
|
|
74
|
+
}
|
|
75
|
+
return enums;
|
|
76
|
+
};
|
|
77
|
+
exports.parseGeneratedEnumsFromSources = parseGeneratedEnumsFromSources;
|
|
78
|
+
const kotlinEnumSimpleName = (kotlinType) => {
|
|
79
|
+
var _a;
|
|
80
|
+
const bare = kotlinType.replace(/\?$/, '').trim();
|
|
81
|
+
return bare.includes('.') ? ((_a = bare.split('.').pop()) !== null && _a !== void 0 ? _a : bare) : bare;
|
|
82
|
+
};
|
|
83
|
+
exports.kotlinEnumSimpleName = kotlinEnumSimpleName;
|
|
84
|
+
const kotlinEnumTypeToTs = (kotlinType, enums) => {
|
|
85
|
+
const simpleName = (0, exports.kotlinEnumSimpleName)(kotlinType);
|
|
86
|
+
const values = enums.get(simpleName);
|
|
87
|
+
if (!values || values.length === 0)
|
|
88
|
+
return null;
|
|
89
|
+
return values.map((value) => `'${value}'`).join(' | ');
|
|
90
|
+
};
|
|
91
|
+
exports.kotlinEnumTypeToTs = kotlinEnumTypeToTs;
|
|
92
|
+
/** Use generated enum type name when declared (paired with `renderEnumExports`). */
|
|
93
|
+
const kotlinEnumTypeRef = (kotlinType, enums) => {
|
|
94
|
+
const simpleName = (0, exports.kotlinEnumSimpleName)(kotlinType);
|
|
95
|
+
return enums.has(simpleName) ? simpleName : null;
|
|
96
|
+
};
|
|
97
|
+
exports.kotlinEnumTypeRef = kotlinEnumTypeRef;
|
|
98
|
+
//# sourceMappingURL=par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AHW,QAAA,oBAAoB,wBAG/B;AAEK,MAAM,kBAAkB,GAAG,CAAC,UAAkB,EAAE,KAAoB,EAAiB,EAAE;IAC5F,MAAM,UAAU,GAAG,IAAA,4BAAoB,EAAC,UAAU,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAChD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC,CAAC;AALW,QAAA,kBAAkB,sBAK7B;AAEF,oFAAoF;AAC7E,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAE,KAAoB,EAAiB,EAAE;IAC3F,MAAM,UAAU,GAAG,IAAA,4BAAoB,EAAC,UAAU,CAAC,CAAC;IACpD,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC,CAAC;AAHW,QAAA,iBAAiB,qBAG5B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { KotlinEnumMap } from './parse-enums';
|
|
2
|
+
import type { KotlinDto, KotlinProperty, MappedHandler, UnmappedHandler } from './types';
|
|
3
|
+
declare const DATA_CLASS_START: RegExp;
|
|
4
|
+
declare const extractDataClasses: (content: string) => {
|
|
5
|
+
name: string;
|
|
6
|
+
properties: KotlinProperty[];
|
|
7
|
+
}[];
|
|
8
|
+
export declare const parseDtosFromSources: (files: string[]) => Map<string, KotlinDto>;
|
|
9
|
+
export declare const parseHandlersFromSources: (files: string[], dtos: Map<string, KotlinDto>) => {
|
|
10
|
+
mapped: MappedHandler[];
|
|
11
|
+
unmapped: UnmappedHandler[];
|
|
12
|
+
};
|
|
13
|
+
export declare const kotlinTypeToTs: (kotlinType: string, dtos: Map<string, KotlinDto>, enums?: KotlinEnumMap) => string;
|
|
14
|
+
export { extractDataClasses, DATA_CLASS_START };
|
|
15
|
+
//# sourceMappingURL=parse-kotlin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-kotlin.d.ts","sourceRoot":"","sources":["../src/parse-kotlin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkBzF,QAAA,MAAM,gBAAgB,QAAsE,CAAC;AAqC7F,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,CAgB3E,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;CAyDxD,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,MAAM,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAC5B,QAAO,aAAyB,KAC/B,MAoBF,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DATA_CLASS_START = exports.extractDataClasses = exports.kotlinTypeToTs = exports.parseHandlersFromSources = exports.parseDtosFromSources = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const naming_1 = require("./naming");
|
|
6
|
+
const parse_enums_1 = require("./parse-enums");
|
|
7
|
+
const PRIMITIVE_TS = {
|
|
8
|
+
String: 'string',
|
|
9
|
+
Int: 'number',
|
|
10
|
+
Long: 'number',
|
|
11
|
+
Short: 'number',
|
|
12
|
+
Byte: 'number',
|
|
13
|
+
Double: 'number',
|
|
14
|
+
Float: 'number',
|
|
15
|
+
Boolean: 'boolean',
|
|
16
|
+
BigDecimal: 'string',
|
|
17
|
+
DateTime: 'string',
|
|
18
|
+
Instant: 'string',
|
|
19
|
+
LocalDate: 'string',
|
|
20
|
+
LocalDateTime: 'string',
|
|
21
|
+
};
|
|
22
|
+
const DATA_CLASS_START = /^\s*(?:data\s+)?class\s+(\w+)\s*(?:\([^)]*\))?\s*(?:\([^)]*\)|\{)/;
|
|
23
|
+
exports.DATA_CLASS_START = DATA_CLASS_START;
|
|
24
|
+
const splitTopLevelArgs = (body) => {
|
|
25
|
+
const parts = [];
|
|
26
|
+
let depth = 0;
|
|
27
|
+
let current = '';
|
|
28
|
+
for (const ch of body) {
|
|
29
|
+
if (ch === '(' || ch === '<' || ch === '[')
|
|
30
|
+
depth += 1;
|
|
31
|
+
if (ch === ')' || ch === '>' || ch === ']')
|
|
32
|
+
depth -= 1;
|
|
33
|
+
if (ch === ',' && depth === 0) {
|
|
34
|
+
parts.push(current.trim());
|
|
35
|
+
current = '';
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
current += ch;
|
|
39
|
+
}
|
|
40
|
+
if (current.trim())
|
|
41
|
+
parts.push(current.trim());
|
|
42
|
+
return parts;
|
|
43
|
+
};
|
|
44
|
+
const stripKotlinAnnotations = (segment) => segment
|
|
45
|
+
.replace(/@[A-Za-z_][\w.]*(?:\s*<[^>]*>)?(?:\s*\([^)]*\))?/g, ' ')
|
|
46
|
+
.replace(/\s+/g, ' ')
|
|
47
|
+
.trim();
|
|
48
|
+
const parseProperty = (segment) => {
|
|
49
|
+
const cleaned = stripKotlinAnnotations(segment);
|
|
50
|
+
const match = cleaned.match(/^(?:val|var)\s+(\w+)\s*:\s*([^=]+?)(?:\s*=\s*.+)?$/);
|
|
51
|
+
if (!match)
|
|
52
|
+
return null;
|
|
53
|
+
const name = match[1];
|
|
54
|
+
let kotlinType = match[2].trim();
|
|
55
|
+
const optional = kotlinType.endsWith('?') || cleaned.includes('=');
|
|
56
|
+
kotlinType = kotlinType.replace(/\?$/, '').trim();
|
|
57
|
+
return { name, kotlinType, optional };
|
|
58
|
+
};
|
|
59
|
+
const extractDataClasses = (content) => {
|
|
60
|
+
const results = [];
|
|
61
|
+
const classRegex = /(?:^|\n)\s*(?:data\s+)?class\s+(\w+)\s*\(/gm;
|
|
62
|
+
let match;
|
|
63
|
+
while ((match = classRegex.exec(content)) !== null) {
|
|
64
|
+
const name = match[1];
|
|
65
|
+
const openParenIndex = match.index + match[0].length - 1;
|
|
66
|
+
let depth = 0;
|
|
67
|
+
let closeIndex = -1;
|
|
68
|
+
for (let i = openParenIndex; i < content.length; i += 1) {
|
|
69
|
+
const ch = content[i];
|
|
70
|
+
if (ch === '(')
|
|
71
|
+
depth += 1;
|
|
72
|
+
if (ch === ')') {
|
|
73
|
+
depth -= 1;
|
|
74
|
+
if (depth === 0) {
|
|
75
|
+
closeIndex = i;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (closeIndex === -1)
|
|
81
|
+
continue;
|
|
82
|
+
const body = content.slice(openParenIndex + 1, closeIndex);
|
|
83
|
+
const properties = splitTopLevelArgs(body)
|
|
84
|
+
.map(parseProperty)
|
|
85
|
+
.filter((p) => p != null);
|
|
86
|
+
if (properties.length > 0) {
|
|
87
|
+
results.push({ name, properties });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return results;
|
|
91
|
+
};
|
|
92
|
+
exports.extractDataClasses = extractDataClasses;
|
|
93
|
+
const parseDtosFromSources = (files) => {
|
|
94
|
+
const dtos = new Map();
|
|
95
|
+
for (const filePath of files) {
|
|
96
|
+
const rawContent = (0, node_fs_1.readFileSync)(filePath, 'utf8');
|
|
97
|
+
const content = rawContent.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\/\/.*$/gm, '');
|
|
98
|
+
for (const parsed of extractDataClasses(content)) {
|
|
99
|
+
dtos.set(parsed.name, {
|
|
100
|
+
name: parsed.name,
|
|
101
|
+
properties: parsed.properties,
|
|
102
|
+
filePath,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return dtos;
|
|
107
|
+
};
|
|
108
|
+
exports.parseDtosFromSources = parseDtosFromSources;
|
|
109
|
+
const HANDLER_REGEX = /(?:eventHandler|contextEventHandler)\s*<\s*([^<>,]+?)(?:\s*,\s*[^>]+)?\s*>\s*\(\s*(?:name\s*=\s*)?"([^"]+)"[^)]*\)/g;
|
|
110
|
+
const HANDLER_INDEX_INPUT = /^(\w+)\.(By\w+)$/;
|
|
111
|
+
const unmappedReason = (inputType) => {
|
|
112
|
+
const trimmed = inputType.trim();
|
|
113
|
+
if (trimmed === 'Unit')
|
|
114
|
+
return 'Unit input';
|
|
115
|
+
if (HANDLER_INDEX_INPUT.test(trimmed))
|
|
116
|
+
return null;
|
|
117
|
+
if (trimmed.includes('.'))
|
|
118
|
+
return 'Non-DTO type (DAO/index/nested qualified type)';
|
|
119
|
+
return null;
|
|
120
|
+
};
|
|
121
|
+
const parseHandlersFromSources = (files, dtos) => {
|
|
122
|
+
const mapped = [];
|
|
123
|
+
const unmapped = [];
|
|
124
|
+
const seenEvents = new Set();
|
|
125
|
+
for (const filePath of files) {
|
|
126
|
+
const content = (0, node_fs_1.readFileSync)(filePath, 'utf8');
|
|
127
|
+
const stripped = content.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
128
|
+
const tryMatch = (regex) => {
|
|
129
|
+
let handlerMatch;
|
|
130
|
+
regex.lastIndex = 0;
|
|
131
|
+
while ((handlerMatch = regex.exec(stripped)) !== null) {
|
|
132
|
+
const inputType = handlerMatch[1].trim();
|
|
133
|
+
const handlerName = handlerMatch[2].trim();
|
|
134
|
+
const eventName = handlerName.startsWith('EVENT_') ? handlerName : `EVENT_${handlerName}`;
|
|
135
|
+
const skipReason = unmappedReason(inputType);
|
|
136
|
+
if (skipReason) {
|
|
137
|
+
unmapped.push({
|
|
138
|
+
handlerName,
|
|
139
|
+
inputType,
|
|
140
|
+
reason: skipReason,
|
|
141
|
+
sourceFile: filePath,
|
|
142
|
+
});
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (!dtos.has(inputType)) {
|
|
146
|
+
unmapped.push({
|
|
147
|
+
handlerName,
|
|
148
|
+
inputType,
|
|
149
|
+
reason: 'No matching data class or generated DAO',
|
|
150
|
+
sourceFile: filePath,
|
|
151
|
+
});
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (seenEvents.has(eventName))
|
|
155
|
+
continue;
|
|
156
|
+
seenEvents.add(eventName);
|
|
157
|
+
mapped.push({
|
|
158
|
+
eventName,
|
|
159
|
+
inputType,
|
|
160
|
+
detailsInterface: (0, naming_1.handlerInputToDetailsInterfaceName)(inputType),
|
|
161
|
+
sourceFile: filePath,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
tryMatch(HANDLER_REGEX);
|
|
166
|
+
}
|
|
167
|
+
mapped.sort((a, b) => a.eventName.localeCompare(b.eventName));
|
|
168
|
+
unmapped.sort((a, b) => a.handlerName.localeCompare(b.handlerName));
|
|
169
|
+
return { mapped, unmapped };
|
|
170
|
+
};
|
|
171
|
+
exports.parseHandlersFromSources = parseHandlersFromSources;
|
|
172
|
+
const kotlinTypeToTs = (kotlinType, dtos, enums = new Map()) => {
|
|
173
|
+
const listMatch = kotlinType.match(/^(?:List|MutableList|Set|MutableSet)<(.+)>$/);
|
|
174
|
+
if (listMatch) {
|
|
175
|
+
return `${(0, exports.kotlinTypeToTs)(listMatch[1].trim(), dtos, enums)}[]`;
|
|
176
|
+
}
|
|
177
|
+
if (PRIMITIVE_TS[kotlinType]) {
|
|
178
|
+
return PRIMITIVE_TS[kotlinType];
|
|
179
|
+
}
|
|
180
|
+
const enumTs = (0, parse_enums_1.kotlinEnumTypeRef)(kotlinType, enums);
|
|
181
|
+
if (enumTs) {
|
|
182
|
+
return enumTs;
|
|
183
|
+
}
|
|
184
|
+
if (dtos.has(kotlinType)) {
|
|
185
|
+
return (0, naming_1.handlerInputToDetailsInterfaceName)(kotlinType);
|
|
186
|
+
}
|
|
187
|
+
return 'unknown';
|
|
188
|
+
};
|
|
189
|
+
exports.kotlinTypeToTs = kotlinTypeToTs;
|
|
190
|
+
//# sourceMappingURL=parse-kotlin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-kotlin.js","sourceRoot":"","sources":["../src/parse-kotlin.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,qCAA8D;AAC9D,+CAAkD;AAIlD,MAAM,YAAY,GAA2B;IAC3C,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,QAAQ;IACf,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,QAAQ;IACpB,QAAQ,EAAE,QAAQ;IAClB,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE,QAAQ;IACnB,aAAa,EAAE,QAAQ;CACxB,CAAC;AAEF,MAAM,gBAAgB,GAAG,mEAAmE,CAAC;AAgMhE,4CAAgB;AA9L7C,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAY,EAAE;IACnD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,OAAO,GAA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AAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;IAClF,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,GAAG,IAAA,sBAAc,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;IACjE,CAAC;IAED,IAAI,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7B,OAAO,YAAY,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,+BAAiB,EAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACpD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QACzB,OAAO,IAAA,2CAAkC,EAAC,UAAU,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAxBW,QAAA,cAAc,kBAwBzB"}
|
package/dist/render.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type KotlinEnumMap } from './parse-enums';
|
|
2
|
+
import type { KotlinDto, MappedHandler, UnmappedHandler } from './types';
|
|
3
|
+
export declare const renderEventTypesFile: (mapped: MappedHandler[], unmapped: UnmappedHandler[], dtos: Map<string, KotlinDto>, enums?: KotlinEnumMap) => string;
|
|
4
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAKA,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA8EzE,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,aAAa,EAAE,EACvB,UAAU,eAAe,EAAE,EAC3B,MAAM,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAC5B,QAAO,aAAyB,KAC/B,MA2BF,CAAC"}
|
package/dist/render.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderEventTypesFile = void 0;
|
|
4
|
+
const naming_1 = require("./naming");
|
|
5
|
+
const parse_enums_1 = require("./parse-enums");
|
|
6
|
+
const parse_kotlin_1 = require("./parse-kotlin");
|
|
7
|
+
const renderInterface = (dto, dtos, enums) => {
|
|
8
|
+
const interfaceName = (0, naming_1.handlerInputToDetailsInterfaceName)(dto.name);
|
|
9
|
+
const lines = dto.properties.map((prop) => {
|
|
10
|
+
const wireName = (0, naming_1.kotlinPropertyToWireField)(prop.name);
|
|
11
|
+
const tsType = (0, parse_kotlin_1.kotlinTypeToTs)(prop.kotlinType, dtos, enums);
|
|
12
|
+
const optional = prop.optional ? '?' : '';
|
|
13
|
+
return ` ${wireName}${optional}: ${tsType};`;
|
|
14
|
+
});
|
|
15
|
+
return `export interface ${interfaceName} {\n${lines.join('\n')}\n}`;
|
|
16
|
+
};
|
|
17
|
+
const renderEventClasses = (mapped) => {
|
|
18
|
+
if (mapped.length === 0)
|
|
19
|
+
return '';
|
|
20
|
+
const sorted = [...mapped].sort((a, b) => a.eventName.localeCompare(b.eventName));
|
|
21
|
+
return sorted
|
|
22
|
+
.map((handler) => {
|
|
23
|
+
const className = (0, naming_1.eventNameToEventClassName)(handler.eventName);
|
|
24
|
+
return `export class ${className} extends GenesisEvent<'${handler.eventName}', ${handler.detailsInterface}> {
|
|
25
|
+
readonly MESSAGE_TYPE = '${handler.eventName}' as const;
|
|
26
|
+
|
|
27
|
+
constructor(details: ${handler.detailsInterface}) {
|
|
28
|
+
super(details);
|
|
29
|
+
}
|
|
30
|
+
}`;
|
|
31
|
+
})
|
|
32
|
+
.join('\n\n');
|
|
33
|
+
};
|
|
34
|
+
const renderUnmappedComment = (unmapped) => {
|
|
35
|
+
if (unmapped.length === 0)
|
|
36
|
+
return '';
|
|
37
|
+
const lines = unmapped.map((entry) => ` * - ${entry.handlerName} (${entry.inputType}): ${entry.reason} [${entry.sourceFile.split(/[/\\]/).pop()}]`);
|
|
38
|
+
return `/**\n * Unmapped handlers (not included in EventDetailsMap):\n${lines.join('\n')}\n */\n\n`;
|
|
39
|
+
};
|
|
40
|
+
const renderEnumExports = (enums, usedEnumNames) => {
|
|
41
|
+
const blocks = [];
|
|
42
|
+
for (const name of [...usedEnumNames].sort()) {
|
|
43
|
+
const values = enums.get(name);
|
|
44
|
+
if (!(values === null || values === void 0 ? void 0 : values.length))
|
|
45
|
+
continue;
|
|
46
|
+
const entries = values.map((value) => ` ${value}: '${value}',`).join('\n');
|
|
47
|
+
blocks.push(`export const ${name} = {\n${entries}\n} as const;\n\nexport type ${name} = (typeof ${name})[keyof typeof ${name}];`);
|
|
48
|
+
}
|
|
49
|
+
return blocks.length > 0 ? `${blocks.join('\n\n')}\n\n` : '';
|
|
50
|
+
};
|
|
51
|
+
const collectUsedEnumNames = (mapped, dtos, enums) => {
|
|
52
|
+
const used = new Set();
|
|
53
|
+
for (const handler of mapped) {
|
|
54
|
+
const dto = dtos.get(handler.inputType);
|
|
55
|
+
if (!dto)
|
|
56
|
+
continue;
|
|
57
|
+
for (const prop of dto.properties) {
|
|
58
|
+
const ref = (0, parse_enums_1.kotlinEnumTypeRef)(prop.kotlinType, enums);
|
|
59
|
+
if (ref)
|
|
60
|
+
used.add(ref);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return used;
|
|
64
|
+
};
|
|
65
|
+
const renderEventTypesFile = (mapped, unmapped, dtos, enums = new Map()) => {
|
|
66
|
+
const usedDtos = new Set(mapped.map((m) => m.inputType));
|
|
67
|
+
const interfaces = [...usedDtos]
|
|
68
|
+
.map((name) => dtos.get(name))
|
|
69
|
+
.filter((dto) => dto != null)
|
|
70
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
71
|
+
.map((dto) => renderInterface(dto, dtos, enums));
|
|
72
|
+
const usedEnumNames = collectUsedEnumNames(mapped, dtos, enums);
|
|
73
|
+
const enumExports = renderEnumExports(enums, usedEnumNames);
|
|
74
|
+
const mapEntries = mapped.map((m) => ` ${m.eventName}: ${m.detailsInterface};`).join('\n');
|
|
75
|
+
const eventClasses = renderEventClasses(mapped);
|
|
76
|
+
const foundationCommsImport = mapped.length > 0 ? `import { GenesisEvent } from '@genesislcap/foundation-comms';\n\n` : '';
|
|
77
|
+
return `// AUTO-GENERATED — do not edit
|
|
78
|
+
|
|
79
|
+
${renderUnmappedComment(unmapped)}${foundationCommsImport}${enumExports}${interfaces.join('\n\n')}
|
|
80
|
+
|
|
81
|
+
export interface EventDetailsMap {
|
|
82
|
+
${mapEntries}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type GenesisEventName = keyof EventDetailsMap;
|
|
86
|
+
${eventClasses ? `\n${eventClasses}\n` : ''}`;
|
|
87
|
+
};
|
|
88
|
+
exports.renderEventTypesFile = renderEventTypesFile;
|
|
89
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":";;;AAAA,qCAIkB;AAClB,+CAAsE;AACtE,iDAAgD;AAGhD,MAAM,eAAe,GAAG,CACtB,GAAc,EACd,IAA4B,EAC5B,KAAoB,EACZ,EAAE;IACV,MAAM,aAAa,GAAG,IAAA,2CAAkC,EAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnE,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxC,MAAM,QAAQ,GAAG,IAAA,kCAAyB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,IAAA,6BAAc,EAAC,IAAI,CAAC,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AAC,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE5F,MAAM,YAAY,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,qBAAqB,GACzB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mEAAmE,CAAC,CAAC,CAAC,EAAE,CAAC;IAE/F,OAAO;;EAEP,qBAAqB,CAAC,QAAQ,CAAC,GAAG,qBAAqB,GAAG,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;;;EAG/F,UAAU;;;;EAIV,YAAY,CAAC,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAC9C,CAAC,CAAC;AAhCW,QAAA,oBAAoB,wBAgC/B"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export type EventTypesConfig = {
|
|
2
|
+
enabled?: boolean;
|
|
3
|
+
serverModule?: string;
|
|
4
|
+
kotlinSources?: string[];
|
|
5
|
+
/**
|
|
6
|
+
* Glob patterns (relative to the parent of `serverModule`, typically `../server`)
|
|
7
|
+
* for Genesis generated table DAO Kotlin sources (`…/gen/dao/Trade.kt`).
|
|
8
|
+
*/
|
|
9
|
+
generatedDaoSources?: string[];
|
|
10
|
+
handlerScan?: string[];
|
|
11
|
+
output?: string;
|
|
12
|
+
runOnBuild?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type EventTypesResolvedConfig = {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
serverModule: string;
|
|
17
|
+
kotlinSources: string[];
|
|
18
|
+
generatedDaoSources: string[];
|
|
19
|
+
handlerScan: string[];
|
|
20
|
+
output: string;
|
|
21
|
+
runOnBuild: boolean;
|
|
22
|
+
};
|
|
23
|
+
export type KotlinProperty = {
|
|
24
|
+
name: string;
|
|
25
|
+
kotlinType: string;
|
|
26
|
+
optional: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type KotlinDto = {
|
|
29
|
+
name: string;
|
|
30
|
+
properties: KotlinProperty[];
|
|
31
|
+
filePath: string;
|
|
32
|
+
};
|
|
33
|
+
export type MappedHandler = {
|
|
34
|
+
eventName: string;
|
|
35
|
+
inputType: string;
|
|
36
|
+
detailsInterface: string;
|
|
37
|
+
sourceFile: string;
|
|
38
|
+
};
|
|
39
|
+
export type UnmappedHandler = {
|
|
40
|
+
handlerName: string;
|
|
41
|
+
inputType: string;
|
|
42
|
+
reason: string;
|
|
43
|
+
sourceFile: string;
|
|
44
|
+
};
|
|
45
|
+
export type GenerateResult = {
|
|
46
|
+
outputPath: string;
|
|
47
|
+
eventCount: number;
|
|
48
|
+
dtoCount: number;
|
|
49
|
+
unmappedCount: number;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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;CACnB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB,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/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/license.txt
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Developer License Agreement
|
|
2
|
+
|
|
3
|
+
This Developer License Agreement (the “Agreement”) is entered into by and between Genesis, Global FinTech Inc.(“Genesis”) and you and/or the entity on whose behalf you are downloading the Software (as defined below) (“you”). This Agreement forms a legally binding contract between you and Genesis in relation to your use of the software libraries, reference implementations, and other related demonstration code (collectively, the “Genesis Software”). [a]
|
|
4
|
+
|
|
5
|
+
To use the Software, you must first agree to this Agreement. You may not use the Software if you do not agree to be bound by the terms of this Agreement. Accordingly, you and Genesis acknowledge and agree as follows:
|
|
6
|
+
|
|
7
|
+
1. LIMITED LICENSE.
|
|
8
|
+
Subject to your complete and ongoing compliance with all the terms and conditions set forth in this Agreement, including without limitation all license limitations and restrictions set forth herein, Genesis grants you the following limited, non-exclusive, non-transferable, non-sublicensable, revocable licenses to use, and (where applicable) authorize your employees to use, the Software internally solely in connection with building, developing and testing your own applications that interoperate with or incorporate the Software (“Applications”) for the purposes of evaluation.
|
|
9
|
+
|
|
10
|
+
2. RESTRICTIONS.
|
|
11
|
+
A. By accessing or using the Software, you represent, warrant, and covenant that (a) you are a person or business entity engaged in the development of software applications, and (b) in the case of a business entity, you have the full power and authority to bind such entity to the terms of this Agreement.
|
|
12
|
+
B. You acknowledge that the foregoing license does not include any right to:
|
|
13
|
+
(i) redistribute, sell, lease, license, modify or otherwise create any derivative works of any portion of the Software, or;
|
|
14
|
+
(ii) distribute, deploy, or otherwise utilize Applications on a public, production, commercial, or other similar purpose other than internal use for evaluation and the development of non-public, experimental Applications (any other public, production, commercial, or similar use requires a separate agreement with Genesis), or
|
|
15
|
+
(iii) use or implement any undocumented feature or API or use any documented feature or API other than in accordance with applicable documentation. You agree to not to do any of the foregoing.
|
|
16
|
+
C. Except as expressly provided herein, you may not:
|
|
17
|
+
(a) reproduce, distribute, publicly display, or publicly perform any part of the Software;
|
|
18
|
+
(b) decompile, reverse engineer, or otherwise access or attempt to access the source code for the Software not made available to you in source code form;
|
|
19
|
+
(c) make or attempt to make any modification to, or otherwise create derivative works of the Software; or
|
|
20
|
+
(d) remove, obscure, interfere with or circumvent any feature of the Software, including without limitation any copyright or other intellectual property notices, security, or access control mechanism;
|
|
21
|
+
(f) use the Software to do anything illegal, including facilitating, promoting, or otherwise encouraging any illegal activities.
|
|
22
|
+
|
|
23
|
+
3. RESERVATION OF RIGHTS.
|
|
24
|
+
A. The Software is owned by Genesis and licensed, not sold, to you. The Software, content, visual interfaces, interactive features, information, graphics, design, compilation, computer code, products, services, and all other elements of the Software and related documentation (the “Materials“), are protected by copyright, trade dress, patent, and trademark laws of the United States and other jurisdictions, international conventions, and all other relevant intellectual property and proprietary rights, and applicable laws (collectively, the “Intellectual Property Rights“).
|
|
25
|
+
B. You agree that Genesis or its subsidiaries or affiliated companies and/or its third-party licensors own all legal right, title and interest in and to the Software and Materials, including any and all Intellectual Property Rights. Genesis reserves all rights not expressly granted in this Agreement. You do not acquire any right, interest or title to the Materials, whether by implication, estoppel, or otherwise, except for the limited rights set forth in this Agreement.
|
|
26
|
+
C. You agree that the form and nature of the Software that Genesis provides may change without prior notice to you and that future versions of the Software may be incompatible with applications developed on previous of the Software. You agree that Genesis may stop (permanently or temporarily) providing the Software (or any features within the Software) to you or to users generally at Genesis’s sole discretion, without prior notice to you. Nothing in this Agreement gives you a right to use any of Genesis’s trade names, trademarks, service marks, logos, domain names, or other distinctive brand features.
|
|
27
|
+
|
|
28
|
+
4. TERMINATION.
|
|
29
|
+
At Genesis’s sole discretion, Genesis may terminate your Developer License and cease provision of the Genesis Software with or without notice, effective immediately, for any reason or no reason at all. Upon the expiration or termination of this Agreement all rights and licenses granted under this Agreement will immediately terminate.
|
|
30
|
+
|
|
31
|
+
5. THIRD PARTY SOFTWARE.
|
|
32
|
+
The Software consists of a package of components and may include references to certain third-party software (“Third Party Software”) that are provided by their authors under separate license terms (the “Third Party Terms”). Your use of any such Third-Party Software in conjunction with the Software in a manner consistent with this Agreement is permitted, however, you may have broader rights and/or restrictions under the applicable Third-Party Terms. Genesis cannot accept any responsibility for the Third-Party Software or your use thereof.
|
|
33
|
+
|
|
34
|
+
6. DISCLAIMER OF WARRANTIES.
|
|
35
|
+
YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SOFTWARE IS AT YOUR SOLE RISK AND THAT THE SOFTWARE IS PROVIDED “AS IS” AND “AS AVAILABLE” WITHOUT WARRANTY OF ANY KIND FROM GENESIS. YOUR USE OF THE SOFTWARE AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE SOFTWARE IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE. GENESIS FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. GENESIS EXPRESSLY DISCLAIMS ANY WARRANTIES OF ANY KIND WITH RESPECT TO THE ACCURACY OR FUNCTIONALITY OF THE SOFTWARE, AND WITH RESPECT TO THE ACCURACY, VALIDITY, OR COMPLETENESS OF ANY INFORMATION OR FEATURES AVAILABLE THROUGH THE SOFTWARE, OR THE QUALITY OR CONSISTENCY OF THE SOFTWARE OR RESULTS OBTAINED THROUGH ITS USE.
|
|
36
|
+
|
|
37
|
+
7. INDEMNIFICATION. To the maximum extent permitted by law, you agree to defend, indemnify, and hold harmless Genesis, its affiliates, and their respective directors, officers, employees, and agents, from and against any and all third-party claims, actions, suits, or proceedings, as well as any and all losses, liabilities, damages, costs, and expenses (including reasonable attorneys’ fees) arising out of or accruing from (a) your breach of this Developer License; (b) your use or misuse of the Genesis Software; (c) your negligence or willful misconduct; and/or (d) your use of the Genesis Software that actually or allegedly infringes any Intellectual Property Rights or privacy rights of any third party in any jurisdiction.
|
|
38
|
+
|
|
39
|
+
8. MISCELLANEOUS.
|
|
40
|
+
(a) If you are agreeing to be bound by this Agreement on behalf of your employer or other entity, you represent and warrant that you have full legal authority to bind your employer or such entity to this Agreement. If you do not have the requisite authority, you may not accept this Agreement on behalf of your employer or other entity.
|
|
41
|
+
(b) This Developer License shall be governed by, and construed in accordance with, the laws of the State of New York without regard to conflict of law principles. For all purposes of this Developer License, the parties’ consent to exclusive jurisdiction and venue in the state and federal courts located in New York County, New York.
|
|
42
|
+
(c) Nothing in this Agreement, or in the nature of your access and use of the Genesis Software, shall create or is intended to create a joint-venture, partnership, or agency relationship between you and Genesis.
|
|
43
|
+
(d) You may not assign or transfer this Agreement or any of your rights or obligations hereunder, absent the prior written consent of Genesis.
|
|
44
|
+
(e) You agree that if Genesis does not exercise or enforce any legal right or remedy contained in this Agreement, this will not be taken to be a formal waiver of Genesis’s rights and that those rights or remedies will still be available to Genesis.
|
|
45
|
+
(f) This Agreement constitutes the complete understanding between you and Genesis with respect to the subject matter contained herein, and supersedes all prior written or oral communications, understandings, and agreements.
|
|
46
|
+
(g) If any provision of this Agreement is deemed to be illegal, invalid, or unenforceable, then that provision shall be removed, and the remaining terms will continue to be valid and enforceable.
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@genesislcap/event-type-codegen",
|
|
3
|
+
"description": "Build-time TypeScript codegen from Kotlin event handler DTOs",
|
|
4
|
+
"version": "14.489.0-canary.FUI-2574-1",
|
|
5
|
+
"license": "SEE LICENSE IN license.txt",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=22.0.0"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "npm run clean && tsc -b ./tsconfig.json",
|
|
13
|
+
"clean": "rimraf dist temp tsconfig.tsbuildinfo",
|
|
14
|
+
"dev": "tsc -b ./tsconfig.json -w",
|
|
15
|
+
"test": "uvu -r tsx/cjs -r ../build/uvu-playwright-builder/config/jsdom.setup.ts . 'test.ts' --i dist --i coverage",
|
|
16
|
+
"lint": "genx lint -l ox",
|
|
17
|
+
"lint:fix": "genx lint -l ox --fix"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"change-case": "^4.1.2",
|
|
21
|
+
"consola": "^3.0.2"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@genesislcap/foundation-testing": "14.489.0-canary.FUI-2574-1",
|
|
25
|
+
"@types/node": "^22.10.2",
|
|
26
|
+
"tsx": "^4.7.0",
|
|
27
|
+
"uvu": "0.5.4"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/genesislcap/foundation-ui.git",
|
|
32
|
+
"directory": "packages/tooling/event-type-codegen"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"gitHead": "6dbab0f331e0fa7a280534d5cf111f09138c31e4"
|
|
38
|
+
}
|