@bytebrand/export-cars 1.26.36 → 1.26.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/export-cars",
3
- "version": "1.26.36",
3
+ "version": "1.26.37",
4
4
  "description": "",
5
5
  "author": "bytebrand",
6
6
  "license": "UNLICENSED",
@@ -1,6 +1,5 @@
1
1
  import { Injectable } from '@nestjs/common';
2
2
  import { ModuleRef } from '@nestjs/core';
3
- import { basename } from 'path';
4
3
 
5
4
  import { CronicleUtils } from '@bytebrand/cronicle-helper';
6
5
  import { FsChunkInterface } from '@bytebrand/chunkable';
@@ -25,9 +24,8 @@ export class FacebookShopExporter implements Exporter {
25
24
  await CronicleUtils.ensureDir(this.configService.config.pathesConfig.localConvertedDirectory);
26
25
  await CronicleUtils.emptyDir(this.configService.config.pathesConfig.localConvertedDirectory);
27
26
 
28
- const selfUrl = `https://ftp.${this.configService.config.domain}/feeds/${basename(fileXml)}`;
29
27
  const facebookShopXmlBuilder = new FacebookShopXmlBuilder(fileXml);
30
- await facebookShopXmlBuilder.buildStart(selfUrl);
28
+ await facebookShopXmlBuilder.buildStart();
31
29
 
32
30
  const facebookShopTransformer = await this.moduleRef.create(FacebookShopTransformer);
33
31
 
@@ -8,18 +8,17 @@ export class FacebookShopXmlBuilder extends XMLBuilderBase {
8
8
  // No xmlns:g / g: prefixes here — that namespace belongs to the old Google Merchant /
9
9
  // Facebook Shop product-catalog schema. Meta's Automotive Model Ads Vehicle Offers Feed
10
10
  // uses plain, undecorated tag names (see facebook-shop.builder field reference above).
11
- async buildStart(selfUrl?: string): Promise<void> {
11
+ // Envelope is <listings>/<listing>, not RSS <rss><channel>/<item>: Meta Commerce Manager
12
+ // rejects the RSS form for a Vehicle Offers catalog as an invalid file format (ADV-369).
13
+ async buildStart(): Promise<void> {
12
14
  await this.write(
13
- '<?xml version="1.0" encoding="utf-8"?>\n<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' +
14
- '\n<channel>\n<title>auto.de Vehicle Offers Feed</title>' +
15
- '\n<description>Automotive Model Ads Vehicle Offers Feed für auto.de</description>' +
16
- '\n<link>https://www.auto.de/</link>' +
17
- `\n<atom:link href="${escape(selfUrl)}" rel="self" type="application/rss+xml" />\n`,
15
+ '<?xml version="1.0" encoding="utf-8"?>\n<listings>' +
16
+ '\n<title>auto.de Vehicle Offers Feed</title>\n',
18
17
  );
19
18
  }
20
19
 
21
20
  async addItem(car: FacebookShopItem): Promise<void> {
22
- let item = '\n<item>\n';
21
+ let item = '\n<listing>\n';
23
22
 
24
23
  const { image, ...tags } = car;
25
24
 
@@ -32,7 +31,7 @@ export class FacebookShopXmlBuilder extends XMLBuilderBase {
32
31
  .map((url: string) => `<image><url>${escape(url)}</url></image>\n`)
33
32
  .join('');
34
33
 
35
- item += '</item>';
34
+ item += '</listing>';
36
35
 
37
36
  await this.write(item);
38
37
  }
@@ -53,7 +52,7 @@ export class FacebookShopXmlBuilder extends XMLBuilderBase {
53
52
  }
54
53
 
55
54
  async buildEnd(): Promise<void> {
56
- await this.write('\n</channel>\n</rss>\n');
55
+ await this.write('\n</listings>\n');
57
56
  await this.end();
58
57
  }
59
58
  }