@koda-sl/baker-cli 0.326.0 → 0.327.0
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/cli.js +44 -5
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -956,7 +956,11 @@ var winnersSearchResponseSchema = z2.object({
|
|
|
956
956
|
// the dashboard then falls back to a single non-paged page.
|
|
957
957
|
offset: z2.number().nullable(),
|
|
958
958
|
total: z2.number().nullable(),
|
|
959
|
-
has_more: z2.boolean().nullable()
|
|
959
|
+
has_more: z2.boolean().nullable(),
|
|
960
|
+
// Ads the corpus holds for each requested `country`; null when the search did
|
|
961
|
+
// not filter by country. Tells "no winners matched" apart from "unsupported"
|
|
962
|
+
// (an unknown code is refused outright).
|
|
963
|
+
country_coverage: z2.array(z2.object({ code: z2.string(), ads: z2.number() })).nullable()
|
|
960
964
|
});
|
|
961
965
|
var advertiserPlatformSchema = z2.object({
|
|
962
966
|
platform: z2.string(),
|
|
@@ -66386,7 +66390,11 @@ registerSchema({
|
|
|
66386
66390
|
description: "Comma list: unaware,problem_aware,solution_aware,product_aware,most_aware",
|
|
66387
66391
|
required: false
|
|
66388
66392
|
},
|
|
66389
|
-
country: {
|
|
66393
|
+
country: {
|
|
66394
|
+
type: "string",
|
|
66395
|
+
description: "Comma list of ISO country codes (US,GB) \u2014 an unknown code is refused with the codes that have ads",
|
|
66396
|
+
required: false
|
|
66397
|
+
},
|
|
66390
66398
|
language: { type: "string", description: "Comma list of language codes", required: false },
|
|
66391
66399
|
"advertiser-id": {
|
|
66392
66400
|
type: "string",
|
|
@@ -66459,6 +66467,32 @@ function buildSearchBody2(args4) {
|
|
|
66459
66467
|
}
|
|
66460
66468
|
return body;
|
|
66461
66469
|
}
|
|
66470
|
+
var UNKNOWN_COUNTRY_RE = /Unknown country code\(s\): ([^.]+)\. Countries with ads: ([^.]+)\./;
|
|
66471
|
+
function unknownCountryFix(message) {
|
|
66472
|
+
const match = UNKNOWN_COUNTRY_RE.exec(message);
|
|
66473
|
+
if (!match) {
|
|
66474
|
+
return null;
|
|
66475
|
+
}
|
|
66476
|
+
const unknownCountries = splitList2(match[1]);
|
|
66477
|
+
const validCountries = splitList2(match[2]);
|
|
66478
|
+
if (unknownCountries.length === 0 || validCountries.length === 0) {
|
|
66479
|
+
return null;
|
|
66480
|
+
}
|
|
66481
|
+
return {
|
|
66482
|
+
action: "retry_with_a_valid_country",
|
|
66483
|
+
explanation: `${unknownCountries.join(", ")} is not a country the winning-ads library holds ads for. Re-run with codes from \`validCountries\`, or drop --country to search every market.`,
|
|
66484
|
+
unknownCountries,
|
|
66485
|
+
validCountries
|
|
66486
|
+
};
|
|
66487
|
+
}
|
|
66488
|
+
function reportSearchError(err) {
|
|
66489
|
+
const fix = err instanceof ApiError ? unknownCountryFix(err.message) : null;
|
|
66490
|
+
if (err instanceof ApiError && fix) {
|
|
66491
|
+
writeJson({ ok: false, error: { code: err.code, message: err.message, fix } });
|
|
66492
|
+
process.exit(1);
|
|
66493
|
+
}
|
|
66494
|
+
reportError2(err);
|
|
66495
|
+
}
|
|
66462
66496
|
var searchCommand5 = defineCommand239({
|
|
66463
66497
|
meta: {
|
|
66464
66498
|
name: "search",
|
|
@@ -66491,7 +66525,11 @@ var searchCommand5 = defineCommand239({
|
|
|
66491
66525
|
required: false
|
|
66492
66526
|
},
|
|
66493
66527
|
awareness: { type: "string", description: "Comma list of awareness stages", required: false },
|
|
66494
|
-
country: {
|
|
66528
|
+
country: {
|
|
66529
|
+
type: "string",
|
|
66530
|
+
description: "Comma list of ISO country codes (US,GB) \u2014 an unknown code is refused with the codes that have ads",
|
|
66531
|
+
required: false
|
|
66532
|
+
},
|
|
66495
66533
|
language: { type: "string", description: "Comma list of language codes", required: false },
|
|
66496
66534
|
"advertiser-id": { type: "string", description: "Restrict to these advertiser ids", required: false },
|
|
66497
66535
|
"exclude-advertiser": {
|
|
@@ -66555,7 +66593,8 @@ var searchCommand5 = defineCommand239({
|
|
|
66555
66593
|
results,
|
|
66556
66594
|
pool_size: data?.pool_size ?? null,
|
|
66557
66595
|
match_confidence: data?.match_confidence ?? null,
|
|
66558
|
-
below_floor_count: data?.below_floor_count ?? null
|
|
66596
|
+
below_floor_count: data?.below_floor_count ?? null,
|
|
66597
|
+
country_coverage: data?.country_coverage ?? null
|
|
66559
66598
|
}
|
|
66560
66599
|
});
|
|
66561
66600
|
return;
|
|
@@ -66568,7 +66607,7 @@ var searchCommand5 = defineCommand239({
|
|
|
66568
66607
|
winningAdNormalizer
|
|
66569
66608
|
);
|
|
66570
66609
|
} catch (err) {
|
|
66571
|
-
|
|
66610
|
+
reportSearchError(err);
|
|
66572
66611
|
}
|
|
66573
66612
|
}
|
|
66574
66613
|
});
|