@overwolf/ow-electron-packages-types 1.1.12-beta.3 → 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 +56 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overwolf/ow-electron-packages-types",
3
- "version": "1.1.12-beta.3",
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>;