steelseries-sonar-sdk 0.4.6 → 0.4.8

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.
Files changed (72) hide show
  1. package/dist/index.d.ts +251 -29
  2. package/dist/index.js +42 -6053
  3. package/package.json +4 -2
  4. package/dist/consts/fetch-options-put.d.ts +0 -3
  5. package/dist/enums.d.ts +0 -82
  6. package/dist/exceptions.d.ts +0 -32
  7. package/dist/functions/audio/get-audio-data-classic.d.ts +0 -7
  8. package/dist/functions/audio/get-audio-data-stream.d.ts +0 -7
  9. package/dist/functions/audio/get-audio-mode.d.ts +0 -7
  10. package/dist/functions/audio/set-audio-mode.d.ts +0 -8
  11. package/dist/functions/audio/set-channel-mute-classic.d.ts +0 -9
  12. package/dist/functions/audio/set-channel-mute-streamer.d.ts +0 -10
  13. package/dist/functions/audio/set-channel-volume-classic.d.ts +0 -9
  14. package/dist/functions/audio/set-channel-volume-streamer.d.ts +0 -10
  15. package/dist/functions/chatmix/get-chat-mix-state.d.ts +0 -7
  16. package/dist/functions/chatmix/set-chat-mix-balance.d.ts +0 -7
  17. package/dist/functions/converters/convert-channel-to-api.d.ts +0 -3
  18. package/dist/functions/converters/convert-chat-mix-balance-to-api.d.ts +0 -2
  19. package/dist/functions/converters/convert-chat-mix-balance-to-user.d.ts +0 -2
  20. package/dist/functions/converters/convert-profile-channel-to-api.d.ts +0 -3
  21. package/dist/functions/converters/convert-profile-channel-to-user.d.ts +0 -3
  22. package/dist/functions/converters/convert-volume-to-api.d.ts +0 -1
  23. package/dist/functions/converters/convert-volume-to-user.d.ts +0 -1
  24. package/dist/functions/devices/get-audio-devices.d.ts +0 -3
  25. package/dist/functions/devices/set-audio-device.d.ts +0 -3
  26. package/dist/functions/endpoint/get-app-endpoint.d.ts +0 -14
  27. package/dist/functions/endpoint/get-sonar-endpoint-cached.d.ts +0 -1
  28. package/dist/functions/endpoint/get-sonar-endpoint.d.ts +0 -14
  29. package/dist/functions/profile/get-channel-profiles.d.ts +0 -3
  30. package/dist/functions/profile/get-selected-profiles.d.ts +0 -2
  31. package/dist/functions/profile/set-selected-profile.d.ts +0 -2
  32. package/dist/sonar/models/audio-settings/chatmix-data.d.ts +0 -5
  33. package/dist/sonar/models/audio-settings/enums/audio-mode.d.ts +0 -4
  34. package/dist/sonar/models/audio-settings/enums/chat-mix-state.d.ts +0 -6
  35. package/dist/sonar/models/audio-settings/enums/device-data-flow.d.ts +0 -5
  36. package/dist/sonar/models/audio-settings/enums/device-default-roles.d.ts +0 -6
  37. package/dist/sonar/models/audio-settings/enums/device-role.d.ts +0 -9
  38. package/dist/sonar/models/audio-settings/enums/device-state.d.ts +0 -8
  39. package/dist/sonar/models/audio-settings/enums/sonar-channel.d.ts +0 -8
  40. package/dist/sonar/models/audio-settings/enums/streaming-path.d.ts +0 -4
  41. package/dist/sonar/models/audio-settings/volume-info-classic.d.ts +0 -4
  42. package/dist/sonar/models/audio-settings/volume-info-streamer.d.ts +0 -10
  43. package/dist/sonar/models/audio-settings/volume-settings-classic.d.ts +0 -9
  44. package/dist/sonar/models/audio-settings/volume-settings-streamer.d.ts +0 -9
  45. package/dist/sonar/models/config/config.d.ts +0 -8
  46. package/dist/sonar/models/config/enums/VirtualAudioDevice.d.ts +0 -7
  47. package/dist/sonar/models/devices/audio-device.d.ts +0 -16
  48. package/dist/sonar/models/devices/changed-device.d.ts +0 -6
  49. package/dist/sonar/requests/audio-devices/change-audio-device.d.ts +0 -3
  50. package/dist/sonar/requests/audio-devices/request-audio-devices.d.ts +0 -9
  51. package/dist/sonar/requests/chatmix/change-chat-mix-balance.d.ts +0 -2
  52. package/dist/sonar/requests/chatmix/request-chat-mix-state.d.ts +0 -2
  53. package/dist/sonar/requests/mode/change-audio-mode.d.ts +0 -2
  54. package/dist/sonar/requests/mode/request-audio-mode.d.ts +0 -2
  55. package/dist/sonar/requests/profiles/change-selected-config.d.ts +0 -2
  56. package/dist/sonar/requests/profiles/request-configs.d.ts +0 -3
  57. package/dist/sonar/requests/profiles/request-selected-configs.d.ts +0 -2
  58. package/dist/sonar/requests/volume-settings/change-volume-level-classic.d.ts +0 -3
  59. package/dist/sonar/requests/volume-settings/change-volume-level-streamer.d.ts +0 -4
  60. package/dist/sonar/requests/volume-settings/change-volume-mute-classic.d.ts +0 -3
  61. package/dist/sonar/requests/volume-settings/change-volume-mute-streamer.d.ts +0 -4
  62. package/dist/sonar/requests/volume-settings/request-volume-settings-classic.d.ts +0 -2
  63. package/dist/sonar/requests/volume-settings/request-volume-settings-streamer.d.ts +0 -2
  64. package/dist/types/audio-device.d.ts +0 -6
  65. package/dist/types/changed-device.d.ts +0 -6
  66. package/dist/types/channel-volume-classic.d.ts +0 -4
  67. package/dist/types/channel-volume-streamer-path.d.ts +0 -4
  68. package/dist/types/channel-volume-streamer.d.ts +0 -5
  69. package/dist/types/channel-volumes-classic.d.ts +0 -10
  70. package/dist/types/channel-volumes-streamer.d.ts +0 -7
  71. package/dist/types/chat-mix-data.d.ts +0 -6
  72. package/dist/types/profile-option.d.ts +0 -8
