@whaly/connector-sdk 0.3.1 → 0.3.2

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/index.d.mts CHANGED
@@ -765,7 +765,7 @@ declare const createCellReference: (columnIndex: number, rowIndex: number) => st
765
765
  /**
766
766
  * Low-level Excel extractor: returns array of row records from a workbook.
767
767
  */
768
- declare const extractExcelRows: (localFilePath: string, conf: ExcelExtractionConfig) => Promise<Record<string, string>[]>;
768
+ declare const extractExcelRows: (localFilePath: string, conf: ExcelExtractionConfig) => Promise<Record<string, string | null>[]>;
769
769
  /**
770
770
  * Validates an Excel file configuration.
771
771
  */
@@ -777,7 +777,7 @@ declare const findAllMatchingConfigs: (filename: string, configs: ExcelExtractio
777
777
  /**
778
778
  * Creates an async generator from Excel data.
779
779
  */
780
- declare function createExcelGenerator(data: Record<string, string>[]): AsyncGenerator<Record<string, any>, void, unknown>;
780
+ declare function createExcelGenerator(data: Record<string, string | null>[]): AsyncGenerator<Record<string, any>, void, unknown>;
781
781
 
782
782
  /**
783
783
  * Builder pattern for creating Excel configurations.
package/dist/index.d.ts CHANGED
@@ -765,7 +765,7 @@ declare const createCellReference: (columnIndex: number, rowIndex: number) => st
765
765
  /**
766
766
  * Low-level Excel extractor: returns array of row records from a workbook.
767
767
  */
768
- declare const extractExcelRows: (localFilePath: string, conf: ExcelExtractionConfig) => Promise<Record<string, string>[]>;
768
+ declare const extractExcelRows: (localFilePath: string, conf: ExcelExtractionConfig) => Promise<Record<string, string | null>[]>;
769
769
  /**
770
770
  * Validates an Excel file configuration.
771
771
  */
@@ -777,7 +777,7 @@ declare const findAllMatchingConfigs: (filename: string, configs: ExcelExtractio
777
777
  /**
778
778
  * Creates an async generator from Excel data.
779
779
  */
780
- declare function createExcelGenerator(data: Record<string, string>[]): AsyncGenerator<Record<string, any>, void, unknown>;
780
+ declare function createExcelGenerator(data: Record<string, string | null>[]): AsyncGenerator<Record<string, any>, void, unknown>;
781
781
 
782
782
  /**
783
783
  * Builder pattern for creating Excel configurations.
package/dist/index.js CHANGED
@@ -2425,10 +2425,10 @@ var extractSingleSheetRows = async (fileName, conf) => {
2425
2425
  if (!variables) {
2426
2426
  throw new Error(`No variables extracted from filename, cannot extract derived field ${key}`);
2427
2427
  }
2428
- acc[key] = variables[column.variableName] || "";
2428
+ acc[key] = variables[column.variableName] || null;
2429
2429
  } else {
2430
2430
  const colIndex = excelColumnToIndex(column.column);
2431
- acc[key] = row[colIndex]?.v || "";
2431
+ acc[key] = row[colIndex]?.v || null;
2432
2432
  }
2433
2433
  return acc;
2434
2434
  }, {});
@@ -2653,7 +2653,8 @@ async function* rowGeneratorFromCsv(path2, fileConfig) {
2653
2653
  for (const key of configKeys) {
2654
2654
  const keyGenerator = fileConfig.fields[key.trim()];
2655
2655
  if (!keyGenerator) continue;
2656
- rowData[keyGenerator.key] = keyGenerator.valueTransformer ? keyGenerator.valueTransformer(row[key]) : row[key];
2656
+ const rawValue = keyGenerator.valueTransformer ? keyGenerator.valueTransformer(row[key]) : row[key];
2657
+ rowData[keyGenerator.key] = rawValue === "" ? null : rawValue;
2657
2658
  }
2658
2659
  yield rowData;
2659
2660
  } else {
@@ -2662,7 +2663,8 @@ async function* rowGeneratorFromCsv(path2, fileConfig) {
2662
2663
  for (let i = 0; i < rowKeys.length; i++) {
2663
2664
  const keyGenerator = fileConfig.fields[i];
2664
2665
  if (!keyGenerator) continue;
2665
- rowData[keyGenerator.key] = keyGenerator.valueTransformer ? keyGenerator.valueTransformer(row[i]) : row[i];
2666
+ const rawValue = keyGenerator.valueTransformer ? keyGenerator.valueTransformer(row[i]) : row[i];
2667
+ rowData[keyGenerator.key] = rawValue === "" ? null : rawValue;
2666
2668
  }
2667
2669
  yield rowData;
2668
2670
  }