@overlayed/app 2.7.0 → 2.9.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/dist/index.d.mts CHANGED
@@ -1,14 +1,13 @@
1
1
  import { Module, Type } from "arktype";
2
2
  import EventEmitter$1 from "events";
3
+ import "xior";
3
4
  import JSZip from "jszip";
4
5
  import { BrowserWindow, BrowserWindowConstructorOptions } from "electron";
5
6
  import { CancellationToken, ProgressInfo, ProgressInfo as ProgressInfo$1, UpdateCheckResult, UpdateCheckResult as UpdateCheckResult$1, UpdateDownloadedEvent, UpdateInfo } from "electron-updater";
6
7
  import { KeyboardKeyEvent, MouseButtonEvent, RenderInterface, RenderInterface as RenderInterface$1, RenderWindow, RenderWindow as RenderWindow$1, RenderWindowConstructorOptions, RenderWindowConstructorOptions as RenderWindowConstructorOptions$1, VirtualKey, VirtualKey as VirtualKey$1, WindowEvent } from "@overlayed-gg/render-interface";
7
-
8
8
  //#region ../utils/dist/index.d.ts
9
9
  type MaybePromise<T> = T | Promise<T>;
10
- type MaybeArray<T> = T | T[]; //#endregion
11
- //#region src/utilities.d.ts
10
+ type MaybeArray<T> = T | T[];
12
11
  //#endregion
13
12
  //#region ../utils-node/dist/index.d.mts
14
13
  //#endregion
@@ -48,8 +47,7 @@ declare class LoggerClass {
48
47
  private logToConsole;
49
48
  }
50
49
  declare const Logger: Singleton<typeof LoggerClass>;
51
- type CustomLoggerScope = ReturnType<typeof Logger.prototype.scope>; //#endregion
52
- //#region src/consts.d.ts
50
+ type CustomLoggerScope = ReturnType<typeof Logger.prototype.scope>;
53
51
  //#endregion
54
52
  //#region src/errorManager.d.ts
