@irsdk-node/native 4.0.2 → 4.1.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/README.md +46 -46
- package/binding.gyp +28 -19
- package/dist/INativeSDK.d.ts +28 -0
- package/dist/INativeSDK.js +2 -0
- package/dist/MockSdk.d.ts +43 -0
- package/dist/MockSdk.js +70 -0
- package/dist/mock-data/loader.d.ts +3 -0
- package/dist/mock-data/loader.js +41 -0
- package/dist/mock-data/session.json +4305 -0
- package/dist/mock-data/telemetry.json +4986 -0
- package/{src/index.d.ts → index.d.ts} +5 -35
- package/index.js +36 -0
- package/lib/irsdk_client.cpp +495 -495
- package/lib/irsdk_client.h +139 -139
- package/lib/irsdk_defines.h +528 -528
- package/{src → lib}/irsdk_node.cc +404 -375
- package/{src → lib}/irsdk_node.h +49 -50
- package/lib/irsdk_node_mocked.cc +226 -0
- package/lib/irsdk_utils.cpp +377 -377
- package/lib/yaml_parser.cpp +176 -176
- package/lib/yaml_parser.h +34 -34
- package/package.json +37 -29
- package/prebuilds/darwin-arm64/@irsdk-node+native.node +0 -0
- package/prebuilds/linux-x64/@irsdk-node+native.node +0 -0
- package/prebuilds/win32-x64/@irsdk-node+native.node +0 -0
- package/build/Debug/irsdk_node.exp +0 -0
- package/build/Debug/irsdk_node.lib +0 -0
- package/build/Debug/irsdk_node.node +0 -0
- package/build/Debug/irsdk_node.pdb +0 -0
- package/build/Debug/obj/irsdk_node/irsdk_node.node.recipe +0 -11
- package/build/Debug/obj/irsdk_node/irsdk_node.tlog/CL.command.1.tlog +0 -0
- package/build/Debug/obj/irsdk_node/irsdk_node.tlog/CL.read.1.tlog +0 -0
- package/build/Debug/obj/irsdk_node/irsdk_node.tlog/CL.write.1.tlog +0 -0
- package/build/Debug/obj/irsdk_node/irsdk_node.tlog/Cl.items.tlog +0 -4
- package/build/Debug/obj/irsdk_node/irsdk_node.tlog/irsdk_node.lastbuildstate +0 -2
- package/build/Debug/obj/irsdk_node/irsdk_node.tlog/link.command.1.tlog +0 -0
- package/build/Debug/obj/irsdk_node/irsdk_node.tlog/link.read.1.tlog +0 -0
- package/build/Debug/obj/irsdk_node/irsdk_node.tlog/link.secondary.1.tlog +0 -3
- package/build/Debug/obj/irsdk_node/irsdk_node.tlog/link.write.1.tlog +0 -0
- package/build/Debug/obj/irsdk_node/lib/irsdk_utils.obj +0 -0
- package/build/Debug/obj/irsdk_node/lib/yaml_parser.obj +0 -0
- package/build/Debug/obj/irsdk_node/src/irsdk_node.obj +0 -0
- package/build/Debug/obj/irsdk_node/vcpkg.applocal.log +0 -1
- package/build/Debug/obj/irsdk_node/win_delay_load_hook.obj +0 -0
- package/build/Release/irsdk_node.exp +0 -0
- package/build/Release/irsdk_node.iobj +0 -0
- package/build/Release/irsdk_node.ipdb +0 -0
- package/build/Release/irsdk_node.lib +0 -0
- package/build/Release/irsdk_node.node +0 -0
- package/build/Release/irsdk_node.pdb +0 -0
- package/build/Release/obj/irsdk_node/irsdk_node.node.recipe +0 -11
- package/build/Release/obj/irsdk_node/irsdk_node.tlog/CL.command.1.tlog +0 -0
- package/build/Release/obj/irsdk_node/irsdk_node.tlog/CL.read.1.tlog +0 -0
- package/build/Release/obj/irsdk_node/irsdk_node.tlog/CL.write.1.tlog +0 -0
- package/build/Release/obj/irsdk_node/irsdk_node.tlog/Cl.items.tlog +0 -4
- package/build/Release/obj/irsdk_node/irsdk_node.tlog/irsdk_node.lastbuildstate +0 -2
- package/build/Release/obj/irsdk_node/irsdk_node.tlog/link.command.1.tlog +0 -0
- package/build/Release/obj/irsdk_node/irsdk_node.tlog/link.read.1.tlog +0 -0
- package/build/Release/obj/irsdk_node/irsdk_node.tlog/link.secondary.1.tlog +0 -5
- package/build/Release/obj/irsdk_node/irsdk_node.tlog/link.write.1.tlog +0 -0
- package/build/Release/obj/irsdk_node/lib/irsdk_utils.obj +0 -0
- package/build/Release/obj/irsdk_node/lib/yaml_parser.obj +0 -0
- package/build/Release/obj/irsdk_node/src/irsdk_node.obj +0 -0
- package/build/Release/obj/irsdk_node/vcpkg.applocal.log +0 -1
- package/build/Release/obj/irsdk_node/win_delay_load_hook.obj +0 -0
- package/build/binding.sln +0 -19
- package/build/config.gypi +0 -426
- package/build/irsdk_node.vcxproj +0 -157
- package/build/irsdk_node.vcxproj.filters +0 -73
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -13
- package/src/index.js +0 -11
|
@@ -13,50 +13,21 @@ import {
|
|
|
13
13
|
TelemetryVariable,
|
|
14
14
|
TelemetryVarList,
|
|
15
15
|
} from '@irsdk-node/types';
|
|
16
|
+
import { INativeSDK } from './dist/INativeSDK';
|
|
16
17
|
|
|
17
18
|
type TelemetryTypesDict = {
|
|
18
19
|
[variableName: string]: number;
|
|
19
20
|
};
|
|
20
21
|
|
|
21
|
-
export
|
|
22
|
-
readonly currDataVersion: number;
|
|
23
|
-
enableLogging: boolean;
|
|
22
|
+
export { INativeSDK } from './dist/INativeSDK';
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
// Control
|
|
27
|
-
startSDK(): boolean;
|
|
28
|
-
stopSDK(): void;
|
|
29
|
-
|
|
30
|
-
// State
|
|
31
|
-
isRunning(): boolean;
|
|
32
|
-
waitForData(timeout?: number): boolean;
|
|
33
|
-
getSessionData(): string; // full yaml
|
|
34
|
-
getTelemetryData(): TelemetryVarList;
|
|
35
|
-
|
|
36
|
-
getTelemetryVariable<T>(index: number): TelemetryVariable<T>;
|
|
37
|
-
getTelemetryVariable<T>(name: string): TelemetryVariable<T>;
|
|
38
|
-
|
|
39
|
-
// Broadcast command overloads
|
|
40
|
-
// This is handled in the cpp side so no need to mess with it in js
|
|
41
|
-
broadcast(message: BroadcastMessages.CameraSwitchPos, pos: number, group: number, camera: number): void;
|
|
42
|
-
broadcast(message: BroadcastMessages.CameraSwitchNum, driver: number, group: number, camera: number): void;
|
|
43
|
-
broadcast(message: BroadcastMessages.CameraSetState, state: CameraState): void;
|
|
44
|
-
broadcast(message: BroadcastMessages.ReplaySetPlaySpeed, speed: number, slowMotion: number): void;
|
|
45
|
-
broadcast(message: BroadcastMessages.ReplaySetPlayPosition, pos: ReplayPositionCommand, frame: number): void;
|
|
46
|
-
broadcast(message: BroadcastMessages.ReplaySearch, mode: ReplaySearchCommand): void;
|
|
47
|
-
broadcast(message: BroadcastMessages.ReplaySetState, state: ReplayStateCommand): void;
|
|
48
|
-
broadcast(message: BroadcastMessages.ReloadTextures, command: ReloadTexturesCommand, carIndex?: number): void;
|
|
49
|
-
broadcast(message: BroadcastMessages.ChatCommand, command: ChatCommand, macro?: number): void;
|
|
50
|
-
broadcast(message: BroadcastMessages.PitCommand, command: PitCommand, param?: number): void;
|
|
51
|
-
broadcast(message: BroadcastMessages.TelemCommand, command: TelemetryCommand): void;
|
|
52
|
-
broadcast(message: BroadcastMessages.FFBCommand, command: FFBCommand, value: number): void;
|
|
53
|
-
broadcast(message: BroadcastMessages.ReplaySearchSessionTime, session: number, time: number): void;
|
|
54
|
-
broadcast(message: BroadcastMessages.VideoCapture, command: VideoCaptureCommand): void;
|
|
55
|
-
}
|
|
24
|
+
export const mockedSdk: boolean;
|
|
56
25
|
|
|
57
26
|
export class NativeSDK implements INativeSDK {
|
|
58
27
|
public readonly currDataVersion: number;
|
|
59
28
|
|
|
29
|
+
public readonly isMocked: boolean;
|
|
30
|
+
|
|
60
31
|
public enableLogging: boolean;
|
|
61
32
|
|
|
62
33
|
constructor();
|
|
@@ -114,4 +85,3 @@ export class NativeSDK implements INativeSDK {
|
|
|
114
85
|
public broadcast(message: BroadcastMessages.VideoCapture, command: VideoCaptureCommand): void;
|
|
115
86
|
}
|
|
116
87
|
|
|
117
|
-
// export const DebugSDK: typeof NativeSDK;
|
package/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
};
|