Skip to content

Commit 98914b2

Browse files
committed
Adds support for AutoAPI L13 (#21)
* Adds support for AutoAPI L13 * Upgrades dependencies
1 parent 363feb3 commit 98914b2

File tree

11 files changed

+170
-85
lines changed

11 files changed

+170
-85
lines changed

package-lock.json

Lines changed: 98 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@highmobility/auto-api-javascript",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"description": "Auto API for JavaScript - the parsing library for the Auto API vehicle data model",
55
"main": "lib/index.js",
66
"module": "es/index.js",
@@ -37,16 +37,16 @@
3737
"devDependencies": {
3838
"@tsconfig/node10": "^1.0.7",
3939
"@types/lodash": "^4.14.168",
40-
"@types/node": "^14.14.35",
40+
"@types/node": "^14.14.37",
4141
"@types/yamljs": "^0.2.31",
42-
"@typescript-eslint/eslint-plugin": "^4.19.0",
43-
"@typescript-eslint/parser": "^4.19.0",
44-
"eslint": "^7.22.0",
42+
"@typescript-eslint/eslint-plugin": "^4.21.0",
43+
"@typescript-eslint/parser": "^4.21.0",
44+
"eslint": "^7.23.0",
4545
"eslint-config-prettier": "^8.1.0",
4646
"eslint-import-resolver-alias": "^1.1.2",
4747
"eslint-plugin-import": "^2.22.1",
4848
"eslint-plugin-prettier": "^3.3.1",
49-
"husky": "^5.2.0",
49+
"husky": "^6.0.0",
5050
"jest": "^26.6.3",
5151
"lint-staged": "^10.5.4",
5252
"npm-run-all": "^4.1.5",
@@ -55,13 +55,13 @@
5555
"ts-jest": "^26.5.4",
5656
"ts-node": "^9.1.1",
5757
"tsconfig-paths": "^3.9.0",
58-
"typescript": "^4.2.3",
58+
"typescript": "^4.2.4",
5959
"yamljs": "^0.3.0"
6060
},
6161
"dependencies": {
6262
"ieee754": "^1.2.1",
6363
"lodash": "^4.17.21",
64-
"tslib": "^2.1.0"
64+
"tslib": "^2.2.0"
6565
},
6666
"husky": {
6767
"hooks": {

scripts/generate-configuration.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import {
1616
ConfigurationFilePath,
1717
CustomTypesFile,
1818
CustomTypesRegex,
19+
EventsFile,
20+
EventsRegex,
1921
PropertyComponentsFile,
2022
UnitTypesFile,
2123
UnitTypesRegex,
@@ -27,6 +29,7 @@ import { parseYmlFile } from './shared/utils';
2729
function createConfiguration() {
2830
const configuration: Configuration = {
2931
capabilities: parseCapabilities(),
32+
events: parseEvents(),
3033
measurement_types: parseUnitTypes(),
3134
property_components: parsePropertyComponents(),
3235
types: parseTypes(),
@@ -56,6 +59,9 @@ function mapTypesToEntity<T extends TypeDefinition>(entity: T) {
5659
...((CustomTypesRegex.test(entity.type) && {
5760
customType: entity.type.replace(CustomTypesRegex, ''),
5861
}) ||
62+
(EventsRegex.test(entity.type) && {
63+
event: entity.type.replace(EventsRegex, ''),
64+
}) ||
5965
(UnitTypesRegex.test(entity.type) && {
6066
unitType: entity.type.replace(UnitTypesRegex, ''),
6167
})),
@@ -83,6 +89,21 @@ function parseCapabilities() {
8389
);
8490
}
8591

92+
function parseEvents() {
93+
return parseYmlFile<{ events: TypeDefinitions }>(EventsFile).events.reduce<
94+
Configuration['events']
95+
>(
96+
(allEvents, event) => ({
97+
...allEvents,
98+
[event.name]: {
99+
...event,
100+
...(event.items && { items: event.items.map((event) => mapTypesToEntity(event)) }),
101+
},
102+
}),
103+
{},
104+
);
105+
}
106+
86107
function parsePropertyComponents() {
87108
return parseYmlFile<{ property_components: PropertyComponents }>(
88109
PropertyComponentsFile,

0 commit comments

Comments
 (0)