@omss/core 0.0.2-beta.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/LICENSE +21 -0
- package/README.md +198 -0
- package/dist/index.cjs +1396 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1324 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +1324 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1378 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +63 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1324 @@
|
|
|
1
|
+
//#region src/features/hooks/HookRegistry.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Hook Registry
|
|
4
|
+
*
|
|
5
|
+
* Manages lifecycle hooks for OMSS events.
|
|
6
|
+
*/
|
|
7
|
+
declare class HookRegistry<T> {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* Get all registered hooks immutable.
|
|
11
|
+
* @dangerous - Be careful with this. what you are doing might cause side effects.
|
|
12
|
+
*/
|
|
13
|
+
get hooks(): ReadonlyMap<keyof T, unknown[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Clear all registered hooks.
|
|
16
|
+
* @dangerous - Be careful with this. Might cause side effects.
|
|
17
|
+
*/
|
|
18
|
+
reset(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Run all hooks for a lifecycle event with the provided payload.
|
|
21
|
+
*
|
|
22
|
+
* @typeParam K - The name of the hook to run.
|
|
23
|
+
* @param name - The hook name (key of THooks).
|
|
24
|
+
* @param payload - The payload to pass to each hook handler.
|
|
25
|
+
*/
|
|
26
|
+
run<K extends keyof T>(name: K, payload: T[K] extends ((payload: infer P) => unknown) ? P : never): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Add a hook handler for a lifecycle event.
|
|
29
|
+
* @param name - The hook name (key of THooks).
|
|
30
|
+
* @param cb - The hook handler function.
|
|
31
|
+
*/
|
|
32
|
+
add<K extends keyof T>(name: K, cb: T[K]): void;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/features/hooks/HookService.d.ts
|
|
36
|
+
declare class HookService<T> {
|
|
37
|
+
#private;
|
|
38
|
+
constructor(hookRegistry?: HookRegistry<T>);
|
|
39
|
+
/**
|
|
40
|
+
* Get all registered hooks immutable. TO ADD HOOKS, USE THE ADD METHOD
|
|
41
|
+
* @dangerous - Be careful with this. what you are doing might cause side effects.
|
|
42
|
+
*/
|
|
43
|
+
get hooks(): ReadonlyMap<keyof T, unknown[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Register a hook for a lifecycle event.
|
|
46
|
+
*
|
|
47
|
+
* @typeParam K - The name of the hook to register.
|
|
48
|
+
* @param name - The hook name (key of THooks).
|
|
49
|
+
* @param cb - The handler function for this hook.
|
|
50
|
+
*/
|
|
51
|
+
add<K extends keyof T>(name: K, cb: T[K]): ReturnType<HookRegistry<T>['add']>;
|
|
52
|
+
/**
|
|
53
|
+
* Clear all registered hooks.
|
|
54
|
+
* @dangerous - Be careful with this. Might cause side effects.
|
|
55
|
+
*/
|
|
56
|
+
reset(): ReturnType<HookRegistry<T>['reset']>;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/types/plugin.d.ts
|
|
60
|
+
/**
|
|
61
|
+
* Plugin with no configuration.
|
|
62
|
+
*/
|
|
63
|
+
type OMSSPluginType = (server: OMSSServer) => Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Plugin with the required configuration.
|
|
66
|
+
*/
|
|
67
|
+
type OMSSConfiguredPluginType<T> = (server: OMSSServer, config: T) => Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Any plugin type.
|
|
70
|
+
*/
|
|
71
|
+
type UnknownPluginType = OMSSPluginType | OMSSConfiguredPluginType<unknown>;
|
|
72
|
+
/**
|
|
73
|
+
* Plugin options — either a plain value or a factory that receives
|
|
74
|
+
* the server instance and returns the resolved value.
|
|
75
|
+
*/
|
|
76
|
+
type OMSSPluginOptions<T> = T | ((server: OMSSServer) => T);
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/features/plugins/plugin-state.d.ts
|
|
79
|
+
/**
|
|
80
|
+
* The states of which a plugin can be.
|
|
81
|
+
*/
|
|
82
|
+
declare enum PluginState {
|
|
83
|
+
Registering = 0,
|
|
84
|
+
Registered = 1,
|
|
85
|
+
Unavailable = 2
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/utils/error.d.ts
|
|
89
|
+
/**
|
|
90
|
+
* Base class for all OMSS framework errors.
|
|
91
|
+
* Use `instanceof OMSSError` to catch any framework error.
|
|
92
|
+
* Always throw a specific subclass, never this directly.
|
|
93
|
+
* Cause is not standardized and may change frequently.
|
|
94
|
+
*/
|
|
95
|
+
declare class OMSSError extends Error {
|
|
96
|
+
/**
|
|
97
|
+
* Create a new OMSSError.
|
|
98
|
+
* @param message - Error message
|
|
99
|
+
* @param options - Additional options for the error
|
|
100
|
+
*/
|
|
101
|
+
constructor(message: string, options?: {
|
|
102
|
+
cause?: unknown;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Returned when an error gets Returned in the OMSSServer class.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* return ERR(OMSSServerError('config.name must be a non-empty string', {cause: config}))
|
|
110
|
+
*/
|
|
111
|
+
declare class OMSSServerError extends OMSSError {}
|
|
112
|
+
/**
|
|
113
|
+
* Returned during plugin registration or execution.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* return ERR(OMSSPluginError(`Plugin "${name}" is already registered`, { cause: plugin }))
|
|
117
|
+
*/
|
|
118
|
+
declare class OMSSPluginError extends OMSSError {}
|
|
119
|
+
/**
|
|
120
|
+
* Returned during resolver registration or ID resolution.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* return ERR(OMSSResolverError(`No resolver found for namespace "xyz"`, { cause: rawId }))
|
|
124
|
+
*/
|
|
125
|
+
declare class OMSSResolverError extends OMSSError {}
|
|
126
|
+
/**
|
|
127
|
+
* Returned during provider registration or source fetching.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* return ERR(OMSSProviderError('Provider must have at least one resolver', { cause: provider }))
|
|
131
|
+
*/
|
|
132
|
+
declare class OMSSProviderError extends OMSSError {}
|
|
133
|
+
/**
|
|
134
|
+
* Returned when an extractor fails to extract the media from a host.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* return ERR(OMSSExtractor('Failed to extract media from host due to host changes', { cause: html }))
|
|
138
|
+
*/
|
|
139
|
+
declare class OMSSExtractorError extends OMSSError {}
|
|
140
|
+
/**
|
|
141
|
+
* Returned when something/several things fail during source gathering.
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* return ERR(OMSSSourceGatheringError('Failed to gather sources', { cause: providerResults }))
|
|
145
|
+
*/
|
|
146
|
+
declare class OMSSSourceGatheringError extends OMSSError {}
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/types/utils.d.ts
|
|
149
|
+
/**
|
|
150
|
+
* A discriminated union representing either a successful result or a failure.
|
|
151
|
+
* Can be {ok: true}, {ok: true, value: T} or {ok: false, error: E}
|
|
152
|
+
* @typeParam T - The success value type.
|
|
153
|
+
* @typeParam E - The error value type.
|
|
154
|
+
*/
|
|
155
|
+
type Result<T, E extends Error> = (T extends void ? {
|
|
156
|
+
ok: true;
|
|
157
|
+
} : {
|
|
158
|
+
ok: true;
|
|
159
|
+
value: T;
|
|
160
|
+
}) | {
|
|
161
|
+
ok: false;
|
|
162
|
+
error: E;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* A tuple type that represents a non-empty array of elements of type T.
|
|
166
|
+
* The first element is of type T, and the rest of the elements are of type T[].
|
|
167
|
+
* This ensures that the array has at least one element.
|
|
168
|
+
* @typeParam T - The type of the elements in the array.
|
|
169
|
+
*/
|
|
170
|
+
type NonEmptyArray<T> = [T, ...T[]];
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/features/plugins/PluginRegistry.d.ts
|
|
173
|
+
/**
|
|
174
|
+
* Registry responsible for executing and managing OMSS Plugins.
|
|
175
|
+
*
|
|
176
|
+
* Plugins are executed when added.
|
|
177
|
+
*/
|
|
178
|
+
declare class PluginRegistry {
|
|
179
|
+
#private;
|
|
180
|
+
constructor(server: OMSSServer);
|
|
181
|
+
add(plugin: OMSSPluginType): Promise<Result<PluginState.Registered, OMSSPluginError>>;
|
|
182
|
+
add<T>(plugin: OMSSConfiguredPluginType<T>, options: OMSSPluginOptions<T>): Promise<Result<PluginState.Registered, OMSSPluginError>>;
|
|
183
|
+
/**
|
|
184
|
+
* Get the current plugin state.
|
|
185
|
+
*/
|
|
186
|
+
getState<T>(plugin: UnknownPluginType | OMSSPluginType | OMSSConfiguredPluginType<T>): PluginState;
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/types/resolver.d.ts
|
|
190
|
+
/**
|
|
191
|
+
* Canonical OMSS ID representation.
|
|
192
|
+
*
|
|
193
|
+
* The raw string follows the `<namespace>:<value_1>:<value_2>:(...):<value_n>` format and the certain id's/namespaces are standardized by OMSS.
|
|
194
|
+
*/
|
|
195
|
+
type OMSSId = string;
|
|
196
|
+
/**
|
|
197
|
+
* Parsed representation of an OMSS ID.
|
|
198
|
+
*/
|
|
199
|
+
interface ParsedOMSSId {
|
|
200
|
+
/**
|
|
201
|
+
* The ID namespace
|
|
202
|
+
*/
|
|
203
|
+
namespace: string;
|
|
204
|
+
/**
|
|
205
|
+
* The ID-values
|
|
206
|
+
*/
|
|
207
|
+
values: string[];
|
|
208
|
+
/**
|
|
209
|
+
* The original raw ID string
|
|
210
|
+
*/
|
|
211
|
+
raw: OMSSId;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Context passed into resolvers when executing them.
|
|
215
|
+
*/
|
|
216
|
+
interface ResolverExecutionContext {
|
|
217
|
+
/**
|
|
218
|
+
* OMSS server instance – gives access to plugins, config, etc.
|
|
219
|
+
*/
|
|
220
|
+
server: OMSSServer;
|
|
221
|
+
/**
|
|
222
|
+
* Abort signal for cancellation.
|
|
223
|
+
*/
|
|
224
|
+
signal: AbortSignal;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Result returned by a resolver – metadata for providers.
|
|
228
|
+
*/
|
|
229
|
+
type ResolverResult<T> = Result<T, OMSSResolverError>;
|
|
230
|
+
/**
|
|
231
|
+
* Base interface for all OMSS resolvers.
|
|
232
|
+
*
|
|
233
|
+
* Resolvers convert an OMSS ID into usable metadata for providers.
|
|
234
|
+
*/
|
|
235
|
+
interface OMSSResolver<TMetadata> {
|
|
236
|
+
/**
|
|
237
|
+
* Namespace this resolver owns, e.g. "tmdb".
|
|
238
|
+
*/
|
|
239
|
+
namespace: string;
|
|
240
|
+
/**
|
|
241
|
+
* Human-readable resolver name.
|
|
242
|
+
*/
|
|
243
|
+
name: string;
|
|
244
|
+
/**
|
|
245
|
+
* A map of ID converters.
|
|
246
|
+
*
|
|
247
|
+
* @key - The unhandled namespace
|
|
248
|
+
* @value - A function that converts that id (from an unknown namespace/id provider) to this resolver's namespace.
|
|
249
|
+
*/
|
|
250
|
+
converter: Map<string, (noHandlerId: OMSSId, ctx: ResolverExecutionContext) => Promise<Result<OMSSId, OMSSResolverError>>>;
|
|
251
|
+
/**
|
|
252
|
+
* Resolve a single ID into metadata.
|
|
253
|
+
*
|
|
254
|
+
* @param id - Parsed OMSS ID
|
|
255
|
+
* @param ctx - Execution context.
|
|
256
|
+
*/
|
|
257
|
+
resolve(id: ParsedOMSSId, ctx: ResolverExecutionContext): Promise<ResolverResult<TMetadata>>;
|
|
258
|
+
}
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/features/resolvers/BaseResolver.d.ts
|
|
261
|
+
/**
|
|
262
|
+
* Base class for all OMSS resolvers.
|
|
263
|
+
*
|
|
264
|
+
* Resolvers convert an OMSS ID into usable metadata for providers.
|
|
265
|
+
*/
|
|
266
|
+
declare abstract class BaseResolver<T> implements OMSSResolver<T> {
|
|
267
|
+
/**
|
|
268
|
+
* Namespace this resolver owns, e.g. "tmdb".
|
|
269
|
+
* Must be unique for a single server instance.
|
|
270
|
+
*/
|
|
271
|
+
abstract namespace: string;
|
|
272
|
+
/**
|
|
273
|
+
* Human-readable resolver name.
|
|
274
|
+
*/
|
|
275
|
+
abstract name: string;
|
|
276
|
+
/**
|
|
277
|
+
* A map of ID converters.
|
|
278
|
+
*
|
|
279
|
+
* @key - The unhandled namespace
|
|
280
|
+
* @value - A function that converts that id (from an unknown namespace/id provider) to this resolver's namespace.
|
|
281
|
+
*/
|
|
282
|
+
abstract converter: Map<string, (noHandlerId: OMSSId, ctx: ResolverExecutionContext) => Promise<Result<OMSSId, OMSSResolverError>>>;
|
|
283
|
+
/**
|
|
284
|
+
* Resolve a single ID into metadata.
|
|
285
|
+
*
|
|
286
|
+
* @param id - Parsed OMSS ID
|
|
287
|
+
* @param ctx - Execution context.
|
|
288
|
+
*/
|
|
289
|
+
abstract resolve(id: ParsedOMSSId, ctx: ResolverExecutionContext): Promise<ResolverResult<T>>;
|
|
290
|
+
}
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/types/middleware.d.ts
|
|
293
|
+
/**
|
|
294
|
+
* A typed map of middleware-enabled operations.
|
|
295
|
+
*/
|
|
296
|
+
type MiddlewareOperationMap = Record<string, {
|
|
297
|
+
context: unknown;
|
|
298
|
+
result: unknown;
|
|
299
|
+
}>;
|
|
300
|
+
/**
|
|
301
|
+
* Middleware function for a specific operation.
|
|
302
|
+
*/
|
|
303
|
+
type MiddlewareHandler<TOperations extends MiddlewareOperationMap, TMethod extends keyof TOperations> = (context: TOperations[TMethod]['context'], next: () => Promise<TOperations[TMethod]['result']>) => Promise<TOperations[TMethod]['result']>;
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/types/extractor.d.ts
|
|
306
|
+
/**
|
|
307
|
+
* Extractor interface.
|
|
308
|
+
*
|
|
309
|
+
* Extractors are used to extract media URLs from a given hosting platform.
|
|
310
|
+
*/
|
|
311
|
+
type Extractor = {
|
|
312
|
+
/**
|
|
313
|
+
* A matcher function that checks if the extractor can handle the given URL.
|
|
314
|
+
*/
|
|
315
|
+
matcher: ExtractorMatcher;
|
|
316
|
+
/**
|
|
317
|
+
* Parse the given URL and return the extracted media URL and headers required for playback.
|
|
318
|
+
* @param url - The URL to parse.
|
|
319
|
+
* @param ctx - Context object containing the referrer (what website opened the URL. If not applicable, keep string empty) and headers.
|
|
320
|
+
*/
|
|
321
|
+
parse: (url: string, ctx: ExtractorContext) => Promise<Result<ExtractorResult, OMSSExtractorError>>;
|
|
322
|
+
};
|
|
323
|
+
type ExtractorMatcher = (url: string) => Promise<Result<void, OMSSExtractorError>>;
|
|
324
|
+
type ExtractorResult = {
|
|
325
|
+
/**
|
|
326
|
+
* The media URL.
|
|
327
|
+
*/
|
|
328
|
+
url: string;
|
|
329
|
+
/**
|
|
330
|
+
* Headers required for playback of the provided url.
|
|
331
|
+
*/
|
|
332
|
+
header: Record<string, string>;
|
|
333
|
+
};
|
|
334
|
+
type ExtractorContext = {
|
|
335
|
+
/**
|
|
336
|
+
* The referrer (what website opened the URL. If not applicable, keep string empty)
|
|
337
|
+
*/
|
|
338
|
+
referrer: string;
|
|
339
|
+
/**
|
|
340
|
+
* Headers required for playback of the provided url. If not applicable, keep empty.
|
|
341
|
+
*/
|
|
342
|
+
header: Record<string, string>;
|
|
343
|
+
/**
|
|
344
|
+
* AbortSignal for cancellation.
|
|
345
|
+
*/
|
|
346
|
+
signal: AbortSignal;
|
|
347
|
+
};
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region src/features/extractors/ExtractorRegistry.d.ts
|
|
350
|
+
/**
|
|
351
|
+
* Extractor Registry
|
|
352
|
+
*
|
|
353
|
+
* Manages all extractors.
|
|
354
|
+
*/
|
|
355
|
+
declare class ExtractorRegistry {
|
|
356
|
+
#private;
|
|
357
|
+
/**
|
|
358
|
+
* Get all extractors.
|
|
359
|
+
*/
|
|
360
|
+
get extractors(): Readonly<Extractor[]>;
|
|
361
|
+
/**
|
|
362
|
+
* Clear all extractors.
|
|
363
|
+
*/
|
|
364
|
+
reset(): void;
|
|
365
|
+
/**
|
|
366
|
+
* Add an extractor.
|
|
367
|
+
* @param extractor - Extractor to add.
|
|
368
|
+
*/
|
|
369
|
+
add(extractor: Extractor): void;
|
|
370
|
+
/**
|
|
371
|
+
* Check if an extractor is already registered.
|
|
372
|
+
* @param extractor - Extractor to check.
|
|
373
|
+
*/
|
|
374
|
+
has(extractor: Extractor): boolean;
|
|
375
|
+
/**
|
|
376
|
+
* Remove an extractor.
|
|
377
|
+
* @param extractor - Extractor to remove.
|
|
378
|
+
* @returns True if the extractor was removed, false otherwise.
|
|
379
|
+
*/
|
|
380
|
+
remove(extractor: Extractor): boolean;
|
|
381
|
+
}
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/features/extractors/ExtractorService.d.ts
|
|
384
|
+
declare class ExtractorService {
|
|
385
|
+
#private;
|
|
386
|
+
constructor(extractorRegistry: ExtractorRegistry, hookRegistry: HookRegistry<OMSSHooks>);
|
|
387
|
+
/**
|
|
388
|
+
* Get all registered extractors (read-only).
|
|
389
|
+
*/
|
|
390
|
+
get extractors(): Result<ReadonlyArray<Extractor>, Error>;
|
|
391
|
+
/**
|
|
392
|
+
* Find an extractor capable of handling the given URL.
|
|
393
|
+
*
|
|
394
|
+
* @param url - URL to search for.
|
|
395
|
+
* @returns The first matching {@link Extractor} or an {@link OMSSExtractorError}.
|
|
396
|
+
*/
|
|
397
|
+
find(url: string): Promise<Result<Extractor, OMSSExtractorError>>;
|
|
398
|
+
/**
|
|
399
|
+
* Register an extractor.
|
|
400
|
+
*
|
|
401
|
+
* @param extractor - Extractor to register.
|
|
402
|
+
*/
|
|
403
|
+
register(extractor: Extractor): Promise<Result<void, Error>>;
|
|
404
|
+
/**
|
|
405
|
+
* Remove every registered extractor.
|
|
406
|
+
*/
|
|
407
|
+
reset(): Result<void, Error>;
|
|
408
|
+
/**
|
|
409
|
+
* Determine whether an extractor has already been registered.
|
|
410
|
+
*
|
|
411
|
+
* @param extractor - Extractor to check.
|
|
412
|
+
*/
|
|
413
|
+
has(extractor: Extractor): Result<boolean, Error>;
|
|
414
|
+
/**
|
|
415
|
+
* Remove an extractor.
|
|
416
|
+
*
|
|
417
|
+
* @param extractor - Extractor to remove.
|
|
418
|
+
* @returns Whether the extractor was removed.
|
|
419
|
+
*/
|
|
420
|
+
remove(extractor: Extractor): Result<boolean, Error>;
|
|
421
|
+
}
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region src/types/provider.d.ts
|
|
424
|
+
/**
|
|
425
|
+
* Core provider interface.
|
|
426
|
+
*
|
|
427
|
+
* @typeParam P - The resolver class this provider is bound to.
|
|
428
|
+
* The return type of P['resolve'] determines the `meta`
|
|
429
|
+
* parameter shape of getSources().
|
|
430
|
+
*/
|
|
431
|
+
interface OMSSProvider<P extends BaseResolver<unknown>> {
|
|
432
|
+
/** Provider ID. Must be unique. */
|
|
433
|
+
readonly id: string;
|
|
434
|
+
/** Friendly name of the provider. */
|
|
435
|
+
readonly name: string;
|
|
436
|
+
/** Whether the provider will be used. */
|
|
437
|
+
readonly enabled: boolean;
|
|
438
|
+
/**
|
|
439
|
+
* Catalog of media this provider supports. It does not have to exist. If it does, it should be a list of media IDs.
|
|
440
|
+
* This does not get queried for source resolving, but more metadata about the provider.
|
|
441
|
+
*/
|
|
442
|
+
readonly catalog?: () => Promise<NonEmptyArray<string>> | NonEmptyArray<string>;
|
|
443
|
+
/**
|
|
444
|
+
* Provide a method that checks whether this provider supports a certain ID.
|
|
445
|
+
* @param id - Parsed OMSS ID
|
|
446
|
+
*/
|
|
447
|
+
readonly supportsId: (id: ParsedOMSSId) => boolean | Promise<boolean>;
|
|
448
|
+
/** Resolver that this provider is bound to. */
|
|
449
|
+
readonly resolver: P;
|
|
450
|
+
/**
|
|
451
|
+
* Fetch sources for a certain request.
|
|
452
|
+
* The shape of `request.meta` is derived from the resolver's resolve() return type.
|
|
453
|
+
*/
|
|
454
|
+
getSources(request: ProviderSourcesMeta<ResolverMetadata<P>>, result: ProviderResultEmitter): Promise<ProviderResult>;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Extract the metadata type from a resolver's resolve method.
|
|
458
|
+
*/
|
|
459
|
+
type ResolverMetadata<R extends BaseResolver<unknown>> = Extract<Awaited<ReturnType<R['resolve']>>, {
|
|
460
|
+
ok: true;
|
|
461
|
+
}> extends {
|
|
462
|
+
value: infer T;
|
|
463
|
+
} ? T : never;
|
|
464
|
+
/**
|
|
465
|
+
* The object passed to providers when they are executed.
|
|
466
|
+
*/
|
|
467
|
+
type ProviderSourcesMeta<T> = {
|
|
468
|
+
utils: {
|
|
469
|
+
/**
|
|
470
|
+
* The parsed OMSS ID of the current request.
|
|
471
|
+
*/
|
|
472
|
+
omssId: ParsedOMSSId;
|
|
473
|
+
/**
|
|
474
|
+
* The abort controller signal for the current request. Providers can check this to abort the request early (recommended for long running requests).
|
|
475
|
+
*/
|
|
476
|
+
abortSignal: AbortSignal;
|
|
477
|
+
/**
|
|
478
|
+
* A function to find an extractor by whatever the extractor service is configured to use.
|
|
479
|
+
* @param args - Arguments to pass to the extractor service's find() method.'
|
|
480
|
+
*/
|
|
481
|
+
findExtractor: (...args: Parameters<ExtractorService['find']>) => ReturnType<ExtractorService['find']>;
|
|
482
|
+
}; /** Metadata returned by the resolver */
|
|
483
|
+
meta: T;
|
|
484
|
+
};
|
|
485
|
+
/**
|
|
486
|
+
* Provider with an unknown resolver. Utils for other services and registries
|
|
487
|
+
*/
|
|
488
|
+
type UnknownProvider = OMSSProvider<BaseResolver<unknown>>;
|
|
489
|
+
/**
|
|
490
|
+
* The result of a provider getSources call.
|
|
491
|
+
*/
|
|
492
|
+
type ProviderResult = Result<OMSSProviderResult, OMSSProviderError>;
|
|
493
|
+
/**
|
|
494
|
+
* The result of a provider getSources call if successful.
|
|
495
|
+
*/
|
|
496
|
+
interface OMSSProviderResult {
|
|
497
|
+
/**
|
|
498
|
+
* Array of sources.
|
|
499
|
+
*/
|
|
500
|
+
sources: Source[];
|
|
501
|
+
/**
|
|
502
|
+
* Array of subtitle tracks.
|
|
503
|
+
*/
|
|
504
|
+
subtitles: Subtitle[];
|
|
505
|
+
/**
|
|
506
|
+
* Array of errors.
|
|
507
|
+
*/
|
|
508
|
+
errors: OMSSProviderError[];
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* The result object passed to the provider's getSources() method.
|
|
512
|
+
*/
|
|
513
|
+
type ProviderResultEmitter = {
|
|
514
|
+
/**
|
|
515
|
+
* Utilities to make your life easier
|
|
516
|
+
*/
|
|
517
|
+
utils: {
|
|
518
|
+
/**
|
|
519
|
+
* Utilities for parsing metadata of sources
|
|
520
|
+
*/
|
|
521
|
+
source: {
|
|
522
|
+
/**
|
|
523
|
+
* Parse a string into a possible source type.
|
|
524
|
+
* @param possibleType - The string to parse
|
|
525
|
+
*/
|
|
526
|
+
parseType(possibleType: string): SourceTypes;
|
|
527
|
+
/**
|
|
528
|
+
* Parse a string into a possible source quality.
|
|
529
|
+
* @param possibleQuality - The string to parse
|
|
530
|
+
*/
|
|
531
|
+
parseQuality(possibleQuality: string): SourceQuality;
|
|
532
|
+
};
|
|
533
|
+
/**
|
|
534
|
+
* Utilities for parsing metadata of subtitles
|
|
535
|
+
*/
|
|
536
|
+
subtitle: {
|
|
537
|
+
/**
|
|
538
|
+
* Parse a string into a possible subtitle format.
|
|
539
|
+
* @param possibleFormat - The string to parse
|
|
540
|
+
*/
|
|
541
|
+
parseFormat(possibleFormat: string): SubtitleFormat;
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
/**
|
|
545
|
+
* Method for custom logging
|
|
546
|
+
* @param action - The action to log
|
|
547
|
+
* @param data - The data to log
|
|
548
|
+
*/
|
|
549
|
+
emit(action: string, data: unknown): void;
|
|
550
|
+
/**
|
|
551
|
+
* Method for debug logging
|
|
552
|
+
* @param args - Arguments to log
|
|
553
|
+
*/
|
|
554
|
+
debug(...args: unknown[]): void;
|
|
555
|
+
/**
|
|
556
|
+
* Method for information logging
|
|
557
|
+
* @param args - Arguments to log
|
|
558
|
+
*/
|
|
559
|
+
info(...args: unknown[]): void;
|
|
560
|
+
/**
|
|
561
|
+
* Method for warning logging
|
|
562
|
+
* @param args - Arguments to log
|
|
563
|
+
*/
|
|
564
|
+
warn(...args: unknown[]): void;
|
|
565
|
+
/**
|
|
566
|
+
* Method for error logging. Not fatal.
|
|
567
|
+
* @param error - The error to log. This will be returned to the requestor
|
|
568
|
+
*/
|
|
569
|
+
error(error: OMSSProviderError): void;
|
|
570
|
+
/**
|
|
571
|
+
* Method to emit a source.
|
|
572
|
+
* @param source - The source to emit
|
|
573
|
+
*/
|
|
574
|
+
source(source: Omit<Source, 'provider'>): void;
|
|
575
|
+
/**
|
|
576
|
+
* Method to emit a subtitle.
|
|
577
|
+
* @param subtitle - The subtitle to emit
|
|
578
|
+
*/
|
|
579
|
+
subtitle(subtitle: Omit<Subtitle, 'provider'>): void;
|
|
580
|
+
/**
|
|
581
|
+
* Method to emit a fatal error. This will stop the provider from executing.
|
|
582
|
+
* @param error - The error to emit
|
|
583
|
+
* @example
|
|
584
|
+
* ```typescript
|
|
585
|
+
* return result.fatal(new OMSSProviderError("Error Message", {cause: optionalObject}))
|
|
586
|
+
* ```
|
|
587
|
+
*/
|
|
588
|
+
fatal(error: OMSSProviderError): Result<never, OMSSProviderError>;
|
|
589
|
+
/**
|
|
590
|
+
* Signal that the provider has finished processing.
|
|
591
|
+
* @important Return the return value of this method.
|
|
592
|
+
* @example
|
|
593
|
+
* ```typescript
|
|
594
|
+
* return result.done()
|
|
595
|
+
* ```
|
|
596
|
+
*/
|
|
597
|
+
done(): ProviderResult;
|
|
598
|
+
};
|
|
599
|
+
interface BaseSource {
|
|
600
|
+
/**
|
|
601
|
+
* A string representing the original URL to the streaming source from the provider, which may require CORS handling or custom headers (provided in the headers field).
|
|
602
|
+
*/
|
|
603
|
+
url: string;
|
|
604
|
+
/**
|
|
605
|
+
* Key-value pairs of HTTP (and non-standard HTTP) headers that should be included when accessing the source URL.
|
|
606
|
+
*/
|
|
607
|
+
header: Record<string, string>;
|
|
608
|
+
/**
|
|
609
|
+
* Indicates if the source is streamable (true) or a direct download link (false). If false, clients must treat the URL as a download link rather than a streaming source. Download links CANNOT be used as streaming sources.
|
|
610
|
+
* @see [MDN Range Headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Range#:~:text=A%20server%20that%20doesn%27t%20support%20range%20requests%20may%20ignore%20the%20Range%20header%20and%20return%20the%20whole%20resource%20with%20a%20200%20status%20code.)
|
|
611
|
+
*/
|
|
612
|
+
streamable: boolean;
|
|
613
|
+
/**
|
|
614
|
+
* Source type, one of:
|
|
615
|
+
* hls — HTTP Live Streaming (M3U8).
|
|
616
|
+
* mp4 — MP4 file.
|
|
617
|
+
* mkv — MKV file.
|
|
618
|
+
* dash — MPEG-DASH (.mpd files).
|
|
619
|
+
*/
|
|
620
|
+
type: SourceTypes;
|
|
621
|
+
/**
|
|
622
|
+
* Video quality. One of 8K, 4K, QHD, FHD, HD, SD, or Auto: Quality should be inferred from the best available metadata, prioritizing resolution, then bitrate, filename, or manifest information. If the quality cannot be determined, use Auto.
|
|
623
|
+
*
|
|
624
|
+
* The ranges are like following:
|
|
625
|
+
* 4320p+ → 8K
|
|
626
|
+
* 2160p–4319p → 4K
|
|
627
|
+
* 1440p–2159p → QHD
|
|
628
|
+
* 1080p–1439p → FHD
|
|
629
|
+
* 720p–1079p → HD
|
|
630
|
+
* Below 720p → SD
|
|
631
|
+
* Unknown → Auto
|
|
632
|
+
*/
|
|
633
|
+
quality: SourceQuality;
|
|
634
|
+
/**
|
|
635
|
+
* Information on the provider that provided this source.
|
|
636
|
+
*/
|
|
637
|
+
provider: {
|
|
638
|
+
id: string;
|
|
639
|
+
name: string;
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* A source that has at least one known language baked into the stream itself
|
|
644
|
+
* (e.g. audio muxed into the HLS/DASH manifest or MP4/MKV file).
|
|
645
|
+
*/
|
|
646
|
+
interface SourceWithLanguages extends BaseSource {
|
|
647
|
+
/**
|
|
648
|
+
* Human-readable language name(s). default/unknown --> Original
|
|
649
|
+
* This should be provided to the best of the provider's ability.
|
|
650
|
+
* You should only list languages that are actually available in this specific source. If the source only contains video (no audio), keep this array empty and add the audiotracks via result.audioTrack().
|
|
651
|
+
*/
|
|
652
|
+
languages: NonEmptyArray<string>;
|
|
653
|
+
audioTracks?: never;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* A source with no muxed-in audio at all (e.g. video-only stream).
|
|
657
|
+
* MUST provide at least one separate AudioTrack instead.
|
|
658
|
+
*/
|
|
659
|
+
interface SourceWithAudioTracks extends BaseSource {
|
|
660
|
+
languages?: never;
|
|
661
|
+
/**
|
|
662
|
+
* Array of audio tracks.
|
|
663
|
+
*/
|
|
664
|
+
audioTracks: NonEmptyArray<AudioTrack>;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* A source object.
|
|
668
|
+
* A source MUST declare at least one language (muxed-in) OR at least one
|
|
669
|
+
* separate audioTrack. Both may be present; at least one is required.
|
|
670
|
+
* @see https://github.com/omss-spec/omss-spec/blob/main/spec/v1.1/omss-v1.1.md#62-source-object
|
|
671
|
+
*/
|
|
672
|
+
type Source = SourceWithLanguages | SourceWithAudioTracks;
|
|
673
|
+
/**
|
|
674
|
+
* Valid Source Types
|
|
675
|
+
*/
|
|
676
|
+
type SourceTypes = 'hls' | 'mp4' | 'dash' | 'mkv';
|
|
677
|
+
/**
|
|
678
|
+
* Video quality
|
|
679
|
+
*/
|
|
680
|
+
type SourceQuality = '8K' | '4K' | 'QHD' | 'FHD' | 'HD' | 'SD' | 'Auto';
|
|
681
|
+
/**
|
|
682
|
+
* A subtitle object.
|
|
683
|
+
* @see https://github.com/omss-spec/omss-spec/blob/main/spec/v1.1/omss-v1.1.md#63-subtitle-object
|
|
684
|
+
*/
|
|
685
|
+
interface Subtitle {
|
|
686
|
+
/**
|
|
687
|
+
* A string representing the original URL to the subtitle from the provider, which may require CORS handling or custom headers (provided in the headers field).
|
|
688
|
+
*/
|
|
689
|
+
url: string;
|
|
690
|
+
/**
|
|
691
|
+
* Key-value pairs of HTTP (and non-standard HTTP) headers that should be included when accessing the subtitle URL.
|
|
692
|
+
*/
|
|
693
|
+
header: Record<string, string>;
|
|
694
|
+
/**
|
|
695
|
+
* Human-readable language name for the subtitle track. default/unknown --> Unknown
|
|
696
|
+
*/
|
|
697
|
+
label: string;
|
|
698
|
+
/**
|
|
699
|
+
* Subtitle format, one of:
|
|
700
|
+
*
|
|
701
|
+
* vtt — WebVTT.
|
|
702
|
+
* srt — SubRip.
|
|
703
|
+
*/
|
|
704
|
+
format: SubtitleFormat;
|
|
705
|
+
/**
|
|
706
|
+
* Information on the provider that provided this subtitle track.
|
|
707
|
+
*/
|
|
708
|
+
provider: {
|
|
709
|
+
id: string;
|
|
710
|
+
name: string;
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Valid Subtitle Formats
|
|
715
|
+
*/
|
|
716
|
+
type SubtitleFormat = 'vtt' | 'srt';
|
|
717
|
+
/**
|
|
718
|
+
* An audio track object.
|
|
719
|
+
* @see https://github.com/omss-spec/omss-spec/blob/main/spec/v1.1/omss-v1.1.md#62-source-object:~:text=Unknown%20%E2%86%92%20Auto-,audioTracks,-(array%20of%20strings
|
|
720
|
+
* @see https://github.com/omss-spec/omss-spec/issues/8
|
|
721
|
+
*/
|
|
722
|
+
interface AudioTrack {
|
|
723
|
+
/**
|
|
724
|
+
* A string representing the original URL to the audiotrack from the provider, which may require CORS handling or custom headers (provided in the headers field).
|
|
725
|
+
*/
|
|
726
|
+
url: string;
|
|
727
|
+
/**
|
|
728
|
+
* Key-value pairs of HTTP (and non-standard HTTP) headers that should be included when accessing the audiotrack URL.
|
|
729
|
+
*/
|
|
730
|
+
header: Record<string, string>;
|
|
731
|
+
/**
|
|
732
|
+
* Human-readable language name for the audiotrack. default/unknown --> Unknown
|
|
733
|
+
*/
|
|
734
|
+
label: string;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Helper types for the structure that should be passed into the emitter.
|
|
738
|
+
*/
|
|
739
|
+
type EmittedSource = Omit<SourceWithLanguages, 'provider'> | Omit<SourceWithAudioTracks, 'provider'>;
|
|
740
|
+
type EmittedSubtitle = Omit<Subtitle, 'provider'>;
|
|
741
|
+
/**
|
|
742
|
+
* Methods that can be called on the ProviderService middleware.
|
|
743
|
+
*/
|
|
744
|
+
type ProviderServiceOperations = {
|
|
745
|
+
/**
|
|
746
|
+
* The provider registration pipeline.
|
|
747
|
+
*
|
|
748
|
+
* Middleware runs after `beforeProviderRegister` and before
|
|
749
|
+
* ProviderRegistry.add(). Context carries the provider being registered.
|
|
750
|
+
*/
|
|
751
|
+
register: {
|
|
752
|
+
context: {
|
|
753
|
+
provider: UnknownProvider;
|
|
754
|
+
};
|
|
755
|
+
result: Result<UnknownProvider, OMSSProviderError>;
|
|
756
|
+
};
|
|
757
|
+
};
|
|
758
|
+
type ProviderServiceMiddleware<TMethod extends keyof ProviderServiceOperations> = MiddlewareHandler<ProviderServiceOperations, TMethod>;
|
|
759
|
+
//#endregion
|
|
760
|
+
//#region src/types/source.d.ts
|
|
761
|
+
/**
|
|
762
|
+
* Options for fetching sources.
|
|
763
|
+
*/
|
|
764
|
+
type GetSourcesOptions = {
|
|
765
|
+
providerId?: string;
|
|
766
|
+
abortSignal?: AbortSignal;
|
|
767
|
+
cleaningFunction?: CleaningFunction;
|
|
768
|
+
providerHookService?: HookService<ProviderHooks>;
|
|
769
|
+
};
|
|
770
|
+
/**
|
|
771
|
+
* Object returned by the SourceService.GetSources() method if there has been at least one successful provider.
|
|
772
|
+
*/
|
|
773
|
+
type GatheredSources = {
|
|
774
|
+
/**
|
|
775
|
+
* Array of sources.
|
|
776
|
+
*/
|
|
777
|
+
sources: Source[];
|
|
778
|
+
/**
|
|
779
|
+
* Array of subtitle tracks.
|
|
780
|
+
*/
|
|
781
|
+
subtitles: Subtitle[];
|
|
782
|
+
/**
|
|
783
|
+
* Array of errors.
|
|
784
|
+
*/
|
|
785
|
+
errors: OMSSError[];
|
|
786
|
+
};
|
|
787
|
+
/**
|
|
788
|
+
* Operations supported by the SourceService Middleware Runner with the according context and result types.
|
|
789
|
+
*/
|
|
790
|
+
type SourceServiceOperations = {
|
|
791
|
+
getSources: {
|
|
792
|
+
context: {
|
|
793
|
+
omssId: OMSSId;
|
|
794
|
+
options: GetSourcesOptions;
|
|
795
|
+
};
|
|
796
|
+
result: Result<GatheredSources, OMSSSourceGatheringError>;
|
|
797
|
+
};
|
|
798
|
+
afterGetSources: {
|
|
799
|
+
context: {
|
|
800
|
+
omssId: OMSSId;
|
|
801
|
+
options: GetSourcesOptions;
|
|
802
|
+
result: Result<GatheredSources, OMSSSourceGatheringError>;
|
|
803
|
+
};
|
|
804
|
+
result: Result<GatheredSources, OMSSSourceGatheringError>;
|
|
805
|
+
};
|
|
806
|
+
};
|
|
807
|
+
/**
|
|
808
|
+
* Middleware function for the SourceService
|
|
809
|
+
*/
|
|
810
|
+
type SourceServiceMiddleware<TMethod extends keyof SourceServiceOperations> = MiddlewareHandler<SourceServiceOperations, TMethod>;
|
|
811
|
+
/**
|
|
812
|
+
* Function to clean a source.
|
|
813
|
+
*
|
|
814
|
+
* This function will be called between a source is registered (in the ResultEmitter) and the source is emitted.
|
|
815
|
+
*/
|
|
816
|
+
type ObjectToClean = {
|
|
817
|
+
url: string;
|
|
818
|
+
header: Record<string, string>;
|
|
819
|
+
};
|
|
820
|
+
type CleaningFunction = (obj: ObjectToClean) => ObjectToClean;
|
|
821
|
+
//#endregion
|
|
822
|
+
//#region src/types/hooks.d.ts
|
|
823
|
+
/**
|
|
824
|
+
* Hook map for OMSS lifecycle events.
|
|
825
|
+
* Each hook name maps to its own payload signature.
|
|
826
|
+
*
|
|
827
|
+
* Hooks follow a standardized signature:
|
|
828
|
+
* - `before[action]` hooks receive the payload before the event is triggered
|
|
829
|
+
* - `after[action]` hooks receive the payload after the event is triggered
|
|
830
|
+
* - `[action]failed` hooks receive the payload if the event fails
|
|
831
|
+
*
|
|
832
|
+
* @note - There are special hooks with elevated access. See the docs for more info.
|
|
833
|
+
*/
|
|
834
|
+
type OMSSHooks = {
|
|
835
|
+
/**
|
|
836
|
+
* Called before a plugin is registered.
|
|
837
|
+
*/
|
|
838
|
+
beforePluginRegister: <T>(payload: {
|
|
839
|
+
plugin: UnknownPluginType;
|
|
840
|
+
options?: OMSSPluginOptions<T>;
|
|
841
|
+
}) => void | Promise<void>;
|
|
842
|
+
/**
|
|
843
|
+
* Called after a plugin is successfully registered.
|
|
844
|
+
*/
|
|
845
|
+
afterPluginRegister: <T>(payload: {
|
|
846
|
+
plugin: UnknownPluginType;
|
|
847
|
+
options?: OMSSPluginOptions<T>;
|
|
848
|
+
}) => void | Promise<void>;
|
|
849
|
+
/**
|
|
850
|
+
* Called when a plugin registration fails.
|
|
851
|
+
*/
|
|
852
|
+
pluginRegisterFailed: <T>(payload: {
|
|
853
|
+
plugin: UnknownPluginType;
|
|
854
|
+
options?: OMSSPluginOptions<T>;
|
|
855
|
+
error: Error;
|
|
856
|
+
}) => void | Promise<void>;
|
|
857
|
+
/**
|
|
858
|
+
* Called before a provider is registered.
|
|
859
|
+
*/
|
|
860
|
+
beforeProviderRegister: (payload: {
|
|
861
|
+
provider: UnknownProvider;
|
|
862
|
+
}) => void | Promise<void>;
|
|
863
|
+
/**
|
|
864
|
+
* Called after a provider is successfully registered.
|
|
865
|
+
*/
|
|
866
|
+
afterProviderRegister: (payload: {
|
|
867
|
+
provider: UnknownProvider;
|
|
868
|
+
}) => void | Promise<void>;
|
|
869
|
+
/**
|
|
870
|
+
* Called when a provider registration fails.
|
|
871
|
+
*/
|
|
872
|
+
providerRegisterFailed: (payload: {
|
|
873
|
+
provider: UnknownProvider;
|
|
874
|
+
error: OMSSProviderError;
|
|
875
|
+
}) => void | Promise<void>;
|
|
876
|
+
/**
|
|
877
|
+
* Called before sources are fetched for an OMSS ID.
|
|
878
|
+
* Receives the raw ID and the optional provider filter.
|
|
879
|
+
*
|
|
880
|
+
* @dangerous - This hook is not intended for general use. You can achieve very funny side effects by using it. Use with caution.
|
|
881
|
+
*/
|
|
882
|
+
beforeGetSources: (payload: {
|
|
883
|
+
omssId: OMSSId;
|
|
884
|
+
providerId?: string | undefined;
|
|
885
|
+
}) => void | Promise<void>;
|
|
886
|
+
/**
|
|
887
|
+
* Called after sources have been successfully fetched.
|
|
888
|
+
* Receives the ID, optional provider filter, and the aggregated result.
|
|
889
|
+
*/
|
|
890
|
+
afterGetSources: (payload: {
|
|
891
|
+
omssId: OMSSId;
|
|
892
|
+
providerId?: string | undefined;
|
|
893
|
+
result: GatheredSources;
|
|
894
|
+
}) => void | Promise<void>;
|
|
895
|
+
/**
|
|
896
|
+
* Called when a getSources call fails entirely (no provider succeeded).
|
|
897
|
+
*/
|
|
898
|
+
getSourcesFailed: (payload: {
|
|
899
|
+
omssId: OMSSId;
|
|
900
|
+
providerId?: string | undefined;
|
|
901
|
+
error: OMSSProviderError;
|
|
902
|
+
}) => void | Promise<void>;
|
|
903
|
+
/**
|
|
904
|
+
* Called before an extractor is registered.
|
|
905
|
+
*
|
|
906
|
+
* @dangerous
|
|
907
|
+
* Registering another extractor from this hook is not allowed and will
|
|
908
|
+
* result in an {@link OMSSExtractorError}.
|
|
909
|
+
*/
|
|
910
|
+
beforeRegisterExtractor: (payload: {
|
|
911
|
+
extractor: Extractor;
|
|
912
|
+
}) => void | Promise<void>;
|
|
913
|
+
/**
|
|
914
|
+
* Called after an extractor has been successfully registered.
|
|
915
|
+
*/
|
|
916
|
+
afterRegisterExtractor: (payload: {
|
|
917
|
+
extractor: Extractor;
|
|
918
|
+
}) => void | Promise<void>;
|
|
919
|
+
/**
|
|
920
|
+
* Called when extractor registration fails.
|
|
921
|
+
*/
|
|
922
|
+
extractorRegisterFailed: (payload: {
|
|
923
|
+
extractor: Extractor;
|
|
924
|
+
error: OMSSExtractorError;
|
|
925
|
+
}) => void | Promise<void>;
|
|
926
|
+
/**
|
|
927
|
+
* Called before attempting to find an extractor for a URL.
|
|
928
|
+
*/
|
|
929
|
+
beforeFindExtractor: (payload: {
|
|
930
|
+
url: string;
|
|
931
|
+
}) => void | Promise<void>;
|
|
932
|
+
/**
|
|
933
|
+
* Called after extractor lookup completes.
|
|
934
|
+
*
|
|
935
|
+
* If no extractor matched, {@link payload.extractor} will be `undefined`.
|
|
936
|
+
*/
|
|
937
|
+
afterFindExtractor: (payload: {
|
|
938
|
+
url: string;
|
|
939
|
+
extractor: Extractor | undefined;
|
|
940
|
+
}) => void | Promise<void>;
|
|
941
|
+
/**
|
|
942
|
+
* Called when no extractor could be found for the provided URL.
|
|
943
|
+
*/
|
|
944
|
+
findExtractorFailed: (payload: {
|
|
945
|
+
url: string;
|
|
946
|
+
error: OMSSExtractorError;
|
|
947
|
+
}) => void | Promise<void>;
|
|
948
|
+
};
|
|
949
|
+
/**
|
|
950
|
+
* Base payload shared by every provider hook.
|
|
951
|
+
*/
|
|
952
|
+
interface BaseProviderHookPayload {
|
|
953
|
+
/** The provider instance that emitted the event. */
|
|
954
|
+
provider: Readonly<UnknownProvider>;
|
|
955
|
+
/**
|
|
956
|
+
* The OMSS ID that was being processed.
|
|
957
|
+
*/
|
|
958
|
+
id: ParsedOMSSId;
|
|
959
|
+
/**
|
|
960
|
+
* At what time was this event emitted?
|
|
961
|
+
*/
|
|
962
|
+
timestamp: string;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Fired when `emitter.debug(...)` is called.
|
|
966
|
+
* Intended for verbose, development-only diagnostics.
|
|
967
|
+
*/
|
|
968
|
+
type ProviderDebugPayload = BaseProviderHookPayload & {
|
|
969
|
+
/** Raw arguments forwarded from `debug(...args)`. */args: unknown[];
|
|
970
|
+
};
|
|
971
|
+
/**
|
|
972
|
+
* Fired when `emitter.info(...)` is called.
|
|
973
|
+
* General informational messages about provider execution.
|
|
974
|
+
*/
|
|
975
|
+
type ProviderInfoPayload = BaseProviderHookPayload & {
|
|
976
|
+
/** Raw arguments forwarded from `info(...args)`. */args: unknown[];
|
|
977
|
+
};
|
|
978
|
+
/**
|
|
979
|
+
* Fired when `emitter.warn(...)` is called.
|
|
980
|
+
* Non-fatal, degraded-but-recoverable situations.
|
|
981
|
+
*/
|
|
982
|
+
type ProviderWarnPayload = BaseProviderHookPayload & {
|
|
983
|
+
/** Raw arguments forwarded from `warn(...args)`. */args: unknown[];
|
|
984
|
+
};
|
|
985
|
+
/**
|
|
986
|
+
* Fired when `emitter.error(...)` is called (non-fatal) OR when
|
|
987
|
+
* `emitter.fatal(...)` is called (fatal — the aggregated error is passed here too).
|
|
988
|
+
*/
|
|
989
|
+
type ProviderErrorPayload = BaseProviderHookPayload & {
|
|
990
|
+
/** The error that was recorded or that terminated the provider. */error: OMSSProviderError;
|
|
991
|
+
};
|
|
992
|
+
/**
|
|
993
|
+
* Fired every time `emitter.source(...)` emits a new source.
|
|
994
|
+
*/
|
|
995
|
+
type ProviderSourcePayload = BaseProviderHookPayload & {
|
|
996
|
+
/** The source object that was just emitted. */source: Source;
|
|
997
|
+
};
|
|
998
|
+
/**
|
|
999
|
+
* Fired every time `emitter.subtitle(...)` emits a new subtitle track.
|
|
1000
|
+
*/
|
|
1001
|
+
type ProviderSubtitlePayload = BaseProviderHookPayload & {
|
|
1002
|
+
/** The subtitle object that was just emitted. */subtitle: Subtitle;
|
|
1003
|
+
};
|
|
1004
|
+
/**
|
|
1005
|
+
* Fired once when `emitter.done()` finalizes the provider's result.
|
|
1006
|
+
*/
|
|
1007
|
+
type ProviderDonePayload = BaseProviderHookPayload & {
|
|
1008
|
+
/** The fully aggregated result (sources, subtitles, non-fatal errors). */result: OMSSProviderResult;
|
|
1009
|
+
};
|
|
1010
|
+
/**
|
|
1011
|
+
* Fired for provider-defined custom events via `emitter.emit(action, data)`.
|
|
1012
|
+
*
|
|
1013
|
+
* @remarks
|
|
1014
|
+
* This is an escape hatch for provider-specific diagnostics/telemetry that
|
|
1015
|
+
* don't map to any of the fixed lifecycle hooks below (e.g. `"cache.hit"`,
|
|
1016
|
+
* `"upstream.retry"`). The `action` string becomes the hook name itself
|
|
1017
|
+
* when calling `hookReg.run(action, ...)`, so consumers register listeners
|
|
1018
|
+
* for these dynamically via `hookReg.add('cache.hit', handler)`.
|
|
1019
|
+
*/
|
|
1020
|
+
type ProviderCustomEventPayload = BaseProviderHookPayload & {
|
|
1021
|
+
/** Arbitrary payload associated with the custom event. */data: unknown;
|
|
1022
|
+
};
|
|
1023
|
+
interface FixedProviderHooks {
|
|
1024
|
+
/** See {@link ProviderDebugPayload}. */
|
|
1025
|
+
debug: (payload: ProviderDebugPayload) => void | Promise<void>;
|
|
1026
|
+
/** See {@link ProviderInfoPayload}. */
|
|
1027
|
+
info: (payload: ProviderInfoPayload) => void | Promise<void>;
|
|
1028
|
+
/** See {@link ProviderWarnPayload}. */
|
|
1029
|
+
warn: (payload: ProviderWarnPayload) => void | Promise<void>;
|
|
1030
|
+
/** See {@link ProviderErrorPayload}. Fires on both `error()` and `fatal()`. */
|
|
1031
|
+
error: (payload: ProviderErrorPayload) => void | Promise<void>;
|
|
1032
|
+
/** See {@link ProviderSourcePayload}. Fires once per `source()` call. */
|
|
1033
|
+
source: (payload: ProviderSourcePayload) => void | Promise<void>;
|
|
1034
|
+
/** See {@link ProviderSubtitlePayload}. Fires once per `subtitle()` call. */
|
|
1035
|
+
subtitle: (payload: ProviderSubtitlePayload) => void | Promise<void>;
|
|
1036
|
+
/** See {@link ProviderDonePayload}. Fires exactly once, at the end of execution. */
|
|
1037
|
+
done: (payload: ProviderDonePayload) => void | Promise<void>;
|
|
1038
|
+
}
|
|
1039
|
+
interface ProviderCustomHooks {
|
|
1040
|
+
[action: string]: (payload: ProviderCustomEventPayload) => void | Promise<void>;
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* All lifecycle hooks fired by a `ProviderResultEmitter` during a single
|
|
1044
|
+
* `getSources()` execution.
|
|
1045
|
+
*
|
|
1046
|
+
* Every union member listed in the index signature corresponds 1:1 to one
|
|
1047
|
+
* of the named hooks below, so each named hook's function type is a valid
|
|
1048
|
+
* subtype of the index signature — this keeps the interface consistent
|
|
1049
|
+
* while still allowing strict payload typing for the well-known events.
|
|
1050
|
+
*/
|
|
1051
|
+
type ProviderHooks = FixedProviderHooks & ProviderCustomHooks;
|
|
1052
|
+
//#endregion
|
|
1053
|
+
//#region src/features/plugins/PluginService.d.ts
|
|
1054
|
+
/**
|
|
1055
|
+
* The public API for managing OMSS plugins.
|
|
1056
|
+
*/
|
|
1057
|
+
declare class PluginService {
|
|
1058
|
+
#private;
|
|
1059
|
+
constructor(omssServer: OMSSServer, pluginRegistry: PluginRegistry, hookRegistry: HookRegistry<OMSSHooks>);
|
|
1060
|
+
/**
|
|
1061
|
+
* Register an OMSS plugin with no config into the system.
|
|
1062
|
+
* @param plugin - Plugin function
|
|
1063
|
+
*/
|
|
1064
|
+
register(plugin: OMSSPluginType): ReturnType<PluginRegistry['add']>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Register an OMSS plugin with a config into the system.
|
|
1067
|
+
* @param plugin - Plugin function
|
|
1068
|
+
* @param options - Plugin configuration
|
|
1069
|
+
*/
|
|
1070
|
+
register<T>(plugin: OMSSConfiguredPluginType<T>, options: OMSSPluginOptions<T>): ReturnType<PluginRegistry['add']>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Get the current State of a plugin
|
|
1073
|
+
* @param plugin - the plugin to get the state from
|
|
1074
|
+
* @returns - a value of the PluginState enum
|
|
1075
|
+
*/
|
|
1076
|
+
getPluginState(plugin: UnknownPluginType): ReturnType<PluginRegistry['getState']>;
|
|
1077
|
+
}
|
|
1078
|
+
//#endregion
|
|
1079
|
+
//#region src/types/config.d.ts
|
|
1080
|
+
interface OMSSConfig {
|
|
1081
|
+
/**
|
|
1082
|
+
* A human-readable name for this server instance.
|
|
1083
|
+
*/
|
|
1084
|
+
name: string;
|
|
1085
|
+
}
|
|
1086
|
+
//#endregion
|
|
1087
|
+
//#region src/features/providers/ProviderRegistry.d.ts
|
|
1088
|
+
/**
|
|
1089
|
+
* Registry responsible for storing and managing OMSS Providers.
|
|
1090
|
+
*
|
|
1091
|
+
* Providers are stored by their unique {@link UnknownProvider.id}.
|
|
1092
|
+
* This registry does not know about hooks.
|
|
1093
|
+
*/
|
|
1094
|
+
declare class ProviderRegistry {
|
|
1095
|
+
#private;
|
|
1096
|
+
/**
|
|
1097
|
+
* Adds a provider to the registry.
|
|
1098
|
+
*
|
|
1099
|
+
* @param provider - The provider instance to register.
|
|
1100
|
+
* @returns `OK` if registration succeeded, `ERR` if the provider ID is already taken.
|
|
1101
|
+
*/
|
|
1102
|
+
add(provider: UnknownProvider): Promise<Result<UnknownProvider, OMSSProviderError>>;
|
|
1103
|
+
/**
|
|
1104
|
+
* Retrieves a registered provider by its ID.
|
|
1105
|
+
*
|
|
1106
|
+
* @param id - The unique provider ID.
|
|
1107
|
+
* @returns The provider instance, or `undefined` if not found.
|
|
1108
|
+
*/
|
|
1109
|
+
get(id: string): UnknownProvider | undefined;
|
|
1110
|
+
/**
|
|
1111
|
+
* Returns all registered providers.
|
|
1112
|
+
*/
|
|
1113
|
+
getAll(filter?: (p: UnknownProvider) => boolean): UnknownProvider[];
|
|
1114
|
+
/**
|
|
1115
|
+
* Returns whether a provider with the given ID is registered.
|
|
1116
|
+
*
|
|
1117
|
+
* @param id - The unique provider ID.
|
|
1118
|
+
*/
|
|
1119
|
+
has(id: string): boolean;
|
|
1120
|
+
}
|
|
1121
|
+
//#endregion
|
|
1122
|
+
//#region src/features/source/SourceService.d.ts
|
|
1123
|
+
/**
|
|
1124
|
+
* Public API for resolving sources for media.
|
|
1125
|
+
*
|
|
1126
|
+
* This service owns the public method surface, middleware execution,
|
|
1127
|
+
* lifecycle hook dispatching, and request coalescing. The actual source
|
|
1128
|
+
* gathering implementation lives in {@link SourceCore}.
|
|
1129
|
+
*/
|
|
1130
|
+
declare class SourceService {
|
|
1131
|
+
#private;
|
|
1132
|
+
constructor(omssServer: OMSSServer, providerRegistry: ProviderRegistry, hookRegistry: HookRegistry<OMSSHooks>, extractorService: ExtractorService);
|
|
1133
|
+
get cleaningFunction(): CleaningFunction;
|
|
1134
|
+
set cleaningFunction(fn: CleaningFunction);
|
|
1135
|
+
/**
|
|
1136
|
+
* Register middleware for a SourceService method.
|
|
1137
|
+
*
|
|
1138
|
+
* Middleware can be used for cross-cutting concerns such as caching,
|
|
1139
|
+
* logging, tracing, or metrics.
|
|
1140
|
+
*
|
|
1141
|
+
* @param method - Middleware-enabled method name.
|
|
1142
|
+
* @param handler - Middleware handler.
|
|
1143
|
+
*/
|
|
1144
|
+
use<TMethod extends keyof SourceServiceOperations>(method: TMethod, handler: SourceServiceMiddleware<TMethod>): void;
|
|
1145
|
+
/**
|
|
1146
|
+
* Fetch sources from all matching providers for an OMSS ID.
|
|
1147
|
+
*
|
|
1148
|
+
* This method is middleware-enabled. Concurrent requests for the same
|
|
1149
|
+
* `omssId` and `providerId` share the same in-flight Promise until the
|
|
1150
|
+
* request settles.
|
|
1151
|
+
*
|
|
1152
|
+
* @param omssId - OMSS identifier such as `"tmdb:12345"`.
|
|
1153
|
+
* @param options - Optional source gathering parameters.
|
|
1154
|
+
* @returns Aggregated provider results or a source gathering error.
|
|
1155
|
+
*/
|
|
1156
|
+
getSources(omssId: OMSSId, options?: GetSourcesOptions): Promise<Result<GatheredSources, OMSSSourceGatheringError>>;
|
|
1157
|
+
}
|
|
1158
|
+
//#endregion
|
|
1159
|
+
//#region src/features/providers/ProviderService.d.ts
|
|
1160
|
+
/**
|
|
1161
|
+
* The public API for managing OMSS Providers.
|
|
1162
|
+
*/
|
|
1163
|
+
declare class ProviderService {
|
|
1164
|
+
#private;
|
|
1165
|
+
constructor(providerRegistry: ProviderRegistry, hookRegistry: HookRegistry<OMSSHooks>);
|
|
1166
|
+
/**
|
|
1167
|
+
* Adds middleware to the `register` pipeline.
|
|
1168
|
+
* Middlewares run in insertion order, after hooks and before the
|
|
1169
|
+
* actual registry `add()` call.
|
|
1170
|
+
*/
|
|
1171
|
+
use<TMethod extends keyof ProviderServiceOperations>(method: TMethod, handler: ProviderServiceMiddleware<TMethod>): this;
|
|
1172
|
+
/**
|
|
1173
|
+
* Registers a provider into the system.
|
|
1174
|
+
*/
|
|
1175
|
+
register(provider: UnknownProvider): Promise<Result<UnknownProvider, OMSSProviderError>>;
|
|
1176
|
+
/**
|
|
1177
|
+
* Retrieves a registered provider by its ID.
|
|
1178
|
+
*
|
|
1179
|
+
* @param id - The provider ID to look up.
|
|
1180
|
+
* @returns The provider instance, or `undefined` if not found.
|
|
1181
|
+
*/
|
|
1182
|
+
get(id: string): ReturnType<ProviderRegistry['get']>;
|
|
1183
|
+
/**
|
|
1184
|
+
* Returns all registered providers.
|
|
1185
|
+
* @param filter - Optional filter function to apply to providers.
|
|
1186
|
+
*/
|
|
1187
|
+
getAll(filter?: (p: UnknownProvider) => boolean): ReturnType<ProviderRegistry['getAll']>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Returns whether a provider with the given ID has been registered.
|
|
1190
|
+
*
|
|
1191
|
+
* @param id - The provider ID to check.
|
|
1192
|
+
*/
|
|
1193
|
+
has(id: string): ReturnType<ProviderRegistry['has']>;
|
|
1194
|
+
/**
|
|
1195
|
+
* Returns a map of all namespaces and an array of all known identifiers for each namespace.
|
|
1196
|
+
* This list is BEST EFFORT ONLY. Do not rely on this. If any provider returns a `*` automatically, the namespace will support all identifiers (e.g. `"tmdb": ["*"], "imdb": ["tt37636", "..."]`.
|
|
1197
|
+
*/
|
|
1198
|
+
catalog(): Promise<Result<Map<string, string[]>, OMSSProviderError>>;
|
|
1199
|
+
/**
|
|
1200
|
+
* Returns the catalog for a single namespace.
|
|
1201
|
+
* Returns `undefined` if no provider in that namespace exposes a catalog.
|
|
1202
|
+
*
|
|
1203
|
+
* @param namespace - The resolver namespace to look up (e.g. `"tmdb"`).
|
|
1204
|
+
* @returns Merged list of IDs for the namespace, `["*"]` if any provider
|
|
1205
|
+
* signals wildcard support, or `undefined` if no catalog data exists.
|
|
1206
|
+
*/
|
|
1207
|
+
catalogForNamespace(namespace: string): Promise<Result<string[], OMSSProviderError>>;
|
|
1208
|
+
}
|
|
1209
|
+
//#endregion
|
|
1210
|
+
//#region src/core/server.d.ts
|
|
1211
|
+
/**
|
|
1212
|
+
* Core server class for OMSS.
|
|
1213
|
+
*/
|
|
1214
|
+
declare class OMSSServer {
|
|
1215
|
+
#private;
|
|
1216
|
+
readonly hooks: HookService<OMSSHooks>;
|
|
1217
|
+
readonly plugins: PluginService;
|
|
1218
|
+
readonly providers: ProviderService;
|
|
1219
|
+
readonly sources: SourceService;
|
|
1220
|
+
readonly extractors: ExtractorService;
|
|
1221
|
+
/**
|
|
1222
|
+
* Creates a new OMSSServer instance.
|
|
1223
|
+
*
|
|
1224
|
+
* @param config - Immutable server configuration
|
|
1225
|
+
*/
|
|
1226
|
+
constructor(config: OMSSConfig);
|
|
1227
|
+
/**
|
|
1228
|
+
* Get the OMSS Config from the constructor
|
|
1229
|
+
* @returns the initialised OMSS Config
|
|
1230
|
+
*/
|
|
1231
|
+
get config(): Readonly<OMSSConfig>;
|
|
1232
|
+
/**
|
|
1233
|
+
* Decorate the OMSSServer instance with a new property.
|
|
1234
|
+
* @param name - The name of the property to be decorated.
|
|
1235
|
+
* @param value - The value to be assigned to the property.
|
|
1236
|
+
* @param deps - An array of dependency names.
|
|
1237
|
+
* @returns The name of the decorated property in the {@link Result} object.
|
|
1238
|
+
*/
|
|
1239
|
+
decorate<T>(name: string, value: T, deps?: string[]): Result<string, OMSSServerError>;
|
|
1240
|
+
/**
|
|
1241
|
+
* Check if a decorator with the given name exists.
|
|
1242
|
+
* @param name - The name of the decorator to check.
|
|
1243
|
+
* @returns True if the decorator exists, false otherwise.
|
|
1244
|
+
*/
|
|
1245
|
+
hasDecorator(name: string): boolean;
|
|
1246
|
+
/**
|
|
1247
|
+
* Get a decorated property by its name.
|
|
1248
|
+
* @param name - The name of the property to retrieve.
|
|
1249
|
+
* @returns The decorated property value in the {@link Result} object.
|
|
1250
|
+
*/
|
|
1251
|
+
getDecorator<T>(name: string): Result<T, OMSSServerError>;
|
|
1252
|
+
}
|
|
1253
|
+
//#endregion
|
|
1254
|
+
//#region src/features/providers/BaseProvider.d.ts
|
|
1255
|
+
/**
|
|
1256
|
+
* Base class for all providers.
|
|
1257
|
+
*/
|
|
1258
|
+
declare abstract class BaseProvider<P extends BaseResolver<unknown>> implements OMSSProvider<P> {
|
|
1259
|
+
/**
|
|
1260
|
+
* Provider ID. Must be unique.
|
|
1261
|
+
*/
|
|
1262
|
+
abstract readonly id: string;
|
|
1263
|
+
/**
|
|
1264
|
+
* Friendly name of the provider.
|
|
1265
|
+
*/
|
|
1266
|
+
abstract readonly name: string;
|
|
1267
|
+
/**
|
|
1268
|
+
* Whether the provider will be used.
|
|
1269
|
+
*/
|
|
1270
|
+
abstract readonly enabled: boolean;
|
|
1271
|
+
/**
|
|
1272
|
+
* Catalog of media this provider supports. It does not have to exist. If it does, it should be a list of media IDs.
|
|
1273
|
+
* This does not get queried for source resolving, but more metadata about the provider.
|
|
1274
|
+
*/
|
|
1275
|
+
abstract readonly catalog?: () => Promise<NonEmptyArray<string>> | NonEmptyArray<string>;
|
|
1276
|
+
/**
|
|
1277
|
+
* Provide a method that checks whether this provider supports a certain ID.
|
|
1278
|
+
* @param id - Parsed OMSS ID
|
|
1279
|
+
*/
|
|
1280
|
+
abstract readonly supportsId: (id: ParsedOMSSId) => boolean | Promise<boolean>;
|
|
1281
|
+
/**
|
|
1282
|
+
* Resolvers that this provider supports.
|
|
1283
|
+
*/
|
|
1284
|
+
abstract readonly resolver: P;
|
|
1285
|
+
/**
|
|
1286
|
+
* Fetch sources for a certain media.
|
|
1287
|
+
* @param media - Return object of the resolver's resolve() method.
|
|
1288
|
+
* @param result - The result emitter.
|
|
1289
|
+
*/
|
|
1290
|
+
abstract getSources(media: ProviderSourcesMeta<ResolverMetadata<P>>, result: ProviderResultEmitter): Promise<ProviderResult>;
|
|
1291
|
+
}
|
|
1292
|
+
//#endregion
|
|
1293
|
+
//#region src/features/resolvers/utils.d.ts
|
|
1294
|
+
/**
|
|
1295
|
+
* Parses an OMSS ID in the form `namespace:value_1[:value_2[:...]]`.
|
|
1296
|
+
*/
|
|
1297
|
+
declare function parseOMSSId(id: OMSSId): Result<ParsedOMSSId, OMSSResolverError>;
|
|
1298
|
+
//#endregion
|
|
1299
|
+
//#region src/utils/utils.d.ts
|
|
1300
|
+
/**
|
|
1301
|
+
* Convenience factory for a successful result.
|
|
1302
|
+
*/
|
|
1303
|
+
declare function OK(): Result<void, never>;
|
|
1304
|
+
declare function OK<T>(value: T): Result<T, never>;
|
|
1305
|
+
/**
|
|
1306
|
+
* Convenience factory for a failed result.
|
|
1307
|
+
*/
|
|
1308
|
+
declare const ERR: <E extends Error>(error: E) => Result<never, E>;
|
|
1309
|
+
type ErrorConstructor<T extends OMSSError> = new (message: string, options?: {
|
|
1310
|
+
cause?: Error;
|
|
1311
|
+
}) => T;
|
|
1312
|
+
/**
|
|
1313
|
+
* Validate a string is safe for use as a unique identifier (only lowercase letters, numbers, and hyphens).
|
|
1314
|
+
* @param value - The string to validate
|
|
1315
|
+
* @param name - The name of the identifier, for error messages
|
|
1316
|
+
* @param ErrorType - The error type to return if validation fails
|
|
1317
|
+
*/
|
|
1318
|
+
declare function validateSafeUniqueString<T extends OMSSError>(value: string, name: string, ErrorType: ErrorConstructor<T>): Result<void, T>;
|
|
1319
|
+
//#endregion
|
|
1320
|
+
//#region src/utils/regexp.d.ts
|
|
1321
|
+
declare const SAFE_UNIQUE_STRING: RegExp;
|
|
1322
|
+
//#endregion
|
|
1323
|
+
export { type AudioTrack, BaseProvider, BaseResolver, type BaseSource, type CleaningFunction, ERR, type EmittedSource, type EmittedSubtitle, type Extractor, type GatheredSources, type GetSourcesOptions, HookRegistry, HookService, type MiddlewareHandler, type MiddlewareOperationMap, type NonEmptyArray, OK, type OMSSConfig, type OMSSConfiguredPluginType, OMSSError, OMSSExtractorError, type OMSSHooks, type OMSSId, OMSSPluginError, type OMSSPluginOptions, type OMSSPluginType, type OMSSProvider, OMSSProviderError, type OMSSProviderResult, type OMSSResolver, OMSSResolverError, OMSSServer, OMSSServerError, OMSSSourceGatheringError, type ObjectToClean, type ParsedOMSSId, PluginState, type ProviderCustomEventPayload, type ProviderDebugPayload, type ProviderDonePayload, type ProviderErrorPayload, type ProviderHooks, type ProviderInfoPayload, type ProviderResult, type ProviderResultEmitter, type ProviderServiceMiddleware, type ProviderServiceOperations, type ProviderSourcePayload, type ProviderSourcesMeta, type ProviderSubtitlePayload, type ProviderWarnPayload, type ResolverExecutionContext, type ResolverMetadata, type ResolverResult, type Result, SAFE_UNIQUE_STRING, type Source, type SourceQuality, type SourceServiceMiddleware, type SourceServiceOperations, type SourceTypes, type Subtitle, type SubtitleFormat, type UnknownPluginType, type UnknownProvider, parseOMSSId, validateSafeUniqueString };
|
|
1324
|
+
//# sourceMappingURL=index.d.mts.map
|