@solidstarters/solid-core 1.2.90 → 1.2.91

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidstarters/solid-core",
3
- "version": "1.2.90",
3
+ "version": "1.2.91",
4
4
  "description": "This module is a NestJS module containing all the required core providers required by a Solid application",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -42,12 +42,14 @@ export class ExcelService {
42
42
  const worksheet = workbook.addWorksheet('Data');
43
43
 
44
44
  // If headers are provided, use them;
45
+ let isHeaderWritten = false;
45
46
  if (headers.length > 0) {
46
47
  worksheet.columns = headers.map((header) => ({
47
48
  header: header, // Convert header names to uppercase
48
49
  key: header,
49
50
  width: 20, // Set column width
50
51
  }));
52
+ isHeaderWritten = true; // Mark headers as written
51
53
  }
52
54
 
53
55
  // ✅ If no data loader provided, write only headers and finish
@@ -66,6 +68,15 @@ export class ExcelService {
66
68
  const records = await getDataRecords(chunkIndex, chunkSize); // Fetch chunked data
67
69
  if (records.length === 0) break; // Stop if no more records
68
70
 
71
+ if (!isHeaderWritten) { // Falback because without columns being set, ExcelJS won't write data correctly
72
+ worksheet.columns = Object.keys(records[0]).map((key) => ({
73
+ header: key.toUpperCase(),
74
+ key: key,
75
+ width: 20,
76
+ }));
77
+ isHeaderWritten = true;
78
+ }
79
+
69
80
  records.forEach((item) => {
70
81
  worksheet.addRow(item).commit(); // Commit each row immediately
71
82
  });