ffc-pay-etl-framework 1.1.0-alpha.8 → 1.1.0

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.
@@ -7,7 +7,7 @@ function isKeyWord(column) {
7
7
  }
8
8
  function getMappingForColumn(mapping, column) {
9
9
  if (mapping.length === 0) {
10
- return;
10
+ return {};
11
11
  }
12
12
  const [map] = mapping.filter(m => m.column === column);
13
13
  return map;
@@ -32,9 +32,6 @@ function writeInsertStatement(columnMapping, table, chunk) {
32
32
  })
33
33
  .join(",")}) VALUES (${chunk._columns.map((column, index) => {
34
34
  const mapping = getMappingForColumn(columnMapping, column);
35
- if (!mapping) {
36
- debug('Mapping not found for column %s', column);
37
- }
38
35
  if ((mapping === null || mapping === void 0 ? void 0 : mapping.targetType) === "number" && (isNaN(chunk[index]) || chunk[index] === '')) {
39
36
  debug('Source data is not a number');
40
37
  return 0;
@@ -63,12 +63,12 @@ function Etl() {
63
63
  this.destination = (destination, ...tasks) => {
64
64
  const connectionname = destination.getConnectionName();
65
65
  const connection = this.connectionList.filter(c => c.name === connectionname)[0];
66
- if (connection) {
67
- destination.setConnection(connection);
68
- }
69
- else if (destination.type === 'PostgresDestination') {
66
+ if (!connection && destination.type === 'PostgresDestination') {
70
67
  throw new Error(`No connection could be found with name ${connectionname}`);
71
68
  }
69
+ else {
70
+ destination.setConnection(connection);
71
+ }
72
72
  if (tasks) {
73
73
  for (const task of tasks) {
74
74
  task.setETL(self);
@@ -1 +1 @@
1
- {"version":3,"file":"postgresDestination.d.ts","sourceRoot":"","sources":["../../../../src/destinations/postgresDestination.js"],"names":[],"mappings":"AA0DA;;;;;;;;GAQG;AACH;IAN2B,KAAK;IACL,cAAc;IACd,OAAO;IACP,aAAa;cAgEvC;AAzGD,yFAiCC;AAnDD,gDAEC;AAED,oEAIC;AAED,2DAEC;AAED,uDAEC"}
1
+ {"version":3,"file":"postgresDestination.d.ts","sourceRoot":"","sources":["../../../../src/destinations/postgresDestination.js"],"names":[],"mappings":"AAuDA;;;;;;;;GAQG;AACH;IAN2B,KAAK;IACL,cAAc;IACd,OAAO;IACP,aAAa;cAgEvC;AAtGD,yFA8BC;AAhDD,gDAEC;AAED,oEAIC;AAED,2DAEC;AAED,uDAEC"}
@@ -9,7 +9,7 @@ function isKeyWord(column) {
9
9
  }
10
10
  function getMappingForColumn(mapping, column) {
11
11
  if (mapping.length === 0) {
12
- return;
12
+ return {};
13
13
  }
14
14
  const [map] = mapping.filter(m => m.column === column);
15
15
  return map;
@@ -34,9 +34,6 @@ function writeInsertStatement(columnMapping, table, chunk) {
34
34
  })
35
35
  .join(",")}) VALUES (${chunk._columns.map((column, index) => {
36
36
  const mapping = getMappingForColumn(columnMapping, column);
37
- if (!mapping) {
38
- debug('Mapping not found for column %s', column);
39
- }
40
37
  if (mapping?.targetType === "number" && (isNaN(chunk[index]) || chunk[index] === '')) {
41
38
  debug('Source data is not a number');
42
39
  return 0;
@@ -65,12 +65,12 @@ function Etl() {
65
65
  this.destination = (destination, ...tasks) => {
66
66
  const connectionname = destination.getConnectionName();
67
67
  const connection = this.connectionList.filter(c => c.name === connectionname)[0];
68
- if (connection) {
69
- destination.setConnection(connection);
70
- }
71
- else if (destination.type === 'PostgresDestination') {
68
+ if (!connection && destination.type === 'PostgresDestination') {
72
69
  throw new Error(`No connection could be found with name ${connectionname}`);
73
70
  }
71
+ else {
72
+ destination.setConnection(connection);
73
+ }
74
74
  if (tasks) {
75
75
  for (const task of tasks) {
76
76
  task.setETL(self);
@@ -1 +1 @@
1
- {"version":3,"file":"postgresDestination.d.ts","sourceRoot":"","sources":["../../../../src/destinations/postgresDestination.js"],"names":[],"mappings":"AA0DA;;;;;;;;GAQG;AACH;IAN2B,KAAK;IACL,cAAc;IACd,OAAO;IACP,aAAa;cAgEvC;AAzGD,yFAiCC;AAnDD,gDAEC;AAED,oEAIC;AAED,2DAEC;AAED,uDAEC"}
1
+ {"version":3,"file":"postgresDestination.d.ts","sourceRoot":"","sources":["../../../../src/destinations/postgresDestination.js"],"names":[],"mappings":"AAuDA;;;;;;;;GAQG;AACH;IAN2B,KAAK;IACL,cAAc;IACd,OAAO;IACP,aAAa;cAgEvC;AAtGD,yFA8BC;AAhDD,gDAEC;AAED,oEAIC;AAED,2DAEC;AAED,uDAEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ffc-pay-etl-framework",
3
- "version": "1.1.0-alpha.8",
3
+ "version": "1.1.0",
4
4
  "publisher": "Defra",
5
5
  "main": "dist/cjs/index.js",
6
6
  "private": false,