goods-exporter 1.1.3 → 1.2.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/README.md +19 -16
- package/dist/bundle.d.ts +18 -1
- package/dist/cjs/index.cjs +268 -45
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +268 -46
- package/dist/esm/index.mjs.map +1 -1
- package/dist/package.json +87 -0
- package/package.json +3 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -4,16 +4,16 @@ import { JsonStreamStringify } from 'json-stream-stringify';
|
|
|
4
4
|
import { XMLBuilder } from 'fast-xml-parser';
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
|
|
7
|
-
var __defProp$
|
|
8
|
-
var __defNormalProp$
|
|
9
|
-
var __publicField$
|
|
7
|
+
var __defProp$b = Object.defineProperty;
|
|
8
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
10
10
|
class CSVStream {
|
|
11
11
|
constructor({ delimiter, lineSeparator, emptyFieldValue }) {
|
|
12
|
-
__publicField$
|
|
13
|
-
__publicField$
|
|
14
|
-
__publicField$
|
|
15
|
-
__publicField$
|
|
16
|
-
__publicField$
|
|
12
|
+
__publicField$b(this, "stream", new PassThrough());
|
|
13
|
+
__publicField$b(this, "delimiter", ";");
|
|
14
|
+
__publicField$b(this, "lineSeparator", "\n");
|
|
15
|
+
__publicField$b(this, "emptyFieldValue", "");
|
|
16
|
+
__publicField$b(this, "columns", /* @__PURE__ */ new Set());
|
|
17
17
|
if (delimiter !== void 0) this.delimiter = delimiter;
|
|
18
18
|
if (lineSeparator !== void 0) this.lineSeparator = lineSeparator;
|
|
19
19
|
if (emptyFieldValue !== void 0) this.emptyFieldValue = emptyFieldValue;
|
|
@@ -47,13 +47,13 @@ var Extension = /* @__PURE__ */ ((Extension2) => {
|
|
|
47
47
|
return Extension2;
|
|
48
48
|
})(Extension || {});
|
|
49
49
|
|
|
50
|
-
var __defProp$
|
|
51
|
-
var __defNormalProp$
|
|
52
|
-
var __publicField$
|
|
50
|
+
var __defProp$a = Object.defineProperty;
|
|
51
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
52
|
+
var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
53
53
|
class CSVFormatter {
|
|
54
54
|
constructor() {
|
|
55
|
-
__publicField$
|
|
56
|
-
__publicField$
|
|
55
|
+
__publicField$a(this, "formatterName", "CSV");
|
|
56
|
+
__publicField$a(this, "fileExtension", Extension.CSV);
|
|
57
57
|
}
|
|
58
58
|
async format(writableStream, products, categories, _, __) {
|
|
59
59
|
const mappedCategories = {};
|
|
@@ -116,14 +116,14 @@ class CSVFormatter {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
var __defProp$
|
|
120
|
-
var __defNormalProp$
|
|
121
|
-
var __publicField$
|
|
119
|
+
var __defProp$9 = Object.defineProperty;
|
|
120
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
121
|
+
var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
122
122
|
const { stream: stream$2 } = pkg;
|
|
123
123
|
class ExcelFormatter {
|
|
124
124
|
constructor() {
|
|
125
|
-
__publicField$
|
|
126
|
-
__publicField$
|
|
125
|
+
__publicField$9(this, "formatterName", "Excel");
|
|
126
|
+
__publicField$9(this, "fileExtension", Extension.XLSX);
|
|
127
127
|
}
|
|
128
128
|
async format(writableStream, products, categories, _, __) {
|
|
129
129
|
const mappedCategories = {};
|
|
@@ -188,14 +188,14 @@ class ExcelFormatter {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
var __defProp$
|
|
192
|
-
var __defNormalProp$
|
|
193
|
-
var __publicField$
|
|
191
|
+
var __defProp$8 = Object.defineProperty;
|
|
192
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
193
|
+
var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
194
194
|
const { stream: stream$1 } = pkg;
|
|
195
195
|
class InsalesFormatter {
|
|
196
196
|
constructor() {
|
|
197
|
-
__publicField$
|
|
198
|
-
__publicField$
|
|
197
|
+
__publicField$8(this, "formatterName", "Insales");
|
|
198
|
+
__publicField$8(this, "fileExtension", Extension.XLSX);
|
|
199
199
|
}
|
|
200
200
|
async format(writableStream, products, categories, _, __) {
|
|
201
201
|
const mappedCategories = {};
|
|
@@ -286,8 +286,9 @@ class InsalesFormatter {
|
|
|
286
286
|
key: column
|
|
287
287
|
}));
|
|
288
288
|
products.forEach((product) => {
|
|
289
|
+
const externalId = `${product.productId}-${product.variantId}`;
|
|
289
290
|
const row = {
|
|
290
|
-
"\u0412\u043D\u0435\u0448\u043D\u0438\u0439 ID":
|
|
291
|
+
"\u0412\u043D\u0435\u0448\u043D\u0438\u0439 ID": externalId,
|
|
291
292
|
"\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0442\u043E\u0432\u0430\u0440": product.url,
|
|
292
293
|
\u0410\u0440\u0442\u0438\u043A\u0443\u043B: product.vendorCode,
|
|
293
294
|
"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0442\u043E\u0432\u0430\u0440\u0430 \u0438\u043B\u0438 \u0443\u0441\u043B\u0443\u0433\u0438": product.title,
|
|
@@ -324,13 +325,13 @@ class InsalesFormatter {
|
|
|
324
325
|
}
|
|
325
326
|
}
|
|
326
327
|
|
|
327
|
-
var __defProp$
|
|
328
|
-
var __defNormalProp$
|
|
329
|
-
var __publicField$
|
|
328
|
+
var __defProp$7 = Object.defineProperty;
|
|
329
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
330
|
+
var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
330
331
|
class JSONFormatter {
|
|
331
332
|
constructor() {
|
|
332
|
-
__publicField$
|
|
333
|
-
__publicField$
|
|
333
|
+
__publicField$7(this, "formatterName", "JSON");
|
|
334
|
+
__publicField$7(this, "fileExtension", Extension.JSON);
|
|
334
335
|
}
|
|
335
336
|
async format(writableStream, products, categories, brands, _) {
|
|
336
337
|
const stream = new JsonStreamStringify({
|
|
@@ -342,13 +343,13 @@ class JSONFormatter {
|
|
|
342
343
|
}
|
|
343
344
|
}
|
|
344
345
|
|
|
345
|
-
var __defProp$
|
|
346
|
-
var __defNormalProp$
|
|
347
|
-
var __publicField$
|
|
346
|
+
var __defProp$6 = Object.defineProperty;
|
|
347
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
348
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
348
349
|
class SimpleJSONFormatter {
|
|
349
350
|
constructor() {
|
|
350
|
-
__publicField$
|
|
351
|
-
__publicField$
|
|
351
|
+
__publicField$6(this, "formatterName", "JSON");
|
|
352
|
+
__publicField$6(this, "fileExtension", Extension.JSON);
|
|
352
353
|
}
|
|
353
354
|
async format(writableStream, products, categories, brands, _) {
|
|
354
355
|
const groupedProduct = /* @__PURE__ */ new Map();
|
|
@@ -374,14 +375,14 @@ class SimpleJSONFormatter {
|
|
|
374
375
|
}
|
|
375
376
|
}
|
|
376
377
|
|
|
377
|
-
var __defProp$
|
|
378
|
-
var __defNormalProp$
|
|
379
|
-
var __publicField$
|
|
378
|
+
var __defProp$5 = Object.defineProperty;
|
|
379
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
380
|
+
var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
380
381
|
const { stream } = pkg;
|
|
381
382
|
class TgShopFormatter {
|
|
382
383
|
constructor() {
|
|
383
|
-
__publicField$
|
|
384
|
-
__publicField$
|
|
384
|
+
__publicField$5(this, "formatterName", "TgShop");
|
|
385
|
+
__publicField$5(this, "fileExtension", Extension.XLSX);
|
|
385
386
|
}
|
|
386
387
|
async format(writableStream, products, categories, _, __) {
|
|
387
388
|
const getParameter = (product, key) => product.params?.find((value) => value.key === key);
|
|
@@ -452,13 +453,13 @@ class TgShopFormatter {
|
|
|
452
453
|
}
|
|
453
454
|
}
|
|
454
455
|
|
|
455
|
-
var __defProp$
|
|
456
|
-
var __defNormalProp$
|
|
457
|
-
var __publicField$
|
|
456
|
+
var __defProp$4 = Object.defineProperty;
|
|
457
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
458
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
458
459
|
class TildaFormatter {
|
|
459
460
|
constructor() {
|
|
460
|
-
__publicField$
|
|
461
|
-
__publicField$
|
|
461
|
+
__publicField$4(this, "formatterName", "Tilda");
|
|
462
|
+
__publicField$4(this, "fileExtension", Extension.CSV);
|
|
462
463
|
}
|
|
463
464
|
async format(writableStream, products, categories, _, __) {
|
|
464
465
|
const mappedCategories = {};
|
|
@@ -505,6 +506,226 @@ class TildaFormatter {
|
|
|
505
506
|
}
|
|
506
507
|
}
|
|
507
508
|
|
|
509
|
+
const buildCategoryPaths = (categories) => {
|
|
510
|
+
const idToCategory = /* @__PURE__ */ new Map();
|
|
511
|
+
categories.forEach((category) => {
|
|
512
|
+
idToCategory.set(category.id, category);
|
|
513
|
+
});
|
|
514
|
+
const categoryPaths = /* @__PURE__ */ new Map();
|
|
515
|
+
categories.forEach((category) => {
|
|
516
|
+
const path = [];
|
|
517
|
+
let currentCategory = category;
|
|
518
|
+
while (currentCategory) {
|
|
519
|
+
path.unshift(currentCategory);
|
|
520
|
+
if (currentCategory.parentId !== void 0) {
|
|
521
|
+
currentCategory = idToCategory.get(currentCategory.parentId);
|
|
522
|
+
} else {
|
|
523
|
+
currentCategory = void 0;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
categoryPaths.set(category.id, path);
|
|
527
|
+
});
|
|
528
|
+
return categoryPaths;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
var __defProp$3 = Object.defineProperty;
|
|
532
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
533
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
534
|
+
class WooCommerceFormatter {
|
|
535
|
+
constructor() {
|
|
536
|
+
__publicField$3(this, "formatterName", "WooCommerce");
|
|
537
|
+
__publicField$3(this, "fileExtension", Extension.CSV);
|
|
538
|
+
__publicField$3(this, "DEFAULT_COLUMNS", [
|
|
539
|
+
"ID",
|
|
540
|
+
"Type",
|
|
541
|
+
"SKU",
|
|
542
|
+
"Name",
|
|
543
|
+
"Parent",
|
|
544
|
+
"Short description",
|
|
545
|
+
"Description",
|
|
546
|
+
"Stock",
|
|
547
|
+
"Regular price",
|
|
548
|
+
"Position",
|
|
549
|
+
"Categories",
|
|
550
|
+
"Tags",
|
|
551
|
+
"Images"
|
|
552
|
+
]);
|
|
553
|
+
}
|
|
554
|
+
formatKeyAttribute(key) {
|
|
555
|
+
const keyWithoutInvalidCharacters = key.replaceAll(",", "").replaceAll(";", "");
|
|
556
|
+
return keyWithoutInvalidCharacters.length >= 28 ? keyWithoutInvalidCharacters.slice(0, 24) + "..." : keyWithoutInvalidCharacters;
|
|
557
|
+
}
|
|
558
|
+
formatValueAttribute(value) {
|
|
559
|
+
return value.replaceAll(",", "").replaceAll(";", "");
|
|
560
|
+
}
|
|
561
|
+
formatProducts(products) {
|
|
562
|
+
const formatParams = (params) => {
|
|
563
|
+
return params?.map(({ key, value }) => {
|
|
564
|
+
const formatedKey = this.formatKeyAttribute(key);
|
|
565
|
+
const formatedValue = this.formatValueAttribute(value);
|
|
566
|
+
return { key: formatedKey, value: formatedValue };
|
|
567
|
+
});
|
|
568
|
+
};
|
|
569
|
+
return products.map((product) => {
|
|
570
|
+
const params = formatParams(product.params);
|
|
571
|
+
const properties = formatParams(product.properties);
|
|
572
|
+
return { ...product, params, properties };
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
createAttribute(data) {
|
|
576
|
+
if (!data?.name || data.id === void 0) return;
|
|
577
|
+
const attributeStartName = "Attribute";
|
|
578
|
+
const attribute = {};
|
|
579
|
+
attribute[`${attributeStartName} ${data.id} name`] = data.name;
|
|
580
|
+
if (data.values !== void 0)
|
|
581
|
+
attribute[`${attributeStartName} ${data.id} value(s)`] = data.values;
|
|
582
|
+
if (data.visible !== void 0)
|
|
583
|
+
attribute[`${attributeStartName} ${data.id} visible`] = data.visible;
|
|
584
|
+
if (data.global !== void 0)
|
|
585
|
+
attribute[`${attributeStartName} ${data.id} global`] = data.global;
|
|
586
|
+
return attribute;
|
|
587
|
+
}
|
|
588
|
+
extractAttributes(products) {
|
|
589
|
+
const formatedProducts = this.formatProducts(products);
|
|
590
|
+
const paramsMap = /* @__PURE__ */ new Map();
|
|
591
|
+
const propertiesMap = /* @__PURE__ */ new Map();
|
|
592
|
+
const uniqueAttributes = /* @__PURE__ */ new Map();
|
|
593
|
+
formatedProducts.forEach((product) => {
|
|
594
|
+
product.params?.forEach(({ key }) => {
|
|
595
|
+
if (!uniqueAttributes.has(key)) {
|
|
596
|
+
uniqueAttributes.set(key, uniqueAttributes.size);
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
product.properties?.forEach(({ key }) => {
|
|
600
|
+
if (!uniqueAttributes.has(key)) {
|
|
601
|
+
uniqueAttributes.set(key, uniqueAttributes.size);
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
});
|
|
605
|
+
formatedProducts.forEach((product) => {
|
|
606
|
+
const paramAttributes = paramsMap.get(product.variantId) ?? {};
|
|
607
|
+
const propertyAttributes = propertiesMap.get(product.variantId) ?? {};
|
|
608
|
+
product.params?.forEach(({ key, value }) => {
|
|
609
|
+
const index = uniqueAttributes.get(key);
|
|
610
|
+
if (index === void 0) {
|
|
611
|
+
console.error(`\u041D\u0435 \u043D\u0430\u0448\u043B\u043E\u0441\u044C \u0443\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u043A\u043B\u044E\u0447\u0430 \u0434\u043B\u044F \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430 - ${key}`);
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
const attribute = this.createAttribute({
|
|
615
|
+
name: key,
|
|
616
|
+
id: index,
|
|
617
|
+
values: value,
|
|
618
|
+
visible: 0,
|
|
619
|
+
global: 0
|
|
620
|
+
});
|
|
621
|
+
if (!attribute) return;
|
|
622
|
+
Object.entries(attribute).forEach(
|
|
623
|
+
([key2, value2]) => paramAttributes[key2] = value2
|
|
624
|
+
);
|
|
625
|
+
});
|
|
626
|
+
product.properties?.forEach(({ key, value }) => {
|
|
627
|
+
const index = uniqueAttributes.get(key);
|
|
628
|
+
if (index === void 0) {
|
|
629
|
+
console.error(`\u041D\u0435 \u043D\u0430\u0448\u043B\u043E\u0441\u044C \u0443\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u043A\u043B\u044E\u0447\u0430 \u0434\u043B\u044F \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430 - ${key}`);
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
if (paramAttributes[`Attribute ${index} name`]) {
|
|
633
|
+
console.warn(`\u0414\u0430\u043D\u043D\u043E\u0435 \u0441\u0432\u043E\u0439\u0441\u0442\u0432\u043E \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0430\u0445 - ${key}`);
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
const attribute = this.createAttribute({
|
|
637
|
+
name: key,
|
|
638
|
+
id: index,
|
|
639
|
+
values: value,
|
|
640
|
+
global: 0
|
|
641
|
+
});
|
|
642
|
+
if (!attribute) return;
|
|
643
|
+
Object.entries(attribute).forEach(
|
|
644
|
+
([key2, value2]) => propertyAttributes[key2] = value2
|
|
645
|
+
);
|
|
646
|
+
});
|
|
647
|
+
paramsMap.set(product.variantId, paramAttributes);
|
|
648
|
+
propertiesMap.set(product.variantId, propertyAttributes);
|
|
649
|
+
});
|
|
650
|
+
return { params: paramsMap, properties: propertiesMap };
|
|
651
|
+
}
|
|
652
|
+
removeVisibleFromAttributes(params) {
|
|
653
|
+
Object.entries(params).forEach(([key]) => {
|
|
654
|
+
if (key.includes("visible")) params[key] = "";
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
async format(writableStream, products, categories, _, __) {
|
|
658
|
+
const categoriePaths = buildCategoryPaths(categories ?? []);
|
|
659
|
+
const csvStream = new CSVStream({
|
|
660
|
+
delimiter: ";",
|
|
661
|
+
emptyFieldValue: "",
|
|
662
|
+
lineSeparator: "\n"
|
|
663
|
+
});
|
|
664
|
+
csvStream.getWritableStream().pipe(writableStream);
|
|
665
|
+
const columns = new Set(this.DEFAULT_COLUMNS);
|
|
666
|
+
const attributes = this.extractAttributes(products);
|
|
667
|
+
const variations = products.map((product, index) => {
|
|
668
|
+
const pathsArray = categoriePaths.get(product.categoryId)?.map((category) => category.name);
|
|
669
|
+
let row = {
|
|
670
|
+
ID: product.variantId,
|
|
671
|
+
Type: "variation",
|
|
672
|
+
SKU: product.variantId,
|
|
673
|
+
Name: product.title,
|
|
674
|
+
Parent: product.parentId ?? 0,
|
|
675
|
+
"Short description": "",
|
|
676
|
+
Description: product.description,
|
|
677
|
+
Stock: product.count ?? 0,
|
|
678
|
+
"Regular price": product.price,
|
|
679
|
+
Position: index + 1,
|
|
680
|
+
Categories: pathsArray?.join(" > "),
|
|
681
|
+
Tags: product.keywords?.join(","),
|
|
682
|
+
Images: product.images?.join(",")
|
|
683
|
+
};
|
|
684
|
+
const productParams = attributes.params.get(product.variantId) ?? {};
|
|
685
|
+
this.removeVisibleFromAttributes(productParams);
|
|
686
|
+
row = { ...row, ...productParams };
|
|
687
|
+
return row;
|
|
688
|
+
});
|
|
689
|
+
const parentProducts = /* @__PURE__ */ new Map();
|
|
690
|
+
variations.forEach((product) => {
|
|
691
|
+
const currentParent = parentProducts.get(product.Parent);
|
|
692
|
+
let row = {
|
|
693
|
+
...product,
|
|
694
|
+
Type: "variable",
|
|
695
|
+
ID: product.Parent,
|
|
696
|
+
SKU: product.Parent,
|
|
697
|
+
Position: 0,
|
|
698
|
+
Parent: "",
|
|
699
|
+
"Regular price": ""
|
|
700
|
+
};
|
|
701
|
+
row.Stock = (currentParent?.Stock || 0) + (product?.Stock || 0);
|
|
702
|
+
const productParams = attributes.params.get(product.SKU) ?? {};
|
|
703
|
+
const productProperties = attributes.properties.get(product.SKU) ?? {};
|
|
704
|
+
Object.entries(productParams).forEach(([key]) => {
|
|
705
|
+
if (key.includes("visible")) productParams[key] = 0;
|
|
706
|
+
});
|
|
707
|
+
if (currentParent) {
|
|
708
|
+
Object.entries(productParams).forEach(([key, value]) => {
|
|
709
|
+
if (key.includes("value(s)")) {
|
|
710
|
+
productParams[key] = currentParent[key] + `, ${value}`;
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
Object.keys({ ...row, ...productParams, ...productProperties }).forEach(
|
|
715
|
+
(item) => columns.add(item)
|
|
716
|
+
);
|
|
717
|
+
row = { ...row, ...productParams, ...productProperties };
|
|
718
|
+
parentProducts.set(product.Parent, row);
|
|
719
|
+
});
|
|
720
|
+
const variableProducts = Array.from(parentProducts.values());
|
|
721
|
+
csvStream.setColumns(columns);
|
|
722
|
+
[...variableProducts, ...variations].forEach((product) => {
|
|
723
|
+
csvStream.addRow(product);
|
|
724
|
+
});
|
|
725
|
+
csvStream.getWritableStream().end();
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
508
729
|
var __defProp$2 = Object.defineProperty;
|
|
509
730
|
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
510
731
|
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -678,7 +899,8 @@ const Formatters = {
|
|
|
678
899
|
ExcelFormatter,
|
|
679
900
|
JSONFormatter,
|
|
680
901
|
SimpleJSONFormatter,
|
|
681
|
-
XMLFormatter
|
|
902
|
+
XMLFormatter,
|
|
903
|
+
WooCommerceFormatter
|
|
682
904
|
};
|
|
683
905
|
|
|
684
906
|
var __defProp = Object.defineProperty;
|
|
@@ -735,5 +957,5 @@ var Currency = /* @__PURE__ */ ((Currency2) => {
|
|
|
735
957
|
return Currency2;
|
|
736
958
|
})(Currency || {});
|
|
737
959
|
|
|
738
|
-
export { Currency, Extension, FormatterAbstract, Formatters, GoodsExporter, Vat };
|
|
960
|
+
export { Currency, Extension, FormatterAbstract, Formatters, GoodsExporter, Vat, buildCategoryPaths };
|
|
739
961
|
//# sourceMappingURL=index.mjs.map
|