@bytebrand/export-cars 1.26.39 → 1.26.40

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.
@@ -1,5 +1,15 @@
1
1
  import { Params } from '../interfaces/params.interface';
2
+ import { FeedGuardOptions } from '../services/feed-guard';
2
3
  import { Config } from './config';
4
+ export declare const CRITEO_DEFAULTS: {
5
+ minSourceItems: number;
6
+ minPublishedItems: number;
7
+ maxDropPercent: number;
8
+ maxSourceAgeHours: number;
9
+ maxStaleHours: number;
10
+ };
3
11
  export declare class CriteoConfig extends Config {
12
+ stateDir: string;
13
+ feedGuard: FeedGuardOptions;
4
14
  constructor(params: Params);
5
15
  }
@@ -1,15 +1,40 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CriteoConfig = void 0;
3
+ exports.CriteoConfig = exports.CRITEO_DEFAULTS = void 0;
4
+ const lodash_1 = require("lodash");
4
5
  const enums_1 = require("../enums");
5
6
  const config_1 = require("./config");
7
+ const text = (value) => (typeof value === 'string' ? value.trim() : '');
8
+ const positiveNumber = (value, fallback) => {
9
+ const parsed = (0, lodash_1.toNumber)(text(value));
10
+ return text(value) && Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
11
+ };
12
+ exports.CRITEO_DEFAULTS = {
13
+ minSourceItems: 1000,
14
+ minPublishedItems: 500,
15
+ maxDropPercent: 20,
16
+ maxSourceAgeHours: 26,
17
+ maxStaleHours: 48,
18
+ };
6
19
  class CriteoConfig extends config_1.Config {
20
+ stateDir;
21
+ feedGuard;
7
22
  constructor(params) {
8
23
  super(params);
9
24
  this.campaign = enums_1.ExportType.CRITEO;
10
25
  this.pathesConfig.localConvertedDirectory = `resources/${enums_1.ExportType.CRITEO}-export`;
26
+ this.stateDir = `resources/${enums_1.ExportType.CRITEO}-state`;
11
27
  this.imageType = enums_1.ImageType.marketing;
12
28
  this.marketingImageConfigId = this.environmentConfig[params.environment].criteoMarketingImagesConfigId;
29
+ this.feedGuard = {
30
+ stateDir: this.stateDir,
31
+ minSourceItems: positiveNumber(params.feedGuardMinSourceItems, exports.CRITEO_DEFAULTS.minSourceItems),
32
+ minPublishedItems: positiveNumber(params.feedGuardMinPublishedItems, exports.CRITEO_DEFAULTS.minPublishedItems),
33
+ maxDropPercent: positiveNumber(params.feedGuardMaxDropPercent, exports.CRITEO_DEFAULTS.maxDropPercent),
34
+ maxSourceAgeHours: positiveNumber(params.feedGuardMaxSourceAgeHours, exports.CRITEO_DEFAULTS.maxSourceAgeHours),
35
+ maxStaleHours: positiveNumber(params.feedGuardMaxStaleHours, exports.CRITEO_DEFAULTS.maxStaleHours),
36
+ acceptDrop: text(params.feedGuardAcceptDrop).toLowerCase() === 'true',
37
+ };
13
38
  this.outputFiles = [
14
39
  `${this.pathesConfig.localConvertedDirectory}/api_export_cars_${enums_1.ExportType.CRITEO}.${enums_1.FileType.XML}`,
15
40
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"criteo.config.js","sourceRoot":"","sources":["../../src/configs/criteo.config.ts"],"names":[],"mappings":";;;AAAA,oCAA4D;AAE5D,qCAAkC;AAElC,MAAa,YAAa,SAAQ,eAAM;IACtC,YAAY,MAAc;QACxB,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,QAAQ,GAAG,kBAAU,CAAC,MAAM,CAAC;QAClC,IAAI,CAAC,YAAY,CAAC,uBAAuB,GAAG,aAAa,kBAAU,CAAC,MAAM,SAAS,CAAC;QACpF,IAAI,CAAC,SAAS,GAAG,iBAAS,CAAC,SAAS,CAAC;QACrC,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,6BAA6B,CAAC;QACvG,IAAI,CAAC,WAAW,GAAG;YACjB,GAAG,IAAI,CAAC,YAAY,CAAC,uBAAuB,oBAAoB,kBAAU,CAAC,MAAM,IAAI,gBAAQ,CAAC,GAAG,EAAE;SACpG,CAAC;QAC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C,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,6BAA6B,CAAC;QACvG,IAAI,CAAC,SAAS,GAAG;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,uBAAuB,EAAE,uBAAe,CAAC,cAAc,CAAC;YAC9F,iBAAiB,EAAE,cAAc,CAAC,MAAM,CAAC,0BAA0B,EAAE,uBAAe,CAAC,iBAAiB,CAAC;YACvG,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,uBAAuB,EAAE,uBAAe,CAAC,cAAc,CAAC;YAC9F,iBAAiB,EAAE,cAAc,CAAC,MAAM,CAAC,0BAA0B,EAAE,uBAAe,CAAC,iBAAiB,CAAC;YACvG,aAAa,EAAE,cAAc,CAAC,MAAM,CAAC,sBAAsB,EAAE,uBAAe,CAAC,aAAa,CAAC;YAC3F,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM;SACtE,CAAC;QACF,IAAI,CAAC,WAAW,GAAG;YACjB,GAAG,IAAI,CAAC,YAAY,CAAC,uBAAuB,oBAAoB,kBAAU,CAAC,MAAM,IAAI,gBAAQ,CAAC,GAAG,EAAE;SACpG,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;CACF;AAzBD,oCAyBC"}
@@ -14,7 +14,8 @@ const common_1 = require("@nestjs/common");
14
14
  const core_1 = require("@nestjs/core");
15
15
  const cronicle_helper_1 = require("@bytebrand/cronicle-helper");
16
16
  const services_1 = require("../services");
17
- const google_xml_builder_1 = require("../formats/google-xml.builder");
17
+ const feed_guard_1 = require("../services/feed-guard");
18
+ const criteo_feed_run_1 = require("../services/criteo-feed-run");
18
19
  const criteo_transformer_1 = require("../transformers/criteo.transformer");
19
20
  let CriteoExporter = class CriteoExporter {
20
21
  carService;
@@ -30,29 +31,32 @@ let CriteoExporter = class CriteoExporter {
30
31
  this.moduleRef = moduleRef;
31
32
  }
32
33
  async export() {
33
- const [fileName] = this.configService.config.outputFiles;
34
- await cronicle_helper_1.CronicleUtils.ensureDir(this.configService.config.pathesConfig.localConvertedDirectory);
35
- await cronicle_helper_1.CronicleUtils.emptyDir(this.configService.config.pathesConfig.localConvertedDirectory);
36
- const googleXmlBuilder = new google_xml_builder_1.GoogleXmlBuilder(fileName);
37
- await googleXmlBuilder.buildStart(this.configService.config.domain);
38
- const criteoTransformer = await this.moduleRef.create(criteo_transformer_1.CriteoTransformer);
39
- let withoutImage = 0;
40
- await this.loaderService.process(async (chunk) => {
41
- chunk.data = chunk.data.filter(car => this.carService.filterCar(car, this.rulesService.rules));
42
- for (const data of chunk.data) {
43
- const car = await criteoTransformer.transform(data);
44
- if (car) {
45
- await googleXmlBuilder.addItem(car);
46
- }
47
- else {
48
- withoutImage += 1;
49
- }
50
- this.carService.counter.countCar(data.images);
51
- }
34
+ const config = this.configService.config;
35
+ const [xmlFile] = config.outputFiles;
36
+ const transformer = await this.moduleRef.create(criteo_transformer_1.CriteoTransformer);
37
+ const run = new criteo_feed_run_1.CriteoFeedRun({
38
+ forEachChunk: fn => this.loaderService.process((chunk) => fn(chunk.data)),
39
+ filterCar: source => this.carService.filterCar(source, this.rulesService.rules),
40
+ transform: source => transformer.transform(source),
41
+ guard: new feed_guard_1.FeedGuard(config.feedGuard),
42
+ }, {
43
+ runId: config.runId,
44
+ domain: config.domain,
45
+ sourceDirectory: config.pathesConfig.localDirectory,
46
+ sourceBaseFileName: config.pathesConfig.baseFileName,
47
+ xmlFile,
48
+ stateDir: config.stateDir,
52
49
  });
53
- await googleXmlBuilder.buildEnd();
54
- console.log(this.carService.counter.getCountedCars());
55
- console.log(`criteo: ${withoutImage} cars skipped without a marketing image`);
50
+ try {
51
+ const report = await run.run();
52
+ if (report.stale) {
53
+ console.log(`criteo feed STALE: last good file ${report.lastGoodAgeHours?.toFixed(1)} h old`);
54
+ }
55
+ }
56
+ catch (error) {
57
+ cronicle_helper_1.LoggerService.exitError(`criteo feed not published: ${error?.message ?? error}`);
58
+ process.exit(1);
59
+ }
56
60
  }
57
61
  };
58
62
  exports.CriteoExporter = CriteoExporter;
@@ -1 +1 @@
1
- {"version":3,"file":"criteo.exporter.js","sourceRoot":"","sources":["../../src/exporters/criteo.exporter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,uCAAyC;AAEzC,gEAA2D;AAG3D,0CAAqF;AACrF,sEAAiE;AAEjE,2EAAwE;AAGjE,IAAM,cAAc,GAApB,MAAM,cAAc;IAEjB;IACA;IACA;IACA;IACA;IALT,YACS,UAAsB,EACtB,aAA4B,EAC5B,YAA0B,EAC1B,aAA4B,EAC5B,SAAoB;QAJpB,eAAU,GAAV,UAAU,CAAY;QACtB,kBAAa,GAAb,aAAa,CAAe;QAC5B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,kBAAa,GAAb,aAAa,CAAe;QAC5B,cAAS,GAAT,SAAS,CAAW;IACzB,CAAC;IAEL,KAAK,CAAC,MAAM;QACX,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC;QACzD,MAAM,+BAAa,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC;QAC9F,MAAM,+BAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC;QAE7F,MAAM,gBAAgB,GAAG,IAAI,qCAAgB,CAAC,QAAQ,CAAC,CAAC;QACxD,MAAM,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEpE,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,sCAAiB,CA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,EAAE,MAAM,CAAC,QAAQ;SACzB,CACD,CAAC;QAEF,IAAI;YACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC;YAC/B,IAAI,MAAM,CAAC,KAAK,EAAE;gBACjB,OAAO,CAAC,GAAG,CAAC,qCAAqC,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;aAC9F;SACD;QAAC,OAAO,KAAK,EAAE;YAGf,+BAAa,CAAC,SAAS,CAAC,8BAA8B,KAAK,EAAE,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC;YACjF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAChB;IACF,CAAC;CACD,CAAA;AA3CY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAGS,qBAAU;QACP,wBAAa;QACd,uBAAY;QACX,wBAAa;QACjB,gBAAS;GANjB,cAAc,CA2C1B"}
@@ -0,0 +1,76 @@
1
+ import { ImboImageResponseInterface } from '@bytebrand/chunkable';
2
+ import { DataSchemes } from '@bytebrand/car-schema';
3
+ import { CriteoXmlItem } from '../interfaces';
4
+ import { FeedGuard, LastGood } from './feed-guard';
5
+ export interface CriteoSourceCar {
6
+ car: DataSchemes.Car;
7
+ images: ImboImageResponseInterface[];
8
+ }
9
+ export declare enum CriteoExclusion {
10
+ noId = "no_id",
11
+ duplicateId = "duplicate_id",
12
+ filtered = "filtered",
13
+ notAvailable = "reserved_or_sold",
14
+ noPrice = "no_valid_price",
15
+ noImage = "no_marketing_image"
16
+ }
17
+ export interface CriteoRunDeps {
18
+ forEachChunk: (fn: (cars: CriteoSourceCar[]) => Promise<void>) => Promise<unknown>;
19
+ filterCar: (source: CriteoSourceCar) => boolean;
20
+ transform: (source: CriteoSourceCar) => Promise<CriteoXmlItem | null>;
21
+ guard: FeedGuard;
22
+ }
23
+ export interface CriteoRunOptions {
24
+ runId?: string;
25
+ domain: string;
26
+ sourceDirectory: string;
27
+ sourceBaseFileName: string;
28
+ xmlFile: string;
29
+ stateDir: string;
30
+ now?: () => Date;
31
+ }
32
+ export interface CriteoRunReport {
33
+ runId?: string;
34
+ startedAt: string;
35
+ finishedAt?: string;
36
+ durationMs?: number;
37
+ status: 'published' | 'blocked' | 'failed';
38
+ guard?: {
39
+ code: string;
40
+ message: string;
41
+ };
42
+ error?: string;
43
+ xmlFile: string;
44
+ source: {
45
+ files: number;
46
+ newestChunkAt: string | null;
47
+ ageHours: number | null;
48
+ cars: number;
49
+ };
50
+ items: number;
51
+ excluded: Record<string, number>;
52
+ withRate: number;
53
+ withoutEnergyClass: number;
54
+ ids: {
55
+ added: number;
56
+ removed: number;
57
+ kept: number;
58
+ removedSample: string[];
59
+ } | null;
60
+ lastGood: LastGood | null;
61
+ lastGoodAgeHours: number | null;
62
+ stale: boolean;
63
+ }
64
+ export declare class CriteoFeedRun {
65
+ private readonly deps;
66
+ private readonly options;
67
+ constructor(deps: CriteoRunDeps, options: CriteoRunOptions);
68
+ private now;
69
+ private get idsFile();
70
+ run(): Promise<CriteoRunReport>;
71
+ private exclusion;
72
+ private readPublishedIds;
73
+ private writePublishedIds;
74
+ private diffIds;
75
+ private writeReport;
76
+ }
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CriteoFeedRun = exports.CriteoExclusion = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const lodash_1 = require("lodash");
7
+ const google_xml_builder_1 = require("../formats/google-xml.builder");
8
+ const feed_guard_1 = require("./feed-guard");
9
+ var CriteoExclusion;
10
+ (function (CriteoExclusion) {
11
+ CriteoExclusion["noId"] = "no_id";
12
+ CriteoExclusion["duplicateId"] = "duplicate_id";
13
+ CriteoExclusion["filtered"] = "filtered";
14
+ CriteoExclusion["notAvailable"] = "reserved_or_sold";
15
+ CriteoExclusion["noPrice"] = "no_valid_price";
16
+ CriteoExclusion["noImage"] = "no_marketing_image";
17
+ })(CriteoExclusion || (exports.CriteoExclusion = CriteoExclusion = {}));
18
+ const NOT_AVAILABLE = ['selector_offerAvailability_reserved', 'selector_offerAvailability_sold'];
19
+ const HOUR_MS = 60 * 60 * 1000;
20
+ const PRICE = /^\d+(\.\d+)? EUR$/;
21
+ const increment = (counter, key) => {
22
+ counter[key] = (counter[key] ?? 0) + 1;
23
+ };
24
+ class CriteoFeedRun {
25
+ deps;
26
+ options;
27
+ constructor(deps, options) {
28
+ this.deps = deps;
29
+ this.options = options;
30
+ }
31
+ now() {
32
+ return this.options.now ? this.options.now() : new Date();
33
+ }
34
+ get idsFile() {
35
+ return (0, path_1.join)(this.options.stateDir, 'published-ids.json');
36
+ }
37
+ async run() {
38
+ const { guard } = this.deps;
39
+ const { xmlFile, runId } = this.options;
40
+ const startedAt = this.now();
41
+ const lastGood = await guard.readLastGood();
42
+ const report = {
43
+ runId,
44
+ startedAt: startedAt.toISOString(),
45
+ status: 'failed',
46
+ xmlFile,
47
+ source: { files: 0, newestChunkAt: null, ageHours: null, cars: 0 },
48
+ items: 0,
49
+ excluded: {},
50
+ withRate: 0,
51
+ withoutEnergyClass: 0,
52
+ ids: null,
53
+ lastGood,
54
+ lastGoodAgeHours: guard.staleHours(lastGood, startedAt),
55
+ stale: guard.isStale(lastGood, startedAt),
56
+ };
57
+ await guard.acquireLock(runId ?? 'local', startedAt);
58
+ const tmpFile = `${xmlFile}.tmp`;
59
+ try {
60
+ const snapshot = await (0, feed_guard_1.inspectSourceSnapshot)(this.options.sourceDirectory, this.options.sourceBaseFileName);
61
+ report.source.files = snapshot.files;
62
+ report.source.newestChunkAt = snapshot.newestMtime?.toISOString() ?? null;
63
+ report.source.ageHours = snapshot.newestMtime
64
+ ? Number(((startedAt.getTime() - snapshot.newestMtime.getTime()) / HOUR_MS).toFixed(2))
65
+ : null;
66
+ guard.checkSource(snapshot, startedAt);
67
+ await fs_1.promises.mkdir((0, path_1.dirname)(xmlFile), { recursive: true });
68
+ await fs_1.promises.rm(tmpFile, { force: true });
69
+ const builder = new google_xml_builder_1.GoogleXmlBuilder(tmpFile);
70
+ await builder.buildStart(this.options.domain);
71
+ const seen = new Set();
72
+ const published = [];
73
+ await this.deps.forEachChunk(async (cars) => {
74
+ for (const source of cars) {
75
+ report.source.cars += 1;
76
+ const reason = this.exclusion(source, seen);
77
+ if (reason) {
78
+ increment(report.excluded, reason);
79
+ continue;
80
+ }
81
+ const item = await this.deps.transform(source);
82
+ if (!item) {
83
+ increment(report.excluded, CriteoExclusion.noImage);
84
+ continue;
85
+ }
86
+ if (!PRICE.test(item.price) || !PRICE.test(item.sale_price)) {
87
+ increment(report.excluded, CriteoExclusion.noPrice);
88
+ continue;
89
+ }
90
+ await builder.addItem(item);
91
+ published.push(item.id);
92
+ report.items += 1;
93
+ if (item.installment) {
94
+ report.withRate += 1;
95
+ }
96
+ if (!item.energy_efficiency_class) {
97
+ report.withoutEnergyClass += 1;
98
+ }
99
+ }
100
+ });
101
+ await builder.buildEnd();
102
+ const counts = { sourceItems: report.source.cars, publishedItems: report.items };
103
+ guard.checkCounts(counts, lastGood);
104
+ const previousIds = await this.readPublishedIds();
105
+ report.lastGood = await guard.publish(tmpFile, xmlFile, counts, this.now(), runId);
106
+ await this.writePublishedIds(published);
107
+ report.ids = this.diffIds(previousIds, published);
108
+ report.status = 'published';
109
+ report.lastGoodAgeHours = 0;
110
+ report.stale = false;
111
+ return report;
112
+ }
113
+ catch (error) {
114
+ if (error instanceof feed_guard_1.FeedGuardError) {
115
+ report.status = 'blocked';
116
+ report.guard = { code: error.code, message: error.message };
117
+ }
118
+ else {
119
+ report.error = error?.message ?? String(error);
120
+ }
121
+ await fs_1.promises.rename(tmpFile, `${xmlFile}.rejected`).catch(() => undefined);
122
+ throw error;
123
+ }
124
+ finally {
125
+ await this.writeReport(report, startedAt);
126
+ await guard.releaseLock();
127
+ }
128
+ }
129
+ exclusion(source, seen) {
130
+ const id = (0, lodash_1.toString)((0, lodash_1.get)(source, 'car._id', ''));
131
+ if (!id) {
132
+ return CriteoExclusion.noId;
133
+ }
134
+ if (seen.has(id)) {
135
+ return CriteoExclusion.duplicateId;
136
+ }
137
+ seen.add(id);
138
+ if (!this.deps.filterCar(source)) {
139
+ return CriteoExclusion.filtered;
140
+ }
141
+ if (NOT_AVAILABLE.includes((0, lodash_1.toString)((0, lodash_1.get)(source.car, 'offer.offerAvailability', '')))) {
142
+ return CriteoExclusion.notAvailable;
143
+ }
144
+ const price = (0, lodash_1.toNumber)((0, lodash_1.get)(source.car, 'price.currentSalesPrice', null));
145
+ if (!Number.isFinite(price) || price <= 0) {
146
+ return CriteoExclusion.noPrice;
147
+ }
148
+ return null;
149
+ }
150
+ async readPublishedIds() {
151
+ try {
152
+ return JSON.parse(await fs_1.promises.readFile(this.idsFile, 'utf8'));
153
+ }
154
+ catch (error) {
155
+ if (error?.code === 'ENOENT') {
156
+ return null;
157
+ }
158
+ throw error;
159
+ }
160
+ }
161
+ async writePublishedIds(ids) {
162
+ await fs_1.promises.mkdir(this.options.stateDir, { recursive: true });
163
+ await fs_1.promises.writeFile(`${this.idsFile}.tmp`, JSON.stringify(ids), 'utf8');
164
+ await fs_1.promises.rename(`${this.idsFile}.tmp`, this.idsFile);
165
+ }
166
+ diffIds(previous, current) {
167
+ if (!previous) {
168
+ return { added: current.length, removed: 0, kept: 0, removedSample: [] };
169
+ }
170
+ const before = new Set(previous);
171
+ const now = new Set(current);
172
+ const removed = previous.filter(id => !now.has(id));
173
+ const kept = current.filter(id => before.has(id)).length;
174
+ return { added: current.length - kept, removed: removed.length, kept, removedSample: removed.slice(0, 20) };
175
+ }
176
+ async writeReport(report, startedAt) {
177
+ const finishedAt = this.now();
178
+ report.finishedAt = finishedAt.toISOString();
179
+ report.durationMs = finishedAt.getTime() - startedAt.getTime();
180
+ await fs_1.promises.mkdir(this.options.stateDir, { recursive: true });
181
+ await fs_1.promises.writeFile((0, path_1.join)(this.options.stateDir, 'last-run-report.json'), JSON.stringify(report, null, 2), 'utf8');
182
+ console.log(`criteo feed report: ${JSON.stringify(report)}`);
183
+ }
184
+ }
185
+ exports.CriteoFeedRun = CriteoFeedRun;
186
+ //# sourceMappingURL=criteo-feed-run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"criteo-feed-run.js","sourceRoot":"","sources":["../../src/services/criteo-feed-run.ts"],"names":[],"mappings":";;;AAAA,2BAAoC;AACpC,+BAAqC;AACrC,mCAAiD;AAIjD,sEAAiE;AAEjE,6CAA0F;AAO1F,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,iCAAc,CAAA;IACd,+CAA4B,CAAA;IAC5B,wCAAqB,CAAA;IACrB,oDAAiC,CAAA;IACjC,6CAA0B,CAAA;IAC1B,iDAA8B,CAAA;AAChC,CAAC,EAPW,eAAe,+BAAf,eAAe,QAO1B;AAKD,MAAM,aAAa,GAAG,CAAC,qCAAqC,EAAE,iCAAiC,CAAC,CAAC;AA6CjG,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC/B,MAAM,KAAK,GAAG,mBAAmB,CAAC;AAElC,MAAM,SAAS,GAAG,CAAC,OAA+B,EAAE,GAAW,EAAE,EAAE;IACjE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC,CAAC;AAQF,MAAa,aAAa;IACK;IAAsC;IAAnE,YAA6B,IAAmB,EAAmB,OAAyB;QAA/D,SAAI,GAAJ,IAAI,CAAe;QAAmB,YAAO,GAAP,OAAO,CAAkB;IAAI,CAAC;IAEzF,GAAG;QACT,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;IAC5D,CAAC;IAED,IAAY,OAAO;QACjB,OAAO,IAAA,WAAI,EAAC,IAAI,CAAC,OAAO,CAAC,Q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