Skip to content

Commit

Permalink
chore: set first argument of onSheetFinished to sheetPath
Browse files Browse the repository at this point in the history
  • Loading branch information
iyxan23 committed Sep 23, 2024
1 parent 21a1cf2 commit b927397
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/xlsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ import { Issue, TemplaterFunction } from "./sheet/expression/evaluate";

const SHARED_STRINGS_ENTRY = "xl/sharedStrings.xml";

export type SheetFinishStatus =
| { status: "success"; issues: Issue[] }
| { status: "failed"; issues: Issue[]; error: Issue };

export async function xlsxFillTemplate(
xlsx: ReadableStream,
output: WritableStream,
input: any,
opts?: {
functions?: Record<string, TemplaterFunction<any>>;
onSheetFinished: (
status:
| { status: "success"; issues: Issue[] }
| { status: "failed"; issues: Issue[]; error: Issue },
) => void;
onSheetFinished: (sheetPath: string, status: SheetFinishStatus) => void;
},
) {
const zipWriter = new ZipWriter(output);
Expand Down Expand Up @@ -66,6 +66,7 @@ export async function xlsxFillTemplate(
);

opts?.onSheetFinished?.(
entry.filename,
result.error
? { status: "failed", issues: result.issues, error: result.cause }
: { status: "success", issues: result.issues },
Expand Down

0 comments on commit b927397

Please sign in to comment.