@bytebrand/export-cars 1.26.40 → 1.26.42

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.
Files changed (32) hide show
  1. package/dist/configs/autouncle.config.js +22 -0
  2. package/dist/configs/autouncle.config.js.map +1 -1
  3. package/dist/exporters/autouncle.exporter.js +10 -0
  4. package/dist/exporters/autouncle.exporter.js.map +1 -1
  5. package/dist/services/autouncle-feed-run.d.ts +6 -0
  6. package/dist/services/autouncle-feed-run.js +11 -1
  7. package/dist/services/autouncle-feed-run.js.map +1 -1
  8. package/dist/transformers/autouncle.transformer.d.ts +4 -0
  9. package/dist/transformers/autouncle.transformer.js +10 -5
  10. package/dist/transformers/autouncle.transformer.js.map +1 -1
  11. package/dist/transformers/google-feed-envkv.d.ts +2 -0
  12. package/dist/transformers/google-feed-envkv.js +9 -1
  13. package/dist/transformers/google-feed-envkv.js.map +1 -1
  14. package/dist/tsconfig.build.tsbuildinfo +1 -1
  15. package/docs/autouncle/AUDIT.md +103 -97
  16. package/docs/autouncle/PARTNER-QUESTIONS.md +3 -1
  17. package/docs/autouncle/RUNBOOK.md +2 -0
  18. package/docs/criteo/RUNBOOK.md +86 -86
  19. package/package.json +1 -1
  20. package/src/configs/autouncle.config.ts +26 -1
  21. package/src/configs/criteo.config.ts +54 -54
  22. package/src/exporters/autouncle.exporter.ts +12 -0
  23. package/src/exporters/criteo.exporter.ts +63 -63
  24. package/src/services/autouncle-feed-run.ts +19 -2
  25. package/src/services/criteo-feed-run.ts +253 -253
  26. package/src/transformers/autouncle.transformer.ts +20 -4
  27. package/src/transformers/google-feed-envkv.ts +10 -0
  28. package/test/autouncle-feed-run.test.ts +25 -2
  29. package/test/autouncle-mapping.test.ts +41 -2
  30. package/test/criteo-feed-run.test.ts +365 -365
  31. package/test/criteo-mapping.test.ts +122 -122
  32. package/test/fixtures/criteo-20-cases.json +581 -581
@@ -62,7 +62,8 @@ const tests: Array<[string, () => void | Promise<void>]> = [
62
62
  assert.equal(a.seller_id, 'dealer-7');
63
63
  assert.equal(b.seller_id, 'dealer-7');
64
64
  assert.notEqual(a.back_link, b.back_link);
65
- assert.equal(a.back_link, 'https://www.auto.de/search/vehicle/car-a?source=classifieds&medium=cpc&campaign=autouncle');
65
+ // ADV-324: partner in source; identical legacy + utm pairs; no paid medium
66
+ assert.equal(a.back_link, 'https://www.auto.de/search/vehicle/car-a?source=autouncle&medium=listing&campaign=listing&utm_source=autouncle&utm_medium=listing&utm_campaign=listing');
66
67
  // same car again -> byte-identical back_link (no relisting under a new URL)
67
68
  assert.equal(item(car('car-a', { 'metaData.ownerId': 'dealer-7' })).back_link, a.back_link);
68
69
  // seller_id is never a vehicle id
@@ -129,6 +130,30 @@ const tests: Array<[string, () => void | Promise<void>]> = [
129
130
  assert.equal(item(car('u5')).power, '85');
130
131
  }],
131
132
 
