@overlayed/app 0.13.1 → 0.14.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.ts +216 -8
- package/dist/index.js +24 -17
- package/dist/siege.d.ts +8 -9
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
import * as arktype0 from "arktype";
|
|
2
|
+
import { Module, Type } from "arktype";
|
|
3
|
+
import EventEmitter$1 from "events";
|
|
1
4
|
import * as electron0 from "electron";
|
|
2
5
|
import { BrowserWindow } from "electron";
|
|
3
|
-
import { EventCallback, EventType, GameModule, GameModuleEventInfer } from "@overlayed/events";
|
|
4
|
-
import * as arktype_internal_attributes_ts0 from "arktype/internal/attributes.ts";
|
|
5
6
|
import * as arktype_internal_methods_object_ts0 from "arktype/internal/methods/object.ts";
|
|
6
|
-
import { CustomLoggerScope, ErrorManagerEvents } from "@overlayed/utils-node";
|
|
7
|
-
import { GameModel, setUpdaterTokenResolver } from "@overlayed/api";
|
|
8
7
|
import { Process } from "@overlayed-gg/native-interface";
|
|
9
|
-
import { MaybePromise } from "@overlayed/utils";
|
|
10
8
|
import {
|
|
11
9
|
AccessLevel,
|
|
12
10
|
KeyboardKeyEvent,
|
|
@@ -20,8 +18,196 @@ import {
|
|
|
20
18
|
VirtualKey,
|
|
21
19
|
WindowEvent,
|
|
22
20
|
} from "@overlayed-gg/render-interface";
|
|
23
|
-
import { RenderInterfaceName } from "@overlayed/native-managers";
|
|
24
21
|
|
|
22
|
+
//#region ../utils/dist/index.d.ts
|
|
23
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
24
|
+
type MaybeArray<T> = T | T[];
|
|
25
|
+
type Result<T, E = string> = [T, undefined] | [undefined, E];
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/utilities.d.ts
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/brand.d.ts
|
|
31
|
+
/**
|
|
32
|
+
* A `Brand` is a type that takes at minimum two type parameters. Given a base
|
|
33
|
+
* type `Base` and some unique and arbitrary branding type `Branding`, it
|
|
34
|
+
* produces a type based on but distinct from `Base`. The resulting branded
|
|
35
|
+
* type is not directly assignable from the base type, and not mutually
|
|
36
|
+
* assignable with another branded type derived from the same base type.
|
|
37
|
+
*
|
|
38
|
+
* Take care that the branding type is unique. Two branded types that share the
|
|
39
|
+
* same base type and branding type are considered the same type! There are two
|
|
40
|
+
* ways to avoid this.
|
|
41
|
+
*
|
|
42
|
+
* The first way is to supply a third type parameter, `ReservedName`, with a
|
|
43
|
+
* string literal type that is not `__type__`, which is the default.
|
|
44
|
+
*
|
|
45
|
+
* The second way is to define a branded type in terms of its surrounding
|
|
46
|
+
* interface, thereby forming a recursive type. This is possible because there
|
|
47
|
+
* are no constraints on what the branding type must be. It does not have to
|
|
48
|
+
* be a string literal type, even though it often is.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```
|
|
52
|
+
* type Path = Brand<string, 'path'>;
|
|
53
|
+
* type UserId = Brand<number, 'user'>;
|
|
54
|
+
* type DifferentUserId = Brand<number, 'user', '__kind__'>;
|
|
55
|
+
* interface Post { id: Brand<number, Post> }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
type Brand<Base, Branding, ReservedName extends string = "__type__"> = Base & { [K in ReservedName]: Branding } & {
|
|
59
|
+
__witness__: Base;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* An `AnyBrand` is a branded type based on any base type branded with any
|
|
63
|
+
* branding type. By itself it is not useful, but it can act as type constraint
|
|
64
|
+
* when manipulating branded types in general.
|
|
65
|
+
*/
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region ../utils-node/dist/index.d.ts
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/asSingleton.d.ts
|
|
70
|
+
type Singleton<T extends new (...args: any[]) => any> = T & {
|
|
71
|
+
getInstance: () => InstanceType<T>;
|
|
72
|
+
clearInstance: () => void;
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/logger.d.ts
|
|
76
|
+
interface LoggerScope {
|
|
77
|
+
scope: (name: string) => LoggerScope;
|
|
78
|
+
error: (...args: unknown[]) => void;
|
|
79
|
+
warn: (...args: unknown[]) => void;
|
|
80
|
+
info: (...args: unknown[]) => void;
|
|
81
|
+
log: (...args: unknown[]) => void;
|
|
82
|
+
}
|
|
83
|
+
declare class LoggerClass {
|
|
84
|
+
private fileLogger;
|
|
85
|
+
private path;
|
|
86
|
+
private appId;
|
|
87
|
+
private messageQueue;
|
|
88
|
+
fileName: string;
|
|
89
|
+
constructor(fileName: string);
|
|
90
|
+
init(appId: string): void;
|
|
91
|
+
scope(name: string): LoggerScope;
|
|
92
|
+
error(...args: unknown[]): void;
|
|
93
|
+
warn(...args: unknown[]): void;
|
|
94
|
+
info(...args: unknown[]): void;
|
|
95
|
+
debug(...args: unknown[]): void;
|
|
96
|
+
log(...args: unknown[]): void;
|
|
97
|
+
private handle;
|
|
98
|
+
}
|
|
99
|
+
declare const Logger: Singleton<typeof LoggerClass>;
|
|
100
|
+
type CustomLoggerScope = ReturnType<typeof Logger.prototype.scope>;
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/consts.d.ts
|
|
103
|
+
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/errorManager.d.ts
|
|
106
|
+
type ErrorManagerEvent = {
|
|
107
|
+
code: string;
|
|
108
|
+
message: string;
|
|
109
|
+
data: Record<string, any>;
|
|
110
|
+
timestamp: number;
|
|
111
|
+
};
|
|
112
|
+
interface FatalElevationMismatch extends ErrorManagerEvent {
|
|
113
|
+
code: "ELEVATION_MISMATCH";
|
|
114
|
+
data: {
|
|
115
|
+
appElevated: boolean;
|
|
116
|
+
gameElevated: boolean;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
interface ErrorPipeServerError extends ErrorManagerEvent {
|
|
120
|
+
code: "PIPE_SERVER_ERROR";
|
|
121
|
+
data: {
|
|
122
|
+
error: unknown;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
interface ErrorInvalidConfigFile extends ErrorManagerEvent {
|
|
126
|
+
code: "INVALID_CONFIG_FILE";
|
|
127
|
+
data: {
|
|
128
|
+
issues: string[];
|
|
129
|
+
filePath: string;
|
|
130
|
+
data: unknown;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
interface WarningInvalidEvent extends ErrorManagerEvent {
|
|
134
|
+
code: "INVALID_EVENT";
|
|
135
|
+
data: {
|
|
136
|
+
summary: string;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
type ErrorEvents = ErrorPipeServerError | ErrorInvalidConfigFile;
|
|
140
|
+
type WarningEvents = WarningInvalidEvent;
|
|
141
|
+
type FatalEvents = FatalElevationMismatch;
|
|
142
|
+
type ErrorManagerEvents = {
|
|
143
|
+
fatal: FatalEvents;
|
|
144
|
+
error: ErrorEvents;
|
|
145
|
+
warning: WarningEvents;
|
|
146
|
+
};
|
|
147
|
+
interface OverlayedConfig {
|
|
148
|
+
/**
|
|
149
|
+
* Your Overlayed application ID.
|
|
150
|
+
*/
|
|
151
|
+
applicationId: string;
|
|
152
|
+
/**
|
|
153
|
+
* The bundle config for your electron app.
|
|
154
|
+
*/
|
|
155
|
+
app: BundleAppConfig;
|
|
156
|
+
/**
|
|
157
|
+
* The optional bundle config for your site.
|
|
158
|
+
*/
|
|
159
|
+
site?: BundleSiteConfig;
|
|
160
|
+
}
|
|
161
|
+
interface BundleConfigBase {
|
|
162
|
+
/**
|
|
163
|
+
* String or array of string [glob](https://www.npmjs.com/package/glob) patterns to bundle.
|
|
164
|
+
*
|
|
165
|
+
* `package.json` is always included.
|
|
166
|
+
*/
|
|
167
|
+
include: MaybeArray<string>;
|
|
168
|
+
/**
|
|
169
|
+
* String or array of string [glob](https://www.npmjs.com/package/glob) patterns to exclude from the bundle.
|
|
170
|
+
*
|
|
171
|
+
* `/installer` is always excluded.
|
|
172
|
+
*/
|
|
173
|
+
exclude?: string | string[];
|
|
174
|
+
}
|
|
175
|
+
interface BundleAppConfig extends BundleConfigBase {}
|
|
176
|
+
interface BundleSiteConfig extends BundleConfigBase {}
|
|
177
|
+
declare function defineConfig(config: OverlayedConfig): OverlayedConfig;
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region ../events/dist/index.d.ts
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/utils.d.ts
|
|
182
|
+
declare const BaseEvent: Type<{
|
|
183
|
+
game: string;
|
|
184
|
+
type: string;
|
|
185
|
+
creation_time: number;
|
|
186
|
+
}>;
|
|
187
|
+
type BaseEvent = typeof BaseEvent.infer;
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/types.d.ts
|
|
190
|
+
type EventType<TEvent extends BaseEvent> = TEvent["type"];
|
|
191
|
+
type GameModuleEvent<TEvents extends Record<string, BaseEvent>> = TEvents & {
|
|
192
|
+
event: BaseEvent;
|
|
193
|
+
};
|
|
194
|
+
type GameModuleEventInfer<TModule extends GameModule> = TModule["events"]["event"]["infer"];
|
|
195
|
+
interface GameModule<
|
|
196
|
+
TEvents extends Record<string, BaseEvent> = Record<string, BaseEvent>,
|
|
197
|
+
TKey extends string = string,
|
|
198
|
+
> {
|
|
199
|
+
key: TKey;
|
|
200
|
+
events: Module<GameModuleEvent<TEvents>>;
|
|
201
|
+
}
|
|
202
|
+
type EventCallback<TEvent extends BaseEvent, TEventType extends EventType<TEvent>> = (
|
|
203
|
+
event: Extract<
|
|
204
|
+
TEvent,
|
|
205
|
+
{
|
|
206
|
+
type: TEventType;
|
|
207
|
+
}
|
|
208
|
+
>,
|
|
209
|
+
) => void;
|
|
210
|
+
//#endregion
|
|
25
211
|
//#region src/managers/manager.d.ts
|
|
26
212
|
/** This should be kept in sync with EventEmitterManager */
|
|
27
213
|
declare class Manager {
|
|
@@ -46,13 +232,27 @@ declare const KeybindSchema: arktype_internal_methods_object_ts0.ObjectType<
|
|
|
46
232
|
{
|
|
47
233
|
[x: string]: {
|
|
48
234
|
keys: string[];
|
|
49
|
-
mode: (In: "toggle" | "hold") =>
|
|
235
|
+
mode: (In: "toggle" | "hold") => arktype0.Out<"toggle" | "hold">;
|
|
50
236
|
};
|
|
51
237
|
},
|
|
52
238
|
{}
|
|
53
239
|
>;
|
|
54
240
|
type KeybindSchemaEntry = (typeof KeybindSchema.infer)[string];
|
|
55
241
|
//#endregion
|
|
242
|
+
//#region ../api/dist/index.d.ts
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region src/endpoints/raven/games.d.ts
|
|
245
|
+
interface GameModel {
|
|
246
|
+
name: string;
|
|
247
|
+
identifier: Brand<string, GameModel>;
|
|
248
|
+
modules: string[];
|
|
249
|
+
executables: string[];
|
|
250
|
+
}
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/instances.d.ts
|
|
253
|
+
declare function setUpdaterTokenResolver(newTokenResolver: () => string | undefined): void;
|
|
254
|
+
//#endregion
|
|
255
|
+
//#endregion
|
|
56
256
|
//#region src/managers/gameLaunchManager.d.ts
|
|
57
257
|
type GameLaunchManagerEvents = {
|
|
58
258
|
gameCloseInternal: (args: { ravenGame: GameModel; process: Process }) => MaybePromise<void>;
|
|
@@ -77,6 +277,10 @@ interface OverridesManagerScope {
|
|
|
77
277
|
setKeyInputBlock: (key: number, block: boolean) => void;
|
|
78
278
|
}
|
|
79
279
|
//#endregion
|
|
280
|
+
//#region ../native-managers/dist/index.d.ts
|
|
281
|
+
//#region src/renderInterfaceManager.d.ts
|
|
282
|
+
type RenderInterfaceName = "OGG_SIEGE";
|
|
283
|
+
//#endregion
|
|
80
284
|
//#region src/managers/overridesManager.d.ts
|
|
81
285
|
declare class OverridesManager extends Manager {
|
|
82
286
|
private renderInterface;
|
|
@@ -282,7 +486,7 @@ interface OverlayedAppInputModule {
|
|
|
282
486
|
scope: (scopeName: string) => ReturnType<OverridesManager["scope"]>;
|
|
283
487
|
raw: OverlayedAppInputModuleRaw;
|
|
284
488
|
}
|
|
285
|
-
interface CortexEvents
|
|
489
|
+
interface CortexEvents {}
|
|
286
490
|
interface OverlayedAppCortexModule {
|
|
287
491
|
track: <TEventName extends keyof CortexEvents>(name: TEventName, data: CortexEvents[TEventName]) => void;
|
|
288
492
|
}
|
|
@@ -440,17 +644,21 @@ declare function setFetchLatestTokenCallback(newFetchLatestToken: () => Promise<
|
|
|
440
644
|
export {
|
|
441
645
|
type AccessLevel,
|
|
442
646
|
ActiveGameInfo,
|
|
647
|
+
type BundleAppConfig,
|
|
648
|
+
type BundleSiteConfig,
|
|
443
649
|
type GameLaunchManagerEvents,
|
|
444
650
|
type KeybindSchemaEntry as KeybindConfig,
|
|
445
651
|
type KeyboardKeyEvent,
|
|
446
652
|
type MouseButtonEvent,
|
|
447
653
|
type OverlayedApp,
|
|
654
|
+
type OverlayedConfig,
|
|
448
655
|
OverridesManagerScope,
|
|
449
656
|
type RenderInterface,
|
|
450
657
|
type RenderWindow,
|
|
451
658
|
type RenderWindowConstructorOptions,
|
|
452
659
|
type VirtualKey,
|
|
453
660
|
type WindowEvent,
|
|
661
|
+
defineConfig,
|
|
454
662
|
overlayed,
|
|
455
663
|
setFetchLatestTokenCallback,
|
|
456
664
|
setUpdaterTokenResolver,
|