@kubb/core 2.0.0-beta.10 → 2.0.0-beta.11

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.
@@ -0,0 +1,32 @@
1
+ declare class EventEmitter<TEvents extends Record<string, any>> {
2
+ #private;
3
+ constructor();
4
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
5
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
6
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
7
+ removeAll(): void;
8
+ }
9
+
10
+ type QueueJob<T = unknown> = {
11
+ (...args: unknown[]): Promise<T | void>;
12
+ };
13
+ type RunOptions = {
14
+ controller?: AbortController;
15
+ name?: string;
16
+ description?: string;
17
+ };
18
+ type Events = {
19
+ jobDone: [result: unknown];
20
+ jobFailed: [error: Error];
21
+ };
22
+ declare class Queue {
23
+ #private;
24
+ readonly eventEmitter: EventEmitter<Events>;
25
+ constructor(maxParallel: number, debug?: boolean);
26
+ run<T>(job: QueueJob<T>, options?: RunOptions): Promise<T>;
27
+ runSync<T>(job: QueueJob<T>, options?: RunOptions): void;
28
+ get hasJobs(): boolean;
29
+ get count(): number;
30
+ }
31
+
32
+ export { EventEmitter as E, Queue as Q, type QueueJob as a };
@@ -0,0 +1,32 @@
1
+ declare class EventEmitter<TEvents extends Record<string, any>> {
2
+ #private;
3
+ constructor();
4
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
5
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
6
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
7
+ removeAll(): void;
8
+ }
9
+
10
+ type QueueJob<T = unknown> = {
11
+ (...args: unknown[]): Promise<T | void>;
12
+ };
13
+ type RunOptions = {
14
+ controller?: AbortController;
15
+ name?: string;
16
+ description?: string;
17
+ };
18
+ type Events = {
19
+ jobDone: [result: unknown];
20
+ jobFailed: [error: Error];
21
+ };
22
+ declare class Queue {
23
+ #private;
24
+ readonly eventEmitter: EventEmitter<Events>;
25
+ constructor(maxParallel: number, debug?: boolean);
26
+ run<T>(job: QueueJob<T>, options?: RunOptions): Promise<T>;
27
+ runSync<T>(job: QueueJob<T>, options?: RunOptions): void;
28
+ get hasJobs(): boolean;
29
+ get count(): number;
30
+ }
31
+
32
+ export { EventEmitter as E, Queue as Q, type QueueJob as a };