goods-exporter 1.2.12 → 1.3.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
@@ -597,7 +597,11 @@ interface Brand {
597
597
  */
598
598
  name: string;
599
599
  /**
600
- * **Ссылка на изображение**
600
+ * **Ссылка на изображение логотипа**
601
+ */
602
+ logoUrl?: string;
603
+ /**
604
+ * **Ссылка на изображение баннера**
601
605
  */
602
606
  coverURL?: string;
603
607
  }
@@ -721,6 +725,10 @@ declare class GoodsExporter<Context extends object | undefined> {
721
725
 
722
726
  declare const buildCategoryPaths: (categories: Category[]) => Map<number, Category[]>;
723
727
 
728
+ declare const writeWithDrain: (stream: Writable) => (chunk: any) => Promise<void>;
729
+
730
+ declare const delay: (ms: number) => Promise<unknown>;
731
+
724
732
  declare const urlQueryEncode: (inputUrl: string) => string;
725
733
 
726
- export { type Brand, type Category, Currency, type Exporter, Extension, FormatterAbstract, type FormatterOptions, Formatters, GoodsExporter, type IParam, type ISize, type Product, type Transformer, Vat, buildCategoryPaths, urlQueryEncode };
734
+ export { type Brand, type Category, Currency, type Exporter, Extension, FormatterAbstract, type FormatterOptions, Formatters, GoodsExporter, type IParam, type ISize, type Product, type Transformer, Vat, buildCategoryPaths, delay, urlQueryEncode, writeWithDrain };
@@ -1,14 +1,19 @@
1
1
  'use strict';
2
2
 
3
+ var utils = require('src/utils');
3
4
  var stream$3 = require('stream');
4
5
  var pkg = require('exceljs');
5
6
  var jsonStreamStringify = require('json-stream-stringify');
7
+ var events = require('events');
6
8
  var fastXmlParser = require('fast-xml-parser');
7
9
  var fs = require('fs');
8
10
 
9
11
  var __defProp$b = Object.defineProperty;
10
12
  var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
13
+ var __publicField$b = (obj, key, value) => {
14
+ __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
15
+ return value;
16
+ };
12
17
  class CSVStream {
13
18
  constructor({ delimiter, lineSeparator, emptyFieldValue }) {
14
19
  __publicField$b(this, "stream", new stream$3.PassThrough());
@@ -16,11 +21,15 @@ class CSVStream {
16
21
  __publicField$b(this, "lineSeparator", "\n");
17
22
  __publicField$b(this, "emptyFieldValue", "");
18
23
  __publicField$b(this, "columns", /* @__PURE__ */ new Set());
19
- if (delimiter !== void 0) this.delimiter = delimiter;
20
- if (lineSeparator !== void 0) this.lineSeparator = lineSeparator;
21
- if (emptyFieldValue !== void 0) this.emptyFieldValue = emptyFieldValue;
24
+ __publicField$b(this, "writer", utils.writeWithDrain(this.stream));
25
+ if (delimiter !== void 0)
26
+ this.delimiter = delimiter;
27
+ if (lineSeparator !== void 0)
28
+ this.lineSeparator = lineSeparator;
29
+ if (emptyFieldValue !== void 0)
30
+ this.emptyFieldValue = emptyFieldValue;
22
31
  }
23
- getWritableStream() {
32
+ get writableStream() {
24
33
  return this.stream;
25
34
  }
26
35
  setColumns(columns) {
@@ -29,12 +38,11 @@ class CSVStream {
29
38
  Array.from(this.columns).join(this.delimiter) + this.lineSeparator
30
39
  );
31
40
  }
32
- addRow(items) {
33
- this.stream.write(
34
- Array.from(this.columns).map(
35
- (key) => items[key] === void 0 ? this.emptyFieldValue : items[key] + ""
36
- ).join(this.delimiter) + this.lineSeparator
37
- );
41
+ async addRow(items) {
42
+ const data = Array.from(this.columns).map(
43
+ (key) => items[key] === void 0 ? this.emptyFieldValue : items[key] + ""
44
+ ).join(this.delimiter) + this.lineSeparator;
45
+ await this.writer(data);
38
46
  }
39
47
  }
40
48
 
@@ -51,7 +59,10 @@ var Extension = /* @__PURE__ */ ((Extension2) => {
51
59
 
52
60
  var __defProp$a = Object.defineProperty;
53
61
  var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
54
- var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
62
+ var __publicField$a = (obj, key, value) => {
63
+ __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
64
+ return value;
65
+ };
55
66
  class CSVFormatter {
56
67
  constructor() {
57
68
  __publicField$a(this, "formatterName", "CSV");
@@ -65,7 +76,7 @@ class CSVFormatter {
65
76
  emptyFieldValue: "",
66
77
  lineSeparator: "\n"
67
78
  });
68
- csvStream.getWritableStream().pipe(writableStream);
79
+ csvStream.writableStream.pipe(writableStream);
69
80
  const columns = /* @__PURE__ */ new Set([
70
81
  "url",
71
82
  "productId",
@@ -96,11 +107,12 @@ class CSVFormatter {
96
107
  ]);
97
108
  products.forEach((product) => {
98
109
  Object.entries(product).forEach(([key, value]) => {
99
- if (value) columns.add(key);
110
+ if (value)
111
+ columns.add(key);
100
112
  });
101
113
  });
102
114
  csvStream.setColumns(columns);
103
- products.forEach((product) => {
115
+ for (const product of products) {
104
116
  const row = {
105
117
  ...product,
106
118
  category: mappedCategories[product.categoryId],
@@ -116,15 +128,18 @@ class CSVFormatter {
116
128
  timeDeliveryMin: product.timeDelivery?.min,
117
129
  timeDeliveryMax: product.timeDelivery?.max
118
130
  };
119
- csvStream.addRow(row);
120
- });
121
- csvStream.getWritableStream().end();
131
+ await csvStream.addRow(row);
132
+ }
133
+ csvStream.writableStream.end();
122
134
  }
123
135
  }
124
136
 
125
137
  var __defProp$9 = Object.defineProperty;
126
138
  var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
127
- var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
139
+ var __publicField$9 = (obj, key, value) => {
140
+ __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
141
+ return value;
142
+ };
128
143
  const { stream: stream$2 } = pkg;
129
144
  class ExcelFormatter {
130
145
  constructor() {
@@ -164,7 +179,8 @@ class ExcelFormatter {
164
179
  ]);
165
180
  products.forEach((product) => {
166
181
  Object.entries(product).forEach(([key, value]) => {
167
- if (value) columns.add(key);
182
+ if (value)
183
+ columns.add(key);
168
184
  });
169
185
  });
170
186
  const workbook = new stream$2.xlsx.WorkbookWriter({
@@ -200,7 +216,10 @@ class ExcelFormatter {
200
216
 
201
217
  var __defProp$8 = Object.defineProperty;
202
218
  var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
203
- var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
219
+ var __publicField$8 = (obj, key, value) => {
220
+ __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
221
+ return value;
222
+ };
204
223
  const { stream: stream$1 } = pkg;
205
224
  class InsalesFormatter {
206
225
  constructor() {
@@ -230,7 +249,8 @@ class InsalesFormatter {
230
249
  const categories2 = {};
231
250
  const categoryList = new Array();
232
251
  function addCategory(categoryId) {
233
- if (categoryId === void 0) return;
252
+ if (categoryId === void 0)
253
+ return;
234
254
  const category = mappedCategories[categoryId];
235
255
  if (category) {
236
256
  categoryList.push(category.name);
@@ -293,7 +313,7 @@ class InsalesFormatter {
293
313
  header: column,
294
314
  key: column
295
315
  }));
296
- products.forEach((product) => {
316
+ for (const product of products) {
297
317
  const externalId = `${product.productId}-${product.variantId}`;
298
318
  const row = {
299
319
  "\u0412\u043D\u0435\u0448\u043D\u0438\u0439 ID": externalId,
@@ -313,7 +333,7 @@ class InsalesFormatter {
313
333
  "\u0413\u0430\u0431\u0430\u0440\u0438\u0442\u044B \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u0430": product.dimensions,
314
334
  \u0412\u0435\u0441: product.weight,
315
335
  "\u0420\u0430\u0437\u043C\u0435\u0449\u0435\u043D\u0438\u0435 \u043D\u0430 \u0441\u0430\u0439\u0442\u0435": product.available,
316
- \u041D\u0414\u0421: product.vat.toString(),
336
+ \u041D\u0414\u0421: product.vat?.toString(),
317
337
  "\u0412\u0430\u043B\u044E\u0442\u0430 \u0441\u043A\u043B\u0430\u0434\u0430": product.currency.toString(),
318
338
  "\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u0430": product.parentId === void 0 ? product.images?.join(" ") : void 0,
319
339
  \u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F: product.parentId === void 0 ? void 0 : product.images?.join(" "),
@@ -325,7 +345,7 @@ class InsalesFormatter {
325
345
  "\u041A\u043B\u044E\u0447\u0435\u0432\u044B\u0435 \u0441\u043B\u043E\u0432\u0430": product.keywords?.join(",")
326
346
  };
327
347
  worksheet.addRow(row).commit();
328
- });
348
+ }
329
349
  worksheet.commit();
330
350
  await workbook.commit();
331
351
  }
@@ -333,7 +353,10 @@ class InsalesFormatter {
333
353
 
334
354
  var __defProp$7 = Object.defineProperty;
335
355
  var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
336
- var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
356
+ var __publicField$7 = (obj, key, value) => {
357
+ __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
358
+ return value;
359
+ };
337
360
  class JSONFormatter {
338
361
  constructor() {
339
362
  __publicField$7(this, "formatterName", "JSON");
@@ -351,7 +374,10 @@ class JSONFormatter {
351
374
 
352
375
  var __defProp$6 = Object.defineProperty;
353
376
  var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
354
- var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
377
+ var __publicField$6 = (obj, key, value) => {
378
+ __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
379
+ return value;
380
+ };
355
381
  class SimpleJSONFormatter {
356
382
  constructor() {
357
383
  __publicField$6(this, "formatterName", "JSON");
@@ -360,16 +386,19 @@ class SimpleJSONFormatter {
360
386
  async format(writableStream, products, categories, brands, _) {
361
387
  const groupedProduct = /* @__PURE__ */ new Map();
362
388
  products.forEach((product) => {
363
- if (product.parentId !== void 0) return;
389
+ if (product.parentId !== void 0)
390
+ return;
364
391
  groupedProduct.set(product.variantId, {
365
392
  ...product,
366
393
  children: []
367
394
  });
368
395
  });
369
396
  products.forEach((product) => {
370
- if (product.parentId === void 0) return;
397
+ if (product.parentId === void 0)
398
+ return;
371
399
  const parent = groupedProduct.get(product.parentId);
372
- if (!parent) return;
400
+ if (!parent)
401
+ return;
373
402
  parent.children.push(product);
374
403
  });
375
404
  const stream = new jsonStreamStringify.JsonStreamStringify({
@@ -383,7 +412,10 @@ class SimpleJSONFormatter {
383
412
 
384
413
  var __defProp$5 = Object.defineProperty;
385
414
  var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
386
- var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
415
+ var __publicField$5 = (obj, key, value) => {
416
+ __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
417
+ return value;
418
+ };
387
419
  const { stream } = pkg;
388
420
  class TgShopFormatter {
389
421
  constructor() {
@@ -461,7 +493,10 @@ class TgShopFormatter {
461
493
 
462
494
  var __defProp$4 = Object.defineProperty;
463
495
  var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
464
- var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
496
+ var __publicField$4 = (obj, key, value) => {
497
+ __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
498
+ return value;
499
+ };
465
500
  class TildaFormatter {
466
501
  constructor() {
467
502
  __publicField$4(this, "formatterName", "Tilda");
@@ -475,7 +510,7 @@ class TildaFormatter {
475
510
  emptyFieldValue: "",
476
511
  lineSeparator: "\n"
477
512
  });
478
- csvStream.getWritableStream().pipe(writableStream);
513
+ csvStream.writableStream.pipe(writableStream);
479
514
  const columns = /* @__PURE__ */ new Set([
480
515
  "SKU",
481
516
  "Brand",
@@ -491,7 +526,7 @@ class TildaFormatter {
491
526
  "Parent UID"
492
527
  ]);
493
528
  csvStream.setColumns(columns);
494
- products.forEach((product) => {
529
+ for (const product of products) {
495
530
  const row = {
496
531
  SKU: product.vendorCode,
497
532
  Brand: product.vendor,
@@ -506,9 +541,9 @@ class TildaFormatter {
506
541
  "External ID": product.variantId,
507
542
  "Parent UID": product.parentId
508
543
  };
509
- csvStream.addRow(row);
510
- });
511
- csvStream.getWritableStream().end();
544
+ await csvStream.addRow(row);
545
+ }
546
+ csvStream.writableStream.end();
512
547
  }
513
548
  }
514
549
 
@@ -534,6 +569,17 @@ const buildCategoryPaths = (categories) => {
534
569
  return categoryPaths;
535
570
  };
536
571
 
572
+ const writeWithDrain = (stream) => {
573
+ return async (chunk) => {
574
+ const canWrite = stream.write(chunk);
575
+ if (!canWrite) {
576
+ await events.once(stream, "drain");
577
+ }
578
+ };
579
+ };
580
+
581
+ const delay = async (ms) => await new Promise((resolve) => setTimeout(resolve, ms));
582
+
537
583
  const urlQueryEncode = (inputUrl) => {
538
584
  try {
539
585
  const url = new URL(inputUrl);
@@ -547,7 +593,10 @@ const urlQueryEncode = (inputUrl) => {
547
593
 
548
594
  var __defProp$3 = Object.defineProperty;
549
595
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
550
- var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
596
+ var __publicField$3 = (obj, key, value) => {
597
+ __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
598
+ return value;
599
+ };
551
600
  class WooCommerceFormatter {
552
601
  constructor() {
553
602
  __publicField$3(this, "formatterName", "WooCommerce");
@@ -591,7 +640,8 @@ class WooCommerceFormatter {
591
640
  });
592
641
  }
593
642
  createAttribute(data) {
594
- if (!data?.name || data.id === void 0) return;
643
+ if (!data?.name || data.id === void 0)
644
+ return;
595
645
  const attributeStartName = "Attribute";
596
646
  const attribute = {};
597
647
  attribute[`${attributeStartName} ${data.id} name`] = data.name;
@@ -638,7 +688,8 @@ class WooCommerceFormatter {
638
688
  visible: 0,
639
689
  global: 0
640
690
  });
641
- if (!attribute) return;
691
+ if (!attribute)
692
+ return;
642
693
  Object.entries(attribute).forEach(
643
694
  ([key2, value2]) => paramAttributes[key2] = value2
644
695
  );
@@ -671,7 +722,8 @@ class WooCommerceFormatter {
671
722
  values: value,
672
723
  global: 0
673
724
  });
674
- if (!attribute) return;
725
+ if (!attribute)
726
+ return;
675
727
  Object.entries(attribute).forEach(
676
728
  ([key2, value2]) => propertyAttributes[key2] = value2
677
729
  );
@@ -683,24 +735,25 @@ class WooCommerceFormatter {
683
735
  }
684
736
  removeVisibleFromAttributes(params) {
685
737
  Object.entries(params).forEach(([key]) => {
686
- if (key.includes("visible")) params[key] = "";
738
+ if (key.includes("visible"))
739
+ params[key] = "";
687
740
  });
688
741
  }
689
742
  async format(writableStream, products, categories, _, __) {
690
- const categoriePaths = buildCategoryPaths(categories ?? []);
743
+ const categoryPaths = buildCategoryPaths(categories ?? []);
691
744
  const csvStream = new CSVStream({
692
745
  delimiter: ";",
693
746
  emptyFieldValue: "",
694
747
  lineSeparator: "\n"
695
748
  });
696
- csvStream.getWritableStream().pipe(writableStream);
749
+ csvStream.writableStream.pipe(writableStream);
697
750
  const columns = new Set(this.DEFAULT_COLUMNS);
698
751
  const attributes = this.extractAttributes(products);
699
752
  const variationsByParentId = /* @__PURE__ */ new Map();
700
753
  const imagesByParentId = /* @__PURE__ */ new Map();
701
754
  const sizesByParentId = /* @__PURE__ */ new Map();
702
755
  const variations = products.map((product, index) => {
703
- const pathsArray = categoriePaths.get(product.categoryId)?.map((category) => category.name);
756
+ const pathsArray = categoryPaths.get(product.categoryId)?.map((category) => category.name);
704
757
  const price = product.price ? product.price : "";
705
758
  let row = {
706
759
  ID: product.variantId,
@@ -756,7 +809,8 @@ class WooCommerceFormatter {
756
809
  const productParams = attributes.params.get(product.SKU) ?? {};
757
810
  const productProperties = attributes.properties.get(product.SKU) ?? {};
758
811
  Object.entries(productParams).forEach(([key]) => {
759
- if (key.includes("visible")) productParams[key] = 0;
812
+ if (key.includes("visible"))
813
+ productParams[key] = 0;
760
814
  });
761
815
  if (currentParent) {
762
816
  Object.entries(productParams).forEach(([key, value]) => {
@@ -773,19 +827,24 @@ class WooCommerceFormatter {
773
827
  });
774
828
  const variableProducts = Array.from(parentProducts.values());
775
829
  csvStream.setColumns(columns);
776
- variableProducts.forEach((parentProduct) => {
777
- csvStream.addRow(parentProduct);
778
- variationsByParentId.get(parentProduct.ID)?.forEach((variationProduct) => {
779
- csvStream.addRow(variationProduct);
780
- });
781
- });
782
- csvStream.getWritableStream().end();
830
+ for (const parentProduct of variableProducts) {
831
+ await csvStream.addRow(parentProduct);
832
+ for (const variationProduct of variationsByParentId.get(
833
+ parentProduct.ID
834
+ ) ?? []) {
835
+ await csvStream.addRow(variationProduct);
836
+ }
837
+ }
838
+ csvStream.writableStream.end();
783
839
  }
784
840
  }
785
841
 
786
842
  var __defProp$2 = Object.defineProperty;
787
843
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
788
- var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
844
+ var __publicField$2 = (obj, key, value) => {
845
+ __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
846
+ return value;
847
+ };
789
848
  class YMLFormatter {
790
849
  constructor() {
791
850
  __publicField$2(this, "formatterName", "YMl");
@@ -804,36 +863,38 @@ class YMLFormatter {
804
863
  result.write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n');
805
864
  result.write('<yml_catalog date="' + date + '">\n');
806
865
  result.write("<shop>\n");
866
+ const resultWriter = utils.writeWithDrain(result);
807
867
  if (options?.shopName) {
808
- result.write(builder.build({ name: options.shopName }));
809
- result.write("\n");
868
+ await resultWriter(builder.build({ name: options.shopName }));
869
+ await resultWriter("\n");
810
870
  }
811
871
  if (options?.companyName) {
812
- result.write(builder.build({ company: options.companyName }));
813
- result.write("\n");
872
+ await resultWriter(builder.build({ company: options.companyName }));
873
+ await resultWriter("\n");
814
874
  }
815
875
  if (categories) {
816
- result.write(
876
+ await resultWriter(
817
877
  builder.build({
818
878
  // tagname: "categories",
819
879
  categories: { category: this.getCategories(categories) }
820
880
  })
821
881
  );
822
- result.write("\n");
882
+ await resultWriter("\n");
823
883
  }
824
884
  if (brands) {
825
- result.write(
885
+ await resultWriter(
826
886
  builder.build({ brands: { brand: this.getBrands(brands) } })
827
887
  );
828
- result.write("\n");
888
+ await resultWriter("\n");
829
889
  }
830
- result.write("<offers>\n");
890
+ await resultWriter("<offers>\n");
831
891
  const offerStream = new stream$3.PassThrough();
892
+ const offerWriter = utils.writeWithDrain(offerStream);
832
893
  offerStream.pipe(result, { end: false });
833
- products.forEach((product) => {
894
+ for (const product of products) {
834
895
  const offer = builder.build({ offer: this.getOffer(product) });
835
- offerStream.write(offer + "\n");
836
- });
896
+ await offerWriter(offer + "\n");
897
+ }
837
898
  offerStream.end();
838
899
  offerStream.on("end", () => {
839
900
  result.write("</offers>\n");
@@ -843,7 +904,8 @@ class YMLFormatter {
843
904
  });
844
905
  }
845
906
  getBrands(brands) {
846
- if (!brands) return [];
907
+ if (!brands)
908
+ return [];
847
909
  return brands.map((brand) => ({
848
910
  "@_id": brand.id,
849
911
  "@_url": brand.coverURL ?? "",
@@ -851,7 +913,8 @@ class YMLFormatter {
851
913
  }));
852
914
  }
853
915
  getCategories(categories) {
854
- if (!categories) return [];
916
+ if (!categories)
917
+ return [];
855
918
  return categories.map((cat) => ({
856
919
  "@_id": cat.id,
857
920
  "@_parentId": cat.parentId ?? "",
@@ -943,7 +1006,10 @@ class YMLFormatter {
943
1006
 
944
1007
  var __defProp$1 = Object.defineProperty;
945
1008
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
946
- var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
1009
+ var __publicField$1 = (obj, key, value) => {
1010
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
1011
+ return value;
1012
+ };
947
1013
  class XMLFormatter extends YMLFormatter {
948
1014
  constructor() {
949
1015
  super(...arguments);
@@ -967,7 +1033,10 @@ const Formatters = {
967
1033
 
968
1034
  var __defProp = Object.defineProperty;
969
1035
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
970
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1036
+ var __publicField = (obj, key, value) => {
1037
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1038
+ return value;
1039
+ };
971
1040
  class GoodsExporter {
972
1041
  constructor(context) {
973
1042
  this.context = context;
@@ -1035,5 +1104,7 @@ exports.Formatters = Formatters;
1035
1104
  exports.GoodsExporter = GoodsExporter;
1036
1105
  exports.Vat = Vat;
1037
1106
  exports.buildCategoryPaths = buildCategoryPaths;
1107
+ exports.delay = delay;
1038
1108
  exports.urlQueryEncode = urlQueryEncode;
1109
+ exports.writeWithDrain = writeWithDrain;
1039
1110
  //# sourceMappingURL=index.cjs.map