ogi-addon 1.9.3 → 1.9.5

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 (58) hide show
  1. package/build/Configuration-CdRZbO6z.d.mts +21 -0
  2. package/build/Configuration-WeOm-F0_.d.cts +21 -0
  3. package/build/ConfigurationBuilder-BSuJ4rSI.cjs +302 -0
  4. package/build/ConfigurationBuilder-BSuJ4rSI.cjs.map +1 -0
  5. package/build/ConfigurationBuilder-BbZDA_xx.d.mts +132 -0
  6. package/build/ConfigurationBuilder-CfHLKMTO.d.cts +132 -0
  7. package/build/EventResponse-CQhmdz3C.d.mts +430 -0
  8. package/build/EventResponse-D1c-Df5W.d.cts +430 -0
  9. package/build/EventResponse.cjs +55 -79
  10. package/build/EventResponse.cjs.map +1 -1
  11. package/build/EventResponse.d.cts +2 -45
  12. package/build/EventResponse.d.mts +2 -0
  13. package/build/EventResponse.mjs +58 -0
  14. package/build/EventResponse.mjs.map +1 -0
  15. package/build/SearchEngine-CRQWXfo6.d.mts +22 -0
  16. package/build/SearchEngine-DBSUNM4A.d.cts +22 -0
  17. package/build/SearchEngine.cjs +0 -19
  18. package/build/SearchEngine.d.cts +2 -20
  19. package/build/SearchEngine.d.mts +2 -0
  20. package/build/SearchEngine.mjs +1 -0
  21. package/build/config/Configuration.cjs +56 -370
  22. package/build/config/Configuration.cjs.map +1 -1
  23. package/build/config/Configuration.d.cts +3 -20
  24. package/build/config/Configuration.d.mts +3 -0
  25. package/build/config/Configuration.mjs +52 -0
  26. package/build/config/Configuration.mjs.map +1 -0
  27. package/build/config/ConfigurationBuilder.cjs +9 -292
  28. package/build/config/ConfigurationBuilder.d.cts +2 -130
  29. package/build/config/ConfigurationBuilder.d.mts +2 -0
  30. package/build/config/ConfigurationBuilder.mjs +221 -0
  31. package/build/config/ConfigurationBuilder.mjs.map +1 -0
  32. package/build/main.cjs +510 -1074
  33. package/build/main.cjs.map +1 -1
  34. package/build/main.d.cts +5 -387
  35. package/build/main.d.mts +5 -0
  36. package/build/main.mjs +510 -0
  37. package/build/main.mjs.map +1 -0
  38. package/package.json +9 -9
  39. package/src/config/Configuration.ts +18 -7
  40. package/src/main.ts +4 -3
  41. package/{tsup.config.js → tsdown.config.js} +2 -1
  42. package/build/EventResponse.d.ts +0 -45
  43. package/build/EventResponse.js +0 -62
  44. package/build/EventResponse.js.map +0 -1
  45. package/build/SearchEngine.cjs.map +0 -1
  46. package/build/SearchEngine.d.ts +0 -20
  47. package/build/SearchEngine.js +0 -1
  48. package/build/SearchEngine.js.map +0 -1
  49. package/build/config/Configuration.d.ts +0 -20
  50. package/build/config/Configuration.js +0 -329
  51. package/build/config/Configuration.js.map +0 -1
  52. package/build/config/ConfigurationBuilder.cjs.map +0 -1
  53. package/build/config/ConfigurationBuilder.d.ts +0 -130
  54. package/build/config/ConfigurationBuilder.js +0 -251
  55. package/build/config/ConfigurationBuilder.js.map +0 -1
  56. package/build/main.d.ts +0 -387
  57. package/build/main.js +0 -1045
  58. package/build/main.js.map +0 -1