package/dist/index.d.ts CHANGED
@@ -1,29 +1,251 @@
1
- export * from './enums';
2
- export * from './exceptions';
3
- export * from './functions/audio/get-audio-data-classic';
4
- export * from './functions/audio/get-audio-data-stream';
5
- export * from './functions/audio/get-audio-mode';
6
- export * from './functions/audio/set-audio-mode';
7
- export * from './functions/audio/set-channel-mute-classic';
8
- export * from './functions/audio/set-channel-mute-streamer';
9
- export * from './functions/audio/set-channel-volume-classic';
10
- export * from './functions/audio/set-channel-volume-streamer';
11
- export * from './functions/chatmix/get-chat-mix-state';
12
- export * from './functions/chatmix/set-chat-mix-balance';
13
- export * from './functions/devices/get-audio-devices';
14
- export * from './functions/devices/set-audio-device';
15
- export * from './functions/endpoint/get-app-endpoint';
16
- export * from './functions/endpoint/get-sonar-endpoint';
17
- export * from './functions/endpoint/get-sonar-endpoint-cached';
18
- export * from './functions/profile/get-channel-profiles';
19
- export * from './functions/profile/get-selected-profiles';
20
- export * from './functions/profile/set-selected-profile';
21
- export * from './types/audio-device';
22
- export * from './types/changed-device';
23
- export * from './types/channel-volume-classic';
24
- export * from './types/channel-volume-streamer';
25
- export * from './types/channel-volume-streamer-path';
26
- export * from './types/channel-volumes-classic';
27
- export * from './types/channel-volumes-streamer';
28
- export * from './types/chat-mix-data';
29
- export * from './types/profile-option';
1
+ /**
2
+ * Sonar audio mixing channels.
3
+ * @property {@link AudioChannel.Master} - Master volume channel.
4
+ * @property {@link AudioChannel.Game} - Game audio channel.
5
+ * @property {@link AudioChannel.Chat} - Chat audio channel.
6
+ * @property {@link AudioChannel.Media} - Media audio channel.
7
+ * @property {@link AudioChannel.Aux} - Auxiliary audio channel.
8
+ * @property {@link AudioChannel.Mic} - Microphone audio channel.
9
+ */
10
+ declare enum AudioChannel {
11
+ Master = "master",
12
+ Game = "game",
13
+ Chat = "chat",
14
+ Media = "media",
15
+ Aux = "aux",
16
+ Mic = "mic"
17
+ }
18
+ declare enum ProfileChannel {
19
+ Game = "game",
20
+ Chat = "chat",
21
+ Media = "media",
22
+ Aux = "aux",
23
+ Mic = "mic"
24
+ }
25
+ /**
26
+ * Sonar device channels.
27
+ * @property {@link DeviceChannel.Output} - All output channels.
28
+ * @property {@link DeviceChannel.Game} - Game output channel.
29
+ * @property {@link DeviceChannel.Chat} - Chat output channel.
30
+ * @property {@link DeviceChannel.Media} - Media output channel.
31
+ * @property {@link DeviceChannel.Aux} - Auxiliary output channel.
32
+ * @property {@link DeviceChannel.Mic} - Microphone input channel.
33
+ */
34
+ declare enum DeviceChannel {
35
+ Output = "render",
36
+ Game = "game",
37
+ Chat = "chat",
38
+ Media = "media",
39
+ Aux = "aux",
40
+ Mic = "mic"
41
+ }
42
+ /**
43
+ * Sonar Streamer Mode path.
44
+ * @property {@link StreamerPath.Streaming} - What the audience will hear.
45
+ * @property {@link StreamerPath.Monitoring} - What the owner will hear.
46
+ */
47
+ declare enum StreamerPath {
48
+ Streaming = "streaming",
49
+ Monitoring = "monitoring"
50
+ }
51
+ /**
52
+ * Sonar mixing state.
53
+ * @property {@link AudioMode.Classic} - Basic mixing.
54
+ * @property {@link AudioMode.Streamer} - Advanced mixing - has stream/monitor path each channel.
55
+ */
56
+ declare enum AudioMode {
57
+ Classic = "classic",
58
+ Streamer = "stream"
59
+ }
60
+ /**
61
+ * The state of CHATMIX availability.
62
+ * @property {@link ChatMixState.Enabled} - CHATMIX is enabled and available.
63
+ * @property {@link ChatMixState.FiniteWheel} - CHATMIX is available but the user cannot interact with it via software.
64
+ * @property {@link ChatMixState.DifferentDeviceSelected} - CHATMIX is unavailable because a different output device is selected.
65
+ * @property {@link ChatMixState.NoDeviceSelected} - CHATMIX is unavailable because no output device is selected.
66
+ */
67
+ declare enum ChatMixState {
68
+ Enabled = "enabled",
69
+ FiniteWheel = "finiteWheel",
70
+ DifferentDeviceSelected = "differentDeviceSelected",
71
+ NoDeviceSelected = "noDeviceSelected"
72
+ }
73
+ /**
74
+ * Type of audio device.
75
+ * @property {@link DeviceFlow.Output} - Device used to render audio (e.g. speakers, headphones).
76
+ * @property {@link DeviceFlow.Input} - Device used to capture audio (e.g. microphones).
77
+ */
78
+ declare enum DeviceFlow {
79
+ Output = "output",
80
+ Input = "input"
81
+ }
82
+ type RequestErrorProps = {
83
+ message?: string;
84
+ innerException?: Error;
85
+ };
86
+ declare enum InitializeErrorReason {
87
+ BadConfig = "Bad Config",
88
+ OSUnsupported = "OS Unsupported",
89
+ NotEnabled = "Not Enabled",
90
+ NotRunning = "Not Running",
91
+ NotReady = "Not Ready",
92
+ NotResponding = "Not Responding",
93
+ NotAvailable = "Not Available"
94
+ }
95
+ type InitializeErrorProps = {
96
+ message?: string;
97
+ innerException?: Error;
98
+ reason: InitializeErrorReason;
99
+ };
100
+ /** Base exception for all handled Sonar related exception. */
101
+ declare abstract class SonarException extends Error {
102
+ constructor(message: string, cause?: Error);
103
+ }
104
+ /** Thrown when the server responds in an unexpected way. */
105
+ declare class SonarRequestException extends SonarException {
106
+ constructor(error?: RequestErrorProps);
107
+ }
108
+ /** Thrown when the server cannot be determined. */
109
+ declare class SonarInitializationException extends SonarException {
110
+ reason: InitializeErrorReason;
111
+ constructor(error: InitializeErrorProps);
112
+ }
113
+ type ChannelVolumeClassic = {
114
+ volume: number;
115
+ isMuted: boolean;
116
+ };
117
+ type ChannelVolumesClassic = {
118
+ [AudioChannel.Master]: ChannelVolumeClassic;
119
+ } & { [K in Exclude<AudioChannel, "master">]? : ChannelVolumeClassic };
120
+ /**
121
+ * Gets audio data for all channels.
122
+ * @param sonarEndpoint Sonar endpoint URL
123
+ * @returns volume in the range of 0 to 100,
124
+ */
125
+ declare function getAudioDataClassic(sonarEndpoint: string): Promise<ChannelVolumesClassic>;
126
+ type ChannelVolumeStreamerPath = {
127
+ volume: number;
128
+ isMuted: boolean;
129
+ };
130
+ type ChannelVolumeStreamer = { [K in StreamerPath] : ChannelVolumeStreamerPath };
131
+ type ChannelVolumesStreamer = {
132
+ [AudioChannel.Master]: ChannelVolumeStreamer;
133
+ } & { [K in AudioChannel]? : ChannelVolumeStreamer };
134
+ /**
135
+ * Gets audio data for all channels.
136
+ * @param sonarEndpoint Sonar endpoint URL
137
+ * @returns volume in the range of 0 to 100,
138
+ */
139
+ declare function getAudioDataStream(sonarEndpoint: string): Promise<ChannelVolumesStreamer>;
140
+ /**
141
+ * Gets audio data for all channels.
142
+ * @param sonarEndpoint Sonar endpoint URL
143
+ * @returns classic or streamer mode
144
+ */
145
+ declare function getAudioMode(sonarEndpoint: string): Promise<AudioMode>;
146
+ /**
147
+ * Gets audio data for all channels.
148
+ * @param sonarEndpoint Sonar endpoint URL
149
+ * @param audioMode Target audio mode
150
+ * @returns classic or streamer mode
151
+ */
152
+ declare function setAudioMode(sonarEndpoint: string, audioMode: AudioMode): Promise<AudioMode>;
153
+ /**
154
+ * Sets audio data for target channel.
155
+ * @param sonarEndpoint Sonar endpoint URL
156
+ * @param isMuted Will mute if true.
157
+ * @param channel Target audio channel
158
+ */
159
+ declare function setChannelMuteClassic(sonarEndpoint: string, isMuted: boolean, channel: AudioChannel): Promise<ChannelVolumeClassic>;
160
+ /**
161
+ * Sets audio data for target channel.
162
+ * @param sonarEndpoint Sonar endpoint URL
163
+ * @param isMuted Will mute if true.
164
+ * @param channel Target audio channel
165
+ * @param path Target streamer path
166
+ */
167
+ declare function setChannelMuteStreamer(sonarEndpoint: string, isMuted: boolean, channel: AudioChannel, path: StreamerPath): Promise<ChannelVolumeStreamerPath>;
168
+ /**
169
+ * Sets audio data for target channel.
170
+ * @param sonarEndpoint Sonar endpoint URL
171
+ * @param volumePercent Volume in the range of 0 to 100
172
+ * @param channel Target audio channel
173
+ */
174
+ declare function setChannelVolumeClassic(sonarEndpoint: string, volumePercent: number, channel: AudioChannel): Promise<ChannelVolumeClassic>;
175
+ /**
176
+ * Sets audio data for target channel.
177
+ * @param sonarEndpoint Sonar endpoint URL
178
+ * @param volumePercent Volume in the range of 0 to 100
179
+ * @param channel Target audio channel
180
+ * @param path Target streamer path
181
+ */
182
+ declare function setChannelVolumeStreamer(sonarEndpoint: string, volumePercent: number, channel: AudioChannel, path: StreamerPath): Promise<ChannelVolumeStreamerPath>;
183
+ type ChatMixData = {
184
+ chatBalance: number;
185
+ state: ChatMixState;
186
+ isEnabled: boolean;
187
+ };
188
+ /**
189
+ * Gets CHATMIX state and data.
190
+ * @param sonarEndpoint Sonar endpoint URL
191
+ * @returns balance as 0 - 100,
192
+ */
193
+ declare function getChatMixState(sonarEndpoint: string): Promise<ChatMixData>;
194
+ /**
195
+ * Set CHATMIX balance between audio(0%) and chat(100%).
196
+ * @param sonarEndpoint Sonar endpoint URL
197
+ * @param chatBalance Balance as 0 - 100,
198
+ */
199
+ declare function setChatMixBalance(sonarEndpoint: string, chatBalance: number): Promise<ChatMixData>;
200
+ type AudioDevice = {
201
+ id: string;
202
+ name: string;
203
+ type: DeviceFlow;
204
+ };
205
+ declare function getAudioDevices(sonarEndpoint: string, deviceType?: DeviceFlow): Promise<AudioDevice[]>;
206
+ type ChangedDevice = {
207
+ deviceId: string;
208
+ deviceChannel: Exclude<DeviceChannel, DeviceChannel.Output>;
209
+ isRunning: boolean;
210
+ };
211
+ declare function setAudioDevice(sonarEndpoint: string, deviceChannel: DeviceChannel, deviceId: string): Promise<ChangedDevice[]>;
212
+ /**
213
+ * Retrieves the SteelSeries GG application's encrypted address from the coreProps.json file.
214
+ *
215
+ * @returns A promise that resolves to the GG application's secure address string (e.g., "https://..."),
216
+ * as found in the ggEncryptedAddress property of coreProps.json.
217
+ *
218
+ * @throws {SonarInitializationException} If the GG server cannot be determined.
219
+ *
220
+ * @remarks
221
+ * - Only supports Windows OS; throws on other platforms.
222
+ * - Locates coreProps.json in the ProgramData directory under SteelSeries folders.
223
+ * - Reads and parses the file, returning the encrypted address as a secure URL.
224
+ */
225
+ declare function getAppEndpoint(): Promise<string>;
226
+ /**
227
+ * Retrieves the Sonar web server address from an application server's /subApps endpoint.
228
+ *
229
+ * @param appEndpoint - The base URL of the application server (e.g. "https://localhost:1234").
230
+ * @returns A promise that resolves to the Sonar web server address.
231
+ *
232
+ * @throws {SonarInitializationException} If the sonar server cannot be determined.
233
+ *
234
+ * @remarks
235
+ * - Performs a GET request to `${appAddress}/subApps`.
236
+ * - The response body is expected to conform to the SubAppsResponse shape and contain `subApps.sonar`.
237
+ * - Uses a fetch TLS option that disables certificate verification (rejectUnauthorized: false).
238
+ */
239
+ declare function getSonarEndpoint(appEndpoint: string): Promise<string>;
240
+ declare function getSonarEndpointCached(appAddress: string, seconds?: number): Promise<string>;
241
+ type ProfileOption = {
242
+ id: string;
243
+ name: string;
244
+ isFavorite: boolean;
245
+ channel: ProfileChannel;
246
+ image?: string;
247
+ };
248
+ declare function getChannelProfiles(sonarAddress: string, channel: ProfileChannel, favoritesOnly?: boolean): Promise<ProfileOption[]>;
249
+ declare function getSelectedProfiles(sonarAddress: string): Promise<ProfileOption[]>;
250
+ declare function setSelectedProfile(sonarAddress: string, profileId: string): Promise<ProfileOption>;
251
+ export { setSelectedProfile, setChatMixBalance, setChannelVolumeStreamer, setChannelVolumeClassic, setChannelMuteStreamer, setChannelMuteClassic, setAudioMode, setAudioDevice, getSonarEndpointCached, getSonarEndpoint, getSelectedProfiles, getChatMixState, getChannelProfiles, getAudioMode, getAudioDevices, getAudioDataStream, getAudioDataClassic, getAppEndpoint, StreamerPath, SonarRequestException, SonarInitializationException, SonarException, ProfileOption, ProfileChannel, InitializeErrorReason, DeviceFlow, DeviceChannel, ChatMixState, ChatMixData, ChannelVolumesStreamer, ChannelVolumesClassic, ChannelVolumeStreamerPath, ChannelVolumeStreamer, ChannelVolumeClassic, ChangedDevice, AudioMode, AudioDevice, AudioChannel };