-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.d.ts
240 lines (220 loc) · 8.34 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
// declare type Buffer = any;
declare module "kafka-connect" {
export interface KafkaHealthConfig {
thresholds?: {
consumer?: {
errors?: number;
lag?: number;
stallLag?: number;
minMessages?: number;
};
producer?: {
errors?: number;
minMessages?: number;
};
};
}
export interface CommonKafkaOptions {
"builtin.features"?: string;
"client.id"?: string;
"metadata.broker.list": string;
"message.max.bytes"?: number;
"message.copy.max.bytes"?: number;
"receive.message.max.bytes"?: number;
"max.in.flight.requests.per.connection"?: number;
"metadata.request.timeout.ms"?: number;
"topic.metadata.refresh.interval.ms"?: number;
"metadata.max.age.ms"?: number;
"topic.metadata.refresh.fast.interval.ms"?: number;
"topic.metadata.refresh.fast.cnt"?: number;
"topic.metadata.refresh.sparse"?: boolean;
"topic.blacklist"?: string;
"debug"?: string;
"socket.timeout.ms"?: number;
"socket.blocking.max.ms"?: number;
"socket.send.buffer.bytes"?: number;
"socket.receive.buffer.bytes"?: number;
"socket.keepalive.enable"?: boolean;
"socket.nagle.disable"?: boolean;
"socket.max.fails"?: number;
"broker.address.ttl"?: number;
"broker.address.family"?: "any" | "v4" | "v6";
"reconnect.backoff.jitter.ms"?: number;
"statistics.interval.ms"?: number;
"enabled_events"?: number;
"log_level"?: number;
"log.queue"?: boolean;
"log.thread.name"?: boolean;
"log.connection.close"?: boolean;
"internal.termination.signal"?: number;
"api.version.request"?: boolean;
"api.version.fallback.ms"?: number;
"broker.version.fallback"?: string;
"security.protocol"?: "plaintext" | "ssl" | "sasl_plaintext" | "sasl_ssl";
"ssl.cipher.suites"?: string;
"ssl.key.location"?: string;
"ssl.key.password"?: string;
"ssl.certificate.location"?: string;
"ssl.ca.location"?: string;
"ssl.crl.location"?: string;
"sasl.mechanisms"?: string;
"sasl.kerberos.service.name"?: string;
"sasl.kerberos.principal"?: string;
"sasl.kerberos.kinit.cmd"?: string;
"sasl.kerberos.keytab"?: string;
"sasl.kerberos.min.time.before.relogin"?: number;
"sasl.username"?: string;
"sasl.password"?: string;
"partition.assignment.strategy"?: string;
"session.timeout.ms"?: number;
"heartbeat.interval.ms"?: number;
"group.protocol.type"?: string;
"coordinator.query.interval.ms"?: number;
"event_cb"?: boolean;
"group.id": string;
"enable.auto.commit"?: boolean;
"auto.commit.interval.ms"?: number;
"enable.auto.offset.store"?: boolean;
"queued.min.messages"?: number;
"queued.max.messages.kbytes"?: number;
"fetch.wait.max.ms"?: number;
"fetch.message.max.bytes"?: number;
"fetch.min.bytes"?: number;
"fetch.error.backoff.ms"?: number;
"offset.store.method"?: "none" | "file" | "broker";
"enable.partition.eof"?: boolean;
"check.crcs"?: boolean;
"queue.buffering.max.messages"?: number;
"queue.buffering.max.kbytes"?: number;
"queue.buffering.max.ms"?: number;
"message.send.max.retries"?: number;
"retry.backoff.ms"?: number;
"compression.codec"?: "none" | "gzip" | "snappy" | "lz4";
"batch.num.messages"?: number;
"delivery.report.only.error"?: boolean;
}
export interface CombinedKafkaConfig {
kafkaHost?: string;
clientName?: string;
groupId?: string;
workerPerPartition?: number;
options?: {
sessionTimeout?: number;
protocol?: [string];
fromOffset?: string;
fetchMaxBytes?: number;
fetchMinBytes?: number;
fetchMaxWaitMs?: number;
heartbeatInterval?: number;
retryMinTimeout?: number;
requireAcks?: number;
ackTimeoutMs?: number;
partitionerType?: number;
};
health?: KafkaHealthConfig;
tconf?: {
"auto.commit.enable"?: boolean;
"auto.commit.interval.ms"?: number;
"auto.offset.reset"?: "smallest" | "earliest" | "beginning" | "largest" | "latest" | "end" | "error";
"offset.store.path"?: string;
"offset.store.sync.interval.ms"?: number;
"offset.store.method"?: "file" | "broker";
"consume.callback.max.messages"?: number;
"request.required.acks"?: number;
"request.timeout.ms"?: number;
"message.timeout.ms"?: number;
"produce.offset.report"?: boolean;
};
noptions?: CommonKafkaOptions;
}
export interface Properties {
kafka: CombinedKafkaConfig;
topic: string;
partitions: number;
maxTasks: number;
pollInterval: number;
produceKeyed: boolean;
produceCompressionType: number;
connector: any;
http: {
port: number;
middlewares: (req, res, next) => void[];
};
enableMetrics: boolean;
batch: any;
}
export class Converter {
fromConnectData(data: any, callback: (error: Error, data: any) => void);
toConnectData(message: any, callback: (error: Error, message: any) => void);
}
export class SourceBaseConverter extends Converter {}
export class SinkBaseConverter extends Converter {}
export class InjectableConverter extends Converter {}
export class ConverterFactory {
static createSinkSchemaConverter(tableSchema: any,
etlFunction: (messageValue: any, callback: (error: Error, newValue: any) => void) => void, schemaAttributes: any);
}
export class Record {
keySchema: any;
key: string | Buffer | null;
valueSchema: any;
value: any;
partition: number;
timestamp: string | null;
}
export class Connector {}
export class Task {}
export class SourceRecord extends Record {
topic: string;
}
export class SinkRecord extends Record {
kafkaOffset: number | null;
timestampType: string | null;
}
export class SourceConnector extends Connector {
start(properties: Properties, callback: (error: Error) => void);
taskConfigs(maxTasks: number, callback: (error: Error, taskConfig: any) => void);
stop();
}
export class SourceTask extends Task {
start(properties: any, callback: (error: Error) => void, parentConfig?: Properties);
poll(callback: (error: Error, records: SourceRecord[]) => void);
stop();
}
export class SinkConnector extends Connector {
start(properties: Properties, callback: (error: Error) => void);
taskConfigs(maxTasks: number, callback: (error: Error, taskConfig: any) => void);
stop();
}
export class SinkTask extends Task {
start(properties: any, callback: (error: Error) => void, parentConfig?: Properties);
put(records: SinkRecord[], callback: (error: Error) => void);
stop();
}
export interface ConfigStats {
kafka: {
consumerStats: any;
producerStats: any;
};
other: any;
}
export class Config {
constructor(config: Properties, Connector: new() => Connector, Task: new() => Task, Converters: new() => Converter[]);
convertTo(message, callback);
convertFrom(message, callback);
run();
close();
getStats(): Promise<ConfigStats>;
}
export class SinkConfig extends Config {
constructor(config: Properties, Connector: new() => Connector, Task: new() => Task, Converters: new() => Converter[], consumer: any);
run(): Promise<void>;
stop(shouldCommit: boolean): void;
}
export class SourceConfig extends Config {
constructor(config: Properties, Connector: new() => Connector, Task: new() => Task, Converters: new() => Converter[], producer: any);
run(): Promise<boolean>;
produce(record: SourceRecord): Promise<any>;
stop(): void;
}
}