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

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.
@@ -43,29 +43,15 @@ function PostgresDestination(options) {
43
43
  const [map] = mapping.filter(m => m.column === column);
44
44
  return map;
45
45
  }
46
- function isKeyWord(column) {
47
- return ['USER'].includes(column.toUpperCase());
48
- }
49
46
  function writeInsertStatement(chunk) {
50
47
  let statement = `INSERT INTO ${table} (${chunk._columns.map(column => {
51
48
  let mapping = getMappingForColumn(column);
52
- return mapping
53
- ?
54
- isKeyWord(mapping.targetColumn)
55
- ? `"${mapping.targetColumn}"`
56
- : mapping.targetColumn
57
- : isKeyWord(column)
58
- ? `"${mapping.column}"`
59
- : mapping.column;
49
+ return mapping ? mapping.targetColumn : column;
60
50
  })
61
51
  .join(",")}) VALUES (${chunk._columns.map((column, index) => {
62
52
  let mapping = getMappingForColumn(column);
63
53
  if (!mapping)
64
54
  debug('Mapping not found for column %s', column);
65
- if (mapping.targetType === "number" && (isNaN(chunk[index]) || chunk[index] === '')) {
66
- debug('Source data is not a number');
67
- return 0;
68
- }
69
55
  if (mapping.targetType === "varchar" || mapping.targetType === "char")
70
56
  return `'${chunk[index]}'`;
71
57
  return chunk[index] ? chunk[index] : 'null';
@@ -1 +1 @@
1
- {"version":3,"file":"postgresDestination.d.ts","sourceRoot":"","sources":["../../../../src/destinations/postgresDestination.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,6CAVG;IAAwB,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,aAAa;CACrC,aA6FF"}
1
+ {"version":3,"file":"postgresDestination.d.ts","sourceRoot":"","sources":["../../../../src/destinations/postgresDestination.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,6CAVG;IAAwB,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,aAAa;CACrC,aA+EF"}
@@ -44,29 +44,15 @@ function PostgresDestination(options) {
44
44
  const [map] = mapping.filter(m => m.column === column);
45
45
  return map;
46
46
  }
47
- function isKeyWord(column) {
48
- return ['USER'].includes(column.toUpperCase());
49
- }
50
47
  function writeInsertStatement(chunk) {
51
48
  let statement = `INSERT INTO ${table} (${chunk._columns.map(column => {
52
49
  let mapping = getMappingForColumn(column);
53
- return mapping
54
- ?
55
- isKeyWord(mapping.targetColumn)
56
- ? `"${mapping.targetColumn}"`
57
- : mapping.targetColumn
58
- : isKeyWord(column)
59
- ? `"${mapping.column}"`
60
- : mapping.column;
50
+ return mapping ? mapping.targetColumn : column;
61
51
  })
62
52
  .join(",")}) VALUES (${chunk._columns.map((column, index) => {
63
53
  let mapping = getMappingForColumn(column);
64
54
  if (!mapping)
65
55
  debug('Mapping not found for column %s', column);
66
- if (mapping.targetType === "number" && (isNaN(chunk[index]) || chunk[index] === '')) {
67
- debug('Source data is not a number');
68
- return 0;
69
- }
70
56
  if (mapping.targetType === "varchar" || mapping.targetType === "char")
71
57
  return `'${chunk[index]}'`;
72
58
  return chunk[index] ? chunk[index] : 'null';
@@ -1 +1 @@
1
- {"version":3,"file":"postgresDestination.d.ts","sourceRoot":"","sources":["../../../../src/destinations/postgresDestination.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,6CAVG;IAAwB,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,aAAa;CACrC,aA6FF"}
1
+ {"version":3,"file":"postgresDestination.d.ts","sourceRoot":"","sources":["../../../../src/destinations/postgresDestination.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,6CAVG;IAAwB,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,aAAa;CACrC,aA+EF"}
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.13",
4
4
  "publisher": "Defra",
5
5
  "main": "dist/cjs/index.js",
6
6
  "private": false,
@@ -24,6 +24,35 @@
24
24
  "jest": {
25
25
  "setupFiles": [
26
26
  "<rootDir>/jest/setEnvVars.js"
27
+ ],
28
+ "collectCoverage": true,
29
+ "collectCoverageFrom": [
30
+ "**/*.js",
31
+ "!**/*.test.js"
32
+ ],
33
+ "coverageDirectory": "test-output",
34
+ "coverageReporters": [
35
+ "text-summary",
36
+ "lcov"
37
+ ],
38
+ "coveragePathIgnorePatterns": [
39
+ "<rootDir>/node_modules/",
40
+ "<rootDir>/test-output/",
41
+ "<rootDir>/test/"
42
+ ],
43
+ "modulePathIgnorePatterns": [
44
+ "node_modules"
45
+ ],
46
+ "reporters": [
47
+ "default",
48
+ [
49
+ "jest-junit",
50
+ {
51
+ "suiteName": "jest tests",
52
+ "outputDirectory": "test-output",
53
+ "outputName": "junit.xml"
54
+ }
55
+ ]
27
56
  ]
28
57
  },
29
58
  "devDependencies": {
@@ -37,6 +66,7 @@
37
66
  "dependencies": {
38
67
  "@faker-js/faker": "^8.4.1",
39
68
  "csv": "^6.3.9",
69
+ "jest-junit": "16.0.0",
40
70
  "mariadb": "^3.3.1",
41
71
  "mysql2": "^3.10.3",
42
72
  "oracledb": "^6.5.1",