lula2 0.6.1 → 0.6.2-nightly.0
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/README.md +1 -1
- package/dist/_app/immutable/chunks/{CIUsQQm2.js → BUfq-T6h.js} +1 -1
- package/dist/_app/immutable/chunks/{C43miErR.js → DI_Sccr_.js} +1 -1
- package/dist/_app/immutable/chunks/{BaNghdtJ.js → q9vWi9bR.js} +1 -1
- package/dist/_app/immutable/entry/{app.DW8m8_kr.js → app.CnxVvuMI.js} +2 -2
- package/dist/_app/immutable/entry/start.C9ziWNNi.js +1 -0
- package/dist/_app/immutable/nodes/{0.DIHiDqse.js → 0.DtrfNNJZ.js} +1 -1
- package/dist/_app/immutable/nodes/{1.DyuqnWpt.js → 1.cJbXpcot.js} +1 -1
- package/dist/_app/immutable/nodes/{2.DCVMr5cE.js → 2.7WuXOZ7r.js} +1 -1
- package/dist/_app/immutable/nodes/{3.CRa3NPUY.js → 3.C-tDHMG0.js} +1 -1
- package/dist/_app/immutable/nodes/{4.BIaoIDIb.js → 4.Ba16bKkW.js} +1 -1
- package/dist/_app/version.json +1 -1
- package/dist/cli/commands/ui.js +26 -71
- package/dist/cli/server/index.js +26 -71
- package/dist/cli/server/server.js +26 -71
- package/dist/cli/server/spreadsheetRoutes.js +26 -71
- package/dist/cli/server/websocketServer.js +27 -72
- package/dist/index.html +6 -6
- package/dist/index.js +26 -71
- package/package.json +21 -22
- package/dist/_app/immutable/entry/start.BstRoW_s.js +0 -1
|
@@ -2843,7 +2843,7 @@ __export(spreadsheetRoutes_exports, {
|
|
|
2843
2843
|
});
|
|
2844
2844
|
import crypto from "crypto";
|
|
2845
2845
|
import { parse as parseCSVSync } from "csv-parse/sync";
|
|
2846
|
-
import
|
|
2846
|
+
import * as XLSX from "xlsx-republish";
|
|
2847
2847
|
import express from "express";
|
|
2848
2848
|
import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
2849
2849
|
import { glob } from "glob";
|
|
@@ -2938,20 +2938,13 @@ async function parseUploadedFile(file) {
|
|
|
2938
2938
|
const csvContent = file.buffer.toString("utf-8");
|
|
2939
2939
|
rawData = parseCSV(csvContent);
|
|
2940
2940
|
} else {
|
|
2941
|
-
const workbook =
|
|
2942
|
-
const
|
|
2943
|
-
|
|
2944
|
-
const worksheet = workbook.worksheets[0];
|
|
2945
|
-
if (!worksheet) {
|
|
2941
|
+
const workbook = XLSX.read(file.buffer, { type: "buffer" });
|
|
2942
|
+
const worksheetName = workbook.SheetNames[0];
|
|
2943
|
+
if (!worksheetName) {
|
|
2946
2944
|
throw new Error("No worksheet found in file");
|
|
2947
2945
|
}
|
|
2948
|
-
worksheet
|
|
2949
|
-
|
|
2950
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
2951
|
-
rowData[colNumber - 1] = cell.value;
|
|
2952
|
-
});
|
|
2953
|
-
rawData[rowNumber - 1] = rowData;
|
|
2954
|
-
});
|
|
2946
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
2947
|
+
rawData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
2955
2948
|
}
|
|
2956
2949
|
return rawData;
|
|
2957
2950
|
}
|
|
@@ -3522,43 +3515,20 @@ async function exportAsExcelWithMapping(controls, metadata, columnMappings, res)
|
|
|
3522
3515
|
});
|
|
3523
3516
|
return exportControl;
|
|
3524
3517
|
});
|
|
3525
|
-
const wb =
|
|
3526
|
-
const ws =
|
|
3527
|
-
|
|
3528
|
-
ws.columns = headers.map((header) => ({
|
|
3529
|
-
header,
|
|
3530
|
-
key: header,
|
|
3531
|
-
width: Math.min(
|
|
3532
|
-
Math.max(
|
|
3533
|
-
header.length,
|
|
3534
|
-
...worksheetData.map((row) => String(row[header] || "").length)
|
|
3535
|
-
) + 2,
|
|
3536
|
-
50
|
|
3537
|
-
)
|
|
3538
|
-
// Auto-size with max width of 50
|
|
3539
|
-
}));
|
|
3540
|
-
worksheetData.forEach((row) => {
|
|
3541
|
-
ws.addRow(row);
|
|
3542
|
-
});
|
|
3543
|
-
ws.getRow(1).font = { bold: true };
|
|
3544
|
-
ws.getRow(1).fill = {
|
|
3545
|
-
type: "pattern",
|
|
3546
|
-
pattern: "solid",
|
|
3547
|
-
fgColor: { argb: "FFE0E0E0" }
|
|
3548
|
-
};
|
|
3518
|
+
const wb = XLSX.utils.book_new();
|
|
3519
|
+
const ws = XLSX.utils.json_to_sheet(worksheetData);
|
|
3520
|
+
XLSX.utils.book_append_sheet(wb, ws, "Controls");
|
|
3549
3521
|
if (metadata) {
|
|
3550
|
-
const metaSheet = wb.addWorksheet("Metadata");
|
|
3551
3522
|
const cleanMetadata = { ...metadata };
|
|
3552
3523
|
delete cleanMetadata.fieldSchema;
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
});
|
|
3524
|
+
const metadataArray = Object.entries(cleanMetadata).map(([key, value]) => ({
|
|
3525
|
+
Property: key,
|
|
3526
|
+
Value: String(value)
|
|
3527
|
+
}));
|
|
3528
|
+
const metaSheet = XLSX.utils.json_to_sheet(metadataArray);
|
|
3529
|
+
XLSX.utils.book_append_sheet(wb, metaSheet, "Metadata");
|
|
3560
3530
|
}
|
|
3561
|
-
const buffer =
|
|
3531
|
+
const buffer = XLSX.write(wb, { type: "buffer", bookType: "xlsx" });
|
|
3562
3532
|
const fileName = `${metadata?.name || "controls"}_export_${Date.now()}.xlsx`;
|
|
3563
3533
|
res.setHeader(
|
|
3564
3534
|
"Content-Type",
|
|
@@ -3800,21 +3770,14 @@ var init_spreadsheetRoutes = __esm({
|
|
|
3800
3770
|
rows = parseCSV(csvContent);
|
|
3801
3771
|
sheets = ["Sheet1"];
|
|
3802
3772
|
} else {
|
|
3803
|
-
const workbook =
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
const worksheet = workbook.worksheets[0];
|
|
3808
|
-
if (!worksheet) {
|
|
3773
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
3774
|
+
sheets = workbook.SheetNames;
|
|
3775
|
+
const worksheetName = workbook.SheetNames[0];
|
|
3776
|
+
if (!worksheetName) {
|
|
3809
3777
|
return res.status(400).json({ error: "No worksheet found in file" });
|
|
3810
3778
|
}
|
|
3811
|
-
worksheet
|
|
3812
|
-
|
|
3813
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
3814
|
-
rowData[colNumber - 1] = cell.value;
|
|
3815
|
-
});
|
|
3816
|
-
rows.push(rowData);
|
|
3817
|
-
});
|
|
3779
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
3780
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
3818
3781
|
}
|
|
3819
3782
|
const headerCandidates = rows.slice(0, 5).map((row, index) => ({
|
|
3820
3783
|
row: index + 1,
|
|
@@ -3846,20 +3809,12 @@ var init_spreadsheetRoutes = __esm({
|
|
|
3846
3809
|
const csvContent = req.file.buffer.toString("utf-8");
|
|
3847
3810
|
rows = parseCSV(csvContent);
|
|
3848
3811
|
} else {
|
|
3849
|
-
const workbook =
|
|
3850
|
-
|
|
3851
|
-
await workbook.xlsx.load(buffer);
|
|
3852
|
-
const worksheet = workbook.getWorksheet(sheetName);
|
|
3853
|
-
if (!worksheet) {
|
|
3812
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
3813
|
+
if (!workbook.SheetNames.includes(sheetName)) {
|
|
3854
3814
|
return res.status(400).json({ error: `Sheet "${sheetName}" not found` });
|
|
3855
3815
|
}
|
|
3856
|
-
worksheet
|
|
3857
|
-
|
|
3858
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
3859
|
-
rowData[colNumber - 1] = cell.value;
|
|
3860
|
-
});
|
|
3861
|
-
rows.push(rowData);
|
|
3862
|
-
});
|
|
3816
|
+
const worksheet = workbook.Sheets[sheetName];
|
|
3817
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
3863
3818
|
}
|
|
3864
3819
|
const headerRowIndex = parseInt(headerRow) - 1;
|
|
3865
3820
|
const headers = rows[headerRowIndex] || [];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// cli/server/spreadsheetRoutes.ts
|
|
2
2
|
import crypto from "crypto";
|
|
3
3
|
import { parse as parseCSVSync } from "csv-parse/sync";
|
|
4
|
-
import
|
|
4
|
+
import * as XLSX from "xlsx-republish";
|
|
5
5
|
import express from "express";
|
|
6
6
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
7
7
|
import { glob } from "glob";
|
|
@@ -140,20 +140,13 @@ async function parseUploadedFile(file) {
|
|
|
140
140
|
const csvContent = file.buffer.toString("utf-8");
|
|
141
141
|
rawData = parseCSV(csvContent);
|
|
142
142
|
} else {
|
|
143
|
-
const workbook =
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
const worksheet = workbook.worksheets[0];
|
|
147
|
-
if (!worksheet) {
|
|
143
|
+
const workbook = XLSX.read(file.buffer, { type: "buffer" });
|
|
144
|
+
const worksheetName = workbook.SheetNames[0];
|
|
145
|
+
if (!worksheetName) {
|
|
148
146
|
throw new Error("No worksheet found in file");
|
|
149
147
|
}
|
|
150
|
-
worksheet
|
|
151
|
-
|
|
152
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
153
|
-
rowData[colNumber - 1] = cell.value;
|
|
154
|
-
});
|
|
155
|
-
rawData[rowNumber - 1] = rowData;
|
|
156
|
-
});
|
|
148
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
149
|
+
rawData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
157
150
|
}
|
|
158
151
|
return rawData;
|
|
159
152
|
}
|
|
@@ -819,43 +812,20 @@ async function exportAsExcelWithMapping(controls, metadata, columnMappings, res)
|
|
|
819
812
|
});
|
|
820
813
|
return exportControl;
|
|
821
814
|
});
|
|
822
|
-
const wb =
|
|
823
|
-
const ws =
|
|
824
|
-
|
|
825
|
-
ws.columns = headers.map((header) => ({
|
|
826
|
-
header,
|
|
827
|
-
key: header,
|
|
828
|
-
width: Math.min(
|
|
829
|
-
Math.max(
|
|
830
|
-
header.length,
|
|
831
|
-
...worksheetData.map((row) => String(row[header] || "").length)
|
|
832
|
-
) + 2,
|
|
833
|
-
50
|
|
834
|
-
)
|
|
835
|
-
// Auto-size with max width of 50
|
|
836
|
-
}));
|
|
837
|
-
worksheetData.forEach((row) => {
|
|
838
|
-
ws.addRow(row);
|
|
839
|
-
});
|
|
840
|
-
ws.getRow(1).font = { bold: true };
|
|
841
|
-
ws.getRow(1).fill = {
|
|
842
|
-
type: "pattern",
|
|
843
|
-
pattern: "solid",
|
|
844
|
-
fgColor: { argb: "FFE0E0E0" }
|
|
845
|
-
};
|
|
815
|
+
const wb = XLSX.utils.book_new();
|
|
816
|
+
const ws = XLSX.utils.json_to_sheet(worksheetData);
|
|
817
|
+
XLSX.utils.book_append_sheet(wb, ws, "Controls");
|
|
846
818
|
if (metadata) {
|
|
847
|
-
const metaSheet = wb.addWorksheet("Metadata");
|
|
848
819
|
const cleanMetadata = { ...metadata };
|
|
849
820
|
delete cleanMetadata.fieldSchema;
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
});
|
|
821
|
+
const metadataArray = Object.entries(cleanMetadata).map(([key, value]) => ({
|
|
822
|
+
Property: key,
|
|
823
|
+
Value: String(value)
|
|
824
|
+
}));
|
|
825
|
+
const metaSheet = XLSX.utils.json_to_sheet(metadataArray);
|
|
826
|
+
XLSX.utils.book_append_sheet(wb, metaSheet, "Metadata");
|
|
857
827
|
}
|
|
858
|
-
const buffer =
|
|
828
|
+
const buffer = XLSX.write(wb, { type: "buffer", bookType: "xlsx" });
|
|
859
829
|
const fileName = `${metadata?.name || "controls"}_export_${Date.now()}.xlsx`;
|
|
860
830
|
res.setHeader(
|
|
861
831
|
"Content-Type",
|
|
@@ -990,21 +960,14 @@ router.post("/parse-excel", upload.single("file"), async (req, res) => {
|
|
|
990
960
|
rows = parseCSV(csvContent);
|
|
991
961
|
sheets = ["Sheet1"];
|
|
992
962
|
} else {
|
|
993
|
-
const workbook =
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
const worksheet = workbook.worksheets[0];
|
|
998
|
-
if (!worksheet) {
|
|
963
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
964
|
+
sheets = workbook.SheetNames;
|
|
965
|
+
const worksheetName = workbook.SheetNames[0];
|
|
966
|
+
if (!worksheetName) {
|
|
999
967
|
return res.status(400).json({ error: "No worksheet found in file" });
|
|
1000
968
|
}
|
|
1001
|
-
worksheet
|
|
1002
|
-
|
|
1003
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
1004
|
-
rowData[colNumber - 1] = cell.value;
|
|
1005
|
-
});
|
|
1006
|
-
rows.push(rowData);
|
|
1007
|
-
});
|
|
969
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
970
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
1008
971
|
}
|
|
1009
972
|
const headerCandidates = rows.slice(0, 5).map((row, index) => ({
|
|
1010
973
|
row: index + 1,
|
|
@@ -1036,20 +999,12 @@ router.post("/parse-excel-sheet", upload.single("file"), async (req, res) => {
|
|
|
1036
999
|
const csvContent = req.file.buffer.toString("utf-8");
|
|
1037
1000
|
rows = parseCSV(csvContent);
|
|
1038
1001
|
} else {
|
|
1039
|
-
const workbook =
|
|
1040
|
-
|
|
1041
|
-
await workbook.xlsx.load(buffer);
|
|
1042
|
-
const worksheet = workbook.getWorksheet(sheetName);
|
|
1043
|
-
if (!worksheet) {
|
|
1002
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
1003
|
+
if (!workbook.SheetNames.includes(sheetName)) {
|
|
1044
1004
|
return res.status(400).json({ error: `Sheet "${sheetName}" not found` });
|
|
1045
1005
|
}
|
|
1046
|
-
worksheet
|
|
1047
|
-
|
|
1048
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
1049
|
-
rowData[colNumber - 1] = cell.value;
|
|
1050
|
-
});
|
|
1051
|
-
rows.push(rowData);
|
|
1052
|
-
});
|
|
1006
|
+
const worksheet = workbook.Sheets[sheetName];
|
|
1007
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
1053
1008
|
}
|
|
1054
1009
|
const headerRowIndex = parseInt(headerRow) - 1;
|
|
1055
1010
|
const headers = rows[headerRowIndex] || [];
|
|
@@ -1290,7 +1290,7 @@ __export(spreadsheetRoutes_exports, {
|
|
|
1290
1290
|
});
|
|
1291
1291
|
import crypto from "crypto";
|
|
1292
1292
|
import { parse as parseCSVSync } from "csv-parse/sync";
|
|
1293
|
-
import
|
|
1293
|
+
import * as XLSX from "xlsx-republish";
|
|
1294
1294
|
import express from "express";
|
|
1295
1295
|
import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
1296
1296
|
import { glob } from "glob";
|
|
@@ -1385,20 +1385,13 @@ async function parseUploadedFile(file) {
|
|
|
1385
1385
|
const csvContent = file.buffer.toString("utf-8");
|
|
1386
1386
|
rawData = parseCSV(csvContent);
|
|
1387
1387
|
} else {
|
|
1388
|
-
const workbook =
|
|
1389
|
-
const
|
|
1390
|
-
|
|
1391
|
-
const worksheet = workbook.worksheets[0];
|
|
1392
|
-
if (!worksheet) {
|
|
1388
|
+
const workbook = XLSX.read(file.buffer, { type: "buffer" });
|
|
1389
|
+
const worksheetName = workbook.SheetNames[0];
|
|
1390
|
+
if (!worksheetName) {
|
|
1393
1391
|
throw new Error("No worksheet found in file");
|
|
1394
1392
|
}
|
|
1395
|
-
worksheet
|
|
1396
|
-
|
|
1397
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
1398
|
-
rowData[colNumber - 1] = cell.value;
|
|
1399
|
-
});
|
|
1400
|
-
rawData[rowNumber - 1] = rowData;
|
|
1401
|
-
});
|
|
1393
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
1394
|
+
rawData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
1402
1395
|
}
|
|
1403
1396
|
return rawData;
|
|
1404
1397
|
}
|
|
@@ -1969,43 +1962,20 @@ async function exportAsExcelWithMapping(controls, metadata, columnMappings, res)
|
|
|
1969
1962
|
});
|
|
1970
1963
|
return exportControl;
|
|
1971
1964
|
});
|
|
1972
|
-
const wb =
|
|
1973
|
-
const ws =
|
|
1974
|
-
|
|
1975
|
-
ws.columns = headers.map((header) => ({
|
|
1976
|
-
header,
|
|
1977
|
-
key: header,
|
|
1978
|
-
width: Math.min(
|
|
1979
|
-
Math.max(
|
|
1980
|
-
header.length,
|
|
1981
|
-
...worksheetData.map((row) => String(row[header] || "").length)
|
|
1982
|
-
) + 2,
|
|
1983
|
-
50
|
|
1984
|
-
)
|
|
1985
|
-
// Auto-size with max width of 50
|
|
1986
|
-
}));
|
|
1987
|
-
worksheetData.forEach((row) => {
|
|
1988
|
-
ws.addRow(row);
|
|
1989
|
-
});
|
|
1990
|
-
ws.getRow(1).font = { bold: true };
|
|
1991
|
-
ws.getRow(1).fill = {
|
|
1992
|
-
type: "pattern",
|
|
1993
|
-
pattern: "solid",
|
|
1994
|
-
fgColor: { argb: "FFE0E0E0" }
|
|
1995
|
-
};
|
|
1965
|
+
const wb = XLSX.utils.book_new();
|
|
1966
|
+
const ws = XLSX.utils.json_to_sheet(worksheetData);
|
|
1967
|
+
XLSX.utils.book_append_sheet(wb, ws, "Controls");
|
|
1996
1968
|
if (metadata) {
|
|
1997
|
-
const metaSheet = wb.addWorksheet("Metadata");
|
|
1998
1969
|
const cleanMetadata = { ...metadata };
|
|
1999
1970
|
delete cleanMetadata.fieldSchema;
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
}
|
|
2008
|
-
const buffer = await wb.xlsx.writeBuffer();
|
|
1971
|
+
const metadataArray = Object.entries(cleanMetadata).map(([key, value]) => ({
|
|
1972
|
+
Property: key,
|
|
1973
|
+
Value: String(value)
|
|
1974
|
+
}));
|
|
1975
|
+
const metaSheet = XLSX.utils.json_to_sheet(metadataArray);
|
|
1976
|
+
XLSX.utils.book_append_sheet(wb, metaSheet, "Metadata");
|
|
1977
|
+
}
|
|
1978
|
+
const buffer = XLSX.write(wb, { type: "buffer", bookType: "xlsx" });
|
|
2009
1979
|
const fileName = `${metadata?.name || "controls"}_export_${Date.now()}.xlsx`;
|
|
2010
1980
|
res.setHeader(
|
|
2011
1981
|
"Content-Type",
|
|
@@ -2247,21 +2217,14 @@ var init_spreadsheetRoutes = __esm({
|
|
|
2247
2217
|
rows = parseCSV(csvContent);
|
|
2248
2218
|
sheets = ["Sheet1"];
|
|
2249
2219
|
} else {
|
|
2250
|
-
const workbook =
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
const worksheet = workbook.worksheets[0];
|
|
2255
|
-
if (!worksheet) {
|
|
2220
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
2221
|
+
sheets = workbook.SheetNames;
|
|
2222
|
+
const worksheetName = workbook.SheetNames[0];
|
|
2223
|
+
if (!worksheetName) {
|
|
2256
2224
|
return res.status(400).json({ error: "No worksheet found in file" });
|
|
2257
2225
|
}
|
|
2258
|
-
worksheet
|
|
2259
|
-
|
|
2260
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
2261
|
-
rowData[colNumber - 1] = cell.value;
|
|
2262
|
-
});
|
|
2263
|
-
rows.push(rowData);
|
|
2264
|
-
});
|
|
2226
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
2227
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
2265
2228
|
}
|
|
2266
2229
|
const headerCandidates = rows.slice(0, 5).map((row, index) => ({
|
|
2267
2230
|
row: index + 1,
|
|
@@ -2293,20 +2256,12 @@ var init_spreadsheetRoutes = __esm({
|
|
|
2293
2256
|
const csvContent = req.file.buffer.toString("utf-8");
|
|
2294
2257
|
rows = parseCSV(csvContent);
|
|
2295
2258
|
} else {
|
|
2296
|
-
const workbook =
|
|
2297
|
-
|
|
2298
|
-
await workbook.xlsx.load(buffer);
|
|
2299
|
-
const worksheet = workbook.getWorksheet(sheetName);
|
|
2300
|
-
if (!worksheet) {
|
|
2259
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
2260
|
+
if (!workbook.SheetNames.includes(sheetName)) {
|
|
2301
2261
|
return res.status(400).json({ error: `Sheet "${sheetName}" not found` });
|
|
2302
2262
|
}
|
|
2303
|
-
worksheet
|
|
2304
|
-
|
|
2305
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
2306
|
-
rowData[colNumber - 1] = cell.value;
|
|
2307
|
-
});
|
|
2308
|
-
rows.push(rowData);
|
|
2309
|
-
});
|
|
2263
|
+
const worksheet = workbook.Sheets[sheetName];
|
|
2264
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
2310
2265
|
}
|
|
2311
2266
|
const headerRowIndex = parseInt(headerRow) - 1;
|
|
2312
2267
|
const headers = rows[headerRowIndex] || [];
|
package/dist/index.html
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
<link rel="icon" href="/lula.png" />
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
8
8
|
|
|
9
|
-
<link rel="modulepreload" href="/_app/immutable/entry/start.
|
|
10
|
-
<link rel="modulepreload" href="/_app/immutable/chunks/
|
|
9
|
+
<link rel="modulepreload" href="/_app/immutable/entry/start.C9ziWNNi.js">
|
|
10
|
+
<link rel="modulepreload" href="/_app/immutable/chunks/q9vWi9bR.js">
|
|
11
11
|
<link rel="modulepreload" href="/_app/immutable/chunks/DTWPdvjs.js">
|
|
12
|
-
<link rel="modulepreload" href="/_app/immutable/entry/app.
|
|
12
|
+
<link rel="modulepreload" href="/_app/immutable/entry/app.CnxVvuMI.js">
|
|
13
13
|
<link rel="modulepreload" href="/_app/immutable/chunks/DsnmJJEf.js">
|
|
14
14
|
<link rel="modulepreload" href="/_app/immutable/chunks/BXUi170M.js">
|
|
15
15
|
<link rel="modulepreload" href="/_app/immutable/chunks/WlyXjfrM.js">
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
<div style="display: contents">
|
|
20
20
|
<script>
|
|
21
21
|
{
|
|
22
|
-
|
|
22
|
+
__sveltekit_fs4f1z = {
|
|
23
23
|
base: ""
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const element = document.currentScript.parentElement;
|
|
27
27
|
|
|
28
28
|
Promise.all([
|
|
29
|
-
import("/_app/immutable/entry/start.
|
|
30
|
-
import("/_app/immutable/entry/app.
|
|
29
|
+
import("/_app/immutable/entry/start.C9ziWNNi.js"),
|
|
30
|
+
import("/_app/immutable/entry/app.CnxVvuMI.js")
|
|
31
31
|
]).then(([kit, app]) => {
|
|
32
32
|
kit.start(app, element);
|
|
33
33
|
});
|
package/dist/index.js
CHANGED
|
@@ -2862,7 +2862,7 @@ __export(spreadsheetRoutes_exports, {
|
|
|
2862
2862
|
});
|
|
2863
2863
|
import crypto from "crypto";
|
|
2864
2864
|
import { parse as parseCSVSync } from "csv-parse/sync";
|
|
2865
|
-
import
|
|
2865
|
+
import * as XLSX from "xlsx-republish";
|
|
2866
2866
|
import express from "express";
|
|
2867
2867
|
import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
2868
2868
|
import { glob } from "glob";
|
|
@@ -2957,20 +2957,13 @@ async function parseUploadedFile(file) {
|
|
|
2957
2957
|
const csvContent = file.buffer.toString("utf-8");
|
|
2958
2958
|
rawData = parseCSV(csvContent);
|
|
2959
2959
|
} else {
|
|
2960
|
-
const workbook =
|
|
2961
|
-
const
|
|
2962
|
-
|
|
2963
|
-
const worksheet = workbook.worksheets[0];
|
|
2964
|
-
if (!worksheet) {
|
|
2960
|
+
const workbook = XLSX.read(file.buffer, { type: "buffer" });
|
|
2961
|
+
const worksheetName = workbook.SheetNames[0];
|
|
2962
|
+
if (!worksheetName) {
|
|
2965
2963
|
throw new Error("No worksheet found in file");
|
|
2966
2964
|
}
|
|
2967
|
-
worksheet
|
|
2968
|
-
|
|
2969
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
2970
|
-
rowData[colNumber - 1] = cell.value;
|
|
2971
|
-
});
|
|
2972
|
-
rawData[rowNumber - 1] = rowData;
|
|
2973
|
-
});
|
|
2965
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
2966
|
+
rawData = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
2974
2967
|
}
|
|
2975
2968
|
return rawData;
|
|
2976
2969
|
}
|
|
@@ -3541,43 +3534,20 @@ async function exportAsExcelWithMapping(controls, metadata, columnMappings, res)
|
|
|
3541
3534
|
});
|
|
3542
3535
|
return exportControl;
|
|
3543
3536
|
});
|
|
3544
|
-
const wb =
|
|
3545
|
-
const ws =
|
|
3546
|
-
|
|
3547
|
-
ws.columns = headers.map((header) => ({
|
|
3548
|
-
header,
|
|
3549
|
-
key: header,
|
|
3550
|
-
width: Math.min(
|
|
3551
|
-
Math.max(
|
|
3552
|
-
header.length,
|
|
3553
|
-
...worksheetData.map((row) => String(row[header] || "").length)
|
|
3554
|
-
) + 2,
|
|
3555
|
-
50
|
|
3556
|
-
)
|
|
3557
|
-
// Auto-size with max width of 50
|
|
3558
|
-
}));
|
|
3559
|
-
worksheetData.forEach((row) => {
|
|
3560
|
-
ws.addRow(row);
|
|
3561
|
-
});
|
|
3562
|
-
ws.getRow(1).font = { bold: true };
|
|
3563
|
-
ws.getRow(1).fill = {
|
|
3564
|
-
type: "pattern",
|
|
3565
|
-
pattern: "solid",
|
|
3566
|
-
fgColor: { argb: "FFE0E0E0" }
|
|
3567
|
-
};
|
|
3537
|
+
const wb = XLSX.utils.book_new();
|
|
3538
|
+
const ws = XLSX.utils.json_to_sheet(worksheetData);
|
|
3539
|
+
XLSX.utils.book_append_sheet(wb, ws, "Controls");
|
|
3568
3540
|
if (metadata) {
|
|
3569
|
-
const metaSheet = wb.addWorksheet("Metadata");
|
|
3570
3541
|
const cleanMetadata = { ...metadata };
|
|
3571
3542
|
delete cleanMetadata.fieldSchema;
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
});
|
|
3543
|
+
const metadataArray = Object.entries(cleanMetadata).map(([key, value]) => ({
|
|
3544
|
+
Property: key,
|
|
3545
|
+
Value: String(value)
|
|
3546
|
+
}));
|
|
3547
|
+
const metaSheet = XLSX.utils.json_to_sheet(metadataArray);
|
|
3548
|
+
XLSX.utils.book_append_sheet(wb, metaSheet, "Metadata");
|
|
3579
3549
|
}
|
|
3580
|
-
const buffer =
|
|
3550
|
+
const buffer = XLSX.write(wb, { type: "buffer", bookType: "xlsx" });
|
|
3581
3551
|
const fileName = `${metadata?.name || "controls"}_export_${Date.now()}.xlsx`;
|
|
3582
3552
|
res.setHeader(
|
|
3583
3553
|
"Content-Type",
|
|
@@ -3819,21 +3789,14 @@ var init_spreadsheetRoutes = __esm({
|
|
|
3819
3789
|
rows = parseCSV(csvContent);
|
|
3820
3790
|
sheets = ["Sheet1"];
|
|
3821
3791
|
} else {
|
|
3822
|
-
const workbook =
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
const worksheet = workbook.worksheets[0];
|
|
3827
|
-
if (!worksheet) {
|
|
3792
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
3793
|
+
sheets = workbook.SheetNames;
|
|
3794
|
+
const worksheetName = workbook.SheetNames[0];
|
|
3795
|
+
if (!worksheetName) {
|
|
3828
3796
|
return res.status(400).json({ error: "No worksheet found in file" });
|
|
3829
3797
|
}
|
|
3830
|
-
worksheet
|
|
3831
|
-
|
|
3832
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
3833
|
-
rowData[colNumber - 1] = cell.value;
|
|
3834
|
-
});
|
|
3835
|
-
rows.push(rowData);
|
|
3836
|
-
});
|
|
3798
|
+
const worksheet = workbook.Sheets[worksheetName];
|
|
3799
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
3837
3800
|
}
|
|
3838
3801
|
const headerCandidates = rows.slice(0, 5).map((row, index) => ({
|
|
3839
3802
|
row: index + 1,
|
|
@@ -3865,20 +3828,12 @@ var init_spreadsheetRoutes = __esm({
|
|
|
3865
3828
|
const csvContent = req.file.buffer.toString("utf-8");
|
|
3866
3829
|
rows = parseCSV(csvContent);
|
|
3867
3830
|
} else {
|
|
3868
|
-
const workbook =
|
|
3869
|
-
|
|
3870
|
-
await workbook.xlsx.load(buffer);
|
|
3871
|
-
const worksheet = workbook.getWorksheet(sheetName);
|
|
3872
|
-
if (!worksheet) {
|
|
3831
|
+
const workbook = XLSX.read(req.file.buffer, { type: "buffer" });
|
|
3832
|
+
if (!workbook.SheetNames.includes(sheetName)) {
|
|
3873
3833
|
return res.status(400).json({ error: `Sheet "${sheetName}" not found` });
|
|
3874
3834
|
}
|
|
3875
|
-
worksheet
|
|
3876
|
-
|
|
3877
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
3878
|
-
rowData[colNumber - 1] = cell.value;
|
|
3879
|
-
});
|
|
3880
|
-
rows.push(rowData);
|
|
3881
|
-
});
|
|
3835
|
+
const worksheet = workbook.Sheets[sheetName];
|
|
3836
|
+
rows = XLSX.utils.sheet_to_json(worksheet, { header: 1, defval: null });
|
|
3882
3837
|
}
|
|
3883
3838
|
const headerRowIndex = parseInt(headerRow) - 1;
|
|
3884
3839
|
const headers = rows[headerRowIndex] || [];
|