@koda-sl/baker-cli 0.254.1 → 0.255.0-dev.8030cfcf9

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
@@ -58,7 +58,7 @@ import {
58
58
  ulid,
59
59
  validateCanvasDeep,
60
60
  ytDlpBlockSignal
61
- } from "./chunk-SJPRTSGY.js";
61
+ } from "./chunk-HBDGUVUH.js";
62
62
  import {
63
63
  csvOrJson,
64
64
  daysAgoIso,
@@ -2113,7 +2113,14 @@ var GOOGLE_ADS_LIMITS = {
2113
2113
  // Google's published headers (`structured-snippet-headers.ts`), the longest
2114
2114
  // of which is 29 characters. Only the values are capped.
2115
2115
  structuredSnippetValuesMin: 3,
2116
- structuredSnippetValuesMax: 10
2116
+ structuredSnippetValuesMax: 10,
2117
+ /**
2118
+ * Per VALUE, not per asset. Google rejects a 26-character value with a bare "Too long." at
2119
+ * `structured_snippet_asset.values[i]` — one red row inside an otherwise clean publish, plus
2120
+ * every link that depends on the asset. Confirmed live on v23: "Bases de datos vectoriales"
2121
+ * (26) rejected, its four neighbours accepted.
2122
+ */
2123
+ structuredSnippetValueMax: 25
2117
2124
  },
2118
2125
  conversionAction: {
2119
2126
  nameMax: 255
@@ -2273,9 +2280,24 @@ var ASSET_FIELD_TYPES = [
2273
2280
  "HEADLINE",
2274
2281
  "DESCRIPTION",
2275
2282
  "LOGO",
2283
+ /**
2284
+ * Kept because a draft staged before {@link IMAGE_ASSET_LINK_MESSAGE} shipped may still carry one,
2285
+ * and because it is the field type an asset-group image occupies. It is refused on an
2286
+ * `assetLink.attach` — see that message for what Google actually does with it.
2287
+ */
2276
2288
  "MARKETING_IMAGE",
2277
2289
  "BUSINESS_NAME"
2278
2290
  ];
2291
+ var IMAGE_ASSET_LINK_FIELD_TYPES = /* @__PURE__ */ new Set([
2292
+ "MARKETING_IMAGE",
2293
+ "SQUARE_MARKETING_IMAGE",
2294
+ "PORTRAIT_MARKETING_IMAGE",
2295
+ "AD_IMAGE"
2296
+ ]);
2297
+ var IMAGE_ASSET_LINK_MESSAGE = "Google does not accept an image through an asset link. MARKETING_IMAGE is a Performance Max asset-group slot (use `asset-groups attach`), and AD_IMAGE \u2014 the field type Google names for a Search image extension \u2014 comes back UNSUPPORTED_FIELD_TYPE at campaign and ad group level alike. Image extensions are not reachable through the API: tell the user to add them in the Google Ads interface, and carry on with the rest of the job.";
2298
+ function isImageAssetLinkFieldType(fieldType) {
2299
+ return IMAGE_ASSET_LINK_FIELD_TYPES.has(fieldType);
2300
+ }
2279
2301
  var ASSET_GROUP_ASSET_FIELD_TYPES = [
2280
2302
  "MARKETING_IMAGE",
2281
2303
  "SQUARE_MARKETING_IMAGE",
@@ -3123,7 +3145,7 @@ var structuredSnippetHeaderSchema = z4.string().min(1).transform((header, ctx) =
3123
3145
  var structuredSnippetAssetSchema = z4.object({
3124
3146
  type: z4.literal("structuredSnippet"),
3125
3147
  header: structuredSnippetHeaderSchema,
3126
- values: z4.array(z4.string().min(1)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax)
3148
+ values: z4.array(z4.string().min(1).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValueMax)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax)
3127
3149
  });
3128
3150
  var callToActionAssetSchema = z4.object({ type: z4.literal("callToAction"), callToAction: z4.string().min(1) });
3129
3151
  var assetCreateSchema = z4.discriminatedUnion("type", [
@@ -3143,7 +3165,7 @@ var assetUpdateSchema = z4.object({
3143
3165
  finalUrls: z4.array(httpsUrlSchema2).min(1).optional(),
3144
3166
  calloutText: z4.string().min(1).max(GOOGLE_ADS_LIMITS.asset.calloutTextMax).optional(),
3145
3167
  header: structuredSnippetHeaderSchema.optional(),
3146
- values: z4.array(z4.string().min(1)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax).optional(),
3168
+ values: z4.array(z4.string().min(1).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValueMax)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax).optional(),
3147
3169
  callToAction: z4.string().min(1).optional(),
3148
3170
  text: z4.string().min(1).optional()
3149
3171
  }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
@@ -3151,7 +3173,11 @@ var assetLinkAttachSchema = z4.object({
3151
3173
  level: z4.enum(["campaign", "adGroup", "customer"]),
3152
3174
  parent: refSchema.optional(),
3153
3175
  asset: refSchema,
3154
- fieldType: z4.enum(ASSET_FIELD_TYPES)
3176
+ // A plain string, not `z.enum(ASSET_FIELD_TYPES)`, so the image refusal below can answer with
3177
+ // the reason instead of an enum listing. An agent reaching for AD_IMAGE is following Google's
3178
+ // own documentation; "Invalid option: expected one of …" sends it to guess another field type,
3179
+ // which is the failure this whole refusal exists to end.
3180
+ fieldType: z4.string().min(1)
3155
3181
  }).superRefine((value, ctx) => {
3156
3182
  if (value.level !== "customer" && !value.parent) {
3157
3183
  ctx.addIssue({
@@ -3160,6 +3186,15 @@ var assetLinkAttachSchema = z4.object({
3160
3186
  message: `parent is required for a ${value.level}-level asset link (--parent-ref)`
3161
3187
  });
3162
3188
  }
3189
+ if (isImageAssetLinkFieldType(value.fieldType)) {
3190
+ ctx.addIssue({ code: z4.ZodIssueCode.custom, path: ["fieldType"], message: IMAGE_ASSET_LINK_MESSAGE });
3191
+ } else if (!ASSET_FIELD_TYPES.includes(value.fieldType)) {
3192
+ ctx.addIssue({
3193
+ code: z4.ZodIssueCode.custom,
3194
+ path: ["fieldType"],
3195
+ message: `expected one of ${ASSET_FIELD_TYPES.join(" | ")}`
3196
+ });
3197
+ }
3163
3198
  });
3164
3199
  var assetGroupCreateSchema = z4.object({
3165
3200
  campaign: refSchema,
@@ -14784,7 +14819,7 @@ var assetsUpdateCommand = defineCommand30({
14784
14819
  "final-urls": { type: "string", description: "Comma-separated sitelink final URLs" },
14785
14820
  "callout-text": { type: "string", description: "Callout text" },
14786
14821
  header: { type: "string", description: "Structured snippet header" },
14787
- values: { type: "string", description: "Comma-separated structured snippet values" },
14822
+ values: { type: "string", description: "Comma-separated structured snippet values (3-10, max 25 characters each)" },
14788
14823
  cta: { type: "string", description: "Call-to-action text" },
14789
14824
  text: { type: "string", description: "Text asset content" }
14790
14825
  },
@@ -14818,7 +14853,9 @@ var assetsCommand = defineCommand30({
14818
14853
  "Stage an asset (text/image/sitelink/callout/structuredSnippet/\u2026)"
14819
14854
  ),
14820
14855
  update: assetsUpdateCommand,
14821
- attach: fileCreateCommand("attach", "google.assetLink.attach", "Attach an asset to a campaign/adGroup/customer"),
14856
+ attach: fileCreateCommand("attach", "google.assetLink.attach", "Attach an asset to a campaign/adGroup/customer", [
14857
+ "Images are not attachable here at all \u2014 Google refuses every image field type through an asset link, at every level. Image extensions have to be added in the Google Ads interface; say so and carry on. Performance Max asset-group images are a different mechanism and do work (`asset-groups attach`)."
14858
+ ]),
14822
14859
  detach: statusCommand2("google.assetLink.detach", "asset link")
14823
14860
  }
14824
14861
  });