ffc-pay-etl-framework 1.1.4-alpha.3 → 1.1.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,24 +1,14 @@
1
+ // @ts-nocheck
1
2
  const fs = require("fs");
2
3
  const { Transform } = require("stream");
3
4
  const { parse } = require("csv-parse");
4
- /**
5
- * @typedef {Object} CSVLoaderOptions
6
- * @property {string} path The path to the CSV file
7
- * @property {string[]} columns The columns in the CSV file
8
- */
9
- /**
10
- * @typedef {import('stream').Readable} Readable
11
- */
12
- /**
13
- * @typedef {Readable & {_columns?: string[], pump?: (csvLoader: Readable) => Readable}} CSVLoaderStream
14
- */
15
5
  /**
16
6
  *
17
- * @param {CSVLoaderOptions} options
18
- * @returns {CSVLoaderStream}
7
+ * @param {Object} options
8
+ * @param {String} options.path
9
+ * @returns StreamReader
19
10
  */
20
11
  function CSVLoader(options) {
21
- /** @type {CSVLoaderStream} */
22
12
  let csvLoader = fs.createReadStream(options.path);
23
13
  let lineCount = 1;
24
14
  csvLoader._columns = options.columns;
@@ -30,16 +20,13 @@ function CSVLoader(options) {
30
20
  writableObjectMode: true,
31
21
  emitClose: true,
32
22
  transform(chunk, _, callback) {
33
- console.log(`Processing chunk: ${JSON.stringify(chunk)}`);
34
23
  chunk["_columns"] = options.columns;
35
24
  chunk["_linecount"] = lineCount;
36
25
  lineCount += 1;
37
26
  // remove non-printable characters
38
27
  options.columns.forEach((_column, index) => {
39
28
  if (chunk[index]) {
40
- console.log(`Before: ${chunk[index].split('').map(char => char.charCodeAt(0)).join(', ')}`);
41
29
  chunk[index] = chunk[index].replace(/[\x00-\x1F\x7F-\x9F]/g, '');
42
- console.log(`After: ${chunk[index].split('').map(char => char.charCodeAt(0)).join(', ')}`);
43
30
  }
44
31
  });
45
32
  callback(null, chunk);
@@ -1,34 +1,12 @@
1
1
  /// <reference types="node" />
2
- export type CSVLoaderOptions = {
3
- /**
4
- * The path to the CSV file
5
- */
6
- path: string;
7
- /**
8
- * The columns in the CSV file
9
- */
10
- columns: string[];
11
- };
12
- export type Readable = import('stream').Readable;
13
- export type CSVLoaderStream = import("stream").Readable & {
14
- _columns?: string[];
15
- pump?: (csvLoader: Readable) => Readable;
16
- };
17
- /**
18
- * @typedef {Object} CSVLoaderOptions
19
- * @property {string} path The path to the CSV file
20
- * @property {string[]} columns The columns in the CSV file
21
- */
22
- /**
23
- * @typedef {import('stream').Readable} Readable
24
- */
25
- /**
26
- * @typedef {Readable & {_columns?: string[], pump?: (csvLoader: Readable) => Readable}} CSVLoaderStream
27
- */
28
2
  /**
29
3
  *
30
- * @param {CSVLoaderOptions} options
31
- * @returns {CSVLoaderStream}
4
+ * @param {Object} options
5
+ * @param {String} options.path
6
+ * @returns StreamReader
32
7
  */
33
- export function CSVLoader(options: CSVLoaderOptions): CSVLoaderStream;
8
+ export function CSVLoader(options: {
9
+ path: string;
10
+ }): fs.ReadStream;
11
+ import fs = require("fs");
34
12
  //# sourceMappingURL=csvloader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"csvloader.d.ts","sourceRoot":"","sources":["../../../../src/loaders/csvloader.js"],"names":[],"mappings":";;;;;UAMc,MAAM;;;;aACN,MAAM,EAAE;;uBAIT,OAAO,QAAQ,EAAE,QAAQ;;eAIF,MAAM,EAAE;uBAAqB,QAAQ,KAAK,QAAQ;;AAXtF;;;;GAIG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;;;GAIG;AACH,mCAHW,gBAAgB,GACd,eAAe,CAkC3B"}
1
+ {"version":3,"file":"csvloader.d.ts","sourceRoot":"","sources":["../../../../src/loaders/csvloader.js"],"names":[],"mappings":";AAKA;;;;;GAKG;AACH;IAH2B,IAAI;kBAgC9B"}
@@ -1,26 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ // @ts-nocheck
3
4
  const fs = require("fs");
4
5
  const { Transform } = require("stream");
5
6
  const { parse } = require("csv-parse");
6
- /**
7
- * @typedef {Object} CSVLoaderOptions
8
- * @property {string} path The path to the CSV file
9
- * @property {string[]} columns The columns in the CSV file
10
- */
11
- /**
12
- * @typedef {import('stream').Readable} Readable
13
- */
14
- /**
15
- * @typedef {Readable & {_columns?: string[], pump?: (csvLoader: Readable) => Readable}} CSVLoaderStream
16
- */
17
7
  /**
18
8
  *
19
- * @param {CSVLoaderOptions} options
20
- * @returns {CSVLoaderStream}
9
+ * @param {Object} options
10
+ * @param {String} options.path
11
+ * @returns StreamReader
21
12
  */
22
13
  function CSVLoader(options) {
23
- /** @type {CSVLoaderStream} */
24
14
  let csvLoader = fs.createReadStream(options.path);
25
15
  let lineCount = 1;
26
16
  csvLoader._columns = options.columns;
@@ -32,16 +22,13 @@ function CSVLoader(options) {
32
22
  writableObjectMode: true,
33
23
  emitClose: true,
34
24
  transform(chunk, _, callback) {
35
- console.log(`Processing chunk: ${JSON.stringify(chunk)}`);
36
25
  chunk["_columns"] = options.columns;
37
26
  chunk["_linecount"] = lineCount;
38
27
  lineCount += 1;
39
28
  // remove non-printable characters
40
29
  options.columns.forEach((_column, index) => {
41
30
  if (chunk[index]) {
42
- console.log(`Before: ${chunk[index].split('').map(char => char.charCodeAt(0)).join(', ')}`);
43
31
  chunk[index] = chunk[index].replace(/[\x00-\x1F\x7F-\x9F]/g, '');
44
- console.log(`After: ${chunk[index].split('').map(char => char.charCodeAt(0)).join(', ')}`);
45
32
  }
46
33
  });
47
34
  callback(null, chunk);
@@ -1,34 +1,12 @@
1
1
  /// <reference types="node" />
2
- export type CSVLoaderOptions = {
3
- /**
4
- * The path to the CSV file
5
- */
6
- path: string;
7
- /**
8
- * The columns in the CSV file
9
- */
10
- columns: string[];
11
- };
12
- export type Readable = import('stream').Readable;
13
- export type CSVLoaderStream = import("stream").Readable & {
14
- _columns?: string[];
15
- pump?: (csvLoader: Readable) => Readable;
16
- };
17
- /**
18
- * @typedef {Object} CSVLoaderOptions
19
- * @property {string} path The path to the CSV file
20
- * @property {string[]} columns The columns in the CSV file
21
- */
22
- /**
23
- * @typedef {import('stream').Readable} Readable
24
- */
25
- /**
26
- * @typedef {Readable & {_columns?: string[], pump?: (csvLoader: Readable) => Readable}} CSVLoaderStream
27
- */
28
2
  /**
29
3
  *
30
- * @param {CSVLoaderOptions} options
31
- * @returns {CSVLoaderStream}
4
+ * @param {Object} options
5
+ * @param {String} options.path
6
+ * @returns StreamReader
32
7
  */
33
- export function CSVLoader(options: CSVLoaderOptions): CSVLoaderStream;
8
+ export function CSVLoader(options: {
9
+ path: string;
10
+ }): fs.ReadStream;
11
+ import fs = require("fs");
34
12
  //# sourceMappingURL=csvloader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"csvloader.d.ts","sourceRoot":"","sources":["../../../../src/loaders/csvloader.js"],"names":[],"mappings":";;;;;UAMc,MAAM;;;;aACN,MAAM,EAAE;;uBAIT,OAAO,QAAQ,EAAE,QAAQ;;eAIF,MAAM,EAAE;uBAAqB,QAAQ,KAAK,QAAQ;;AAXtF;;;;GAIG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;;;GAIG;AACH,mCAHW,gBAAgB,GACd,eAAe,CAkC3B"}
1
+ {"version":3,"file":"csvloader.d.ts","sourceRoot":"","sources":["../../../../src/loaders/csvloader.js"],"names":[],"mappings":";AAKA;;;;;GAKG;AACH;IAH2B,IAAI;kBAgC9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ffc-pay-etl-framework",
3
- "version": "1.1.4-alpha.3",
3
+ "version": "1.1.4",
4
4
  "publisher": "Defra",
5
5
  "main": "dist/cjs/index.js",
6
6
  "private": false,