@xlsxflow/core 1.1.2 → 1.1.4

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.d.cts CHANGED
@@ -286,9 +286,11 @@ interface RowData {
286
286
  styles?: (CellStyle | undefined)[];
287
287
  richText?: (RichTextRun[] | undefined)[];
288
288
  formatted?: (string | undefined)[];
289
+ errors?: (true | undefined)[];
289
290
  }
290
291
  interface WorksheetOptions {
291
292
  formulas?: boolean;
293
+ errors?: boolean;
292
294
  cellStyles?: (CellStyle | undefined)[];
293
295
  numFmts?: (string | undefined)[];
294
296
  richText?: ColorResolver;
@@ -365,6 +367,7 @@ interface WorkbookParts {
365
367
  workbookPath: string;
366
368
  workbookXml: string;
367
369
  sheets: Map<string, string>;
370
+ chartsheets: Set<string>;
368
371
  sharedStrings?: string;
369
372
  styles?: string;
370
373
  theme?: string;
@@ -372,6 +375,7 @@ interface WorkbookParts {
372
375
  declare function resolveWorkbookParts(readText: (path: string) => Promise<string>): Promise<WorkbookParts>;
373
376
  declare function partRelationships(readText: (path: string) => Promise<string>, partPath: string): Promise<Relationship[]>;
374
377
  declare function decodeXString(s: string): string;
378
+ declare function checkCellText(s: string, ref: string): string;
375
379
  declare function colIndex(ref: string): number;
376
380
  declare function colLetter(index: number): string;
377
381
  type RefRole = 'single' | 'start' | 'end';
@@ -391,12 +395,12 @@ type CellEdit = CellValue$1 | {
391
395
  style?: CellStyle;
392
396
  };
393
397
  declare class SheetEditor {
394
- private modifications;
398
+ private appends;
395
399
  private cellEdits;
396
400
  private additions;
397
401
  private deletions;
398
402
  private shiftOps;
399
- appendSheet(sheetName: string, rows: Row[], options?: SheetOptions): void;
403
+ appendSheet(sheetName: string, rows: Row[], _options?: SheetOptions): this;
400
404
  setCells(sheetName: string, cells: Record<string, CellEdit>): this;
401
405
  addSheet(sheetName: string, rows: Row[]): this;
402
406
  deleteSheet(sheetName: string): this;
@@ -409,7 +413,6 @@ declare class SheetEditor {
409
413
  maxUncompressedBytes?: number;
410
414
  }): ReadableStream<Uint8Array>;
411
415
  private createEditTransform;
412
- private createInjectTransform;
413
416
  private readStreamToString;
414
417
  }
415
418
 
@@ -420,6 +423,7 @@ interface ParseOptions {
420
423
  styles?: boolean;
421
424
  richText?: boolean;
422
425
  formatted?: boolean;
426
+ errors?: boolean;
423
427
  }
424
428
  interface WorkbookInfo {
425
429
  sheets: {
@@ -491,16 +495,31 @@ declare class StyleEngine {
491
495
  }
492
496
 
493
497
  type FormulaResult = number | string | boolean | null;
498
+ interface FormulaCell {
499
+ formula: string;
500
+ }
501
+ declare class FormulaError {
502
+ readonly code: string;
503
+ constructor(code: string);
504
+ }
505
+ type Value = number | string | boolean | null | FormulaError;
494
506
  declare class FormulaEngine {
495
507
  private cells;
508
+ private results;
509
+ private evaluating;
496
510
  clear(): void;
497
- loadData(data: (FormulaResult)[][], startRow?: number): void;
511
+ loadData(data: (FormulaResult | FormulaCell)[][], startRow?: number): void;
498
512
  evaluate(formula: string): FormulaResult;
513
+ evaluateRaw(formula: string): Value;
514
+ cellValue(ref: string): Value;
515
+ private run;
516
+ private lookup;
499
517
  private tokenize;
500
518
  private parse;
519
+ private scalar;
501
520
  private evaluateAst;
502
- private numbers;
503
- private flatten;
521
+ private binary;
522
+ private call;
504
523
  private getRangeValues;
505
524
  private parseRef;
506
525
  private toRef;
@@ -526,6 +545,7 @@ interface ZipRecord {
526
545
  declare class ZipRandomAccessParser {
527
546
  private reader;
528
547
  private records;
548
+ private lowerCase;
529
549
  constructor(reader: RandomAccessReader);
530
550
  parseCentralDirectory(): Promise<void>;
531
551
  has(filename: string): boolean;
@@ -540,7 +560,7 @@ declare class ZipStreamWriter {
540
560
  private cdEntries;
541
561
  private offset;
542
562
  private streamController;
543
- private resumePull;
563
+ private waiting;
544
564
  private cancelled;
545
565
  stream: ReadableStream<Uint8Array>;
546
566
  private textEncoder;
@@ -551,6 +571,8 @@ declare class ZipStreamWriter {
551
571
  error(err: unknown): void;
552
572
  private localHeader;
553
573
  private pushChunk;
574
+ private roomInQueue;
575
+ private wake;
554
576
  }
555
577
 
556
578
  interface CfbEntry {
@@ -596,6 +618,8 @@ declare class StylePatcher {
596
618
  dateFormat(base: number, d: Date): number;
597
619
  toXml(): string;
598
620
  private existing;
621
+ private list;
622
+ private at;
599
623
  private add;
600
624
  private items;
601
625
  private prefix;
@@ -619,5 +643,5 @@ declare const XlsxFlow: {
619
643
  readFile(filePath: string, options?: ParseOptions): Promise<ParseResult>;
620
644
  };
621
645
 
622
- export { CfbReader, ConditionalFormatter, DRAWING_NS, FormulaEngine, OdsWriter, SheetEditor, SheetReader, SheetWriter, StyleEngine, StylePatcher, XlsxFlow, ZipRandomAccessParser, ZipStreamWriter, anchorXml, colIndex, colLetter, crc32, createBlobReader, createFileReader, createXmlStreamParser, dateToSerial, decodeXString, drawingPartXml, encodeXString, isCfb, legacyPasswordHash, mapFormulaRefs, parseCsv, parseWorksheet, partRelationships, readSharedStrings, recalcOnOpen, resolveWorkbookParts, sheetToJson, shiftFormula, streamToCsv };
646
+ export { CfbReader, ConditionalFormatter, DRAWING_NS, FormulaEngine, OdsWriter, SheetEditor, SheetReader, SheetWriter, StyleEngine, StylePatcher, XlsxFlow, ZipRandomAccessParser, ZipStreamWriter, anchorXml, checkCellText, colIndex, colLetter, crc32, createBlobReader, createFileReader, createXmlStreamParser, dateToSerial, decodeXString, drawingPartXml, encodeXString, isCfb, legacyPasswordHash, mapFormulaRefs, parseCsv, parseWorksheet, partRelationships, readSharedStrings, recalcOnOpen, resolveWorkbookParts, sheetToJson, shiftFormula, streamToCsv };
623
647
  export type { BorderSide, CellAlignment, CellBorder, CellComment, CellEdit, CellFill, CellFont, CellStyle, CellValue$1 as CellValue, CfbEntry, ColumnOptions, ComparisonOperator, ConditionalFormat, ConditionalFormatRule, CsvOptions, DataValidation, DefinedName, GradientFill, HighlightStyle, OdsSheetOptions, OdsWriterOptions, PageSetup, ParseOptions, Placement, RandomAccessReader, RefMapper, RefRole, Relationship, RichTextRun, Row, RowData, RowOptions, SheetComment, SheetImage, SheetMetadata, SheetOptions, SheetProtection, SheetView, StyledCell, TableOptions, WorkbookInfo, WorkbookParts, WorkbookProperties, WriterOptions };
package/dist/index.d.ts CHANGED
@@ -286,9 +286,11 @@ interface RowData {
286
286
  styles?: (CellStyle | undefined)[];
287
287
  richText?: (RichTextRun[] | undefined)[];
288
288
  formatted?: (string | undefined)[];
289
+ errors?: (true | undefined)[];
289
290
  }
290
291
  interface WorksheetOptions {
291
292
  formulas?: boolean;
293
+ errors?: boolean;
292
294
  cellStyles?: (CellStyle | undefined)[];
293
295
  numFmts?: (string | undefined)[];
294
296
  richText?: ColorResolver;
@@ -365,6 +367,7 @@ interface WorkbookParts {
365
367
  workbookPath: string;
366
368
  workbookXml: string;
367
369
  sheets: Map<string, string>;
370
+ chartsheets: Set<string>;
368
371
  sharedStrings?: string;
369
372
  styles?: string;
370
373
  theme?: string;
@@ -372,6 +375,7 @@ interface WorkbookParts {
372
375
  declare function resolveWorkbookParts(readText: (path: string) => Promise<string>): Promise<WorkbookParts>;
373
376
  declare function partRelationships(readText: (path: string) => Promise<string>, partPath: string): Promise<Relationship[]>;
374
377
  declare function decodeXString(s: string): string;
378
+ declare function checkCellText(s: string, ref: string): string;
375
379
  declare function colIndex(ref: string): number;
376
380
  declare function colLetter(index: number): string;
377
381
  type RefRole = 'single' | 'start' | 'end';
@@ -391,12 +395,12 @@ type CellEdit = CellValue$1 | {
391
395
  style?: CellStyle;
392
396
  };
393
397
  declare class SheetEditor {
394
- private modifications;
398
+ private appends;
395
399
  private cellEdits;
396
400
  private additions;
397
401
  private deletions;
398
402
  private shiftOps;
399
- appendSheet(sheetName: string, rows: Row[], options?: SheetOptions): void;
403
+ appendSheet(sheetName: string, rows: Row[], _options?: SheetOptions): this;
400
404
  setCells(sheetName: string, cells: Record<string, CellEdit>): this;
401
405
  addSheet(sheetName: string, rows: Row[]): this;
402
406
  deleteSheet(sheetName: string): this;
@@ -409,7 +413,6 @@ declare class SheetEditor {
409
413
  maxUncompressedBytes?: number;
410
414
  }): ReadableStream<Uint8Array>;
411
415
  private createEditTransform;
412
- private createInjectTransform;
413
416
  private readStreamToString;
414
417
  }
415
418
 
@@ -420,6 +423,7 @@ interface ParseOptions {
420
423
  styles?: boolean;
421
424
  richText?: boolean;
422
425
  formatted?: boolean;
426
+ errors?: boolean;
423
427
  }
424
428
  interface WorkbookInfo {
425
429
  sheets: {
@@ -491,16 +495,31 @@ declare class StyleEngine {
491
495
  }
492
496
 
493
497
  type FormulaResult = number | string | boolean | null;
498
+ interface FormulaCell {
499
+ formula: string;
500
+ }
501
+ declare class FormulaError {
502
+ readonly code: string;
503
+ constructor(code: string);
504
+ }
505
+ type Value = number | string | boolean | null | FormulaError;
494
506
  declare class FormulaEngine {
495
507
  private cells;
508
+ private results;
509
+ private evaluating;
496
510
  clear(): void;
497
- loadData(data: (FormulaResult)[][], startRow?: number): void;
511
+ loadData(data: (FormulaResult | FormulaCell)[][], startRow?: number): void;
498
512
  evaluate(formula: string): FormulaResult;
513
+ evaluateRaw(formula: string): Value;
514
+ cellValue(ref: string): Value;
515
+ private run;
516
+ private lookup;
499
517
  private tokenize;
500
518
  private parse;
519
+ private scalar;
501
520
  private evaluateAst;
502
- private numbers;
503
- private flatten;
521
+ private binary;
522
+ private call;
504
523
  private getRangeValues;
505
524
  private parseRef;
506
525
  private toRef;
@@ -526,6 +545,7 @@ interface ZipRecord {
526
545
  declare class ZipRandomAccessParser {
527
546
  private reader;
528
547
  private records;
548
+ private lowerCase;
529
549
  constructor(reader: RandomAccessReader);
530
550
  parseCentralDirectory(): Promise<void>;
531
551
  has(filename: string): boolean;
@@ -540,7 +560,7 @@ declare class ZipStreamWriter {
540
560
  private cdEntries;
541
561
  private offset;
542
562
  private streamController;
543
- private resumePull;
563
+ private waiting;
544
564
  private cancelled;
545
565
  stream: ReadableStream<Uint8Array>;
546
566
  private textEncoder;
@@ -551,6 +571,8 @@ declare class ZipStreamWriter {
551
571
  error(err: unknown): void;
552
572
  private localHeader;
553
573
  private pushChunk;
574
+ private roomInQueue;
575
+ private wake;
554
576
  }
555
577
 
556
578
  interface CfbEntry {
@@ -596,6 +618,8 @@ declare class StylePatcher {
596
618
  dateFormat(base: number, d: Date): number;
597
619
  toXml(): string;
598
620
  private existing;
621
+ private list;
622
+ private at;
599
623
  private add;
600
624
  private items;
601
625
  private prefix;
@@ -619,5 +643,5 @@ declare const XlsxFlow: {
619
643
  readFile(filePath: string, options?: ParseOptions): Promise<ParseResult>;
620
644
  };
621
645
 
622
- export { CfbReader, ConditionalFormatter, DRAWING_NS, FormulaEngine, OdsWriter, SheetEditor, SheetReader, SheetWriter, StyleEngine, StylePatcher, XlsxFlow, ZipRandomAccessParser, ZipStreamWriter, anchorXml, colIndex, colLetter, crc32, createBlobReader, createFileReader, createXmlStreamParser, dateToSerial, decodeXString, drawingPartXml, encodeXString, isCfb, legacyPasswordHash, mapFormulaRefs, parseCsv, parseWorksheet, partRelationships, readSharedStrings, recalcOnOpen, resolveWorkbookParts, sheetToJson, shiftFormula, streamToCsv };
646
+ export { CfbReader, ConditionalFormatter, DRAWING_NS, FormulaEngine, OdsWriter, SheetEditor, SheetReader, SheetWriter, StyleEngine, StylePatcher, XlsxFlow, ZipRandomAccessParser, ZipStreamWriter, anchorXml, checkCellText, colIndex, colLetter, crc32, createBlobReader, createFileReader, createXmlStreamParser, dateToSerial, decodeXString, drawingPartXml, encodeXString, isCfb, legacyPasswordHash, mapFormulaRefs, parseCsv, parseWorksheet, partRelationships, readSharedStrings, recalcOnOpen, resolveWorkbookParts, sheetToJson, shiftFormula, streamToCsv };
623
647
  export type { BorderSide, CellAlignment, CellBorder, CellComment, CellEdit, CellFill, CellFont, CellStyle, CellValue$1 as CellValue, CfbEntry, ColumnOptions, ComparisonOperator, ConditionalFormat, ConditionalFormatRule, CsvOptions, DataValidation, DefinedName, GradientFill, HighlightStyle, OdsSheetOptions, OdsWriterOptions, PageSetup, ParseOptions, Placement, RandomAccessReader, RefMapper, RefRole, Relationship, RichTextRun, Row, RowData, RowOptions, SheetComment, SheetImage, SheetMetadata, SheetOptions, SheetProtection, SheetView, StyledCell, TableOptions, WorkbookInfo, WorkbookParts, WorkbookProperties, WriterOptions };