@overwolf/ow-electron-packages-types 1.1.12-beta.2 → 1.1.12-beta.4

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 (2) hide show
  1. package/package.json +3 -2
  2. package/types.d.ts +125 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overwolf/ow-electron-packages-types",
3
- "version": "1.1.12-beta.2",
3
+ "version": "1.1.12-beta.4",
4
4
  "description": "Type definition file for autocompletion and documentation purposes for ow-electron packages",
5
5
  "license": "MIT",
6
6
  "types": "types.d.ts",
@@ -34,7 +34,8 @@
34
34
  "scripts": {
35
35
  "combine": "node combine-dts.js ./modules",
36
36
  "beta": "node beta.js",
37
- "release": "node release.js"
37
+ "release": "node release.js",
38
+ "prepare": "git config core.hooksPath .githooks || true"
38
39
  },
39
40
  "dependencies": {
40
41
  "glob": "^13.0.0"
package/types.d.ts CHANGED
@@ -101,6 +101,46 @@ interface ElevatedInjectionCapability {
101
101
  readonly brokerInstalled: boolean;
102
102
  }
103
103
 
104
+ /**
105
+ * The value a failed elevation call rejects with: `installHighElevationHelper()`,
106
+ * `isHighElevationHelperInstalled()`, `canInjectElevated()`,
107
+ * `installElevationBroker()` and `uninstallElevationBroker()`.
108
+ *
109
+ * It is a plain object, not an `Error` instance: `err instanceof Error` is
110
+ * `false`, and there is no stack trace.
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * try {
115
+ * await api.installElevationBroker();
116
+ * } catch (err) {
117
+ * const { message, exitCode } = err as UtilityApiError;
118
+ * if (exitCode === 1223) {
119
+ * console.warn('User cancelled UAC prompt');
120
+ * } else {
121
+ * console.error('Broker install failed:', message, exitCode);
122
+ * }
123
+ * }
124
+ * ```
125
+ */
126
+ interface UtilityApiError {
127
+ /**
128
+ * Describes the failure.
129
+ */
130
+ readonly message: string;
131
+
132
+ /**
133
+ * Exit code of the elevated installer process. Only set by the calls that
134
+ * prompt for UAC (`installHighElevationHelper()`,
135
+ * `installElevationBroker()` and `uninstallElevationBroker()`), and only
136
+ * when the installer actually ran - it is absent when the call failed
137
+ * before that, e.g. a missing helper binary.
138
+ *
139
+ * `1223` (ERROR_CANCELLED) means the user cancelled the UAC prompt.
140
+ */
141
+ readonly exitCode?: number;
142
+ }
143
+
104
144
  /**
105
145
  * Defines the API for managing game launch and utility operations.
106
146
  */
@@ -132,9 +172,9 @@ interface IOverwolfUtilityApi {
132
172
  * Allows injection into high elevation games.
133
173
  * No-ops if files are already present.
134
174
  *
135
- * @throws `HelperInstallError` `exitCode 1223` — user cancelled the UAC prompt (ERROR_CANCELLED)
136
- * @throws `HelperInstallError` `err.exitCode !== 1223` — the installer process failed. Log `err.exitCode` and investigate.
137
- * @throws `HelperInstallError` any other non-zero exitCode — installation failed.
175
+ * @throws {@link UtilityApiError} `exitCode 1223` — user cancelled the UAC prompt (ERROR_CANCELLED)
176
+ * @throws {@link UtilityApiError} any other `exitCode` — the installer process failed. Log `err.exitCode` and investigate.
177
+ * @throws {@link UtilityApiError} no `exitCode` — the call failed before the installer ran. Log `err.message`.
138
178
  *
139
179
  * @remarks
140
180
  * The helper binaries are installed to:
@@ -150,12 +190,13 @@ interface IOverwolfUtilityApi {
150
190
  * try {
151
191
  * await api.installHighElevationHelper();
152
192
  * console.log('Helper installed successfully');
153
- * } catch (err: any) {
154
- * if (err.exitCode === 1223) {
193
+ * } catch (err) {
194
+ * const { message, exitCode } = err as UtilityApiError;
195
+ * if (exitCode === 1223) {
155
196
  * // User cancelled the UAC prompt — not an error, just inform the user
156
197
  * console.warn('User cancelled UAC prompt');
157
198
  * } else {
158
- * console.error('Installation failed, exitCode:', err.exitCode);
199
+ * console.error('Installation failed:', message, exitCode);
159
200
  * }
160
201
  * }
161
202
  * ```
@@ -179,6 +220,7 @@ interface IOverwolfUtilityApi {
179
220
  * `%CommonProgramFiles%\<app-name>\`.
180
221
  *
181
222
  * @returns `true` if the helper is installed and ready.
223
+ * @throws {@link UtilityApiError}
182
224
  *
183
225
  * @remarks
184
226
  * This only reports whether the binaries are present. On a standard
@@ -202,6 +244,7 @@ interface IOverwolfUtilityApi {
202
244
  *
203
245
  * @returns An {@link ElevatedInjectionCapability} describing what's
204
246
  * missing when elevated injection isn't currently possible.
247
+ * @throws {@link UtilityApiError}
205
248
  *
206
249
  * @remarks
207
250
  * `supported` is `false` with reason `'account-cannot-elevate'` on a
@@ -227,8 +270,9 @@ interface IOverwolfUtilityApi {
227
270
  * integrity, which is the only way an app running under a standard user
228
271
  * account can overlay an elevated game. Prompts for UAC once.
229
272
  *
230
- * @throws `HelperInstallError` `exitCode 1223` — user cancelled the UAC prompt (ERROR_CANCELLED)
231
- * @throws `HelperInstallError` any other non-zero exitCode — installation failed
273
+ * @throws {@link UtilityApiError} `exitCode 1223` — user cancelled the UAC prompt (ERROR_CANCELLED)
274
+ * @throws {@link UtilityApiError} any other `exitCode` — installation failed
275
+ * @throws {@link UtilityApiError} no `exitCode` — the call failed before the installer ran
232
276
  *
233
277
  * @remarks
234
278
  * The service stays registered until `uninstallElevationBroker()` removes
@@ -242,6 +286,10 @@ interface IOverwolfUtilityApi {
242
286
  * Stops and removes the elevation broker service. Prompts for UAC once.
243
287
  * Succeeds when the service is already absent.
244
288
  *
289
+ * @throws {@link UtilityApiError} `exitCode 1223` — user cancelled the UAC prompt (ERROR_CANCELLED)
290
+ * @throws {@link UtilityApiError} any other `exitCode` — removal failed
291
+ * @throws {@link UtilityApiError} no `exitCode` — the call failed before the uninstaller ran
292
+ *
245
293
  * @returns Resolves when removal completes.
246
294
  */
247
295
  uninstallElevationBroker?(): Promise<void>;
@@ -4232,6 +4280,24 @@ type CrashDumpType = 'off' | 'mini' | 'full';
4232
4280
  */
4233
4281
  type ObsHostMode = 'process' | 'dll';
4234
4282
 
4283
+ /**
4284
+ * Lifecycle of the recording or replays output.
4285
+ *
4286
+ * | Value | Meaning |
4287
+ * | ------------ | -------------------------------------------------------------------- |
4288
+ * | `idle` | Not started. |
4289
+ * | `starting` | Start accepted, output not running yet - OBS waits for a capture source to hook. |
4290
+ * | `active` | Running and producing frames. |
4291
+ *
4292
+ * An output stays `starting` for as long as its capture source fails to hook,
4293
+ * with no timeout. Operations that need a running output - `captureReplay`,
4294
+ * `splitRecording` - fail with `CaptureSourceNotHooked` while it does.
4295
+ *
4296
+ * @see {@link IOverwolfRecordingApi.getRecordingState}
4297
+ * @see {@link IOverwolfRecordingApi.getReplayState}
4298
+ */
4299
+ type OutputState = 'idle' | 'starting' | 'active';
4300
+
4235
4301
  /**
4236
4302
  * Crash dump configuration for the OBS host process.
4237
4303
  */
@@ -4321,6 +4387,10 @@ interface RecordingAppOptions {
4321
4387
  * | `-998` | `ConnectionOBSError` | Failed to connect to the OBS process. |
4322
4388
  * | `-997` | `AlreadyRunning` | Operation attempted while recording is already running. |
4323
4389
  * | `-996` | `ElevationHelperMissing` | Elevated game capture requested while the High Elevation Helper isn't installed. |
4390
+ * | `-995` | `CaptureSourceNotHooked` | Output accepted by OBS but not running yet - waiting for a capture source. |
4391
+ * | `-994` | `CaptureSourceNotFound` | A game or window capture source's target process wasn't found. Retryable. |
4392
+ * | `-993` | `CaptureSourceCreationFailed`| OBS refused to create the capture source. Not retryable. |
4393
+ * | `-992` | `OBSNotReady` | OBS accepted the connection but its core isn't initialized yet. Retryable. |
4324
4394
  * | `-12` | `SplitRecordingDisabled` | Attempted to split recording when split recording is disabled. |
4325
4395
  * | `-11` | `MissingOrInvalidParameters` | One or more required parameters are missing or invalid. |
4326
4396
  * | `-10` | `NoActiveRecording` | No active recording session found. |
@@ -4348,6 +4418,10 @@ type ErrorCode =
4348
4418
  | -998 // Failed to connect to the OBS process. 'ConnectionOBSError'
4349
4419
  | -997 // Operation attempted while recording is already running. 'AlreadyRunning'
4350
4420
  | -996 // Elevated game capture requested while the High Elevation Helper isn't installed. 'ElevationHelperMissing'
4421
+ | -995 // Output accepted by OBS but not running yet - waiting for a capture source. 'CaptureSourceNotHooked'
4422
+ | -994 // A game or window capture source's target process wasn't found. Retryable. 'CaptureSourceNotFound'
4423
+ | -993 // OBS refused to create the capture source. 'CaptureSourceCreationFailed'
4424
+ | -992 // OBS accepted the connection but its core isn't initialized yet. Retryable. 'OBSNotReady'
4351
4425
  | -12 // Attempted to split recording when split recording is disabled. 'SplitRecordingDisabled'
4352
4426
  | -11 // One or more required parameters are missing or invalid. 'MissingOrInvalidParameters'
4353
4427
  | -10 // No active recording session found. 'NoActiveRecording'
@@ -4936,20 +5010,60 @@ interface IOverwolfRecordingApi {
4936
5010
  readonly binFolderPath: string;
4937
5011
 
4938
5012
  /**
4939
- * Checks if either recording or replays are currently active.
5013
+ * Whether a recording or a replays service has been started and not yet
5014
+ * stopped - `true` for both the `starting` and `active` states.
5015
+ *
5016
+ * @see {@link getRecordingState}
5017
+ * @see {@link getReplayState}
4940
5018
  */
4941
5019
  isActive(): Promise<boolean>;
4942
5020
 
4943
5021
  /**
4944
- * Checks if a recording is currently active.
5022
+ * Whether a recording has been started and not yet stopped.
5023
+ *
5024
+ * `true` from the moment {@link startRecording} resolves, including while the
5025
+ * output is still `starting` - waiting for a capture source to hook - so it
5026
+ * does not mean frames are being written.
5027
+ *
5028
+ * @see {@link getRecordingState} to tell those apart.
4945
5029
  */
4946
5030
  isRecordingActive(): Promise<boolean>;
4947
5031
 
4948
5032
  /**
4949
- * Checks if a replay session is currently active.
5033
+ * Whether a replays service has been started and not yet stopped.
5034
+ *
5035
+ * `true` from the moment {@link startReplays} resolves, including while the
5036
+ * buffer is still `starting` - waiting for a capture source to hook - so it
5037
+ * does not mean the buffer holds any footage.
5038
+ *
5039
+ * @see {@link getReplayState} to tell those apart.
4950
5040
  */
4951
5041
  isReplayActive(): Promise<boolean>;
4952
5042
 
5043
+ /**
5044
+ * The recording output's current state.
5045
+ *
5046
+ * @example
5047
+ * ```ts
5048
+ * if (await recorder.getRecordingState() === 'starting') {
5049
+ * // started, but no capture source has hooked yet - nothing is written
5050
+ * }
5051
+ * ```
5052
+ *
5053
+ * @see {@link OutputState}
5054
+ */
5055
+ getRecordingState(): Promise<OutputState>;
5056
+
5057
+ /**
5058
+ * The replays buffer's current state.
5059
+ *
5060
+ * {@link captureReplay} fails with `CaptureSourceNotHooked` while this is
5061
+ * `starting`, since the buffer holds no footage yet.
5062
+ *
5063
+ * @see {@link OutputState}
5064
+ */
5065
+ getReplayState(): Promise<OutputState>;
5066
+
4953
5067
  /**
4954
5068
  * Queries supported encoders, audio/video devices, and configuration options.
4955
5069
  *