goods-exporter
Advanced tools
Comparing version 1.1.3 to 1.2.0
import { Writable } from 'stream'; | ||
import { Category as Category$1 } from 'dist/bundle'; | ||
@@ -650,2 +651,15 @@ interface Product { | ||
declare class WooCommerceFormatter implements FormatterAbstract { | ||
formatterName: string; | ||
fileExtension: Extension; | ||
private readonly DEFAULT_COLUMNS; | ||
private formatKeyAttribute; | ||
private formatValueAttribute; | ||
private formatProducts; | ||
private createAttribute; | ||
private extractAttributes; | ||
private removeVisibleFromAttributes; | ||
format(writableStream: Writable, products: Product[], categories?: Category[], _?: Brand[], __?: FormatterOptions): Promise<void>; | ||
} | ||
declare class YMLFormatter implements FormatterAbstract { | ||
@@ -675,2 +689,3 @@ formatterName: string; | ||
XMLFormatter: typeof XMLFormatter; | ||
WooCommerceFormatter: typeof WooCommerceFormatter; | ||
}; | ||
@@ -691,2 +706,4 @@ | ||
export { type Brand, type Category, Currency, type Exporter, Extension, FormatterAbstract, type FormatterOptions, Formatters, GoodsExporter, type IParam, type ISize, type Product, type Transformer, Vat }; | ||
declare const buildCategoryPaths: (categories: Category$1[]) => Map<number, Category$1[]>; | ||
export { type Brand, type Category, Currency, type Exporter, Extension, FormatterAbstract, type FormatterOptions, Formatters, GoodsExporter, type IParam, type ISize, type Product, type Transformer, Vat, buildCategoryPaths }; |
@@ -14,3 +14,3 @@ { | ||
"name": "goods-exporter", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "A versatile JavaScript library for exporting goods data to various formats such as YML, CSV, and Excel. Simplify data export tasks with ease. Supports streams.", | ||
@@ -29,2 +29,3 @@ "main": "./dist/cjs/index.cjs", | ||
"build": "rollup -c", | ||
"build:watch": "rollup -c --watch", | ||
"test": "vitest", | ||
@@ -44,2 +45,3 @@ "lint": "eslint --ext .ts --fix", | ||
"insales", | ||
"wocommerce", | ||
"items", | ||
@@ -46,0 +48,0 @@ "products", |
@@ -8,3 +8,2 @@ # goods-exporter | ||
A versatile JavaScript library for exporting goods data to various formats such as YML, CSV, and Excel. Simplify data | ||
@@ -33,2 +32,3 @@ export tasks with ease. | ||
- Tilda | ||
- WooCommerce | ||
@@ -48,10 +48,10 @@ ## Installation | ||
```typescript | ||
import { GoodsExporter, Product, Category, Formatters } from '../src'; | ||
import { GoodsExporter, Product, Category, Formatters } from "../src"; | ||
import { PassThrough } from "stream"; | ||
// Create an instance of the GoodsExporter class. | ||
const exporter = new GoodsExporter() | ||
const exporter = new GoodsExporter(); | ||
const products: Product[] = [] // Put your products; | ||
const categories: Category[] = [{ id: 1, name: 'Обувь' }] | ||
const products: Product[] = []; // Put your products; | ||
const categories: Category[] = [{ id: 1, name: "Обувь" }]; | ||
@@ -80,18 +80,20 @@ // Call the data export method. | ||
// Create an instance of the GoodsExporter class. | ||
const exporter = new GoodsExporter() | ||
const exporter = new GoodsExporter(); | ||
// Define an object 'transformers' that contains data transformation functions. | ||
const transformers: Transformer[] = [ | ||
(products) => products.map(product => ({ | ||
...product, | ||
price: product.price + 10000 | ||
(products) => | ||
products.map((product) => ({ | ||
...product, | ||
price: product.price + 10000, | ||
})), | ||
(products) => products.map(product => ({ | ||
...product, | ||
images: product.images?.map(image => image.replace("image", "pic")) | ||
})) | ||
] | ||
(products) => | ||
products.map((product) => ({ | ||
...product, | ||
images: product.images?.map((image) => image.replace("image", "pic")), | ||
})), | ||
]; | ||
// Set the formatter for exporting data to YML. | ||
exporter.setFormatter(new Formatters.YMLFormatter()) // or your own Formatter; | ||
exporter.setFormatter(new Formatters.YMLFormatter()); // or your own Formatter; | ||
@@ -106,3 +108,4 @@ // Set transformers based on the specified keys. | ||
# Supported by [PoizonAPI](https://t.me/PoizonAPI) | ||
# Supported by [PoizonAPI](https://t.me/PoizonAPI) | ||
[![PoizonAPI](https://i.ibb.co/HBbTpp0/Group-1.png)](https://t.me/PoizonAPI) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
301464
9
2588
107