1 | import type { IActionContext, Logger } from '@comunica/types';
|
2 | import type { Bus } from './Bus';
|
3 | import type { TestResult } from './TestResult';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | export declare abstract class Actor<I extends IAction, T extends IActorTest, O extends IActorOutput, TS = undefined> implements IActorArgs<I, T, O, TS> {
|
22 | readonly name: string;
|
23 | readonly bus: Bus<Actor<I, T, O, TS>, I, T, O, TS>;
|
24 | readonly beforeActors: Actor<I, T, O, TS>[];
|
25 | |
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | protected constructor(args: IActorArgs<I, T, O, TS>);
|
37 | /**
|
38 | * Get the logger from the given context.
|
39 | * @param {ActionContext} context An optional context.
|
40 | * @return {Logger} The logger or undefined.
|
41 | */
|
42 | static getContextLogger(context: IActionContext): Logger | undefined;
|
43 | |
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | abstract test(action: I): Promise<TestResult<T, TS>>;
|
51 | |
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 | abstract run(action: I, sideData: TS): Promise<O>;
|
61 | |
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | runObservable(action: I, sideData: TS): Promise<O>;
|
69 | protected getDefaultLogData(context: IActionContext, data?: (() => any)): any;
|
70 | protected logTrace(context: IActionContext, message: string, data?: (() => any)): void;
|
71 | protected logDebug(context: IActionContext, message: string, data?: (() => any)): void;
|
72 | protected logInfo(context: IActionContext, message: string, data?: (() => any)): void;
|
73 | protected logWarn(context: IActionContext, message: string, data?: (() => any)): void;
|
74 | protected logError(context: IActionContext, message: string, data?: (() => any)): void;
|
75 | protected logFatal(context: IActionContext, message: string, data?: (() => any)): void;
|
76 | }
|
77 | export interface IActorArgs<I extends IAction, T extends IActorTest, O extends IActorOutput, TS = undefined> {
|
78 | /**
|
79 | * The name for this actor.
|
80 | * @default {<rdf:subject>}
|
81 | */
|
82 | name: string;
|
83 | /**
|
84 | * The bus this actor subscribes to.
|
85 | */
|
86 | bus: Bus<Actor<I, T, O, TS>, I, T, O, TS>;
|
87 | /**
|
88 | * The message that will be configured in the bus for reporting failures.
|
89 | *
|
90 | * This message may be a template string that contains references to the executed `action`.
|
91 | * For example, the following templated string is allowed:
|
92 | * "RDF dereferencing failed: no actors could handle ${action.handle.mediaType}"
|
93 | */
|
94 | busFailMessage?: string;
|
95 | /**
|
96 | * Actor that must be registered in the bus before this actor.
|
97 | */
|
98 | beforeActors?: Actor<I, T, O, TS>[];
|
99 | }
|
100 | /**
|
101 | * Data interface for the type of action.
|
102 | */
|
103 | export interface IAction {
|
104 | /**
|
105 | * The input context that is passed through by actors.
|
106 | */
|
107 | context: IActionContext;
|
108 | }
|
109 | /**
|
110 | * Data interface for the type of an actor test result.
|
111 | */
|
112 | export interface IActorTest {
|
113 | }
|
114 | /**
|
115 | * Data interface for the type of an actor run result.
|
116 | */
|
117 | export interface IActorOutput {
|
118 | }
|
119 |
|
\ | No newline at end of file |