package/build/main.d.ts DELETED
@@ -1,387 +0,0 @@
1
- import events from 'node:events';
2
- import { ConfigurationFile, ConfigurationBuilder } from './config/ConfigurationBuilder.js';
3
- import { Configuration } from './config/Configuration.js';
4
- import EventResponse from './EventResponse.js';
5
- import { SearchResult } from './SearchEngine.js';
6
- import { IFuseOptions } from 'fuse.js';
7
- import { z } from 'zod';
8
-
9
- type OGIAddonEvent = 'connect' | 'disconnect' | 'configure' | 'authenticate' | 'search' | 'setup' | 'library-search' | 'game-details' | 'exit' | 'check-for-updates' | 'task-run' | 'request-dl' | 'catalog';
10
- type OGIAddonClientSentEvent = 'response' | 'authenticate' | 'configure' | 'defer-update' | 'notification' | 'input-asked' | 'get-app-details' | 'search-app-name' | 'flag' | 'task-update';
11
- type OGIAddonServerSentEvent = 'authenticate' | 'configure' | 'config-update' | 'search' | 'setup' | 'response' | 'library-search' | 'check-for-updates' | 'task-run' | 'game-details' | 'request-dl' | 'catalog';
12
-
13
- declare const VERSION: string;
14
- interface ClientSentEventTypes {
15
- response: any;
16
- authenticate: {
17
- name: string;
18
- id: string;
19
- description: string;
20
- version: string;
21
- author: string;
22
- };
23
- configure: ConfigurationFile;
24
- 'defer-update': {
25
- logs: string[];
26
- progress: number;
27
- };
28
- notification: Notification;
29
- 'input-asked': ConfigurationBuilder;
30
- 'task-update': {
31
- id: string;
32
- progress: number;
33
- logs: string[];
34
- finished: boolean;
35
- failed: string | undefined;
36
- };
37
- 'get-app-details': {
38
- appID: number;
39
- storefront: string;
40
- };
41
- 'search-app-name': {
42
- query: string;
43
- storefront: string;
44
- };
45
- flag: {
46
- flag: string;
47
- value: string | string[];
48
- };
49
- }
50
- type BasicLibraryInfo = {
51
- name: string;
52
- capsuleImage: string;
53
- appID: number;
54
- storefront: string;
55
- };
56
- type SetupEventResponse = Omit<LibraryInfo, 'capsuleImage' | 'coverImage' | 'name' | 'appID' | 'storefront' | 'addonsource' | 'titleImage'> & {
57
- redistributables?: {
58
- name: string;
59
- path: string;
60
- }[];
61
- };
62
- interface EventListenerTypes {
63
- /**
64
- * This event is emitted when the addon connects to the OGI Addon Server. Addon does not need to resolve anything.
65
- * @param event
66
- * @returns
67
- */
68
- connect: (event: EventResponse<void>) => void;
69
- /**
70
- * This event is emitted when the client requests for the addon to disconnect. Addon does not need to resolve this event, but we recommend `process.exit(0)` so the addon can exit gracefully instead of by force by the addon server.
71
- * @param reason
72
- * @returns
73
- */
74
- disconnect: (reason: string) => void;
75
- /**
76
- * This event is emitted when the client requests for the addon to configure itself. Addon should resolve the event with the internal configuration. (See ConfigurationBuilder)
77
- * @param config
78
- * @returns
79
- */
80
- configure: (config: ConfigurationBuilder) => ConfigurationBuilder;
81
- /**
82
- * This event is called when the client provides a response to any event. This should be treated as middleware.
83
- * @param response
84
- * @returns
85
- */
86
- response: (response: any) => void;
87
- /**
88
- * This event is called when the client requests for the addon to authenticate itself. You don't need to provide any info.
89
- * @param config
90
- * @returns
91
- */
92
- authenticate: (config: any) => void;
93
- /**
94
- * This event is emitted when the client requests for a torrent/direct download search to be performed. Addon is given the gameID (could be a steam appID or custom store appID), along with the storefront type. Addon should resolve the event with the search results. (See SearchResult)
95
- * @param query
96
- * @param event
97
- * @returns
98
- */
99
- search: (query: {
100
- storefront: string;
101
- appID: number;
102
- } & ({
103
- for: 'game' | 'task' | 'all';
104
- } | {
105
- for: 'update';
106
- libraryInfo: LibraryInfo;
107
- }), event: EventResponse<SearchResult[]>) => void;
108
- /**
109
- * This event is emitted when the client requests for app setup to be performed. Addon should resolve the event with the metadata for the library entry. (See LibraryInfo)
110
- * @param data
111
- * @param event
112
- * @returns
113
- */
114
- setup: (data: {
115
- path: string;
116
- type: 'direct' | 'torrent' | 'magnet' | 'empty';
117
- name: string;
118
- usedRealDebrid: boolean;
119
- multiPartFiles?: {
120
- name: string;
121
- downloadURL: string;
122
- }[];
123
- appID: number;
124
- storefront: string;
125
- manifest?: Record<string, unknown>;
126
- } & ({
127
- for: 'game';
128
- } | {
129
- for: 'update';
130
- currentLibraryInfo: LibraryInfo;
131
- }), event: EventResponse<SetupEventResponse>) => void;
132
- /**
133
- * This event is emitted when the client requires for a search to be performed. Input is the search query.
134
- * @param query
135
- * @param event
136
- * @returns
137
- */
138
- 'library-search': (query: string, event: EventResponse<BasicLibraryInfo[]>) => void;
139
- /**
140
- * This event is emitted when the client requests for a task to be run. Addon should resolve the event with the task.
141
- * @param task
142
- * @param event
143
- * @returns
144
- */
145
- 'task-run': (task: {
146
- manifest: Record<string, unknown>;
147
- downloadPath: string;
148
- name: string;
149
- }, event: EventResponse<void>) => void;
150
- /**
151
- * This event is emitted when the client requests for a game details to be fetched. Addon should resolve the event with the game details. This is used to generate a store page for the game.
152
- * @param appID
153
- * @param event
154
- * @returns
155
- */
156
- 'game-details': (details: {
157
- appID: number;
158
- storefront: string;
159
- }, event: EventResponse<StoreData | undefined>) => void;
160
- /**
161
- * This event is emitted when the client requests for the addon to exit. Use this to perform any cleanup tasks, ending with a `process.exit(0)`.
162
- * @returns
163
- */
164
- exit: () => void;
165
- /**
166
- * This event is emitted when the client requests for a download to be performed with the 'request' type. Addon should resolve the event with a SearchResult containing the actual download info.
167
- * @param appID
168
- * @param info
169
- * @param event
170
- * @returns
171
- */
172
- 'request-dl': (appID: number, info: SearchResult, event: EventResponse<SearchResult>) => void;
173
- /**
174
- * This event is emitted when the client requests for a catalog to be fetched. Addon should resolve the event with the catalog.
175
- * @param event
176
- * @returns
177
- */
178
- catalog: (event: Omit<EventResponse<{
179
- [key: string]: {
180
- name: string;
181
- description: string;
182
- listings: BasicLibraryInfo[];
183
- };
184
- }>, 'askForInput'>) => void;
185
- /**
186
- * This event is emitted when the client requests for an addon to check for updates. Addon should resolve the event with the update information.
187
- * @param data
188
- * @param event
189
- * @returns
190
- */
191
- 'check-for-updates': (data: {
192
- appID: number;
193
- storefront: string;
194
- currentVersion: string;
195
- }, event: EventResponse<{
196
- available: true;
197
- version: string;
198
- } | {
199
- available: false;
200
- }>) => void;
201
- }
202
- interface StoreData {
203
- name: string;
204
- publishers: string[];
205
- developers: string[];
206
- appID: number;
207
- releaseDate: string;
208
- capsuleImage: string;
209
- coverImage: string;
210
- basicDescription: string;
211
- description: string;
212
- headerImage: string;
213
- latestVersion: string;
214
- }
215
- interface WebsocketMessageClient {
216
- event: OGIAddonClientSentEvent;
217
- id?: string;
218
- args: any;
219
- statusError?: string;
220
- }
221
- interface WebsocketMessageServer {
222
- event: OGIAddonServerSentEvent;
223
- id?: string;
224
- args: any;
225
- statusError?: string;
226
- }
227
- /**
228
- * The configuration for the addon. This is used to identify the addon and provide information about it.
229
- * Storefronts is an array of names of stores that the addon supports.
230
- */
231
- interface OGIAddonConfiguration {
232
- name: string;
233
- id: string;
234
- description: string;
235
- version: string;
236
- author: string;
237
- repository: string;
238
- storefronts: string[];
239
- }
240
- /**
241
- * The main class for the OGI Addon. This class is used to interact with the OGI Addon Server. The OGI Addon Server provides a `--addonSecret` to the addon so it can securely connect.
242
- * @example
243
- * ```typescript
244
- * const addon = new OGIAddon({
245
- * name: 'Test Addon',
246
- * id: 'test-addon',
247
- * description: 'A test addon',
248
- * version: '1.0.0',
249
- * author: 'OGI Developers',
250
- * repository: ''
251
- * });
252
- * ```
253
- *
254
- */
255
- declare class OGIAddon {
256
- eventEmitter: events<[never]>;
257
- addonWSListener: OGIAddonWSListener;
258
- addonInfo: OGIAddonConfiguration;
259
- config: Configuration;
260
- private eventsAvailable;
261
- private registeredConnectEvent;
262
- constructor(addonInfo: OGIAddonConfiguration);
263
- /**
264
- * Register an event listener for the addon. (See EventListenerTypes)
265
- * @param event {OGIAddonEvent}
266
- * @param listener {EventListenerTypes[OGIAddonEvent]}
267
- */
268
- on<T extends OGIAddonEvent>(event: T, listener: EventListenerTypes[T]): void;
269
- emit<T extends OGIAddonEvent>(event: T, ...args: Parameters<EventListenerTypes[T]>): void;
270
- /**
271
- * Notify the client using a notification. Provide the type of notification, the message, and an ID.
272
- * @param notification {Notification}
273
- */
274
- notify(notification: Notification): void;
275
- /**
276
- * Get the app details for a given appID and storefront.
277
- * @param appID {number}
278
- * @param storefront {string}
279
- * @returns {Promise<StoreData>}
280
- */
281
- getAppDetails(appID: number, storefront: string): Promise<StoreData | undefined>;
282
- searchGame(query: string, storefront: string): Promise<BasicLibraryInfo[]>;
283
- /**
284
- * Notify the OGI Addon Server that you are performing a background task. This can be used to help users understand what is happening in the background.
285
- * @param id {string}
286
- * @param progress {number}
287
- * @param logs {string[]}
288
- */
289
- task(): Promise<CustomTask>;
290
- /**
291
- * Extract a file using 7-Zip on Windows, unzip on Linux/Mac.
292
- * @param path {string}
293
- * @param outputPath {string}
294
- * @param type {'unrar' | 'unzip'}
295
- * @returns {Promise<void>}
296
- */
297
- extractFile(path: string, outputPath: string, type: 'unrar' | 'unzip'): Promise<void>;
298
- }
299
- declare class CustomTask {
300
- readonly id: string;
301
- progress: number;
302
- logs: string[];
303
- finished: boolean;
304
- ws: OGIAddonWSListener;
305
- failed: string | undefined;
306
- constructor(ws: OGIAddonWSListener, id: string, progress: number, logs: string[]);
307
- log(log: string): void;
308
- finish(): void;
309
- fail(message: string): void;
310
- setProgress(progress: number): void;
311
- update(): void;
312
- }
313
- /**
314
- * A search tool wrapper over Fuse.js for the OGI Addon. This tool is used to search for items in the library.
315
- * @example
316
- * ```typescript
317
- * const searchTool = new SearchTool<LibraryInfo>([{ name: 'test', appID: 123 }, { name: 'test2', appID: 124 }], ['name']);
318
- * const results = searchTool.search('test', 10);
319
- * ```
320
- */
321
- declare class SearchTool<T> {
322
- private fuse;
323
- constructor(items: T[], keys: string[], options?: Omit<IFuseOptions<T>, 'keys'>);
324
- search(query: string, limit?: number): T[];
325
- addItems(items: T[]): void;
326
- }
327
- /**
328
- * Library Info is the metadata for a library entry after setting up a game.
329
- */
330
- declare const ZodLibraryInfo: z.ZodObject<{
331
- name: z.ZodString;
332
- version: z.ZodString;
333
- cwd: z.ZodString;
334
- appID: z.ZodNumber;
335
- launchExecutable: z.ZodString;
336
- launchArguments: z.ZodOptional<z.ZodString>;
337
- capsuleImage: z.ZodString;
338
- storefront: z.ZodString;
339
- addonsource: z.ZodString;
340
- coverImage: z.ZodString;
341
- titleImage: z.ZodOptional<z.ZodString>;
342
- }, "strip", z.ZodTypeAny, {
343
- name: string;
344
- version: string;
345
- cwd: string;
346
- appID: number;
347
- launchExecutable: string;
348
- capsuleImage: string;
349
- storefront: string;
350
- addonsource: string;
351
- coverImage: string;
352
- launchArguments?: string | undefined;
353
- titleImage?: string | undefined;
354
- }, {
355
- name: string;
356
- version: string;
357
- cwd: string;
358
- appID: number;
359
- launchExecutable: string;
360
- capsuleImage: string;
361
- storefront: string;
362
- addonsource: string;
363
- coverImage: string;
364
- launchArguments?: string | undefined;
365
- titleImage?: string | undefined;
366
- }>;
367
- type LibraryInfo = z.infer<typeof ZodLibraryInfo>;
368
- interface Notification {
369
- type: 'warning' | 'error' | 'info' | 'success';
370
- message: string;
371
- id: string;
372
- }
373
- declare class OGIAddonWSListener {
374
- private socket;
375
- eventEmitter: events.EventEmitter;
376
- addon: OGIAddon;
377
- constructor(ogiAddon: OGIAddon, eventEmitter: events.EventEmitter);
378
- private userInputAsked;
379
- private registerMessageReceiver;
380
- private waitForEventToRespond;
381
- respondToMessage(messageID: string, response: any, originalEvent: EventResponse<any> | undefined): void;
382
- waitForResponseFromServer<T>(messageID: string): Promise<T>;
383
- send(event: OGIAddonClientSentEvent, args: ClientSentEventTypes[OGIAddonClientSentEvent]): string;
384
- close(): void;
385
- }
386
-
387
- export { type BasicLibraryInfo, type ClientSentEventTypes, Configuration, ConfigurationBuilder, CustomTask, type EventListenerTypes, EventResponse, type LibraryInfo, type OGIAddonClientSentEvent, type OGIAddonConfiguration, type OGIAddonEvent, type OGIAddonServerSentEvent, SearchResult, SearchTool, type SetupEventResponse, type StoreData, VERSION, type WebsocketMessageClient, type WebsocketMessageServer, ZodLibraryInfo, OGIAddon as default };