@koda-sl/baker-cli 0.348.0 → 0.349.0-dev.c05788ee3

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
@@ -67,7 +67,7 @@ import {
67
67
  validateCanvasDeep,
68
68
  withoutCastName,
69
69
  ytDlpBlockSignal
70
- } from "./chunk-YBD3W4M7.js";
70
+ } from "./chunk-CEFJ5YSG.js";
71
71
  import {
72
72
  csvOrJson,
73
73
  daysAgoIso,
@@ -9848,6 +9848,27 @@ var CORRECTION_RULES = [
9848
9848
  };
9849
9849
  }
9850
9850
  },
9851
+ // 0b. OPERATOR_FIELD_MISMATCH — the field refuses this operator, and Google names the
9852
+ // ones it takes. Kept ahead of the field-specific rules for the same reason as rule 0.
9853
+ // A repeated field (final_urls, labels, …) takes only CONTAINS ALL/ANY/NONE, so it has
9854
+ // no null test at all: read it unfiltered and filter the rows instead.
9855
+ {
9856
+ matchApiError: /OPERATOR_FIELD_MISMATCH|is not a valid operator to use with/i,
9857
+ fix: (ctx) => {
9858
+ const message = ctx.apiErrorMessage ?? "";
9859
+ const field = message.match(/valid operator to use with '([\w.]+)'/i)?.[1] ?? "this field";
9860
+ const operator = message.match(/([A-Z][A-Z_ =!<>]*?) is not a valid operator/)?.[1]?.trim();
9861
+ const valid = message.match(/Valid operators: (.+?)\.?(?:"|$)/i)?.[1]?.trim();
9862
+ const refused = operator ? `${operator} cannot be used on ${field}` : `${field} does not take that operator`;
9863
+ const allowed = valid ? `; its valid operators are ${valid}` : "";
9864
+ const repeated = valid?.split(",").every((op) => /^CONTAINS (ALL|ANY|NONE)$/i.test(op.trim())) ?? false;
9865
+ const guidance = repeated ? `. ${field} is a list field, so it cannot be tested for null or compared with =: to find rows that have it, drop that condition, keep ${field} in SELECT and filter the rows (rows without it omit the key); to match values, use ${field} CONTAINS ANY ('value')` : ". Rewrite that condition with one of them, or drop it and filter the rows";
9866
+ return {
9867
+ action: "change_operator",
9868
+ explanation: `${refused}${allowed}${guidance}`
9869
+ };
9870
+ }
9871
+ },
9851
9872
  // 1. bare keyword.text → ad_group_criterion.keyword.text (leaves <resource>.keyword.text untouched)
9852
9873
  {
9853
9874
  matchQuery: /(?<![\w.])keyword\.text\b/,
@@ -9890,10 +9911,11 @@ var CORRECTION_RULES = [
9890
9911
  };
9891
9912
  }
9892
9913
  },
9893
- // 4. CONTAINS → LIKE
9914
+ // 4. CONTAINS → LIKE. Keyed on the query alone: Google's error envelope ("Request contains an
9915
+ // invalid argument … Valid operators: CONTAINS ANY") matches any loose error pattern, and this
9916
+ // advice only makes sense when the query actually wrote CONTAINS(…).
9894
9917
  {
9895
9918
  matchQuery: /CONTAINS\s*\(/i,
9896
- matchApiError: /CONTAINS.*not.*supported|invalid.*operator.*CONTAINS/i,
9897
9919
  fix: (ctx) => {
9898
9920
  const match = ctx.originalQuery.match(/CONTAINS\s*\(\s*([^,]+),\s*'([^']+)'\s*\)/i);
9899
9921
  if (match) {