-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.js
49 lines (36 loc) · 1.4 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 SequelizeSourceConfig = require("./lib/SequelizeSourceConfig.js");
const SequelizeSinkConfig = require("./lib/SequelizeSinkConfig.js");
const SequelizeSourceConnector = require("./lib/source/SequelizeSourceConnector.js");
const SequelizeSinkConnector = require("./lib/sink/SequelizeSinkConnector.js");
const SequelizeSourceTask = require("./lib/source/SequelizeSourceTask.js");
const SequelizeSinkTask = require("./lib/sink/SequelizeSinkTask.js");
const JsonConverter = require("./lib/utils/JsonConverter.js");
const ConverterFactory = require("./lib/utils/ConverterFactory.js");
const runSourceConnector = (properties, converters = [], onError = null) => {
const config = new SequelizeSourceConfig(properties,
SequelizeSourceConnector,
SequelizeSourceTask, [JsonConverter].concat(converters));
if (onError) {
config.on("error", onError);
}
return config.run().then(() => {
return config;
});
};
const runSinkConnector = (properties, converters = [], onError = null) => {
const config = new SequelizeSinkConfig(properties,
SequelizeSinkConnector,
SequelizeSinkTask, [JsonConverter].concat(converters));
if (onError) {
config.on("error", onError);
}
return config.run().then(() => {
return config;
});
};
module.exports = {
runSourceConnector,
runSinkConnector,
ConverterFactory
};