@ai-matrx/alchemy 0.8.4 → 0.8.5
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/CHANGELOG.md +7 -0
- package/dist/core.cjs +1 -45
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +1 -45
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +1 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -45
- package/dist/index.js.map +1 -1
- package/dist/operate-xlsx.cjs +34007 -18
- package/dist/operate-xlsx.cjs.map +1 -1
- package/dist/operate-xlsx.js +34011 -5
- package/dist/operate-xlsx.js.map +1 -1
- package/dist/operate.cjs +1 -45
- package/dist/operate.cjs.map +1 -1
- package/dist/operate.js +1 -45
- package/dist/operate.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1362,50 +1362,6 @@ var init_document = __esm({
|
|
|
1362
1362
|
}
|
|
1363
1363
|
});
|
|
1364
1364
|
|
|
1365
|
-
// src/operate/formats/xlsx.ts
|
|
1366
|
-
var xlsx_exports = {};
|
|
1367
|
-
__export(xlsx_exports, {
|
|
1368
|
-
xlsxEngine: () => xlsxEngine
|
|
1369
|
-
});
|
|
1370
|
-
var cell, xlsxEngine;
|
|
1371
|
-
var init_xlsx = __esm({
|
|
1372
|
-
"src/operate/formats/xlsx.ts"() {
|
|
1373
|
-
"use strict";
|
|
1374
|
-
init_core();
|
|
1375
|
-
cell = (value) => value === void 0 || value === null ? null : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? value : JSON.stringify(value);
|
|
1376
|
-
xlsxEngine = {
|
|
1377
|
-
async build(draft, options, signal) {
|
|
1378
|
-
if (signal.aborted) throw new DOMException("Cancelled", "AbortError");
|
|
1379
|
-
const p = draft.payload;
|
|
1380
|
-
if (p.kind !== "rows") throw new ContentTransferError("unsupported-format", "An Excel workbook needs table rows. Download it as CSV or JSON instead.");
|
|
1381
|
-
const columns = p.columns.filter(
|
|
1382
|
-
(c) => c.visible && c.exportable !== false && c.classification !== "secret" && c.classification !== "credential"
|
|
1383
|
-
);
|
|
1384
|
-
const XLSX = await import("xlsx");
|
|
1385
|
-
if (signal.aborted) throw new DOMException("Cancelled", "AbortError");
|
|
1386
|
-
const sheet = XLSX.utils.aoa_to_sheet([columns.map((c) => c.label), ...p.rows.map((row) => columns.map((c) => cell(readTransferCell(row, c))))]);
|
|
1387
|
-
const book = XLSX.utils.book_new();
|
|
1388
|
-
const filename = options.filename ?? "export.xlsx";
|
|
1389
|
-
const sheetName = filename.replace(/\.xlsx$/i, "").replace(/[\\/?*[\]:]/g, " ").trim().slice(0, 31) || "Data";
|
|
1390
|
-
XLSX.utils.book_append_sheet(book, sheet, sheetName);
|
|
1391
|
-
const written = XLSX.write(book, { type: "array", bookType: "xlsx", compression: true });
|
|
1392
|
-
return sealTransferArtifact({
|
|
1393
|
-
snapshotId: draft.snapshotId,
|
|
1394
|
-
draftRevision: draft.revision,
|
|
1395
|
-
format: "xlsx",
|
|
1396
|
-
plainText: serialize(draft, "tsv", { spreadsheetSafe: true }).plainText,
|
|
1397
|
-
file: {
|
|
1398
|
-
filename,
|
|
1399
|
-
mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1400
|
-
bytes: written instanceof Uint8Array ? written : new Uint8Array(written)
|
|
1401
|
-
},
|
|
1402
|
-
omissions: draft.omissions.map((o) => ({ ...o }))
|
|
1403
|
-
});
|
|
1404
|
-
}
|
|
1405
|
-
};
|
|
1406
|
-
}
|
|
1407
|
-
});
|
|
1408
|
-
|
|
1409
1365
|
// src/index.ts
|
|
1410
1366
|
var src_exports = {};
|
|
1411
1367
|
__export(src_exports, {
|
|
@@ -1582,7 +1538,7 @@ var FORMAT_ADAPTERS = Object.freeze([
|
|
|
1582
1538
|
modes: ["download"],
|
|
1583
1539
|
runsOn: "client",
|
|
1584
1540
|
supports: isRows,
|
|
1585
|
-
load: lazy(async () => (await
|
|
1541
|
+
load: lazy(async () => (await import("@ai-matrx/alchemy/operate/formats/xlsx")).xlsxEngine)
|
|
1586
1542
|
},
|
|
1587
1543
|
{
|
|
1588
1544
|
id: "pdf",
|