@koda-sl/baker-cli 0.186.0 → 0.187.0-dev.720190ec6
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
CHANGED
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
toModelSafeImage,
|
|
48
48
|
ulid,
|
|
49
49
|
validateCanvasDeep
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-FNH2XY63.js";
|
|
51
51
|
import {
|
|
52
52
|
csvOrJson,
|
|
53
53
|
daysAgoIso,
|
|
@@ -6511,14 +6511,13 @@ var adScheduleCriterionSchema = z16.object({
|
|
|
6511
6511
|
endHour: z16.number().int().min(0).max(24),
|
|
6512
6512
|
endMinute: z16.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO")
|
|
6513
6513
|
});
|
|
6514
|
+
var bidModifierSchema = z16.number().min(0).max(10).refine((v) => v === 0 || v >= 0.1, {
|
|
6515
|
+
message: "bid modifier must be 0 (exclude the device) or between 0.1 and 10.0"
|
|
6516
|
+
});
|
|
6514
6517
|
var deviceCriterionSchema = z16.object({
|
|
6515
6518
|
criterionType: z16.literal("device"),
|
|
6516
6519
|
device: z16.enum(DEVICE_TYPES),
|
|
6517
|
-
|
|
6518
|
-
// to opt out of a Device type." So 0 (exclude the device) and 0.1–10.0 are valid; the (0, 0.1) gap is not.
|
|
6519
|
-
bidModifier: z16.number().min(0).max(10).optional().refine((v) => v === void 0 || v === 0 || v >= 0.1, {
|
|
6520
|
-
message: "bid modifier must be 0 (exclude the device) or between 0.1 and 10.0"
|
|
6521
|
-
})
|
|
6520
|
+
bidModifier: bidModifierSchema.optional()
|
|
6522
6521
|
});
|
|
6523
6522
|
var campaignCriterionAddSchema = z16.object({
|
|
6524
6523
|
campaign: refSchema,
|
|
@@ -6539,6 +6538,9 @@ var campaignCriterionAddSchema = z16.object({
|
|
|
6539
6538
|
});
|
|
6540
6539
|
}
|
|
6541
6540
|
});
|
|
6541
|
+
var campaignCriterionUpdateSchema = z16.object({
|
|
6542
|
+
bidModifier: bidModifierSchema
|
|
6543
|
+
});
|
|
6542
6544
|
var GOOGLE_DRAFT_OP_KINDS = [
|
|
6543
6545
|
"google.budget.create",
|
|
6544
6546
|
"google.budget.update",
|
|
@@ -6586,6 +6588,7 @@ var GOOGLE_DRAFT_OP_KINDS = [
|
|
|
6586
6588
|
"google.label.create",
|
|
6587
6589
|
"google.label.attach",
|
|
6588
6590
|
"google.campaignCriterion.add",
|
|
6591
|
+
"google.campaignCriterion.update",
|
|
6589
6592
|
"google.campaignCriterion.remove"
|
|
6590
6593
|
];
|
|
6591
6594
|
var googleDraftOpKindSchema = z16.enum(GOOGLE_DRAFT_OP_KINDS);
|
|
@@ -6645,6 +6648,7 @@ var googleDraftOpInputSchema = z16.discriminatedUnion("kind", [
|
|
|
6645
6648
|
createOp2("google.label.create", labelCreateSchema),
|
|
6646
6649
|
createOp2("google.label.attach", labelAttachSchema),
|
|
6647
6650
|
createOp2("google.campaignCriterion.add", campaignCriterionAddSchema),
|
|
6651
|
+
updateOp2("google.campaignCriterion.update", campaignCriterionUpdateSchema),
|
|
6648
6652
|
targetOp("google.campaignCriterion.remove")
|
|
6649
6653
|
]);
|
|
6650
6654
|
|
|
@@ -10953,14 +10957,64 @@ var labelsCommand = defineCommand30({
|
|
|
10953
10957
|
attach: fileCreateCommand("attach", "google.label.attach", "Attach a label to a campaign/adGroup/ad")
|
|
10954
10958
|
}
|
|
10955
10959
|
});
|
|
10960
|
+
function bidModifierFlag(value) {
|
|
10961
|
+
if (value === void 0 || value === null || value === "") {
|
|
10962
|
+
failWriteValidation(
|
|
10963
|
+
"--bid-modifier is required: 1 for no adjustment, 1.25 to bid 25% more, 0.9 to bid 10% less, 0 to stop serving on it"
|
|
10964
|
+
);
|
|
10965
|
+
}
|
|
10966
|
+
const num3 = Number(value);
|
|
10967
|
+
if (Number.isNaN(num3) || num3 < 0 || num3 > 10 || num3 > 0 && num3 < 0.1) {
|
|
10968
|
+
failWriteValidation("--bid-modifier must be 0 (stop serving on it) or between 0.1 and 10.0");
|
|
10969
|
+
}
|
|
10970
|
+
return num3;
|
|
10971
|
+
}
|
|
10956
10972
|
var campaignCriteriaCommand = defineCommand30({
|
|
10957
10973
|
meta: {
|
|
10958
10974
|
name: "campaign-criteria",
|
|
10959
|
-
description: "Stage campaign criteria (location/language/adSchedule/device) add/remove
|
|
10975
|
+
description: "Stage campaign criteria (location/language/adSchedule/device): add/remove a targeting criterion, or update a device bid adjustment"
|
|
10960
10976
|
},
|
|
10961
10977
|
subCommands: {
|
|
10962
10978
|
add: fileCreateCommand("add", "google.campaignCriterion.add", "Add a campaign criterion"),
|
|
10963
|
-
|
|
10979
|
+
update: defineCommand30({
|
|
10980
|
+
meta: {
|
|
10981
|
+
name: "update",
|
|
10982
|
+
description: "Change a criterion's bid adjustment \u2014 the ONLY way to change device targeting, which Google does not let you add or remove. Start here: `campaign-criteria update customers/<cid>/campaignCriteria/<campaignId>~<criterionId> --bid-modifier 1` resets a boost to neutral; --bid-modifier 0 stops ads serving on that device. Read the current ones with: baker ads google query \"SELECT campaign_criterion.resource_name, campaign_criterion.device.type, campaign_criterion.bid_modifier FROM campaign_criterion WHERE campaign_criterion.type = 'DEVICE'\""
|
|
10983
|
+
},
|
|
10984
|
+
args: {
|
|
10985
|
+
...customerIdArg,
|
|
10986
|
+
id: {
|
|
10987
|
+
type: "positional",
|
|
10988
|
+
description: "Criterion resource name (customers/\u2026/campaignCriteria/{campaignId}~{criterionId})",
|
|
10989
|
+
required: false
|
|
10990
|
+
},
|
|
10991
|
+
"bid-modifier": {
|
|
10992
|
+
type: "string",
|
|
10993
|
+
description: "1 = no adjustment, 1.25 = bid 25% more, 0.9 = bid 10% less, 0 = don't serve on it"
|
|
10994
|
+
}
|
|
10995
|
+
},
|
|
10996
|
+
run: async ({ args }) => {
|
|
10997
|
+
const customerId = requireCustomerId(args);
|
|
10998
|
+
const target = requireTarget(args, "campaign criterion");
|
|
10999
|
+
await stageUpdate("google.campaignCriterion.update", customerId, target, {
|
|
11000
|
+
bidModifier: bidModifierFlag(args["bid-modifier"])
|
|
11001
|
+
});
|
|
11002
|
+
}
|
|
11003
|
+
}),
|
|
11004
|
+
remove: defineCommand30({
|
|
11005
|
+
meta: {
|
|
11006
|
+
name: "remove",
|
|
11007
|
+
description: "Stage a campaign criterion remove. Works for what you added \u2014 locations, languages, ad schedules. Device targeting CANNOT be removed: Google keeps a criterion per device on every campaign, so use `campaign-criteria update --bid-modifier` to change or neutralise it instead."
|
|
11008
|
+
},
|
|
11009
|
+
args: {
|
|
11010
|
+
...customerIdArg,
|
|
11011
|
+
id: { type: "positional", description: "Criterion resource name or id", required: false }
|
|
11012
|
+
},
|
|
11013
|
+
run: async ({ args }) => {
|
|
11014
|
+
const customerId = requireCustomerId(args);
|
|
11015
|
+
await stageTarget("google.campaignCriterion.remove", customerId, requireTarget(args, "campaign criterion"));
|
|
11016
|
+
}
|
|
11017
|
+
})
|
|
10964
11018
|
}
|
|
10965
11019
|
});
|
|
10966
11020
|
var googleWriteCommands = {
|