@hotlap.ai/telemetry 1.1.0 → 1.2.0
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/dist/cli.js +1 -1
- package/dist/ibt.d.ts +2 -1
- package/dist/ibt.d.ts.map +1 -1
- package/dist/ibt.js +1 -1
- package/dist/{index-tz5ph8p3.js → index-6wrtvcny.js} +38 -16
- package/dist/neutral/ibt-kagktz7r.js +6208 -0
- package/dist/neutral/ibt.js +20 -6103
- package/dist/neutral/session-yaml.js +20 -0
- package/dist/session-yaml.d.ts +87 -0
- package/dist/session-yaml.d.ts.map +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cleanYamlFast,
|
|
3
|
+
decodeSessionYaml,
|
|
4
|
+
parseSessionYaml,
|
|
5
|
+
parseTrackLengthKm,
|
|
6
|
+
readSessionInfoRange,
|
|
7
|
+
resolveSessionMetadata,
|
|
8
|
+
sessionMetadataFromYamlBytes,
|
|
9
|
+
sessionTypeForSessionNum
|
|
10
|
+
} from "./ibt-kagktz7r.js";
|
|
11
|
+
export {
|
|
12
|
+
sessionTypeForSessionNum,
|
|
13
|
+
sessionMetadataFromYamlBytes,
|
|
14
|
+
resolveSessionMetadata,
|
|
15
|
+
readSessionInfoRange,
|
|
16
|
+
parseTrackLengthKm,
|
|
17
|
+
parseSessionYaml,
|
|
18
|
+
decodeSessionYaml,
|
|
19
|
+
cleanYamlFast
|
|
20
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fast single-pass YAML cleaning function.
|
|
3
|
+
* Combines multiple string operations to reduce intermediate allocations.
|
|
4
|
+
*/
|
|
5
|
+
export declare function cleanYamlFast(yaml: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Read the session-info byte range from the .ibt fixed header (first 48+
|
|
8
|
+
* bytes are sufficient). For consumers that range-download instead of
|
|
9
|
+
* loading the whole file.
|
|
10
|
+
*/
|
|
11
|
+
export declare function readSessionInfoRange(headerBytes: ArrayBuffer | Uint8Array): {
|
|
12
|
+
sessionInfoLen: number;
|
|
13
|
+
sessionInfoOffset: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Canonical text decode (RFC C5/D5): UTF-8 first; if replacement characters
|
|
17
|
+
* appear, fall back to windows-1252 (older iRacing builds and non-ASCII
|
|
18
|
+
* driver/team names). A plain lossy UTF-8 decode corrupts those names —
|
|
19
|
+
* that was divergence D5.
|
|
20
|
+
*/
|
|
21
|
+
export declare function decodeSessionYaml(bytes: Uint8Array): string;
|
|
22
|
+
export interface SessionYamlDoc {
|
|
23
|
+
WeekendInfo?: Record<string, unknown>;
|
|
24
|
+
DriverInfo?: {
|
|
25
|
+
DriverCarIdx?: number;
|
|
26
|
+
Drivers?: Array<Record<string, unknown>>;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
};
|
|
29
|
+
SplitTimeInfo?: {
|
|
30
|
+
Sectors?: Array<{
|
|
31
|
+
SectorNum?: number;
|
|
32
|
+
SectorStartPct?: number;
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
SessionInfo?: {
|
|
36
|
+
Sessions?: Array<Record<string, unknown>>;
|
|
37
|
+
};
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
/** Clean + parse the raw YAML text with a real YAML parser (never regex). */
|
|
41
|
+
export declare function parseSessionYaml(raw: string): SessionYamlDoc | null;
|
|
42
|
+
export interface ResolvedSessionEntry {
|
|
43
|
+
sessionNum: number | null;
|
|
44
|
+
/** Full string, e.g. "Offline Testing", "Lone Qualify" — never truncated. */
|
|
45
|
+
sessionType: string | null;
|
|
46
|
+
sessionName: string | null;
|
|
47
|
+
raw: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
export interface SessionMetadata {
|
|
50
|
+
trackId: number | null;
|
|
51
|
+
trackName: string | null;
|
|
52
|
+
trackConfigName: string | null;
|
|
53
|
+
trackLengthKm: number | null;
|
|
54
|
+
trackNumTurns: number | null;
|
|
55
|
+
eventType: string | null;
|
|
56
|
+
category: string | null;
|
|
57
|
+
seriesId: number | null;
|
|
58
|
+
seasonId: number | null;
|
|
59
|
+
sessionId: number | null;
|
|
60
|
+
subSessionId: number | null;
|
|
61
|
+
raceWeek: number | null;
|
|
62
|
+
official: boolean | null;
|
|
63
|
+
driverCarIdx: number;
|
|
64
|
+
driverName: string | null;
|
|
65
|
+
driverUserId: number | null;
|
|
66
|
+
carId: number | null;
|
|
67
|
+
carScreenName: string | null;
|
|
68
|
+
carPath: string | null;
|
|
69
|
+
carClassId: number | null;
|
|
70
|
+
carNumber: string | null;
|
|
71
|
+
teamName: string | null;
|
|
72
|
+
sessions: ResolvedSessionEntry[];
|
|
73
|
+
/** Raw parsed doc for specialized consumers (results positions, sectors…). */
|
|
74
|
+
doc: SessionYamlDoc;
|
|
75
|
+
}
|
|
76
|
+
export declare function parseTrackLengthKm(value: unknown): number | null;
|
|
77
|
+
export declare function resolveSessionMetadata(doc: SessionYamlDoc): SessionMetadata;
|
|
78
|
+
/**
|
|
79
|
+
* Session-type resolution per RFC C5: the type of the session the telemetry
|
|
80
|
+
* was recorded in is Sessions[n].SessionType where n comes from the
|
|
81
|
+
* SessionNum CHANNEL — never "the first SessionType in the document" (that
|
|
82
|
+
* was divergence D4) and never WeekendInfo.EventType (kept separately).
|
|
83
|
+
*/
|
|
84
|
+
export declare function sessionTypeForSessionNum(meta: Pick<SessionMetadata, 'sessions'>, sessionNum: number): string | null;
|
|
85
|
+
/** Convenience: raw YAML byte range → resolved metadata (or null on parse failure). */
|
|
86
|
+
export declare function sessionMetadataFromYamlBytes(bytes: Uint8Array): SessionMetadata | null;
|
|
87
|
+
//# sourceMappingURL=session-yaml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-yaml.d.ts","sourceRoot":"","sources":["../src/session-yaml.ts"],"names":[],"mappings":"AAqBA;;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;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,EACvC,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CAEf;AAED,uFAAuF;AACvF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,UAAU,GAAG,eAAe,GAAG,IAAI,CAGtF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotlap.ai/telemetry",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "High-performance iRacing telemetry library for Bun - IBT file parsing and live data streaming",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"import": "./dist/neutral/normalize.js",
|
|
28
28
|
"default": "./dist/neutral/normalize.js"
|
|
29
29
|
},
|
|
30
|
+
"./session": {
|
|
31
|
+
"types": "./dist/session-yaml.d.ts",
|
|
32
|
+
"import": "./dist/neutral/session-yaml.js",
|
|
33
|
+
"default": "./dist/neutral/session-yaml.js"
|
|
34
|
+
},
|
|
30
35
|
"./live": {
|
|
31
36
|
"types": "./dist/live.d.ts",
|
|
32
37
|
"import": "./dist/live.js",
|
|
@@ -50,7 +55,7 @@
|
|
|
50
55
|
"scripts": {
|
|
51
56
|
"build": "bun run build:js && bun run build:types",
|
|
52
57
|
"build:js": "bun build ./src/index.ts ./src/ibt.ts ./src/live.ts ./src/constants.ts ./src/cli.ts ./src/telemetry-server.ts ./src/types.ts ./src/binary-reader.ts --outdir ./dist --target bun --splitting && bun run build:neutral",
|
|
53
|
-
"build:neutral": "bun build ./src/ibt.ts ./src/normalize.ts --outdir ./dist/neutral --target browser --splitting",
|
|
58
|
+
"build:neutral": "bun build ./src/ibt.ts ./src/normalize.ts ./src/session-yaml.ts --outdir ./dist/neutral --target browser --splitting",
|
|
54
59
|
"build:types": "tsc --emitDeclarationOnly --declaration --declarationMap --outDir ./dist",
|
|
55
60
|
"build:server": "bun build ./src/telemetry-server.ts --compile --outfile ./dist/hotlap-telemetry",
|
|
56
61
|
"clean": "rm -rf dist",
|