ogi-addon 1.0.0 → 1.1.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.
- package/LICENSE +660 -660
- package/README.md +40 -40
- package/build/EventResponse.cjs +19 -0
- package/build/EventResponse.cjs.map +1 -1
- package/build/EventResponse.d.cts +20 -1
- package/build/EventResponse.d.ts +20 -1
- package/build/EventResponse.js +19 -0
- package/build/EventResponse.js.map +1 -1
- package/build/SearchEngine.cjs.map +1 -1
- package/build/SearchEngine.d.cts +1 -1
- package/build/SearchEngine.d.ts +1 -1
- package/build/config/Configuration.cjs +71 -0
- package/build/config/Configuration.cjs.map +1 -1
- package/build/config/Configuration.js +71 -0
- package/build/config/Configuration.js.map +1 -1
- package/build/config/ConfigurationBuilder.cjs +71 -0
- package/build/config/ConfigurationBuilder.cjs.map +1 -1
- package/build/config/ConfigurationBuilder.d.cts +71 -0
- package/build/config/ConfigurationBuilder.d.ts +71 -0
- package/build/config/ConfigurationBuilder.js +71 -0
- package/build/config/ConfigurationBuilder.js.map +1 -1
- package/build/main.cjs +201 -17
- package/build/main.cjs.map +1 -1
- package/build/main.d.cts +133 -6
- package/build/main.d.ts +133 -6
- package/build/main.js +198 -16
- package/build/main.js.map +1 -1
- package/package.json +50 -49
- package/schema.json +30 -30
- package/src/EventResponse.ts +59 -40
- package/src/SearchEngine.ts +16 -16
- package/src/config/Configuration.ts +82 -82
- package/src/config/ConfigurationBuilder.ts +270 -198
- package/src/main.ts +521 -342
- package/tsconfig.json +38 -38
- package/tsup.config.js +10 -10
package/build/main.d.cts
CHANGED
|
@@ -5,13 +5,20 @@ import { Configuration } from './config/Configuration.cjs';
|
|
|
5
5
|
import EventResponse from './EventResponse.cjs';
|
|
6
6
|
import { SearchResult } from './SearchEngine.cjs';
|
|
7
7
|
|
|
8
|
-
type OGIAddonEvent = 'connect' | 'disconnect' | 'configure' | 'authenticate' | 'search' | 'setup' | 'library-search' | 'game-details' | 'exit';
|
|
9
|
-
type OGIAddonClientSentEvent = 'response' | 'authenticate' | 'configure' | 'defer-update' | 'notification' | 'input-asked';
|
|
10
|
-
type OGIAddonServerSentEvent = 'authenticate' | 'configure' | 'config-update' | 'search' | 'setup' | 'response' | 'library-search' | 'game-details';
|
|
8
|
+
type OGIAddonEvent = 'connect' | 'disconnect' | 'configure' | 'authenticate' | 'search' | 'setup' | 'library-search' | 'game-details' | 'exit' | 'request-dl';
|
|
9
|
+
type OGIAddonClientSentEvent = 'response' | 'authenticate' | 'configure' | 'defer-update' | 'notification' | 'input-asked' | 'steam-search' | 'task-update';
|
|
10
|
+
type OGIAddonServerSentEvent = 'authenticate' | 'configure' | 'config-update' | 'search' | 'setup' | 'response' | 'library-search' | 'game-details' | 'request-dl';
|
|
11
11
|
|
|
12
|
+
declare const VERSION: string;
|
|
12
13
|
interface ClientSentEventTypes {
|
|
13
14
|
response: any;
|
|
14
|
-
authenticate:
|
|
15
|
+
authenticate: {
|
|
16
|
+
name: string;
|
|
17
|
+
id: string;
|
|
18
|
+
description: string;
|
|
19
|
+
version: string;
|
|
20
|
+
author: string;
|
|
21
|
+
};
|
|
15
22
|
configure: ConfigurationFile;
|
|
16
23
|
'defer-update': {
|
|
17
24
|
logs: string[];
|
|
@@ -19,6 +26,16 @@ interface ClientSentEventTypes {
|
|
|
19
26
|
};
|
|
20
27
|
notification: Notification;
|
|
21
28
|
'input-asked': ConfigurationBuilder;
|
|
29
|
+
'steam-search': {
|
|
30
|
+
query: string;
|
|
31
|
+
strict: boolean;
|
|
32
|
+
};
|
|
33
|
+
'task-update': {
|
|
34
|
+
id: string;
|
|
35
|
+
progress: number;
|
|
36
|
+
logs: string[];
|
|
37
|
+
finished: boolean;
|
|
38
|
+
};
|
|
22
39
|
}
|
|
23
40
|
type BasicLibraryInfo = {
|
|
24
41
|
name: string;
|
|
@@ -26,15 +43,52 @@ type BasicLibraryInfo = {
|
|
|
26
43
|
appID: number;
|
|
27
44
|
};
|
|
28
45
|
interface EventListenerTypes {
|
|
46
|
+
/**
|
|
47
|
+
* This event is emitted when the addon connects to the OGI Addon Server. Addon does not need to resolve anything.
|
|
48
|
+
* @param socket
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
29
51
|
connect: (socket: ws) => void;
|
|
52
|
+
/**
|
|
53
|
+
* 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.
|
|
54
|
+
* @param reason
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
30
57
|
disconnect: (reason: string) => void;
|
|
58
|
+
/**
|
|
59
|
+
* 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)
|
|
60
|
+
* @param config
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
31
63
|
configure: (config: ConfigurationBuilder) => ConfigurationBuilder;
|
|
64
|
+
/**
|
|
65
|
+
* This event is called when the client provides a response to any event. This should be treated as middleware.
|
|
66
|
+
* @param response
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
32
69
|
response: (response: any) => void;
|
|
70
|
+
/**
|
|
71
|
+
* This event is called when the client requests for the addon to authenticate itself. You don't need to provide any info.
|
|
72
|
+
* @param config
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
33
75
|
authenticate: (config: any) => void;
|
|
76
|
+
/**
|
|
77
|
+
* 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)
|
|
78
|
+
* @param query
|
|
79
|
+
* @param event
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
34
82
|
search: (query: {
|
|
35
83
|
type: 'steamapp' | 'internal';
|
|
36
84
|
text: string;
|
|
37
85
|
}, event: EventResponse<SearchResult[]>) => void;
|
|
86
|
+
/**
|
|
87
|
+
* 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)
|
|
88
|
+
* @param data
|
|
89
|
+
* @param event
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
38
92
|
setup: (data: {
|
|
39
93
|
path: string;
|
|
40
94
|
type: 'direct' | 'torrent' | 'magnet';
|
|
@@ -47,9 +101,16 @@ interface EventListenerTypes {
|
|
|
47
101
|
appID: number;
|
|
48
102
|
storefront: 'steam' | 'internal';
|
|
49
103
|
}, event: EventResponse<LibraryInfo>) => void;
|
|
104
|
+
/**
|
|
105
|
+
* This event is emitted when the client requires for a search to be performed. Input is the search query.
|
|
106
|
+
* @param query
|
|
107
|
+
* @param event
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
50
110
|
'library-search': (query: string, event: EventResponse<BasicLibraryInfo[]>) => void;
|
|
51
111
|
'game-details': (appID: number, event: EventResponse<StoreData>) => void;
|
|
52
112
|
exit: () => void;
|
|
113
|
+
'request-dl': (appID: number, info: SearchResult, event: EventResponse<SearchResult>) => void;
|
|
53
114
|
}
|
|
54
115
|
interface StoreData {
|
|
55
116
|
name: string;
|
|
@@ -81,16 +142,82 @@ interface OGIAddonConfiguration {
|
|
|
81
142
|
author: string;
|
|
82
143
|
repository: string;
|
|
83
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* 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.
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const addon = new OGIAddon({
|
|
150
|
+
* name: 'Test Addon',
|
|
151
|
+
* id: 'test-addon',
|
|
152
|
+
* description: 'A test addon',
|
|
153
|
+
* version: '1.0.0',
|
|
154
|
+
* author: 'OGI Developers',
|
|
155
|
+
* repository: ''
|
|
156
|
+
* });
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
*/
|
|
84
160
|
declare class OGIAddon {
|
|
85
161
|
eventEmitter: events<[never]>;
|
|
86
162
|
addonWSListener: OGIAddonWSListener;
|
|
87
163
|
addonInfo: OGIAddonConfiguration;
|
|
88
164
|
config: Configuration;
|
|
89
165
|
constructor(addonInfo: OGIAddonConfiguration);
|
|
166
|
+
/**
|
|
167
|
+
* Register an event listener for the addon. (See EventListenerTypes)
|
|
168
|
+
* @param event {OGIAddonEvent}
|
|
169
|
+
* @param listener {EventListenerTypes[OGIAddonEvent]}
|
|
170
|
+
*/
|
|
90
171
|
on<T extends OGIAddonEvent>(event: T, listener: EventListenerTypes[T]): void;
|
|
91
172
|
emit<T extends OGIAddonEvent>(event: T, ...args: Parameters<EventListenerTypes[T]>): void;
|
|
173
|
+
/**
|
|
174
|
+
* Notify the client using a notification. Provide the type of notification, the message, and an ID.
|
|
175
|
+
* @param notification {Notification}
|
|
176
|
+
*/
|
|
92
177
|
notify(notification: Notification): void;
|
|
178
|
+
/**
|
|
179
|
+
* Search for items in the OGI Steam-Synced Library. Query can either be a Steam AppID or a Steam Game Name.
|
|
180
|
+
* @param query {string}
|
|
181
|
+
* @param event {EventResponse<BasicLibraryInfo[]>}
|
|
182
|
+
*/
|
|
183
|
+
steamSearch(query: string, strict?: boolean): Promise<Omit<BasicLibraryInfo, "capsuleImage">[]>;
|
|
184
|
+
/**
|
|
185
|
+
* 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.
|
|
186
|
+
* @param id {string}
|
|
187
|
+
* @param progress {number}
|
|
188
|
+
* @param logs {string[]}
|
|
189
|
+
*/
|
|
190
|
+
task(): Promise<CustomTask>;
|
|
191
|
+
}
|
|
192
|
+
declare class CustomTask {
|
|
193
|
+
readonly id: string;
|
|
194
|
+
progress: number;
|
|
195
|
+
logs: string[];
|
|
196
|
+
finished: boolean;
|
|
197
|
+
ws: OGIAddonWSListener;
|
|
198
|
+
constructor(ws: OGIAddonWSListener, id: string, progress: number, logs: string[]);
|
|
199
|
+
log(log: string): void;
|
|
200
|
+
finish(): void;
|
|
201
|
+
setProgress(progress: number): void;
|
|
202
|
+
update(): void;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* A search tool for the OGI Addon. This tool is used to search for items in the library. Powered by Fuse.js, bundled into OGI.
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* const searchTool = new SearchTool<LibraryInfo>([], ['name']);
|
|
209
|
+
* const results = searchTool.search('test', 10);
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
declare class SearchTool<T> {
|
|
213
|
+
private fuse;
|
|
214
|
+
constructor(items: T[], keys: string[]);
|
|
215
|
+
search(query: string, limit?: number): T[];
|
|
216
|
+
addItems(items: T[]): void;
|
|
93
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Library Info is the metadata for a library entry after setting up a game.
|
|
220
|
+
*/
|
|
94
221
|
interface LibraryInfo {
|
|
95
222
|
name: string;
|
|
96
223
|
version: string;
|
|
@@ -119,8 +246,8 @@ declare class OGIAddonWSListener {
|
|
|
119
246
|
private waitForEventToRespond;
|
|
120
247
|
respondToMessage(messageID: string, response: any): void;
|
|
121
248
|
waitForResponseFromServer<T>(messageID: string): Promise<T>;
|
|
122
|
-
send(event: OGIAddonClientSentEvent, args:
|
|
249
|
+
send(event: OGIAddonClientSentEvent, args: ClientSentEventTypes[OGIAddonClientSentEvent]): string;
|
|
123
250
|
close(): void;
|
|
124
251
|
}
|
|
125
252
|
|
|
126
|
-
export { type BasicLibraryInfo, type ClientSentEventTypes, Configuration, ConfigurationBuilder, type EventListenerTypes, EventResponse, type LibraryInfo, type OGIAddonClientSentEvent, type OGIAddonConfiguration, type OGIAddonEvent, type OGIAddonServerSentEvent, SearchResult, type StoreData, type WebsocketMessageClient, type WebsocketMessageServer, OGIAddon as default };
|
|
253
|
+
export { type BasicLibraryInfo, type ClientSentEventTypes, Configuration, ConfigurationBuilder, type EventListenerTypes, EventResponse, type LibraryInfo, type OGIAddonClientSentEvent, type OGIAddonConfiguration, type OGIAddonEvent, type OGIAddonServerSentEvent, SearchResult, SearchTool, type StoreData, VERSION, type WebsocketMessageClient, type WebsocketMessageServer, OGIAddon as default };
|
package/build/main.d.ts
CHANGED
|
@@ -5,13 +5,20 @@ import { Configuration } from './config/Configuration.js';
|
|
|
5
5
|
import EventResponse from './EventResponse.js';
|
|
6
6
|
import { SearchResult } from './SearchEngine.js';
|
|
7
7
|
|
|
8
|
-
type OGIAddonEvent = 'connect' | 'disconnect' | 'configure' | 'authenticate' | 'search' | 'setup' | 'library-search' | 'game-details' | 'exit';
|
|
9
|
-
type OGIAddonClientSentEvent = 'response' | 'authenticate' | 'configure' | 'defer-update' | 'notification' | 'input-asked';
|
|
10
|
-
type OGIAddonServerSentEvent = 'authenticate' | 'configure' | 'config-update' | 'search' | 'setup' | 'response' | 'library-search' | 'game-details';
|
|
8
|
+
type OGIAddonEvent = 'connect' | 'disconnect' | 'configure' | 'authenticate' | 'search' | 'setup' | 'library-search' | 'game-details' | 'exit' | 'request-dl';
|
|
9
|
+
type OGIAddonClientSentEvent = 'response' | 'authenticate' | 'configure' | 'defer-update' | 'notification' | 'input-asked' | 'steam-search' | 'task-update';
|
|
10
|
+
type OGIAddonServerSentEvent = 'authenticate' | 'configure' | 'config-update' | 'search' | 'setup' | 'response' | 'library-search' | 'game-details' | 'request-dl';
|
|
11
11
|
|
|
12
|
+
declare const VERSION: string;
|
|
12
13
|
interface ClientSentEventTypes {
|
|
13
14
|
response: any;
|
|
14
|
-
authenticate:
|
|
15
|
+
authenticate: {
|
|
16
|
+
name: string;
|
|
17
|
+
id: string;
|
|
18
|
+
description: string;
|
|
19
|
+
version: string;
|
|
20
|
+
author: string;
|
|
21
|
+
};
|
|
15
22
|
configure: ConfigurationFile;
|
|
16
23
|
'defer-update': {
|
|
17
24
|
logs: string[];
|
|
@@ -19,6 +26,16 @@ interface ClientSentEventTypes {
|
|
|
19
26
|
};
|
|
20
27
|
notification: Notification;
|
|
21
28
|
'input-asked': ConfigurationBuilder;
|
|
29
|
+
'steam-search': {
|
|
30
|
+
query: string;
|
|
31
|
+
strict: boolean;
|
|
32
|
+
};
|
|
33
|
+
'task-update': {
|
|
34
|
+
id: string;
|
|
35
|
+
progress: number;
|
|
36
|
+
logs: string[];
|
|
37
|
+
finished: boolean;
|
|
38
|
+
};
|
|
22
39
|
}
|
|
23
40
|
type BasicLibraryInfo = {
|
|
24
41
|
name: string;
|
|
@@ -26,15 +43,52 @@ type BasicLibraryInfo = {
|
|
|
26
43
|
appID: number;
|
|
27
44
|
};
|
|
28
45
|
interface EventListenerTypes {
|
|
46
|
+
/**
|
|
47
|
+
* This event is emitted when the addon connects to the OGI Addon Server. Addon does not need to resolve anything.
|
|
48
|
+
* @param socket
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
29
51
|
connect: (socket: ws) => void;
|
|
52
|
+
/**
|
|
53
|
+
* 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.
|
|
54
|
+
* @param reason
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
30
57
|
disconnect: (reason: string) => void;
|
|
58
|
+
/**
|
|
59
|
+
* 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)
|
|
60
|
+
* @param config
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
31
63
|
configure: (config: ConfigurationBuilder) => ConfigurationBuilder;
|
|
64
|
+
/**
|
|
65
|
+
* This event is called when the client provides a response to any event. This should be treated as middleware.
|
|
66
|
+
* @param response
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
32
69
|
response: (response: any) => void;
|
|
70
|
+
/**
|
|
71
|
+
* This event is called when the client requests for the addon to authenticate itself. You don't need to provide any info.
|
|
72
|
+
* @param config
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
33
75
|
authenticate: (config: any) => void;
|
|
76
|
+
/**
|
|
77
|
+
* 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)
|
|
78
|
+
* @param query
|
|
79
|
+
* @param event
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
34
82
|
search: (query: {
|
|
35
83
|
type: 'steamapp' | 'internal';
|
|
36
84
|
text: string;
|
|
37
85
|
}, event: EventResponse<SearchResult[]>) => void;
|
|
86
|
+
/**
|
|
87
|
+
* 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)
|
|
88
|
+
* @param data
|
|
89
|
+
* @param event
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
38
92
|
setup: (data: {
|
|
39
93
|
path: string;
|
|
40
94
|
type: 'direct' | 'torrent' | 'magnet';
|
|
@@ -47,9 +101,16 @@ interface EventListenerTypes {
|
|
|
47
101
|
appID: number;
|
|
48
102
|
storefront: 'steam' | 'internal';
|
|
49
103
|
}, event: EventResponse<LibraryInfo>) => void;
|
|
104
|
+
/**
|
|
105
|
+
* This event is emitted when the client requires for a search to be performed. Input is the search query.
|
|
106
|
+
* @param query
|
|
107
|
+
* @param event
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
50
110
|
'library-search': (query: string, event: EventResponse<BasicLibraryInfo[]>) => void;
|
|
51
111
|
'game-details': (appID: number, event: EventResponse<StoreData>) => void;
|
|
52
112
|
exit: () => void;
|
|
113
|
+
'request-dl': (appID: number, info: SearchResult, event: EventResponse<SearchResult>) => void;
|
|
53
114
|
}
|
|
54
115
|
interface StoreData {
|
|
55
116
|
name: string;
|
|
@@ -81,16 +142,82 @@ interface OGIAddonConfiguration {
|
|
|
81
142
|
author: string;
|
|
82
143
|
repository: string;
|
|
83
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* 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.
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const addon = new OGIAddon({
|
|
150
|
+
* name: 'Test Addon',
|
|
151
|
+
* id: 'test-addon',
|
|
152
|
+
* description: 'A test addon',
|
|
153
|
+
* version: '1.0.0',
|
|
154
|
+
* author: 'OGI Developers',
|
|
155
|
+
* repository: ''
|
|
156
|
+
* });
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
*/
|
|
84
160
|
declare class OGIAddon {
|
|
85
161
|
eventEmitter: events<[never]>;
|
|
86
162
|
addonWSListener: OGIAddonWSListener;
|
|
87
163
|
addonInfo: OGIAddonConfiguration;
|
|
88
164
|
config: Configuration;
|
|
89
165
|
constructor(addonInfo: OGIAddonConfiguration);
|
|
166
|
+
/**
|
|
167
|
+
* Register an event listener for the addon. (See EventListenerTypes)
|
|
168
|
+
* @param event {OGIAddonEvent}
|
|
169
|
+
* @param listener {EventListenerTypes[OGIAddonEvent]}
|
|
170
|
+
*/
|
|
90
171
|
on<T extends OGIAddonEvent>(event: T, listener: EventListenerTypes[T]): void;
|
|
91
172
|
emit<T extends OGIAddonEvent>(event: T, ...args: Parameters<EventListenerTypes[T]>): void;
|
|
173
|
+
/**
|
|
174
|
+
* Notify the client using a notification. Provide the type of notification, the message, and an ID.
|
|
175
|
+
* @param notification {Notification}
|
|
176
|
+
*/
|
|
92
177
|
notify(notification: Notification): void;
|
|
178
|
+
/**
|
|
179
|
+
* Search for items in the OGI Steam-Synced Library. Query can either be a Steam AppID or a Steam Game Name.
|
|
180
|
+
* @param query {string}
|
|
181
|
+
* @param event {EventResponse<BasicLibraryInfo[]>}
|
|
182
|
+
*/
|
|
183
|
+
steamSearch(query: string, strict?: boolean): Promise<Omit<BasicLibraryInfo, "capsuleImage">[]>;
|
|
184
|
+
/**
|
|
185
|
+
* 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.
|
|
186
|
+
* @param id {string}
|
|
187
|
+
* @param progress {number}
|
|
188
|
+
* @param logs {string[]}
|
|
189
|
+
*/
|
|
190
|
+
task(): Promise<CustomTask>;
|
|
191
|
+
}
|
|
192
|
+
declare class CustomTask {
|
|
193
|
+
readonly id: string;
|
|
194
|
+
progress: number;
|
|
195
|
+
logs: string[];
|
|
196
|
+
finished: boolean;
|
|
197
|
+
ws: OGIAddonWSListener;
|
|
198
|
+
constructor(ws: OGIAddonWSListener, id: string, progress: number, logs: string[]);
|
|
199
|
+
log(log: string): void;
|
|
200
|
+
finish(): void;
|
|
201
|
+
setProgress(progress: number): void;
|
|
202
|
+
update(): void;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* A search tool for the OGI Addon. This tool is used to search for items in the library. Powered by Fuse.js, bundled into OGI.
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* const searchTool = new SearchTool<LibraryInfo>([], ['name']);
|
|
209
|
+
* const results = searchTool.search('test', 10);
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
declare class SearchTool<T> {
|
|
213
|
+
private fuse;
|
|
214
|
+
constructor(items: T[], keys: string[]);
|
|
215
|
+
search(query: string, limit?: number): T[];
|
|
216
|
+
addItems(items: T[]): void;
|
|
93
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Library Info is the metadata for a library entry after setting up a game.
|
|
220
|
+
*/
|
|
94
221
|
interface LibraryInfo {
|
|
95
222
|
name: string;
|
|
96
223
|
version: string;
|
|
@@ -119,8 +246,8 @@ declare class OGIAddonWSListener {
|
|
|
119
246
|
private waitForEventToRespond;
|
|
120
247
|
respondToMessage(messageID: string, response: any): void;
|
|
121
248
|
waitForResponseFromServer<T>(messageID: string): Promise<T>;
|
|
122
|
-
send(event: OGIAddonClientSentEvent, args:
|
|
249
|
+
send(event: OGIAddonClientSentEvent, args: ClientSentEventTypes[OGIAddonClientSentEvent]): string;
|
|
123
250
|
close(): void;
|
|
124
251
|
}
|
|
125
252
|
|
|
126
|
-
export { type BasicLibraryInfo, type ClientSentEventTypes, Configuration, ConfigurationBuilder, type EventListenerTypes, EventResponse, type LibraryInfo, type OGIAddonClientSentEvent, type OGIAddonConfiguration, type OGIAddonEvent, type OGIAddonServerSentEvent, SearchResult, type StoreData, type WebsocketMessageClient, type WebsocketMessageServer, OGIAddon as default };
|
|
253
|
+
export { type BasicLibraryInfo, type ClientSentEventTypes, Configuration, ConfigurationBuilder, type EventListenerTypes, EventResponse, type LibraryInfo, type OGIAddonClientSentEvent, type OGIAddonConfiguration, type OGIAddonEvent, type OGIAddonServerSentEvent, SearchResult, SearchTool, type StoreData, VERSION, type WebsocketMessageClient, type WebsocketMessageServer, OGIAddon as default };
|