goods-exporter 1.3.3 → 1.3.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.
@@ -0,0 +1,1060 @@
1
+ 'use strict';
2
+
3
+ var events = require('events');
4
+ var stream$3 = require('stream');
5
+ var pkg = require('exceljs');
6
+ var jsonStreamStringify = require('json-stream-stringify');
7
+ var fastXmlParser = require('fast-xml-parser');
8
+ var fs = require('fs');
9
+
10
+ const buildCategoryPaths = (categories) => {
11
+ const idToCategory = /* @__PURE__ */ new Map();
12
+ categories.forEach((category) => {
13
+ idToCategory.set(category.id, category);
14
+ });
15
+ const categoryPaths = /* @__PURE__ */ new Map();
16
+ categories.forEach((category) => {
17
+ const path = [];
18
+ let currentCategory = category;
19
+ while (currentCategory) {
20
+ path.unshift(currentCategory);
21
+ if (currentCategory.parentId !== void 0) {
22
+ currentCategory = idToCategory.get(currentCategory.parentId);
23
+ } else {
24
+ currentCategory = void 0;
25
+ }
26
+ }
27
+ categoryPaths.set(category.id, path);
28
+ });
29
+ return categoryPaths;
30
+ };
31
+
32
+ const writeWithDrain = (stream) => {
33
+ return async (chunk) => {
34
+ const canWrite = stream.write(chunk);
35
+ if (!canWrite) {
36
+ await events.once(stream, "drain");
37
+ }
38
+ };
39
+ };
40
+
41
+ const delay = async (ms) => await new Promise((resolve) => setTimeout(resolve, ms));
42
+
43
+ const urlQueryEncode = (inputUrl) => {
44
+ try {
45
+ const url = new URL(inputUrl);
46
+ url.search = url.search.replace(/^\?/, "").replace(/,/g, "%2C");
47
+ return url.toString();
48
+ } catch (error) {
49
+ console.error("Invalid URL:", error);
50
+ return "";
51
+ }
52
+ };
53
+
54
+ var __defProp$b = Object.defineProperty;
55
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
56
+ var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
57
+ class CSVStream {
58
+ constructor({ delimiter, lineSeparator, emptyFieldValue }) {
59
+ __publicField$b(this, "stream", new stream$3.PassThrough());
60
+ __publicField$b(this, "delimiter", ";");
61
+ __publicField$b(this, "lineSeparator", "\n");
62
+ __publicField$b(this, "emptyFieldValue", "");
63
+ __publicField$b(this, "columns", /* @__PURE__ */ new Set());
64
+ __publicField$b(this, "writer", writeWithDrain(this.stream));
65
+ if (delimiter !== void 0) this.delimiter = delimiter;
66
+ if (lineSeparator !== void 0) this.lineSeparator = lineSeparator;
67
+ if (emptyFieldValue !== void 0) this.emptyFieldValue = emptyFieldValue;
68
+ }
69
+ get writableStream() {
70
+ return this.stream;
71
+ }
72
+ setColumns(columns) {
73
+ this.columns = columns;
74
+ this.stream.write(
75
+ Array.from(this.columns).join(this.delimiter) + this.lineSeparator
76
+ );
77
+ }
78
+ async addRow(items) {
79
+ const data = Array.from(this.columns).map(
80
+ (key) => items[key] === void 0 ? this.emptyFieldValue : items[key] + ""
81
+ ).join(this.delimiter) + this.lineSeparator;
82
+ await this.writer(data);
83
+ }
84
+ }
85
+
86
+ class FormatterAbstract {
87
+ }
88
+ var Extension = /* @__PURE__ */ ((Extension2) => {
89
+ Extension2["CSV"] = "csv";
90
+ Extension2["YML"] = "yml";
91
+ Extension2["XML"] = "xml";
92
+ Extension2["XLSX"] = "xlsx";
93
+ Extension2["JSON"] = "json";
94
+ return Extension2;
95
+ })(Extension || {});
96
+
97
+ var __defProp$a = Object.defineProperty;
98
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
99
+ var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
100
+ class CSVFormatter {
101
+ constructor() {
102
+ __publicField$a(this, "formatterName", "CSV");
103
+ __publicField$a(this, "fileExtension", Extension.CSV);
104
+ }
105
+ async format(writableStream, products, categories, _, __) {
106
+ const mappedCategories = {};
107
+ categories?.forEach(({ id, name }) => mappedCategories[id] = name);
108
+ const csvStream = new CSVStream({
109
+ delimiter: ";",
110
+ emptyFieldValue: "",
111
+ lineSeparator: "\n"
112
+ });
113
+ csvStream.writableStream.pipe(writableStream);
114
+ const columns = /* @__PURE__ */ new Set([
115
+ "url",
116
+ "productId",
117
+ "parentId",
118
+ "variantId",
119
+ "title",
120
+ "description",
121
+ "vendor",
122
+ "vendorCode",
123
+ "category",
124
+ "images",
125
+ "videos",
126
+ "timeDeliveryMin",
127
+ "timeDeliveryMax",
128
+ "price",
129
+ "oldPrice",
130
+ "purchasePrice",
131
+ "currency",
132
+ "saleDate",
133
+ "countryOfOrigin",
134
+ "tags",
135
+ "codesTN",
136
+ "params",
137
+ "properties",
138
+ "sizes",
139
+ "keywords",
140
+ "relatedProducts"
141
+ ]);
142
+ products.forEach((product) => {
143
+ Object.entries(product).forEach(([key, value]) => {
144
+ if (value) columns.add(key);
145
+ });
146
+ });
147
+ csvStream.setColumns(columns);
148
+ for (const product of products) {
149
+ const row = {
150
+ ...product,
151
+ category: mappedCategories[product.categoryId],
152
+ images: product.images?.join(","),
153
+ videos: product.videos?.join(","),
154
+ tags: product.tags?.join(","),
155
+ codesTN: product.codesTN?.join(", "),
156
+ params: product.params?.map(({ key, value }) => `${key}=${value}`).join(", "),
157
+ properties: product.properties?.map(({ key, value }) => `${key}=${value}`).join(", "),
158
+ sizes: product.sizes?.map(({ name, value }) => `${name}=${value}`).join(", "),
159
+ keywords: product.keywords?.join(","),
160
+ relatedProducts: product.relatedProducts?.join(","),
161
+ timeDeliveryMin: product.timeDelivery?.min,
162
+ timeDeliveryMax: product.timeDelivery?.max
163
+ };
164
+ await csvStream.addRow(row);
165
+ }
166
+ csvStream.writableStream.end();
167
+ }
168
+ }
169
+
170
+ var __defProp$9 = Object.defineProperty;
171
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
172
+ var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
173
+ const { stream: stream$2 } = pkg;
174
+ class ExcelFormatter {
175
+ constructor() {
176
+ __publicField$9(this, "formatterName", "Excel");
177
+ __publicField$9(this, "fileExtension", Extension.XLSX);
178
+ }
179
+ async format(writableStream, products, categories, _, __) {
180
+ const mappedCategories = {};
181
+ categories?.forEach(({ id, name }) => mappedCategories[id] = name);
182
+ const columns = /* @__PURE__ */ new Set([
183
+ "url",
184
+ "productId",
185
+ "parentId",
186
+ "variantId",
187
+ "title",
188
+ "description",
189
+ "vendor",
190
+ "vendorCode",
191
+ "category",
192
+ "images",
193
+ "videos",
194
+ "timeDeliveryMin",
195
+ "timeDeliveryMax",
196
+ "price",
197
+ "oldPrice",
198
+ "purchasePrice",
199
+ "currency",
200
+ "saleDate",
201
+ "countryOfOrigin",
202
+ "tags",
203
+ "codesTN",
204
+ "params",
205
+ "properties",
206
+ "sizes",
207
+ "keywords",
208
+ "relatedProducts"
209
+ ]);
210
+ products.forEach((product) => {
211
+ Object.entries(product).forEach(([key, value]) => {
212
+ if (value) columns.add(key);
213
+ });
214
+ });
215
+ const workbook = new stream$2.xlsx.WorkbookWriter({
216
+ stream: writableStream
217
+ });
218
+ const worksheet = workbook.addWorksheet("products");
219
+ worksheet.columns = Array.from(columns).map((column) => ({
220
+ key: column,
221
+ header: column
222
+ }));
223
+ products.forEach((product) => {
224
+ const row = {
225
+ ...product,
226
+ category: mappedCategories[product.categoryId],
227
+ images: product.images?.join(","),
228
+ videos: product.videos?.join(","),
229
+ tags: product.tags?.join(","),
230
+ keywords: product.keywords?.join(","),
231
+ relatedProducts: product.relatedProducts?.join(","),
232
+ codesTN: product.codesTN?.join(", "),
233
+ params: product.params?.map(({ key, value }) => `${key}=${value}`).join(", "),
234
+ properties: product.properties?.map(({ key, value }) => `${key}=${value}`).join(", "),
235
+ sizes: product.sizes?.map(({ name, value }) => `${name}=${value}`).join(", "),
236
+ timeDeliveryMin: product.timeDelivery?.min,
237
+ timeDeliveryMax: product.timeDelivery?.max
238
+ };
239
+ worksheet.addRow(row).commit();
240
+ });
241
+ worksheet.commit();
242
+ await workbook.commit();
243
+ }
244
+ }
245
+
246
+ var __defProp$8 = Object.defineProperty;
247
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
248
+ var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
249
+ const { stream: stream$1 } = pkg;
250
+ class InsalesFormatter {
251
+ constructor() {
252
+ __publicField$8(this, "formatterName", "Insales");
253
+ __publicField$8(this, "fileExtension", Extension.XLSX);
254
+ }
255
+ async format(writableStream, products, categories, _, __) {
256
+ const mappedCategories = {};
257
+ categories?.forEach(
258
+ (category) => mappedCategories[category.id] = category
259
+ );
260
+ const getParams = (product) => {
261
+ const properties = {};
262
+ product.params?.forEach(
263
+ (p) => properties[`\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u043E: ${p.key}`] = p.value
264
+ );
265
+ return properties;
266
+ };
267
+ const getProperties = (product) => {
268
+ const properties = {};
269
+ product.properties?.forEach(
270
+ (p) => properties[`\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440: ${p.key}`] = p.value
271
+ );
272
+ return properties;
273
+ };
274
+ const getCategories = (product) => {
275
+ const categories2 = {};
276
+ const categoryList = new Array();
277
+ function addCategory(categoryId) {
278
+ if (categoryId === void 0) return;
279
+ const category = mappedCategories[categoryId];
280
+ if (category) {
281
+ categoryList.push(category.name);
282
+ addCategory(category.parentId);
283
+ }
284
+ }
285
+ addCategory(product.categoryId);
286
+ categoryList.forEach((name, i) => {
287
+ const index = categoryList.length - 1 - i;
288
+ const key = index === 0 ? "\u041A\u043E\u0440\u043D\u0435\u0432\u0430\u044F" : `\u041F\u043E\u0434\u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F ${index}`;
289
+ categories2[key] = name;
290
+ });
291
+ return categories2;
292
+ };
293
+ const workbook = new stream$1.xlsx.WorkbookWriter({
294
+ stream: writableStream
295
+ });
296
+ const worksheet = workbook.addWorksheet("products");
297
+ const columns = /* @__PURE__ */ new Set([
298
+ "\u0412\u043D\u0435\u0448\u043D\u0438\u0439 ID",
299
+ "\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0442\u043E\u0432\u0430\u0440",
300
+ "\u0410\u0440\u0442\u0438\u043A\u0443\u043B",
301
+ "\u041A\u043E\u0440\u043D\u0435\u0432\u0430\u044F",
302
+ "\u041F\u043E\u0434\u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F 1",
303
+ "\u041F\u043E\u0434\u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F 2",
304
+ "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0442\u043E\u0432\u0430\u0440\u0430 \u0438\u043B\u0438 \u0443\u0441\u043B\u0443\u0433\u0438",
305
+ "\u0412\u0440\u0435\u043C\u044F \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438: \u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435",
306
+ "\u0412\u0440\u0435\u043C\u044F \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438: \u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435",
307
+ "\u0421\u0442\u0430\u0440\u0430\u044F \u0446\u0435\u043D\u0430",
308
+ "\u0426\u0435\u043D\u0430 \u043F\u0440\u043E\u0434\u0430\u0436\u0438",
309
+ "C\u0435\u0431\u0435\u0441\u0442\u043E\u0438\u043C\u043E\u0441\u0442\u044C",
310
+ "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438",
311
+ "\u041E\u0441\u0442\u0430\u0442\u043E\u043A",
312
+ "\u0428\u0442\u0440\u0438\u0445-\u043A\u043E\u0434",
313
+ "\u041A\u0440\u0430\u0442\u043A\u043E\u0435 \u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435",
314
+ "\u041F\u043E\u043B\u043D\u043E\u0435 \u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435",
315
+ "\u0413\u0430\u0431\u0430\u0440\u0438\u0442\u044B \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u0430",
316
+ "\u0412\u0435\u0441",
317
+ "\u0420\u0430\u0437\u043C\u0435\u0449\u0435\u043D\u0438\u0435 \u043D\u0430 \u0441\u0430\u0439\u0442\u0435",
318
+ "\u041D\u0414\u0421",
319
+ "\u0412\u0430\u043B\u044E\u0442\u0430 \u0441\u043A\u043B\u0430\u0434\u0430",
320
+ "\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u0430",
321
+ "\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",
322
+ "\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0432\u0438\u0434\u0435\u043E",
323
+ "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B",
324
+ "\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u0430",
325
+ "\u0420\u0430\u0437\u043C\u0435\u0440\u043D\u0430\u044F \u0441\u0435\u0442\u043A\u0430",
326
+ "\u0421\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0435 \u0442\u043E\u0432\u0430\u0440\u044B",
327
+ "\u041A\u043B\u044E\u0447\u0435\u0432\u044B\u0435 \u0441\u043B\u043E\u0432\u0430"
328
+ ]);
329
+ products.forEach((product) => {
330
+ Object.keys({
331
+ ...getParams(product),
332
+ ...getProperties(product)
333
+ }).forEach((key) => {
334
+ columns.add(key);
335
+ });
336
+ });
337
+ worksheet.columns = Array.from(columns).map((column) => ({
338
+ header: column,
339
+ key: column
340
+ }));
341
+ for (const product of products) {
342
+ const externalId = `${product.productId}-${product.variantId}`;
343
+ const row = {
344
+ "\u0412\u043D\u0435\u0448\u043D\u0438\u0439 ID": externalId,
345
+ "\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0442\u043E\u0432\u0430\u0440": product.url,
346
+ \u0410\u0440\u0442\u0438\u043A\u0443\u043B: externalId,
347
+ // TODO: product.vendorCode,
348
+ "\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,
349
+ "\u0412\u0440\u0435\u043C\u044F \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438: \u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435": product.timeDelivery?.min,
350
+ "\u0412\u0440\u0435\u043C\u044F \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438: \u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435": product.timeDelivery?.max,
351
+ "\u0421\u0442\u0430\u0440\u0430\u044F \u0446\u0435\u043D\u0430": product.oldPrice,
352
+ "\u0426\u0435\u043D\u0430 \u043F\u0440\u043E\u0434\u0430\u0436\u0438": product.price,
353
+ C\u0435\u0431\u0435\u0441\u0442\u043E\u0438\u043C\u043E\u0441\u0442\u044C: product.purchasePrice,
354
+ ...getCategories(product),
355
+ \u041E\u0441\u0442\u0430\u0442\u043E\u043A: product.count,
356
+ "\u0428\u0442\u0440\u0438\u0445-\u043A\u043E\u0434": product.barcode,
357
+ "\u041A\u0440\u0430\u0442\u043A\u043E\u0435 \u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435": void 0,
358
+ "\u041F\u043E\u043B\u043D\u043E\u0435 \u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435": product.description,
359
+ "\u0413\u0430\u0431\u0430\u0440\u0438\u0442\u044B \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u0430": product.dimensions,
360
+ \u0412\u0435\u0441: product.weight,
361
+ "\u0420\u0430\u0437\u043C\u0435\u0449\u0435\u043D\u0438\u0435 \u043D\u0430 \u0441\u0430\u0439\u0442\u0435": product.available,
362
+ \u041D\u0414\u0421: product.vat?.toString(),
363
+ "\u0412\u0430\u043B\u044E\u0442\u0430 \u0441\u043A\u043B\u0430\u0434\u0430": product.currency.toString(),
364
+ "\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,
365
+ \u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F: product.parentId === void 0 ? void 0 : product.images?.join(" "),
366
+ "\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0432\u0438\u0434\u0435\u043E": product.videos ? product.videos[0] : void 0,
367
+ "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440: \u0410\u0440\u0442\u0438\u043A\u0443\u043B": product.vendorCode,
368
+ // TODO: брать из обычных параметров
369
+ ...getParams(product),
370
+ ...getProperties(product),
371
+ "\u0420\u0430\u0437\u043C\u0435\u0440\u043D\u0430\u044F \u0441\u0435\u0442\u043A\u0430": JSON.stringify(product.sizes),
372
+ "\u0421\u0432\u044F\u0437\u0430\u043D\u043D\u044B\u0435 \u0442\u043E\u0432\u0430\u0440\u044B": product.relatedProducts?.join(","),
373
+ "\u041A\u043B\u044E\u0447\u0435\u0432\u044B\u0435 \u0441\u043B\u043E\u0432\u0430": product.keywords?.join(",")
374
+ };
375
+ worksheet.addRow(row).commit();
376
+ }
377
+ worksheet.commit();
378
+ await workbook.commit();
379
+ }
380
+ }
381
+
382
+ var __defProp$7 = Object.defineProperty;
383
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
384
+ var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
385
+ class JSONFormatter {
386
+ constructor() {
387
+ __publicField$7(this, "formatterName", "JSON");
388
+ __publicField$7(this, "fileExtension", Extension.JSON);
389
+ }
390
+ async format(writableStream, products, categories, brands, _) {
391
+ const stream = new jsonStreamStringify.JsonStreamStringify({
392
+ categories,
393
+ brands,
394
+ products
395
+ });
396
+ stream.pipe(writableStream);
397
+ }
398
+ }
399
+
400
+ var __defProp$6 = Object.defineProperty;
401
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
402
+ var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
403
+ class SimpleJSONFormatter {
404
+ constructor() {
405
+ __publicField$6(this, "formatterName", "JSON");
406
+ __publicField$6(this, "fileExtension", Extension.JSON);
407
+ }
408
+ async format(writableStream, products, categories, brands, _) {
409
+ const groupedProduct = /* @__PURE__ */ new Map();
410
+ products.forEach((product) => {
411
+ if (product.parentId !== void 0) return;
412
+ groupedProduct.set(product.variantId, {
413
+ ...product,
414
+ children: []
415
+ });
416
+ });
417
+ products.forEach((product) => {
418
+ if (product.parentId === void 0) return;
419
+ const parent = groupedProduct.get(product.parentId);
420
+ if (!parent) return;
421
+ parent.children.push(product);
422
+ });
423
+ const stream = new jsonStreamStringify.JsonStreamStringify({
424
+ categories,
425
+ brands,
426
+ products: Array.from(groupedProduct.values())
427
+ });
428
+ stream.pipe(writableStream);
429
+ }
430
+ }
431
+
432
+ var __defProp$5 = Object.defineProperty;
433
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
434
+ var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
435
+ const { stream } = pkg;
436
+ class TgShopFormatter {
437
+ constructor() {
438
+ __publicField$5(this, "formatterName", "TgShop");
439
+ __publicField$5(this, "fileExtension", Extension.XLSX);
440
+ }
441
+ async format(writableStream, products, categories, _, __) {
442
+ const getParameter = (product, key) => product.params?.find((value) => value.key === key);
443
+ const convertProduct = (product) => ({
444
+ "category id": product.categoryId,
445
+ "group id": product.parentId,
446
+ "id product": product.variantId,
447
+ "name product": product.title,
448
+ price: product.price,
449
+ picture: product.images?.join(", "),
450
+ vendorCode: product.vendorCode,
451
+ oldprice: product.oldPrice,
452
+ description: product.description,
453
+ shortDescription: "",
454
+ quantityInStock: product.count,
455
+ color: getParameter(product, "color")?.value,
456
+ size: getParameter(product, "size")?.value,
457
+ priority: void 0
458
+ });
459
+ const workbook = new stream.xlsx.WorkbookWriter({
460
+ stream: writableStream
461
+ });
462
+ const categoryWorksheet = workbook.addWorksheet("categories");
463
+ const productsWorksheet = workbook.addWorksheet("offers");
464
+ categoryWorksheet.columns = [
465
+ {
466
+ header: "id",
467
+ key: "id"
468
+ },
469
+ {
470
+ header: "parentId",
471
+ key: "parentId"
472
+ },
473
+ {
474
+ header: "name",
475
+ key: "name"
476
+ }
477
+ ];
478
+ const columns = [
479
+ "category id",
480
+ "group id",
481
+ "id product",
482
+ "name product",
483
+ "price",
484
+ "picture",
485
+ "vendorCode",
486
+ "oldprice",
487
+ "description",
488
+ "shortDescription",
489
+ "quantityInStock",
490
+ "color",
491
+ "size",
492
+ "priority"
493
+ ];
494
+ productsWorksheet.columns = columns.map((column) => ({
495
+ header: column,
496
+ key: column
497
+ }));
498
+ categories?.forEach((category) => {
499
+ categoryWorksheet.addRow(category).commit();
500
+ });
501
+ products.forEach((product) => {
502
+ productsWorksheet.addRow(convertProduct(product)).commit();
503
+ });
504
+ categoryWorksheet.commit();
505
+ productsWorksheet.commit();
506
+ await workbook.commit();
507
+ }
508
+ }
509
+
510
+ var __defProp$4 = Object.defineProperty;
511
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
512
+ var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
513
+ class TildaFormatter {
514
+ constructor() {
515
+ __publicField$4(this, "formatterName", "Tilda");
516
+ __publicField$4(this, "fileExtension", Extension.CSV);
517
+ }
518
+ async format(writableStream, products, categories, _, __) {
519
+ const mappedCategories = {};
520
+ categories?.forEach(({ id, name }) => mappedCategories[id] = name);
521
+ const csvStream = new CSVStream({
522
+ delimiter: ";",
523
+ emptyFieldValue: "",
524
+ lineSeparator: "\n"
525
+ });
526
+ csvStream.writableStream.pipe(writableStream);
527
+ const columns = /* @__PURE__ */ new Set([
528
+ "SKU",
529
+ "Brand",
530
+ "Category",
531
+ "Title",
532
+ "Text",
533
+ "Photo",
534
+ "Price",
535
+ "Price Old",
536
+ "Quantity",
537
+ "Editions",
538
+ "External ID",
539
+ "Parent UID"
540
+ ]);
541
+ csvStream.setColumns(columns);
542
+ for (const product of products) {
543
+ const row = {
544
+ SKU: product.vendorCode,
545
+ Brand: product.vendor,
546
+ Category: mappedCategories[product.categoryId],
547
+ Title: product.title,
548
+ Text: product.description,
549
+ Photo: product.images?.join(";"),
550
+ Price: product.price,
551
+ "Price Old": product.oldPrice,
552
+ Quantity: product.count,
553
+ Editions: product.params?.map(({ key, value }) => `${key}:${value}`).join(";"),
554
+ "External ID": product.variantId,
555
+ "Parent UID": product.parentId
556
+ };
557
+ await csvStream.addRow(row);
558
+ }
559
+ csvStream.writableStream.end();
560
+ }
561
+ }
562
+
563
+ var __defProp$3 = Object.defineProperty;
564
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
565
+ var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
566
+ class WooCommerceFormatter {
567
+ constructor() {
568
+ __publicField$3(this, "formatterName", "WooCommerce");
569
+ __publicField$3(this, "fileExtension", Extension.CSV);
570
+ __publicField$3(this, "DEFAULT_COLUMNS", [
571
+ "ID",
572
+ "Type",
573
+ "SKU",
574
+ "Name",
575
+ "Parent",
576
+ "Short description",
577
+ "Description",
578
+ "Stock",
579
+ "Regular price",
580
+ "Position",
581
+ "Categories",
582
+ "Tags",
583
+ "Images",
584
+ "SizeGrid"
585
+ ]);
586
+ }
587
+ formatKeyAttribute(key) {
588
+ const keyWithoutInvalidCharacters = key.replaceAll(",", "").replaceAll(";", "");
589
+ return keyWithoutInvalidCharacters.length >= 28 ? keyWithoutInvalidCharacters.slice(0, 24) + "..." : keyWithoutInvalidCharacters;
590
+ }
591
+ formatValueAttribute(value) {
592
+ return value.replaceAll(",", "").replaceAll(";", "");
593
+ }
594
+ formatProducts(products) {
595
+ const formatParams = (params) => {
596
+ return params?.map(({ key, value }) => {
597
+ const formatedKey = this.formatKeyAttribute(key);
598
+ const formatedValue = this.formatValueAttribute(value);
599
+ return { key: formatedKey, value: formatedValue };
600
+ });
601
+ };
602
+ return products.map((product) => {
603
+ const params = formatParams(product.params);
604
+ const properties = formatParams(product.properties);
605
+ return { ...product, params, properties };
606
+ });
607
+ }
608
+ createAttribute(data) {
609
+ if (!data?.name || data.id === void 0) return;
610
+ const attributeStartName = "Attribute";
611
+ const attribute = {};
612
+ attribute[`${attributeStartName} ${data.id} name`] = data.name;
613
+ if (data.values !== void 0)
614
+ attribute[`${attributeStartName} ${data.id} value(s)`] = data.values;
615
+ if (data.visible !== void 0)
616
+ attribute[`${attributeStartName} ${data.id} visible`] = data.visible;
617
+ if (data.global !== void 0)
618
+ attribute[`${attributeStartName} ${data.id} global`] = data.global;
619
+ return attribute;
620
+ }
621
+ extractAttributes(products) {
622
+ const formatedProducts = this.formatProducts(products);
623
+ const paramsMap = /* @__PURE__ */ new Map();
624
+ const propertiesMap = /* @__PURE__ */ new Map();
625
+ const uniqueAttributes = /* @__PURE__ */ new Map();
626
+ const genderTitle = "\u041F\u043E\u043B";
627
+ formatedProducts.forEach((product) => {
628
+ product.params?.forEach(({ key }) => {
629
+ if (!uniqueAttributes.has(key)) {
630
+ uniqueAttributes.set(key, uniqueAttributes.size);
631
+ }
632
+ });
633
+ uniqueAttributes.set(genderTitle, uniqueAttributes.size);
634
+ product.properties?.forEach(({ key }) => {
635
+ if (!uniqueAttributes.has(key)) {
636
+ uniqueAttributes.set(key, uniqueAttributes.size);
637
+ }
638
+ });
639
+ });
640
+ formatedProducts.forEach((product) => {
641
+ const paramAttributes = paramsMap.get(product.variantId) ?? {};
642
+ const propertyAttributes = propertiesMap.get(product.variantId) ?? {};
643
+ product.params?.forEach(({ key, value }) => {
644
+ const index = uniqueAttributes.get(key);
645
+ if (index === void 0) {
646
+ 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}`);
647
+ return;
648
+ }
649
+ const attribute = this.createAttribute({
650
+ name: key,
651
+ id: index,
652
+ values: value,
653
+ visible: 0,
654
+ global: 0
655
+ });
656
+ if (!attribute) return;
657
+ Object.entries(attribute).forEach(
658
+ ([key2, value2]) => paramAttributes[key2] = value2
659
+ );
660
+ });
661
+ const genderIndex = uniqueAttributes.get(genderTitle);
662
+ const genderAttribute = this.createAttribute({
663
+ name: genderTitle,
664
+ id: genderIndex,
665
+ values: product.gender,
666
+ global: 0
667
+ });
668
+ if (genderAttribute) {
669
+ Object.entries(genderAttribute).forEach(
670
+ ([key, value]) => propertyAttributes[key] = value
671
+ );
672
+ }
673
+ product.properties?.forEach(({ key, value }) => {
674
+ const index = uniqueAttributes.get(key);
675
+ if (index === void 0) {
676
+ 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}`);
677
+ return;
678
+ }
679
+ if (paramAttributes[`Attribute ${index} name`]) {
680
+ 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}`);
681
+ return;
682
+ }
683
+ const attribute = this.createAttribute({
684
+ name: key,
685
+ id: index,
686
+ values: value,
687
+ global: 0
688
+ });
689
+ if (!attribute) return;
690
+ Object.entries(attribute).forEach(
691
+ ([key2, value2]) => propertyAttributes[key2] = value2
692
+ );
693
+ });
694
+ paramsMap.set(product.variantId, paramAttributes);
695
+ propertiesMap.set(product.variantId, propertyAttributes);
696
+ });
697
+ return { params: paramsMap, properties: propertiesMap };
698
+ }
699
+ removeVisibleFromAttributes(params) {
700
+ Object.entries(params).forEach(([key]) => {
701
+ if (key.includes("visible")) params[key] = "";
702
+ });
703
+ }
704
+ async format(writableStream, products, categories, _, __) {
705
+ const categoryPaths = buildCategoryPaths(categories ?? []);
706
+ const csvStream = new CSVStream({
707
+ delimiter: ";",
708
+ emptyFieldValue: "",
709
+ lineSeparator: "\n"
710
+ });
711
+ csvStream.writableStream.pipe(writableStream);
712
+ const columns = new Set(this.DEFAULT_COLUMNS);
713
+ const attributes = this.extractAttributes(products);
714
+ const variationsByParentId = /* @__PURE__ */ new Map();
715
+ const imagesByParentId = /* @__PURE__ */ new Map();
716
+ const sizesByParentId = /* @__PURE__ */ new Map();
717
+ const variations = products.map((product, index) => {
718
+ const pathsArray = categoryPaths.get(product.categoryId)?.map((category) => category.name);
719
+ const price = product.price ? product.price : "";
720
+ let row = {
721
+ ID: product.variantId,
722
+ Type: "variation",
723
+ SKU: product.variantId,
724
+ Name: product.title,
725
+ Parent: product.parentId ?? 0,
726
+ "Short description": "",
727
+ Description: product.description,
728
+ Stock: product.count ?? 0,
729
+ "Regular price": price,
730
+ Position: index + 1,
731
+ Categories: pathsArray?.join(" > "),
732
+ Tags: product.keywords?.join(","),
733
+ Images: "",
734
+ SizeGrid: ""
735
+ };
736
+ const productParams = attributes.params.get(product.variantId) ?? {};
737
+ if (!imagesByParentId.has(row.Parent)) {
738
+ const images = product.images?.map(urlQueryEncode).join(",");
739
+ imagesByParentId.set(row.Parent, images);
740
+ }
741
+ if (!sizesByParentId.has(row.Parent)) {
742
+ sizesByParentId.set(
743
+ row.Parent,
744
+ product.sizes ? JSON.stringify(product.sizes) : ""
745
+ );
746
+ }
747
+ this.removeVisibleFromAttributes(productParams);
748
+ row = { ...row, ...productParams };
749
+ if (variationsByParentId.has(row.Parent)) {
750
+ variationsByParentId.get(row.Parent)?.push(row);
751
+ } else {
752
+ variationsByParentId.set(row.Parent, [row]);
753
+ }
754
+ return row;
755
+ });
756
+ const parentProducts = /* @__PURE__ */ new Map();
757
+ variations.forEach((product) => {
758
+ const currentParent = parentProducts.get(product.Parent);
759
+ let row = {
760
+ ...product,
761
+ Type: "variable",
762
+ ID: product.Parent,
763
+ SKU: product.Parent,
764
+ Position: 0,
765
+ Parent: "",
766
+ "Regular price": "",
767
+ Images: imagesByParentId.get(product.Parent) ?? "",
768
+ SizeGrid: sizesByParentId.get(product.Parent) ?? ""
769
+ };
770
+ row.Stock = (currentParent?.Stock || 0) + (product?.Stock || 0);
771
+ const productParams = attributes.params.get(product.SKU) ?? {};
772
+ const productProperties = attributes.properties.get(product.SKU) ?? {};
773
+ Object.entries(productParams).forEach(([key]) => {
774
+ if (key.includes("visible")) productParams[key] = 0;
775
+ });
776
+ if (currentParent) {
777
+ Object.entries(productParams).forEach(([key, value]) => {
778
+ if (key.includes("value(s)")) {
779
+ productParams[key] = currentParent[key] + `, ${value}`;
780
+ }
781
+ });
782
+ }
783
+ Object.keys({ ...row, ...productParams, ...productProperties }).forEach(
784
+ (item) => columns.add(item)
785
+ );
786
+ row = { ...row, ...productParams, ...productProperties };
787
+ parentProducts.set(product.Parent, row);
788
+ });
789
+ const variableProducts = Array.from(parentProducts.values());
790
+ csvStream.setColumns(columns);
791
+ for (const parentProduct of variableProducts) {
792
+ await csvStream.addRow(parentProduct);
793
+ for (const variationProduct of variationsByParentId.get(
794
+ parentProduct.ID
795
+ ) ?? []) {
796
+ await csvStream.addRow(variationProduct);
797
+ }
798
+ }
799
+ csvStream.writableStream.end();
800
+ }
801
+ }
802
+
803
+ var __defProp$2 = Object.defineProperty;
804
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
805
+ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
806
+ class YMLFormatter {
807
+ constructor() {
808
+ __publicField$2(this, "formatterName", "YMl");
809
+ __publicField$2(this, "fileExtension", Extension.YML);
810
+ }
811
+ async format(writableStream, products, categories, brands, options) {
812
+ const result = new stream$3.PassThrough();
813
+ result.pipe(writableStream);
814
+ const builder = new fastXmlParser.XMLBuilder({
815
+ ignoreAttributes: false,
816
+ cdataPropName: "__cdata",
817
+ format: true,
818
+ indentBy: " "
819
+ });
820
+ const date = (/* @__PURE__ */ new Date()).toISOString().replace(/.\d+Z/, "");
821
+ result.write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n');
822
+ result.write('<yml_catalog date="' + date + '">\n');
823
+ result.write("<shop>\n");
824
+ const resultWriter = writeWithDrain(result);
825
+ if (options?.shopName) {
826
+ await resultWriter(builder.build({ name: options.shopName }));
827
+ await resultWriter("\n");
828
+ }
829
+ if (options?.companyName) {
830
+ await resultWriter(builder.build({ company: options.companyName }));
831
+ await resultWriter("\n");
832
+ }
833
+ if (categories) {
834
+ await resultWriter(
835
+ builder.build({
836
+ // tagname: "categories",
837
+ categories: { category: this.getCategories(categories) }
838
+ })
839
+ );
840
+ await resultWriter("\n");
841
+ }
842
+ if (brands) {
843
+ await resultWriter(
844
+ builder.build({ brands: { brand: this.getBrands(brands) } })
845
+ );
846
+ await resultWriter("\n");
847
+ }
848
+ await resultWriter("<offers>\n");
849
+ const offerStream = new stream$3.PassThrough();
850
+ const offerWriter = writeWithDrain(offerStream);
851
+ offerStream.pipe(result, { end: false });
852
+ for (const product of products) {
853
+ const offer = builder.build({ offer: this.getOffer(product) });
854
+ await offerWriter(offer + "\n");
855
+ }
856
+ offerStream.end();
857
+ offerStream.on("end", () => {
858
+ result.write("</offers>\n");
859
+ result.write("</shop>\n");
860
+ result.write("</yml_catalog>\n");
861
+ result.end();
862
+ });
863
+ }
864
+ getBrands(brands) {
865
+ if (!brands) return [];
866
+ return brands.map((brand) => ({
867
+ "@_id": brand.id,
868
+ "@_url": brand.coverURL ?? "",
869
+ "#text": brand.name
870
+ }));
871
+ }
872
+ getCategories(categories) {
873
+ if (!categories) return [];
874
+ return categories.map((cat) => ({
875
+ "@_id": cat.id,
876
+ "@_parentId": cat.parentId ?? "",
877
+ "#text": cat.name
878
+ }));
879
+ }
880
+ getOffer(product) {
881
+ const result = {
882
+ "@_id": product.variantId,
883
+ name: product.title,
884
+ price: product.price,
885
+ oldprice: product.oldPrice,
886
+ purchase_price: product.purchasePrice,
887
+ additional_expenses: product.additionalExpenses,
888
+ cofinance_price: product.cofinancePrice,
889
+ currencyId: product.currency,
890
+ categoryId: product.categoryId,
891
+ vendorId: product.vendorId,
892
+ vendor: product.vendor,
893
+ vendorCode: product.vendorCode,
894
+ picture: product.images,
895
+ video: product.videos,
896
+ available: product.available,
897
+ "time-delivery": product.timeDelivery ? {
898
+ "@_min": product.timeDelivery.min,
899
+ "@_max": product.timeDelivery.max,
900
+ "#text": `${product.timeDelivery.min}-${product.timeDelivery.max}`
901
+ } : void 0,
902
+ series: product.seriesName,
903
+ "min-quantity": product.minQuantity,
904
+ "step-quantity": product.stepQuantity,
905
+ size: product.sizes?.map((size) => ({
906
+ "#text": size.value,
907
+ "@_name": size.name,
908
+ "@_delimiter": size.delimiter
909
+ })),
910
+ keyword: product.keywords,
911
+ saleDate: product.saleDate,
912
+ property: product.properties?.map((property) => ({
913
+ "#text": property.value,
914
+ "@_name": property.key
915
+ })),
916
+ param: product.params?.map((param) => ({
917
+ "#text": param.value,
918
+ "@_name": param.key
919
+ })),
920
+ description: {
921
+ __cdata: product.description
922
+ },
923
+ country_of_origin: product.countryOfOrigin,
924
+ barcode: product.barcode,
925
+ vat: product.vat,
926
+ count: product.count,
927
+ "set-ids": product.tags?.join(", "),
928
+ adult: product.adult,
929
+ downloadable: product.downloadable,
930
+ "period-of-validity-days": product.validityPeriod,
931
+ "comment-validity-days": product.validityComment,
932
+ "service-life-days": product.serviceLifePeriod,
933
+ "comment-life-days": product.serviceLifeComment,
934
+ "warranty-days": product.warrantyPeriod,
935
+ "comment-warranty": product.warrantyComment,
936
+ manufacturer_warranty: product.manufacturerWarranty,
937
+ certificate: product.certificate,
938
+ url: product.url,
939
+ weight: product.weight,
940
+ dimensions: product.dimensions,
941
+ boxCount: product.boxCount,
942
+ disabled: product.disabled,
943
+ age: product.age != null && {
944
+ "@_unit": product.age.unit,
945
+ "#text": product.age.value
946
+ },
947
+ "tn-ved-codes": product.codesTN?.length != null && {
948
+ "tn-ved-code": product.codesTN
949
+ },
950
+ relatedProduct: product.relatedProducts,
951
+ gender: product.gender
952
+ };
953
+ if (product.parentId !== void 0) {
954
+ return {
955
+ ...result,
956
+ "@_group_id": product.parentId
957
+ };
958
+ }
959
+ return result;
960
+ }
961
+ }
962
+
963
+ var __defProp$1 = Object.defineProperty;
964
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
965
+ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
966
+ class XMLFormatter extends YMLFormatter {
967
+ constructor() {
968
+ super(...arguments);
969
+ __publicField$1(this, "formatterName", "XML");
970
+ __publicField$1(this, "fileExtension", Extension.XML);
971
+ }
972
+ }
973
+
974
+ const Formatters = {
975
+ TildaFormatter,
976
+ CSVFormatter,
977
+ InsalesFormatter,
978
+ YMLFormatter,
979
+ TgShopFormatter,
980
+ ExcelFormatter,
981
+ JSONFormatter,
982
+ SimpleJSONFormatter,
983
+ XMLFormatter,
984
+ WooCommerceFormatter
985
+ };
986
+
987
+ var __defProp = Object.defineProperty;
988
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
989
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
990
+ class GoodsExporter {
991
+ constructor(context) {
992
+ this.context = context;
993
+ __publicField(this, "_context");
994
+ __publicField(this, "formatter", new Formatters.YMLFormatter());
995
+ __publicField(this, "exporter", () => {
996
+ return fs.createWriteStream(
997
+ `${this.formatter.formatterName}.output.${this.formatter.fileExtension}`
998
+ );
999
+ });
1000
+ __publicField(this, "transformers", new Array());
1001
+ this._context = context;
1002
+ }
1003
+ setContext(context) {
1004
+ this._context = context;
1005
+ }
1006
+ setTransformers(transformers) {
1007
+ this.transformers = transformers;
1008
+ }
1009
+ setFormatter(formatter) {
1010
+ this.formatter = formatter;
1011
+ }
1012
+ setExporter(exporter) {
1013
+ this.exporter = exporter;
1014
+ }
1015
+ async export(products, categories, brands, option) {
1016
+ let transformedProducts = products;
1017
+ for (const transformer of this.transformers)
1018
+ transformedProducts = await transformer(
1019
+ transformedProducts,
1020
+ this._context
1021
+ );
1022
+ const writableStream = this.exporter();
1023
+ await this.formatter.format(
1024
+ writableStream,
1025
+ transformedProducts,
1026
+ categories,
1027
+ brands,
1028
+ option
1029
+ );
1030
+ }
1031
+ }
1032
+
1033
+ var Vat = /* @__PURE__ */ ((Vat2) => {
1034
+ Vat2["NO_VAT"] = "NO_VAT";
1035
+ Vat2["VAT_0"] = "VAT_0";
1036
+ Vat2["VAT_10"] = "VAT_10";
1037
+ Vat2["VAT_20"] = "VAT_20";
1038
+ return Vat2;
1039
+ })(Vat || {});
1040
+ var Currency = /* @__PURE__ */ ((Currency2) => {
1041
+ Currency2["RUR"] = "RUR";
1042
+ Currency2["BYN"] = "BYN";
1043
+ Currency2["EUR"] = "EUR";
1044
+ Currency2["USD"] = "USD";
1045
+ Currency2["UAN"] = "UAN";
1046
+ Currency2["KZT"] = "KZT";
1047
+ return Currency2;
1048
+ })(Currency || {});
1049
+
1050
+ exports.Currency = Currency;
1051
+ exports.Extension = Extension;
1052
+ exports.FormatterAbstract = FormatterAbstract;
1053
+ exports.Formatters = Formatters;
1054
+ exports.GoodsExporter = GoodsExporter;
1055
+ exports.Vat = Vat;
1056
+ exports.buildCategoryPaths = buildCategoryPaths;
1057
+ exports.delay = delay;
1058
+ exports.urlQueryEncode = urlQueryEncode;
1059
+ exports.writeWithDrain = writeWithDrain;
1060
+ //# sourceMappingURL=index.cjs.map