@ai-matrx/alchemy 0.8.3 → 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/dist/index.cjs CHANGED
@@ -5,8 +5,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res) => function __init() {
9
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
+ var __esm = (fn, res, err) => function __init() {
9
+ if (err) throw err[0];
10
+ try {
11
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
12
+ } catch (e) {
13
+ throw err = [e], e;
14
+ }
10
15
  };
11
16
  var __export = (target, all) => {
12
17
  for (var name in all)
@@ -1357,50 +1362,6 @@ var init_document = __esm({
1357
1362
  }
1358
1363
  });
1359
1364
 
1360
- // src/operate/formats/xlsx.ts
1361
- var xlsx_exports = {};
1362
- __export(xlsx_exports, {
1363
- xlsxEngine: () => xlsxEngine
1364
- });
1365
- var cell, xlsxEngine;
1366
- var init_xlsx = __esm({
1367
- "src/operate/formats/xlsx.ts"() {
1368
- "use strict";
1369
- init_core();
1370
- cell = (value) => value === void 0 || value === null ? null : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? value : JSON.stringify(value);
1371
- xlsxEngine = {
1372
- async build(draft, options, signal) {
1373
- if (signal.aborted) throw new DOMException("Cancelled", "AbortError");
1374
- const p = draft.payload;
1375
- if (p.kind !== "rows") throw new ContentTransferError("unsupported-format", "An Excel workbook needs table rows. Download it as CSV or JSON instead.");
1376
- const columns = p.columns.filter(
1377
- (c) => c.visible && c.exportable !== false && c.classification !== "secret" && c.classification !== "credential"
1378
- );
1379
- const XLSX = await import("xlsx");
1380
- if (signal.aborted) throw new DOMException("Cancelled", "AbortError");
1381
- const sheet = XLSX.utils.aoa_to_sheet([columns.map((c) => c.label), ...p.rows.map((row) => columns.map((c) => cell(readTransferCell(row, c))))]);
1382
- const book = XLSX.utils.book_new();
1383
- const filename = options.filename ?? "export.xlsx";
1384
- const sheetName = filename.replace(/\.xlsx$/i, "").replace(/[\\/?*[\]:]/g, " ").trim().slice(0, 31) || "Data";
1385
- XLSX.utils.book_append_sheet(book, sheet, sheetName);
1386
- const written = XLSX.write(book, { type: "array", bookType: "xlsx", compression: true });
1387
- return sealTransferArtifact({
1388
- snapshotId: draft.snapshotId,
1389
- draftRevision: draft.revision,
1390
- format: "xlsx",
1391
- plainText: serialize(draft, "tsv", { spreadsheetSafe: true }).plainText,
1392
- file: {
1393
- filename,
1394
- mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1395
- bytes: written instanceof Uint8Array ? written : new Uint8Array(written)
1396
- },
1397
- omissions: draft.omissions.map((o) => ({ ...o }))
1398
- });
1399
- }
1400
- };
1401
- }
1402
- });
1403
-
1404
1365
  // src/index.ts
1405
1366
  var src_exports = {};
1406
1367
  __export(src_exports, {
@@ -1577,7 +1538,7 @@ var FORMAT_ADAPTERS = Object.freeze([
1577
1538
  modes: ["download"],
1578
1539
  runsOn: "client",
1579
1540
  supports: isRows,
1580
- load: lazy(async () => (await Promise.resolve().then(() => (init_xlsx(), xlsx_exports))).xlsxEngine)
1541
+ load: lazy(async () => (await import("@ai-matrx/alchemy/operate/formats/xlsx")).xlsxEngine)
1581
1542
  },
1582
1543
  {
1583
1544
  id: "pdf",