@tmlmobilidade/writers 20251222.1647.5 → 20251229.932.45

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/dist/csv.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  interface CsvWriterOptions {
2
2
  batch_size?: number;
3
3
  include_bom?: boolean;
4
+ logs?: boolean;
4
5
  new_line_character?: string;
5
6
  }
6
7
  export declare class CsvWriter<T> {
@@ -8,6 +9,7 @@ export declare class CsvWriter<T> {
8
9
  private FILE_PATH;
9
10
  private INCLUDE_BOM;
10
11
  private INSTANCE_NAME;
12
+ private LOGS;
11
13
  private MAX_BATCH_SIZE;
12
14
  private NEW_LINE_CHARACTER;
13
15
  private SESSION_TIMER;
package/dist/csv.js CHANGED
@@ -10,6 +10,7 @@ export class CsvWriter {
10
10
  FILE_PATH = null;
11
11
  INCLUDE_BOM = false;
12
12
  INSTANCE_NAME = 'Unnamed Instance';
13
+ LOGS = true;
13
14
  MAX_BATCH_SIZE = 5000;
14
15
  NEW_LINE_CHARACTER = '\n';
15
16
  SESSION_TIMER = new Timer();
@@ -17,6 +18,7 @@ export class CsvWriter {
17
18
  constructor(instanceName, filePath, options) {
18
19
  this.INSTANCE_NAME = instanceName;
19
20
  this.FILE_PATH = filePath;
21
+ this.LOGS = options?.logs ?? true;
20
22
  if (options?.batch_size)
21
23
  this.MAX_BATCH_SIZE = options.batch_size;
22
24
  if (options?.new_line_character)
@@ -60,7 +62,8 @@ export class CsvWriter {
60
62
  //
61
63
  // Append the csv string to the file
62
64
  fs.appendFileSync(this.FILE_PATH, csvData, { encoding: 'utf-8', flush: true });
63
- Logger.info(`CSVWRITER [${this.INSTANCE_NAME}]: Flush | Length: ${this.CURRENT_BATCH_DATA.length} | File Path: ${this.FILE_PATH} (session: ${sssionTimerResult}) (flush: ${flushTimer.get()})`);
65
+ if (this.LOGS)
66
+ Logger.info(`CSVWRITER [${this.INSTANCE_NAME}]: Flush | Length: ${this.CURRENT_BATCH_DATA.length} | File Path: ${this.FILE_PATH} (session: ${sssionTimerResult}) (flush: ${flushTimer.get()})`);
64
67
  this.CURRENT_BATCH_DATA = [];
65
68
  //
66
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/writers",
3
- "version": "20251222.1647.5",
3
+ "version": "20251229.932.45",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"