goods-exporter 0.4.6 → 0.5.1

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/bundle.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { Stream, Writable } from 'stream';
2
+
1
3
  interface Product {
2
4
  /**
3
5
  * **ID товара**
@@ -582,7 +584,7 @@ interface Brand {
582
584
  declare abstract class FormatterAbstract {
583
585
  abstract formatterName: string;
584
586
  abstract fileExtension: Extension;
585
- abstract format(products: Product[], categories?: Category[], brands?: Brand[], option?: FormatterOptions): Promise<Buffer | string>;
587
+ abstract format(products: Product[], categories?: Category[], brands?: Brand[], option?: FormatterOptions): Promise<Stream>;
586
588
  }
587
589
  interface FormatterOptions {
588
590
  shopName?: string;
@@ -599,44 +601,43 @@ declare enum Extension {
599
601
  declare class CSVFormatter implements FormatterAbstract {
600
602
  formatterName: string;
601
603
  fileExtension: Extension;
602
- format(products: Product[], categories?: Category[], _?: Brand[], options?: FormatterOptions): Promise<string>;
604
+ format(products: Product[], categories?: Category[], _?: Brand[], __?: FormatterOptions): Promise<Stream>;
603
605
  }
604
606
 
605
607
  declare class ExcelFormatter implements FormatterAbstract {
606
608
  formatterName: string;
607
609
  fileExtension: Extension;
608
- format(products: Product[], categories?: Category[], _?: Brand[], options?: FormatterOptions): Promise<Buffer>;
610
+ format(products: Product[], categories?: Category[], _?: Brand[], __?: FormatterOptions): Promise<Stream>;
609
611
  }
610
612
 
611
613
  declare class InsalesFormatter implements FormatterAbstract {
612
614
  formatterName: string;
613
615
  fileExtension: Extension;
614
- format(products: Product[], categories?: Category[], _?: Brand[], __?: FormatterOptions): Promise<Buffer>;
616
+ format(products: Product[], categories?: Category[], _?: Brand[], __?: FormatterOptions): Promise<Stream>;
615
617
  }
616
618
 
617
619
  declare class JSONFormatter implements FormatterAbstract {
618
620
  formatterName: string;
619
621
  fileExtension: Extension;
620
- format(products: Product[], categories?: Category[], brands?: Brand[], _?: FormatterOptions): Promise<string>;
622
+ format(products: Product[], categories?: Category[], brands?: Brand[], _?: FormatterOptions): Promise<Stream>;
621
623
  }
622
624
 
623
625
  declare class TgShopFormatter implements FormatterAbstract {
624
626
  formatterName: string;
625
627
  fileExtension: Extension;
626
- format(products: Product[], categories?: Category[], _?: Brand[], __?: FormatterOptions): Promise<Buffer>;
628
+ format(products: Product[], categories?: Category[], _?: Brand[], __?: FormatterOptions): Promise<Stream>;
627
629
  }
628
630
 
629
631
  declare class TildaFormatter implements FormatterAbstract {
630
632
  formatterName: string;
631
633
  fileExtension: Extension;
632
- format(products: Product[], categories?: Category[], _?: Brand[], __?: FormatterOptions): Promise<string>;
634
+ format(products: Product[], categories?: Category[], _?: Brand[], __?: FormatterOptions): Promise<Stream>;
633
635
  }
634
636
 
635
637
  declare class YMLFormatter implements FormatterAbstract {
636
638
  formatterName: string;
637
639
  fileExtension: Extension;
638
- private readonly builder;
639
- format(products: Product[], categories?: Category[], brands?: Brand[], options?: FormatterOptions): Promise<string>;
640
+ format(products: Product[], categories?: Category[], brands?: Brand[], options?: FormatterOptions): Promise<Stream>;
640
641
  private getBrands;
641
642
  private getCategories;
642
643
  private getOffers;
@@ -653,7 +654,7 @@ declare const Formatters: {
653
654
  };
654
655
 
655
656
  type Transformer = (products: Product[]) => Product[] | Promise<Product[]>;
656
- type Exporter = (data: Buffer) => Buffer | Promise<Buffer>;
657
+ type Exporter = () => Writable;
657
658
 
658
659
  declare class GoodsExporter {
659
660
  private formatter;
@@ -662,7 +663,7 @@ declare class GoodsExporter {
662
663
  setTransformers(transformers: Transformer[]): void;
663
664
  setFormatter(formatter: FormatterAbstract): void;
664
665
  setExporter(exporter: Exporter): void;
665
- export(products: Product[], categories?: Category[], brands?: Brand[], option?: FormatterOptions): Promise<Buffer>;
666
+ export(products: Product[], categories?: Category[], brands?: Brand[], option?: FormatterOptions): Promise<void>;
666
667
  }
667
668
 
668
669
  export { type Brand, type Category, Currency, type Exporter, Extension, FormatterAbstract, type FormatterOptions, Formatters, GoodsExporter, type IParam, type ISize, type Product, type Transformer, Vat };