@bytebrand/export-cars 1.22.26 → 1.22.27
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/constants/fb.constants.d.ts +3 -3
- package/dist/constants/fb.constants.js +3 -3
- package/dist/constants/fb.constants.js.map +1 -1
- package/dist/formats/google-xml.builder.js +11 -11
- package/dist/transformers/fb.transformer.js +2 -2
- package/dist/transformers/fb.transformer.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/constants/fb.constants.ts +3 -3
- package/src/formats/google-xml.builder.ts +80 -80
- package/src/interfaces/export-item.interface.ts +425 -425
- package/src/transformers/fb.transformer.ts +2 -2
- package/src/transformers/google.transformer.ts +584 -584
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const FB_MAX_TRIM_LENGTH = 50;
|
|
2
2
|
export const FB_MAX_IMAGE_COUNT_FOR_DEAFULT = 47;
|
|
3
3
|
export const FB_MIN_MILEAGES = 900;
|
|
4
|
-
export const DEFAULT_ZIP = '
|
|
5
|
-
export const DEFAULT_CITY = '
|
|
6
|
-
export const DEFAULT_ADDR1 = '
|
|
4
|
+
export const DEFAULT_ZIP = '06796';
|
|
5
|
+
export const DEFAULT_CITY = 'Sandersdorf-Brehna';
|
|
6
|
+
export const DEFAULT_ADDR1 = 'Max-Planck-Str. 19';
|
|
7
7
|
export const TIMESTAMP_FIRST_YEAR = 1970;
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
-
import { GoogleXmlItem, FbXmlItem, CriteoXmlItem } from '../interfaces';
|
|
3
|
-
|
|
4
|
-
export class GoogleXmlBuilder extends XMLBuilderBase {
|
|
5
|
-
async buildStart(url?: string): Promise<void> {
|
|
6
|
-
await this.write(
|
|
7
|
-
`<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:g="http://base.google.com/ns/1.0"><channel><title>Auto de feed</title><link>${url}</link>`,
|
|
8
|
-
);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async addItem(item: FbXmlItem | GoogleXmlItem | CriteoXmlItem): Promise<void> {
|
|
12
|
-
const listing: string = Object.entries(item)
|
|
13
|
-
.map(([key, data]): string => {
|
|
14
|
-
if (key === 'certification') {
|
|
15
|
-
return this.getCertificationElement(key, data);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (key === 'installment') {
|
|
19
|
-
return this.getInstallmentElement(key, data);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (key === 'vehicle_fulfillment') {
|
|
23
|
-
return this.getVehicleFulfillmentElement(key, data);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (['additional_image_link', 'vehicle_option'].includes(key)) {
|
|
27
|
-
return data.map((value: string) => this.getElement(`g:${key}`, this.escapeXML(value))).join('');
|
|
28
|
-
} else {
|
|
29
|
-
return this.getElement(`g:${key}`, this.escapeXML(data));
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
.join('');
|
|
33
|
-
|
|
34
|
-
await this.write(`<item>${listing}</item>\n`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async buildEnd(): Promise<void> {
|
|
38
|
-
await this.write('</channel></rss>');
|
|
39
|
-
await this.end();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private getVehicleFulfillmentElement(rootTag: string, data: {
|
|
43
|
-
option: string;
|
|
44
|
-
store_code: string;
|
|
45
|
-
}): string {
|
|
46
|
-
return `<g:${rootTag}>
|
|
47
|
-
<g:option>${data.option}</g:option>
|
|
48
|
-
<g:store_code>${data.store_code}</g:store_code>
|
|
49
|
-
</g:${rootTag}>`;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
private getCertificationElement(rootTag: string, data: Array<{
|
|
53
|
-
certification_authority: string;
|
|
54
|
-
certification_name: string;
|
|
55
|
-
certification_code?: string;
|
|
56
|
-
certification_value?: string;
|
|
57
|
-
}>): string {
|
|
58
|
-
return data.map(certification => `<g:${rootTag}>
|
|
59
|
-
<g:certification_authority>${certification.certification_authority}</g:certification_authority>
|
|
60
|
-
<g:certification_name>${certification.certification_name}</g:certification_name>
|
|
61
|
-
<g:certification_value>${certification.certification_value}</g:certification_value>
|
|
62
|
-
</g:${rootTag}>`).join('');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
private getInstallmentElement(rootTag: string, data: { paybackPeriod: string; monthlyInstallment: string; apr?: string }): string {
|
|
66
|
-
return `<g:${rootTag}>
|
|
67
|
-
<g:months>${data.paybackPeriod}</g:months>
|
|
68
|
-
<g:amount>${data.monthlyInstallment} EUR</g:amount>${data.apr ? `
|
|
69
|
-
<g:apr>${data.apr}</g:apr>` : ''}
|
|
70
|
-
</g:${rootTag}>`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
private escapeXML(str: string | null | undefined): string {
|
|
74
|
-
return typeof str === 'string' ? str.replace(/&/g, '&')
|
|
75
|
-
.replace(/</g, '<')
|
|
76
|
-
.replace(/>/g, '>')
|
|
77
|
-
.replace(/"/g, '"')
|
|
78
|
-
.replace(/'/g, ''') : str;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
1
|
+
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
+
import { GoogleXmlItem, FbXmlItem, CriteoXmlItem } from '../interfaces';
|
|
3
|
+
|
|
4
|
+
export class GoogleXmlBuilder extends XMLBuilderBase {
|
|
5
|
+
async buildStart(url?: string): Promise<void> {
|
|
6
|
+
await this.write(
|
|
7
|
+
`<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:g="http://base.google.com/ns/1.0"><channel><title>Auto de feed</title><link>${url}</link>`,
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async addItem(item: FbXmlItem | GoogleXmlItem | CriteoXmlItem): Promise<void> {
|
|
12
|
+
const listing: string = Object.entries(item)
|
|
13
|
+
.map(([key, data]): string => {
|
|
14
|
+
if (key === 'certification') {
|
|
15
|
+
return this.getCertificationElement(key, data);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (key === 'installment') {
|
|
19
|
+
return this.getInstallmentElement(key, data);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (key === 'vehicle_fulfillment') {
|
|
23
|
+
return this.getVehicleFulfillmentElement(key, data);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (['additional_image_link', 'vehicle_option'].includes(key)) {
|
|
27
|
+
return data.map((value: string) => this.getElement(`g:${key}`, this.escapeXML(value))).join('');
|
|
28
|
+
} else {
|
|
29
|
+
return this.getElement(`g:${key}`, this.escapeXML(data));
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
.join('');
|
|
33
|
+
|
|
34
|
+
await this.write(`<item>${listing}</item>\n`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async buildEnd(): Promise<void> {
|
|
38
|
+
await this.write('</channel></rss>');
|
|
39
|
+
await this.end();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private getVehicleFulfillmentElement(rootTag: string, data: {
|
|
43
|
+
option: string;
|
|
44
|
+
store_code: string;
|
|
45
|
+
}): string {
|
|
46
|
+
return `<g:${rootTag}>
|
|
47
|
+
<g:option>${data.option}</g:option>
|
|
48
|
+
<g:store_code>${data.store_code}</g:store_code>
|
|
49
|
+
</g:${rootTag}>`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private getCertificationElement(rootTag: string, data: Array<{
|
|
53
|
+
certification_authority: string;
|
|
54
|
+
certification_name: string;
|
|
55
|
+
certification_code?: string;
|
|
56
|
+
certification_value?: string;
|
|
57
|
+
}>): string {
|
|
58
|
+
return data.map(certification => `<g:${rootTag}>
|
|
59
|
+
<g:certification_authority>${certification.certification_authority}</g:certification_authority>
|
|
60
|
+
<g:certification_name>${certification.certification_name}</g:certification_name>
|
|
61
|
+
<g:certification_value>${certification.certification_value}</g:certification_value>
|
|
62
|
+
</g:${rootTag}>`).join('');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private getInstallmentElement(rootTag: string, data: { paybackPeriod: string; monthlyInstallment: string; apr?: string }): string {
|
|
66
|
+
return `<g:${rootTag}>
|
|
67
|
+
<g:months>${data.paybackPeriod}</g:months>
|
|
68
|
+
<g:amount>${data.monthlyInstallment} EUR</g:amount>${data.apr ? `
|
|
69
|
+
<g:apr>${data.apr}</g:apr>` : ''}
|
|
70
|
+
</g:${rootTag}>`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private escapeXML(str: string | null | undefined): string {
|
|
74
|
+
return typeof str === 'string' ? str.replace(/&/g, '&')
|
|
75
|
+
.replace(/</g, '<')
|
|
76
|
+
.replace(/>/g, '>')
|
|
77
|
+
.replace(/"/g, '"')
|
|
78
|
+
.replace(/'/g, ''') : str;
|
|
79
|
+
}
|
|
80
|
+
}
|