leo-connector-common 5.0.0 → 5.0.3

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.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # Documentation
2
- Quick Start Guide: https://github.com/LeoPlatform/Leo
3
-
4
- Documentation for the connectors can be found here: https://github.com/LeoPlatform/connectors
5
-
6
- # Support
1
+ # Documentation
2
+ Quick Start Guide: https://github.com/LeoPlatform/Leo
3
+
4
+ Documentation for the connectors can be found here: https://github.com/LeoPlatform/connectors
5
+
6
+ # Support
7
7
  Want to hire an expert, or need technical support? Reach out to the Leo team: https://leoinsights.com/contact
package/base.js CHANGED
@@ -1,45 +1,45 @@
1
- 'use strict';
2
-
3
- const dol = require('./dol');
4
- const sqlNibbler = require('./sql/nibbler');
5
- const snapshotter = require('./sql/snapshotter');
6
-
7
- module.exports = class Connector {
8
- constructor(params) {
9
- this.params = Object.assign({
10
- connect: undefined,
11
- checksum: undefined,
12
- listener: undefined
13
- }, params);
14
- }
15
-
16
- connect(config) {
17
- if (!config) {
18
- throw new Error('Missing database connection credentials');
19
- } else if (typeof config.query !== "function") {
20
- config = this.params.connect(config);
21
- }
22
-
23
- return config;
24
- }
25
-
26
- nibble(config, table, id, opts) {
27
- return sqlNibbler(this.connect(config), table, id, opts);
28
- }
29
-
30
- checksum(config) {
31
- return this.params.checksum(this.connect(config));
32
- }
33
-
34
- streamChanges(config, opts = {}) {
35
- return this.params.listener(config, opts);
36
- }
37
-
38
- domainObjectBuilder(config) {
39
- return new dol(this.connect(config));
40
- }
41
-
42
- snapshotter(config) {
43
- return new snapshotter(this.connect(config));
44
- }
45
- };
1
+ 'use strict';
2
+
3
+ const dol = require('./dol');
4
+ const sqlNibbler = require('./sql/nibbler');
5
+ const snapshotter = require('./sql/snapshotter');
6
+
7
+ module.exports = class Connector {
8
+ constructor(params) {
9
+ this.params = Object.assign({
10
+ connect: undefined,
11
+ checksum: undefined,
12
+ listener: undefined
13
+ }, params);
14
+ }
15
+
16
+ connect(config) {
17
+ if (!config) {
18
+ throw new Error('Missing database connection credentials');
19
+ } else if (typeof config.query !== "function") {
20
+ config = this.params.connect(config);
21
+ }
22
+
23
+ return config;
24
+ }
25
+
26
+ nibble(config, table, id, opts) {
27
+ return sqlNibbler(this.connect(config), table, id, opts);
28
+ }
29
+
30
+ checksum(config) {
31
+ return this.params.checksum(this.connect(config));
32
+ }
33
+
34
+ streamChanges(config, opts = {}) {
35
+ return this.params.listener(config, opts);
36
+ }
37
+
38
+ domainObjectBuilder(config) {
39
+ return new dol(this.connect(config));
40
+ }
41
+
42
+ snapshotter(config) {
43
+ return new snapshotter(this.connect(config));
44
+ }
45
+ };