133
+ ['EnVKV: WLTP picks of the Google feed, legacy only as fallback; BEV no fuel, CO2 0; 0 / missing -> ""', () => {
134
+ const wltp = item(car('e1', { 'consumption.wltpCombined': 5.8, 'environmentEmissions.wltpCo2': 132 }));
135
+ assert.deepEqual([wltp.fuel_economy, wltp.co2_emission], ['5.8', '132']);
136
+ // fixture has only the legacy fields (6.1 l, 137 g) -> sent as before
137
+ const legacy = item(car('e2'));
138
+ assert.deepEqual([legacy.fuel_economy, legacy.co2_emission], ['6.1', '137']);
139
+ // CBD mirrors kWh into consumptionCombined for BEVs: never sent as fuel economy
140
+ const bev = item(car('e3', { 'consumption.fuel': 'selector_fuel_electrical', 'consumption.consumptionCombined': 16.5, 'environmentEmissions.co2': null }));
141
+ assert.deepEqual([bev.fuel_economy, bev.co2_emission], ['', '0']);
142
+ const none = item(car('e4', { 'consumption.consumptionCombined': 0, 'environmentEmissions.co2': null }));
143
+ assert.deepEqual([none.fuel_economy, none.co2_emission], ['', '']);
144
+ }],
145
+
146
+ ['EnVKV: estimated values withheld by the publication gate; the CO2-derived class goes with CO2', () => {
147
+ const c = car('w1', { 'consumption.wltpCombined': 5.8, 'environmentEmissions.wltpCo2': 132, 'environmentEmissions.wltpEnergyEfficiencyClass': 'D' });
148
+ const sent = item(c);
149
+ assert.deepEqual([sent.fuel_economy, sent.co2_emission, sent.co2_effiency_class], ['5.8', '132', 'D']);
150
+ const noFuel = item(c, { withheldEnvkv: ['fuel_consumption'] });
151
+ assert.deepEqual([noFuel.fuel_economy, noFuel.co2_emission, noFuel.co2_effiency_class], ['', '132', 'D']);
152
+ const noCo2 = item(c, { withheldEnvkv: ['co2_emissions'] });
153
+ assert.deepEqual([noCo2.fuel_economy, noCo2.co2_emission, noCo2.co2_effiency_class], ['5.8', '', '']);
154
+ assert.deepEqual(Object.keys(noCo2), HISTORIC_KEYS);
155
+ }],
156
+
132
157
  ['seller address: the dealer\'s own address, region from the postal code table', () => {
133
158
  const a = item(car('s1'));
134
159
  assert.equal(a.seller_city, 'Sandersdorf-Brehna');
@@ -201,12 +226,26 @@ const tests: Array<[string, () => void | Promise<void>]> = [
201
226
  assert.equal(dry.maxImages, 0);
202
227
  assert.equal(dry.feedGuard.minPublishedItems, 1);
203
228
  assert.equal(new AutouncleConfig({ ...base, autouncleDryRun: 'no' } as any).dryRun, true);
204
- const live = new AutouncleConfig({ ...base, autouncleDryRun: 'false', autouncleMaxImages: '12', feedGuardMinPublishedItems: '50' } as any);
229
+ const gateTable = { publicationGateBqProject: 'p', publicationGateBqDataset: 'd', publicationGateBqTable: 't' };
230
+ const live = new AutouncleConfig({ ...base, ...gateTable, publicationGate: 'enforce', autouncleDryRun: 'false', autouncleMaxImages: '12', feedGuardMinPublishedItems: '50' } as any);
205
231
  assert.equal(live.dryRun, false);
206
232
  assert.equal(live.outputFiles[0], 'resources/autouncle-export/api_export_cars_autouncle.json');
207
233
  assert.equal(live.stateDir, 'resources/autouncle-state/export');
208
234
  assert.equal(live.maxImages, 12);
209
235
  assert.equal(live.feedGuard.minPublishedItems, 50);
236
+ assert.deepEqual(live.publicationGate, { mode: 'enforce', project: 'p', dataset: 'd', table: 't' });
237
+ }],
238
+
239
+ ['config: publication gate off by default for a dry-run; a live run needs enforce; audit / enforce need the table', () => {
240
+ const base = { environment: Environment.DEVELOP, exportType: ExportType.AUTOUNCLE };
241
+ const gateTable = { publicationGateBqProject: 'p', publicationGateBqDataset: 'd', publicationGateBqTable: 't' };
242
+ assert.equal(new AutouncleConfig({ ...base } as any).publicationGate, undefined);
243
+ assert.equal(new AutouncleConfig({ ...base, publicationGate: 'off' } as any).publicationGate, undefined);
244
+ assert.equal(new AutouncleConfig({ ...base, ...gateTable, publicationGate: 'Audit' } as any).publicationGate.mode, 'audit');
245
+ assert.throws(() => new AutouncleConfig({ ...base, autouncleDryRun: 'false' } as any), /needs publicationGate=enforce/);
246
+ assert.throws(() => new AutouncleConfig({ ...base, ...gateTable, publicationGate: 'audit', autouncleDryRun: 'false' } as any), /needs publicationGate=enforce/);
247
+ assert.throws(() => new AutouncleConfig({ ...base, publicationGate: 'enforce' } as any), /needs publicationGateBqProject/);
248
+ assert.throws(() => new AutouncleConfig({ ...base, publicationGate: 'strict' } as any), /must be off, audit or enforce/);
210
249
  }],
211
250
  ];
212
251