-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
49 lines (36 loc) · 1.38 KB
/
index.js
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
"use strict";
const BigQuerySourceConfig = require("./lib/BigQuerySourceConfig.js");
const BigQuerySinkConfig = require("./lib/BigQuerySinkConfig.js");
const BigQuerySourceConnector = require("./lib/source/BigQuerySourceConnector.js");
const BigQuerySinkConnector = require("./lib/sink/BigQuerySinkConnector.js");
const BigQuerySourceTask = require("./lib/source/BigQuerySourceTask.js");
const BigQuerySinkTask = require("./lib/sink/BigQuerySinkTask.js");
const JsonConverter = require("./lib/utils/JsonConverter.js");
const ConverterFactory = require("./lib/utils/ConverterFactory.js");
const runSourceConnector = (properties, converters = [], onError = null) => {
const config = new BigQuerySourceConfig(properties,
BigQuerySourceConnector,
BigQuerySourceTask, [JsonConverter].concat(converters));
if (onError) {
config.on("error", onError);
}
return config.run().then(() => {
return config;
});
};
const runSinkConnector = (properties, converters = [], onError = null) => {
const config = new BigQuerySinkConfig(properties,
BigQuerySinkConnector,
BigQuerySinkTask, [JsonConverter].concat(converters));
if (onError) {
config.on("error", onError);
}
return config.run().then(() => {
return config;
});
};
module.exports = {
runSourceConnector,
runSinkConnector,
ConverterFactory
};