ffc-pay-etl-framework 0.0.8 → 0.0.9-alpha.4

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.
@@ -1,4 +1,6 @@
1
1
  // @ts-nocheck
2
+ const EventEmitter = require('node:events');
3
+ const util = require('node:util');
2
4
  const { RowMetaData } = require("./rowMetaData");
3
5
  const { compose } = require("node:stream");
4
6
  /**
@@ -14,6 +16,7 @@ const { compose } = require("node:stream");
14
16
  * @returns Etl
15
17
  */
16
18
  function Etl() {
19
+ EventEmitter.call(this);
17
20
  let self = this;
18
21
  self.validatorList = [];
19
22
  self.transformationList = [];
@@ -25,7 +28,10 @@ function Etl() {
25
28
  this.pump = () => {
26
29
  this.loader
27
30
  .pump(this.loader)
28
- .pipe(compose(RowMetaData(), ...self.validatorList, ...self.transformationList, ...self.destinationList));
31
+ .pipe(compose(RowMetaData(), ...self.validatorList, ...self.transformationList, ...self.destinationList)
32
+ // @ts-ignore
33
+ ).on('finish', (data) => self.emit('finish', data));
34
+ return self;
29
35
  };
30
36
  this.validator = (validator) => {
31
37
  self.validatorList.push(validator);
@@ -41,6 +47,7 @@ function Etl() {
41
47
  };
42
48
  return;
43
49
  }
50
+ util.inherits(Etl, EventEmitter);
44
51
  module.exports = {
45
52
  Etl
46
53
  };
@@ -17,7 +17,7 @@ export class Etl {
17
17
  transformationList: any[];
18
18
  destinationList: any[];
19
19
  loader: (loader: any) => this;
20
- pump: () => void;
20
+ pump: () => this;
21
21
  validator: (validator: any) => this;
22
22
  destination: (destination: any) => this;
23
23
  transform: (transform: any) => this;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/index.js"],"names":[],"mappings":";AAIA;;;;;;;GAOG;AAEH;;;GAGG;AACH,4BAwCC;;IAtCG,qBAAuB;IACvB,0BAA4B;IAC5B,uBAAyB;IAEzB,8BAGC;IAED,iBAWC;IAED,oCAGC;IAED,wCAGC;IAED,oCAGC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/index.js"],"names":[],"mappings":";AAMA;;;;;;;GAOG;AAEH;;;GAGG;AACH,4BA2CC;;IAxCG,qBAAuB;IACvB,0BAA4B;IAC5B,uBAAyB;IAEzB,8BAGC;IAED,iBAaC;IAED,oCAGC;IAED,wCAGC;IAED,oCAGC"}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  // @ts-nocheck
3
+ const EventEmitter = require('node:events');
4
+ const util = require('node:util');
3
5
  const { RowMetaData } = require("./rowMetaData");
4
6
  const { compose } = require("node:stream");
5
7
  /**
@@ -15,6 +17,7 @@ const { compose } = require("node:stream");
15
17
  * @returns Etl
16
18
  */
17
19
  function Etl() {
20
+ EventEmitter.call(this);
18
21
  let self = this;
19
22
  self.validatorList = [];
20
23
  self.transformationList = [];
@@ -26,7 +29,10 @@ function Etl() {
26
29
  this.pump = () => {
27
30
  this.loader
28
31
  .pump(this.loader)
29
- .pipe(compose(RowMetaData(), ...self.validatorList, ...self.transformationList, ...self.destinationList));
32
+ .pipe(compose(RowMetaData(), ...self.validatorList, ...self.transformationList, ...self.destinationList)
33
+ // @ts-ignore
34
+ ).on('finish', (data) => self.emit('finish', data));
35
+ return self;
30
36
  };
31
37
  this.validator = (validator) => {
32
38
  self.validatorList.push(validator);
@@ -42,6 +48,7 @@ function Etl() {
42
48
  };
43
49
  return;
44
50
  }
51
+ util.inherits(Etl, EventEmitter);
45
52
  module.exports = {
46
53
  Etl
47
54
  };
@@ -17,7 +17,7 @@ export class Etl {
17
17
  transformationList: any[];
18
18
  destinationList: any[];
19
19
  loader: (loader: any) => this;
20
- pump: () => void;
20
+ pump: () => this;
21
21
  validator: (validator: any) => this;
22
22
  destination: (destination: any) => this;
23
23
  transform: (transform: any) => this;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/index.js"],"names":[],"mappings":";AAIA;;;;;;;GAOG;AAEH;;;GAGG;AACH,4BAwCC;;IAtCG,qBAAuB;IACvB,0BAA4B;IAC5B,uBAAyB;IAEzB,8BAGC;IAED,iBAWC;IAED,oCAGC;IAED,wCAGC;IAED,oCAGC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/index.js"],"names":[],"mappings":";AAMA;;;;;;;GAOG;AAEH;;;GAGG;AACH,4BA2CC;;IAxCG,qBAAuB;IACvB,0BAA4B;IAC5B,uBAAyB;IAEzB,8BAGC;IAED,iBAaC;IAED,oCAGC;IAED,wCAGC;IAED,oCAGC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ffc-pay-etl-framework",
3
- "version": "0.0.8",
3
+ "version": "0.0.9-alpha.4",
4
4
  "publisher": "Defra",
5
5
  "main": "dist/cjs/index.js",
6
6
  "private": false,