55
53
  type ErrorManagerEvent = {
@@ -102,66 +100,66 @@ type WarningEvents = WarningInvalidEvent | WarningEventBufferFull;
102
100
  type FatalEvents = FatalElevationMismatch;
103
101
  interface OverlayedConfig {
104
102
  /**
105
- * Your Overlayed application ID.
106
- */
103
+ * Your Overlayed application ID.
104
+ */
107
105
  applicationId: string;
108
106
  /**
109
- * The bundle config for your electron app.
110
- */
107
+ * The bundle config for your electron app.
108
+ */
111
109
  app: BundleAppConfig;
112
110
  /**
113
- * The optional bundle config for your site.
114
- */
111
+ * The optional bundle config for your site.
112
+ */
115
113
  site?: BundleSiteConfig;
116
114
  /**
117
- * Override the default commit hash resolution (`git rev-parse HEAD`).
118
- * Return `undefined` to omit the commit hash from the upload.
119
- */
115
+ * Override the default commit hash resolution (`git rev-parse HEAD`).
116
+ * Return `undefined` to omit the commit hash from the upload.
117
+ */
120
118
  resolveCommitHash?: () => string | undefined;
121
119
  /**
122
- * When true, the bundle will be created in debug mode.
123
- * - Extra logs will occur
124
- * - The bundles will be outputted as a zip **instead of uploading to the Overlayed platform**
125
- *
126
- * @default false
127
- */
120
+ * When true, the bundle will be created in debug mode.
121
+ * - Extra logs will occur
122
+ * - The bundles will be outputted as a zip **instead of uploading to the Overlayed platform**
123
+ *
124
+ * @default false
125
+ */
128
126
  debug?: boolean;
129
127
  }
130
128
  interface BundleConfigBase {
131
129
  /**
132
- * The base directory to bundle from.
133
- *
134
- * @default location of the overlayed.config.ts file
135
- */
130
+ * The base directory to bundle from.
131
+ *
132
+ * @default location of the overlayed.config.ts file
133
+ */
136
134
  baseDir?: string;
137
135
  /**
138
- * String or array of string [glob](https://www.npmjs.com/package/glob) patterns to bundle.
139
- *
140
- * `package.json` is always included.
141
- */
136
+ * String or array of string [glob](https://www.npmjs.com/package/glob) patterns to bundle.
137
+ *
138
+ * `package.json` is always included.
139
+ */
142
140
  include: MaybeArray<string>;
143
141
  /**
144
- * String or array of string [glob](https://www.npmjs.com/package/glob) patterns to exclude from the bundle.
145
- *
146
- * `/installer` is always excluded.
147
- */
142
+ * String or array of string [glob](https://www.npmjs.com/package/glob) patterns to exclude from the bundle.
143
+ *
144
+ * `/installer` is always excluded.
145
+ */
148
146
  exclude?: string | string[];
149
147
  }
150
148
  interface BundleAppConfig extends BundleConfigBase {
151
149
  /**
152
- * Relative path to the `node_modules` directory used when resolving installed package versions.
153
- *
154
- * @default "node_modules"
155
- */
150
+ * Relative path to the `node_modules` directory used when resolving installed package versions.
151
+ *
152
+ * @default "node_modules"
153
+ */
156
154
  nodeModulesDir?: string;
157
155
  /**
158
- * Override the default version resolution for `@overlayed/app` and `@overlayed/electron`.
159
- * Receives the package name and the resolved base directory, and should return the semver version string.
160
- */
156
+ * Override the default version resolution for `@overlayed/app` and `@overlayed/electron`.
157
+ * Receives the package name and the resolved base directory, and should return the semver version string.
158
+ */
161
159
  resolvePackageVersion?: (packageName: string, cwd: string) => string;
162
160
  }
163
161
  interface BundleSiteConfig extends BundleConfigBase {}
164
- declare function defineConfig(config: OverlayedConfig): OverlayedConfig;
162
+ export declare function defineConfig(config: OverlayedConfig): OverlayedConfig;
165
163
  //#endregion
166
164
  //#region ../events/dist/index.d.mts
167
165
  //#endregion
@@ -171,7 +169,8 @@ declare const BaseEvent: Type<{
171
169
  type: string;
172
170
  creationTime: number;
173
171
  }>;
174
- type BaseEvent = typeof BaseEvent.infer; //#endregion
172
+ type BaseEvent = typeof BaseEvent.infer;
173
+ //#endregion
175
174
  //#region src/types.d.ts
176
175
  type EventType<TEvent extends BaseEvent> = TEvent["type"];
177
176
  type GameModuleEvent<TEvents extends Record<string, BaseEvent>> = TEvents & {
@@ -219,75 +218,58 @@ type KeybindSchemaEntry = (typeof KeybindSchema.infer)[string];
219
218
  //#endregion
220
219
  //#region src/brand.d.ts
221
220
  /**
222
- * A `Brand` is a type that takes at minimum two type parameters. Given a base
223
- * type `Base` and some unique and arbitrary branding type `Branding`, it
224
- * produces a type based on but distinct from `Base`. The resulting branded
225
- * type is not directly assignable from the base type, and not mutually
226
- * assignable with another branded type derived from the same base type.
227
- *
228
- * Take care that the branding type is unique. Two branded types that share the
229
- * same base type and branding type are considered the same type! There are two
230
- * ways to avoid this.
231
- *
232
- * The first way is to supply a third type parameter, `ReservedName`, with a
233
- * string literal type that is not `__type__`, which is the default.
234
- *
235
- * The second way is to define a branded type in terms of its surrounding
236
- * interface, thereby forming a recursive type. This is possible because there
237
- * are no constraints on what the branding type must be. It does not have to
238
- * be a string literal type, even though it often is.
239
- *
240
- * @example
241
- * ```
242
- * type Path = Brand<string, 'path'>;
243
- * type UserId = Brand<number, 'user'>;
244
- * type DifferentUserId = Brand<number, 'user', '__kind__'>;
245
- * interface Post { id: Brand<number, Post> }
246
- * ```
247
- */
248
- type Brand<Base, Branding, ReservedName extends string = "__type__"> = Base & { [K in ReservedName]: Branding } & {
221
+ * A `Brand` is a type that takes at minimum two type parameters. Given a base
222
+ * type `Base` and some unique and arbitrary branding type `Branding`, it
223
+ * produces a type based on but distinct from `Base`. The resulting branded
224
+ * type is not directly assignable from the base type, and not mutually
225
+ * assignable with another branded type derived from the same base type.
226
+ *
227
+ * Take care that the branding type is unique. Two branded types that share the
228
+ * same base type and branding type are considered the same type! There are two
229
+ * ways to avoid this.
230
+ *
231
+ * The first way is to supply a third type parameter, `ReservedName`, with a
232
+ * string literal type that is not `__type__`, which is the default.
233
+ *
234
+ * The second way is to define a branded type in terms of its surrounding
235
+ * interface, thereby forming a recursive type. This is possible because there
236
+ * are no constraints on what the branding type must be. It does not have to
237
+ * be a string literal type, even though it often is.
238
+ *
239
+ * @example
240
+ * ```
241
+ * type Path = Brand<string, 'path'>;
242
+ * type UserId = Brand<number, 'user'>;
243
+ * type DifferentUserId = Brand<number, 'user', '__kind__'>;
244
+ * interface Post { id: Brand<number, Post> }
245
+ * ```
246
+ */
247
+ type Brand<Base, Branding, ReservedName extends string = "__type__"> = Base & { [K in ReservedName]: Branding; } & {
249
248
  __witness__: Base;
250
249
  };
251
250
  /**
252
- * An `AnyBrand` is a branded type based on any base type branded with any
253
- * branding type. By itself it is not useful, but it can act as type constraint
254
- * when manipulating branded types in general.
255
- */
251
+ * An `AnyBrand` is a branded type based on any base type branded with any
252
+ * branding type. By itself it is not useful, but it can act as type constraint
253
+ * when manipulating branded types in general.
254
+ */
256
255
  type AnyBrand = Brand<unknown, any>;
257
256
  /**
258
- * `BaseOf` is a type that takes any branded type `B` and yields its base type.
259
- */
257
+ * `BaseOf` is a type that takes any branded type `B` and yields its base type.
258
+ */
260
259
  type BaseOf<B extends AnyBrand> = B["__witness__"];
261
260
  /**
262
- * A `Brander` is a function that takes a value of some base type and casts
263
- * that value to a branded type derived from said base type. It can be thought
264
- * of as the type of a "constructor", in the functional programming sense of
265
- * the word.
266
- *
267
- * @example
268
- * ```
269
- * type UserId = Brand<number, 'user'>;
270
- * // A Brander<UserId> would take a number and return a UserId
271
- * ```
272
- */
261
+ * A `Brander` is a function that takes a value of some base type and casts
262
+ * that value to a branded type derived from said base type. It can be thought
263
+ * of as the type of a "constructor", in the functional programming sense of
264
+ * the word.
265
+ *
266
+ * @example
267
+ * ```
268
+ * type UserId = Brand<number, 'user'>;
269
+ * // A Brander<UserId> would take a number and return a UserId
270
+ * ```
271
+ */
273
272
  type Brander<B extends AnyBrand> = (underlying: BaseOf<B>) => B;
274
- /**
275
- * A generic function that, when given some branded type, can take a value with
276
- * the base type of the branded type, and cast that value to the branded type.
277
- * It fulfills the contract of a `Brander`.
278
- *
279
- * At runtime, this function simply returns the value as-is.
280
- *
281
- * @param underlying The value with a base type, to be casted
282
- * @return The same underlying value, but casted
283
- * @example
284
- * ```
285
- * type UserId = Brand<number, 'user'>;
286
- * const UserId: Brander<UserId> = identity;
287
- * ```
288
- */
289
- //#endregion
290
- //#region src/endpoints/applications/applications.d.ts
291
273
  //#endregion
292
274
  //#region src/endpoints/applications/crashDumps.d.ts
293
275
  type GameCrashReportId = Brand<string, "GameCrashReportId">;
@@ -481,8 +463,7 @@ declare function module(): {
481
463
  };
482
464
  };
483
465
  }>;
484
- }; //#endregion
485
- //#region src/events/loggedIn.d.ts
466
+ };
486
467
  //#endregion
487
468
  //#region src/managers/crashDumpManager.d.ts
488
469
  type CrashDumpEvent = {
@@ -513,17 +494,19 @@ type UpdateManagerEvents = {
513
494
  info: ProgressInfo$1;
514
495
  };
515
496
  /**
516
- * Emitted when the access token fetcher returns an invalid token.
497
+ * Emitted when the player has no access to the private channel being checked: the access token fetcher
498
+ * returned null or threw, or the update server rejected the token it returned. The check falls back to the
499
+ * default channel's release, or fails when the app doesn't allow public releases.
517
500
  *
518
- * We strongly recommend logging the user out in this case, as it likely means
519
- * their account no longer has access to the private channel.
501
+ * Fires once per channel until access is regained, so calling `checkForUpdates` from the handler can't loop.
502
+ * We recommend logging the user out in this case, as their account likely no longer has access to the channel.
520
503
  */
521
504
  authTokenInvalid: {};
522
505
  };
523
506
  //#endregion
524
507
  //#region src/utilities/types.d.ts
525
508
  type UniversalGameModule = ReturnType<typeof module>;
526
- type OverlayedAppGameModules<TModule extends GameModule> = { [TKey in TModule["key"]]: OverlayedAppGameModuleListeners<TModule, TKey> } & { [TKey in UniversalGameModule["key"]]: OverlayedAppGameModuleListeners<UniversalGameModule, TKey> };
509
+ type OverlayedAppGameModules<TModule extends GameModule> = { [TKey in TModule["key"]]: OverlayedAppGameModuleListeners<TModule, TKey>; } & { [TKey in UniversalGameModule["key"]]: OverlayedAppGameModuleListeners<UniversalGameModule, TKey>; };
527
510
  type OverlayedAppGameModuleListeners<TModule extends GameModule, TKey extends TModule["key"] = TModule["key"]> = {
528
511
  /**
529
512
  * Listen to any event emitted by the module.
@@ -845,7 +828,7 @@ interface OverlayedAppNoticesModule {
845
828
  */
846
829
  getNotices: () => NoticeModel[];
847
830
  }
848
- type OverlayedAppUpdateHandlerMapping = { [K in keyof UpdateManagerEvents]: (data: UpdateManagerEvents[K]) => void };
831
+ type OverlayedAppUpdateHandlerMapping = { [K in keyof UpdateManagerEvents]: (data: UpdateManagerEvents[K]) => void; };
849
832
  interface OverlayedAppUpdateModule {
850
833
  site: OverlayedAppSiteModule;
851
834
  on: <TEvent extends keyof OverlayedAppUpdateHandlerMapping = keyof OverlayedAppUpdateHandlerMapping>(event: TEvent, cb: OverlayedAppUpdateHandlerMapping[TEvent]) => void;
@@ -857,7 +840,7 @@ interface OverlayedAppUpdateModule {
857
840
  checkForUpdates: () => Promise<UpdateCheckResult$1 | null>;
858
841
  /**
859
842
  * Sets the function to fetch the access token.
860
- * This function should return the access token or null if the channel is public.
843
+ * Called only when an update check needs a token for a private channel. Return null when the player has no access.
861
844
  *
862
845
  * @param accessTokenFetcher - The function to fetch the access token. Optionally pass the new channel to fetch the access token for.
863
846
  */
@@ -1262,6 +1245,6 @@ interface OverlayedOptions<TModule extends GameModule, TKeybind extends string,
1262
1245
  }
1263
1246
  //#endregion
1264
1247
  //#region src/utilities/overlayed.d.ts
1265
- declare function overlayed<TModule extends GameModule, TShortcut extends string, TFeatureFlag extends string = string>(optionsRaw: OverlayedOptions<TModule, TShortcut, TFeatureFlag>): OverlayedApp<TModule, TShortcut, TFeatureFlag>;
1248
+ export declare function overlayed<TModule extends GameModule, TShortcut extends string, TFeatureFlag extends string = string>(optionsRaw: OverlayedOptions<TModule, TShortcut, TFeatureFlag>): OverlayedApp<TModule, TShortcut, TFeatureFlag>;
1266
1249
  //#endregion
1267
- export { type ActiveGameInfo, type BundleAppConfig, type BundleSiteConfig, type ErrorEvents, type FatalEvents, type FeatureFlagLayers, type FeatureFlagModel, type FeedbackId, type FeedbackType, type GameCloseEvent, type GameLaunchEvent, type GameReadyEvent, type KeybindSchemaEntry as KeybindConfig, type KeyboardKeyEvent, type LoggerScope, type MouseButtonEvent, type NoticeId, type NoticeModel, type NoticeType, type OverlayedApp, type OverlayedConfig, type OverlayedNavigationGuardOptions, type OverridesManagerScope, type ProgressInfo, RenderInterface, type RenderWindow, type RenderWindowConstructorOptions, type UpdateCheckResult, VirtualKey, type WarningEvents, type WindowEvent, type WindowOpenAction, defineConfig, overlayed };
1250
+ export { type ActiveGameInfo, type BundleAppConfig, type BundleSiteConfig, type ErrorEvents, type FatalEvents, type FeatureFlagLayers, type FeatureFlagModel, type FeedbackId, type FeedbackType, type GameCloseEvent, type GameLaunchEvent, type GameReadyEvent, type KeybindSchemaEntry as KeybindConfig, type KeyboardKeyEvent, type LoggerScope, type MouseButtonEvent, type NoticeId, type NoticeModel, type NoticeType, type OverlayedApp, type OverlayedConfig, type OverlayedNavigationGuardOptions, type OverridesManagerScope, type ProgressInfo, RenderInterface, type RenderWindow, type RenderWindowConstructorOptions, type UpdateCheckResult, VirtualKey, type WarningEvents, type WindowEvent, type WindowOpenAction };