@irsdk-node/native 4.1.0 → 5.0.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/LICENSE.md +9 -0
- package/README.md +90 -21
- package/dist/cjs/index.cjs +9453 -0
- package/dist/esm/index.js +9440 -0
- package/dist/{INativeSDK.d.ts → types/INativeSDK.d.ts} +9 -0
- package/dist/{MockSdk.d.ts → types/MockSdk.d.ts} +2 -1
- package/dist/types/index.d.ts +4 -0
- package/lib/irsdk_client.cpp +94 -94
- package/lib/irsdk_client.h +23 -23
- package/lib/irsdk_defines.h +136 -82
- package/lib/irsdk_diskclient.cpp +997 -0
- package/lib/irsdk_diskclient.h +205 -0
- package/lib/irsdk_node.cc +1 -1
- package/lib/irsdk_utils.cpp +71 -71
- package/lib/yaml_parser.cpp +41 -41
- package/lib/yaml_parser.h +1 -1
- package/package.json +25 -27
- package/prebuilds/darwin-arm64/@irsdk-node+native.node +0 -0
- package/prebuilds/win32-x64/@irsdk-node+native.node +0 -0
- package/dist/INativeSDK.js +0 -2
- package/dist/MockSdk.js +0 -70
- package/dist/mock-data/loader.js +0 -41
- package/dist/mock-data/session.json +0 -4305
- package/dist/mock-data/telemetry.json +0 -4986
- package/index.d.ts +0 -87
- package/index.js +0 -36
- /package/dist/{mock-data → types/mock-data}/loader.d.ts +0 -0
package/index.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BroadcastMessages,
|
|
3
|
-
CameraState,
|
|
4
|
-
ChatCommand,
|
|
5
|
-
FFBCommand,
|
|
6
|
-
PitCommand,
|
|
7
|
-
ReloadTexturesCommand,
|
|
8
|
-
ReplayPositionCommand,
|
|
9
|
-
ReplaySearchCommand,
|
|
10
|
-
ReplayStateCommand,
|
|
11
|
-
TelemetryCommand,
|
|
12
|
-
VideoCaptureCommand,
|
|
13
|
-
TelemetryVariable,
|
|
14
|
-
TelemetryVarList,
|
|
15
|
-
} from '@irsdk-node/types';
|
|
16
|
-
import { INativeSDK } from './dist/INativeSDK';
|
|
17
|
-
|
|
18
|
-
type TelemetryTypesDict = {
|
|
19
|
-
[variableName: string]: number;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export { INativeSDK } from './dist/INativeSDK';
|
|
23
|
-
|
|
24
|
-
export const mockedSdk: boolean;
|
|
25
|
-
|
|
26
|
-
export class NativeSDK implements INativeSDK {
|
|
27
|
-
public readonly currDataVersion: number;
|
|
28
|
-
|
|
29
|
-
public readonly isMocked: boolean;
|
|
30
|
-
|
|
31
|
-
public enableLogging: boolean;
|
|
32
|
-
|
|
33
|
-
constructor();
|
|
34
|
-
|
|
35
|
-
// Main API
|
|
36
|
-
// Control
|
|
37
|
-
public startSDK(): boolean;
|
|
38
|
-
|
|
39
|
-
public stopSDK(): void;
|
|
40
|
-
|
|
41
|
-
// State
|
|
42
|
-
public isRunning(): boolean;
|
|
43
|
-
|
|
44
|
-
public waitForData(timeout?: number): boolean;
|
|
45
|
-
|
|
46
|
-
public getSessionData(): string; // full yaml
|
|
47
|
-
|
|
48
|
-
public getTelemetryData(): TelemetryVarList;
|
|
49
|
-
|
|
50
|
-
public getTelemetryVariable<T extends number | boolean | string>(index: number): TelemetryVariable<T[]>;
|
|
51
|
-
|
|
52
|
-
public getTelemetryVariable<T extends number | boolean | string>(name: string): TelemetryVariable<T[]>;
|
|
53
|
-
|
|
54
|
-
// Private helpers
|
|
55
|
-
public __getTelemetryTypes(): TelemetryTypesDict;
|
|
56
|
-
|
|
57
|
-
// Broadcast command overloads
|
|
58
|
-
// This is handled in the cpp side so no need to mess with it in js
|
|
59
|
-
public broadcast(message: BroadcastMessages.CameraSwitchPos, pos: number, group: number, camera: number): void;
|
|
60
|
-
|
|
61
|
-
public broadcast(message: BroadcastMessages.CameraSwitchNum, driver: number, group: number, camera: number): void;
|
|
62
|
-
|
|
63
|
-
public broadcast(message: BroadcastMessages.CameraSetState, state: CameraState): void;
|
|
64
|
-
|
|
65
|
-
public broadcast(message: BroadcastMessages.ReplaySetPlaySpeed, speed: number, slowMotion: number): void;
|
|
66
|
-
|
|
67
|
-
public broadcast(message: BroadcastMessages.ReplaySetPlayPosition, pos: ReplayPositionCommand, frame: number): void;
|
|
68
|
-
|
|
69
|
-
public broadcast(message: BroadcastMessages.ReplaySearch, mode: ReplaySearchCommand): void;
|
|
70
|
-
|
|
71
|
-
public broadcast(message: BroadcastMessages.ReplaySetState, state: ReplayStateCommand): void;
|
|
72
|
-
|
|
73
|
-
public broadcast(message: BroadcastMessages.ReloadTextures, command: ReloadTexturesCommand, carIndex?: number): void;
|
|
74
|
-
|
|
75
|
-
public broadcast(message: BroadcastMessages.ChatCommand, command: ChatCommand, macro?: number): void;
|
|
76
|
-
|
|
77
|
-
public broadcast(message: BroadcastMessages.PitCommand, command: PitCommand, param?: number): void;
|
|
78
|
-
|
|
79
|
-
public broadcast(message: BroadcastMessages.TelemCommand, command: TelemetryCommand): void;
|
|
80
|
-
|
|
81
|
-
public broadcast(message: BroadcastMessages.FFBCommand, command: FFBCommand, value: number): void;
|
|
82
|
-
|
|
83
|
-
public broadcast(message: BroadcastMessages.ReplaySearchSessionTime, session: number, time: number): void;
|
|
84
|
-
|
|
85
|
-
public broadcast(message: BroadcastMessages.VideoCapture, command: VideoCaptureCommand): void;
|
|
86
|
-
}
|
|
87
|
-
|
package/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
3
|
-
/* eslint-disable global-require */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
6
|
-
|
|
7
|
-
// Import from JS so that we can type the API in a nicer way (without aliases)
|
|
8
|
-
// The alternative would be to somehow get types generated, or use aliases to
|
|
9
|
-
// fake a module and then define that module... but those are gross, so no thanks
|
|
10
|
-
const nodePath = require('node:path');
|
|
11
|
-
const { warn } = require('node:console');
|
|
12
|
-
const MockSdk = require('./dist/MockSDK');
|
|
13
|
-
|
|
14
|
-
let sdkBinding;
|
|
15
|
-
let isMocked;
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
19
|
-
const binding = require('node-gyp-build')(nodePath.join(__dirname, '.'));
|
|
20
|
-
isMocked = binding.mockedSdk;
|
|
21
|
-
|
|
22
|
-
if (isMocked) {
|
|
23
|
-
sdkBinding = MockSdk;
|
|
24
|
-
} else {
|
|
25
|
-
sdkBinding = binding.iRacingSdkNode;
|
|
26
|
-
}
|
|
27
|
-
} catch (err) {
|
|
28
|
-
warn('Failed to load native iRacing SDK module. Loading mock SDK instead.');
|
|
29
|
-
isMocked = true;
|
|
30
|
-
sdkBinding = MockSdk;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
module.exports = {
|
|
34
|
-
NativeSDK: sdkBinding,
|
|
35
|
-
mockedSdk: isMocked,
|
|
36
|
-
};
|
|
File without changes
|