@koda-sl/baker-cli 0.559.0 → 0.560.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/README.md +3 -1
- package/dist/{accounts-ZFQYZT3J.js → accounts-RRCALMPX.js} +2 -2
- package/dist/{ads-XXSBCX4B.js → ads-OC3ENYUC.js} +2 -2
- package/dist/{changes-MVCX3GLE.js → changes-AEAVFB3M.js} +29 -10
- package/dist/changes-AEAVFB3M.js.map +1 -0
- package/dist/{chunk-2L24FULD.js → chunk-JQDYH5XP.js} +24 -2
- package/dist/chunk-JQDYH5XP.js.map +1 -0
- package/dist/{chunk-HNELOMY2.js → chunk-NKZDYXEN.js} +12 -5
- package/dist/chunk-NKZDYXEN.js.map +1 -0
- package/dist/{chunk-NPGPRZW2.js → chunk-VR6XCLY6.js} +10 -3
- package/dist/chunk-VR6XCLY6.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/{currency-XFY2EX72.js → currency-GLHXNSHY.js} +2 -2
- package/dist/{google-TOO3FDZ6.js → google-TKRS4CGR.js} +27 -12
- package/dist/google-TKRS4CGR.js.map +1 -0
- package/dist/{query-ZYG5RCCW.js → query-YWDUKFS7.js} +4 -4
- package/dist/{url-options-C3ZOWN2L.js → url-options-5PUWQKWS.js} +2 -2
- package/package.json +1 -1
- package/dist/changes-MVCX3GLE.js.map +0 -1
- package/dist/chunk-2L24FULD.js.map +0 -1
- package/dist/chunk-HNELOMY2.js.map +0 -1
- package/dist/chunk-NPGPRZW2.js.map +0 -1
- package/dist/google-TOO3FDZ6.js.map +0 -1
- /package/dist/{accounts-ZFQYZT3J.js.map → accounts-RRCALMPX.js.map} +0 -0
- /package/dist/{ads-XXSBCX4B.js.map → ads-OC3ENYUC.js.map} +0 -0
- /package/dist/{currency-XFY2EX72.js.map → currency-GLHXNSHY.js.map} +0 -0
- /package/dist/{query-ZYG5RCCW.js.map → query-YWDUKFS7.js.map} +0 -0
- /package/dist/{url-options-C3ZOWN2L.js.map → url-options-5PUWQKWS.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/ads/google/during-literals.ts","../src/commands/ads/google/changes-window.ts","../src/commands/ads/google/presets.ts","../src/commands/ads/google/list-fields.ts","../src/commands/ads/google/correction-table.ts","../src/commands/ads/google/error-parser.ts"],"sourcesContent":["/**\n * The date literals GAQL's `DURING` accepts — Google's grammar, verbatim. Anything else is refused by\n * Google with \"Invalid date literal supplied for DURING operator\", so it is refused here first.\n * https://developers.google.com/google-ads/api/docs/query/grammar\n */\nexport const GAQL_DURING_LITERALS = [\n \"TODAY\",\n \"YESTERDAY\",\n \"LAST_7_DAYS\",\n \"LAST_14_DAYS\",\n \"LAST_30_DAYS\",\n \"LAST_BUSINESS_WEEK\",\n \"THIS_MONTH\",\n \"LAST_MONTH\",\n \"THIS_WEEK_SUN_TODAY\",\n \"THIS_WEEK_MON_TODAY\",\n \"LAST_WEEK_SUN_SAT\",\n \"LAST_WEEK_MON_SUN\",\n] as const;\n\nexport function isDuringLiteral(value: string): boolean {\n return (GAQL_DURING_LITERALS as readonly string[]).includes(value.toUpperCase());\n}\n\nfunction isoDay(date: Date): string {\n return date.toISOString().slice(0, 10);\n}\n\nfunction utcDate(year: number, month: number, day: number): Date {\n return new Date(Date.UTC(year, month, day));\n}\n\n/** `months` calendar months before `date`, on the same day or the target month's last day if shorter. */\nfunction monthsBefore(date: Date, months: number): Date {\n const lastDayOfTarget = utcDate(date.getUTCFullYear(), date.getUTCMonth() - months + 1, 0).getUTCDate();\n return utcDate(date.getUTCFullYear(), date.getUTCMonth() - months, Math.min(date.getUTCDate(), lastDayOfTarget));\n}\n\n/**\n * The BETWEEN range an unsupported literal means, or null when it names no fixed window (ALL_TIME).\n * Rolling windows end yesterday, as Google's own LAST_30_DAYS does; calendar periods run to their end,\n * or to today for the current one.\n */\nexport function equivalentBetween(literal: string, now: Date): string | null {\n const upper = literal.toUpperCase();\n const today = utcDate(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate());\n const yesterday = utcDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate() - 1);\n const range = (from: Date, to: Date) => `BETWEEN '${isoDay(from)}' AND '${isoDay(to)}'`;\n const year = today.getUTCFullYear();\n const quarterStart = Math.floor(today.getUTCMonth() / 3) * 3;\n\n const rolling = upper.match(/^LAST_(\\d+)_(DAYS|WEEKS|MONTHS|YEARS)$/);\n if (rolling) {\n const n = Number(rolling[1]);\n const unit = rolling[2];\n if (n < 1) return null;\n if (unit === \"DAYS\" || unit === \"WEEKS\") {\n const days = unit === \"DAYS\" ? n : n * 7;\n return range(utcDate(year, today.getUTCMonth(), today.getUTCDate() - days), yesterday);\n }\n const months = unit === \"MONTHS\" ? n : n * 12;\n return range(monthsBefore(today, months), yesterday);\n }\n\n switch (upper) {\n case \"THIS_YEAR\":\n return range(utcDate(year, 0, 1), today);\n case \"LAST_YEAR\":\n return range(utcDate(year - 1, 0, 1), utcDate(year - 1, 11, 31));\n case \"THIS_QUARTER\":\n return range(utcDate(year, quarterStart, 1), today);\n case \"LAST_QUARTER\":\n return range(utcDate(year, quarterStart - 3, 1), utcDate(year, quarterStart, 0));\n default:\n return null;\n }\n}\n\nexport function duringLiteralExplanation(literal: string, between: string | null): string {\n const accepted = GAQL_DURING_LITERALS.join(\", \");\n const lead = between\n ? `Google does not accept ${literal} after DURING. The same window as explicit dates is ${between}.`\n : `Google does not accept ${literal} after DURING, and it names no fixed window — use BETWEEN 'YYYY-MM-DD' AND 'YYYY-MM-DD', or drop the date filter.`;\n return `${lead} DURING accepts only: ${accepted}. Any other window needs BETWEEN.`;\n}\n","import {\n CHANGE_RESOURCE_TYPES,\n CHANGE_SCOPE_MAX_DAYS,\n CHANGE_SCOPES,\n CHANGES_MAX_LIMIT,\n type ChangeScope,\n DEFAULT_CHANGE_DAYS,\n isChangeLookbackWithinReach,\n} from \"@baker/api/ads-google\";\nimport type { QueryFix } from \"../types.ts\";\nimport { equivalentBetween } from \"./during-literals.ts\";\n\nexport { CHANGE_RESOURCE_TYPES, CHANGE_SCOPE_MAX_DAYS, CHANGES_MAX_LIMIT, DEFAULT_CHANGE_DAYS };\n\n/**\n * A year of monthly spend per campaign — what to read when a change is older than any history\n * resource reaches. Dates are spelled out: GAQL has no LAST_12_MONTHS literal.\n */\nexport function monthlySpendTrendQuery(now: Date = new Date()): string {\n return `SELECT campaign.name, segments.month, metrics.cost_micros, metrics.conversions FROM campaign WHERE segments.date ${equivalentBetween(\"LAST_12_MONTHS\", now)}`;\n}\n\nexport type ChangesWindowResolution =\n | { ok: true; scope: ChangeScope; days: number; hints: string[] }\n | { ok: false; error: { code: string; message: string; fix: QueryFix } };\n\nfunction isChangeScope(value: string): value is ChangeScope {\n return (CHANGE_SCOPES as readonly string[]).includes(value);\n}\n\nexport function resolveChangesWindow(input: {\n days?: number;\n scope?: string;\n limit?: number;\n resourceType?: string;\n}): ChangesWindowResolution {\n const refusal = changesFilterRefusal(input);\n if (refusal) return { ok: false, error: refusal };\n const scope = input.scope ?? \"detail\";\n if (!isChangeScope(scope)) {\n return {\n ok: false,\n error: {\n code: \"INVALID_SCOPE\",\n message: `Unknown scope '${scope}'. Use 'detail' (field-level changes, 30 days) or 'summary' (which resources changed, 90 days).`,\n fix: {\n action: \"retry_with_flag\",\n explanation: \"Pass --scope detail or --scope summary.\",\n },\n },\n };\n }\n\n const days = input.days ?? DEFAULT_CHANGE_DAYS;\n if (!Number.isInteger(days) || days < 1) {\n return {\n ok: false,\n error: {\n code: \"INVALID_LOOKBACK\",\n message: `--days must be a whole number of days, got '${days}'.`,\n fix: {\n action: \"retry_with_flag\",\n explanation: `Pass --days as a positive integer, e.g. --days ${DEFAULT_CHANGE_DAYS}.`,\n },\n },\n };\n }\n\n if (!isChangeLookbackWithinReach(days, scope)) {\n return { ok: false, error: lookbackTooLong(scope, days, CHANGE_SCOPE_MAX_DAYS[scope]) };\n }\n\n return { ok: true, scope, days, hints: hintsFor(scope, days) };\n}\n\ntype ChangesRefusal = { code: string; message: string; fix: QueryFix };\n\n/**\n * `--limit` and `--resource-type` checked before the call, against the bounds the route enforces.\n * Left to the route, a bad value came back as an unclassified error whose fix told the agent to\n * check its GAQL — and `changes` takes none.\n */\nexport function changesFilterRefusal(input: { limit?: number; resourceType?: string }): ChangesRefusal | null {\n const { limit, resourceType } = input;\n if (limit !== undefined && (!Number.isInteger(limit) || limit < 1 || limit > CHANGES_MAX_LIMIT)) {\n return {\n code: \"INVALID_LIMIT\",\n message: `--limit must be a whole number from 1 to ${CHANGES_MAX_LIMIT}, got '${limit}'.`,\n fix: {\n action: \"retry_with_flag\",\n explanation: `Pass --limit ${CHANGES_MAX_LIMIT} at most. To see further back than one full read reaches, narrow with --resource-type or shorten --days and read again.`,\n },\n };\n }\n if (resourceType && !(CHANGE_RESOURCE_TYPES as readonly string[]).includes(resourceType)) {\n return {\n code: \"INVALID_RESOURCE_TYPE\",\n message: `--resource-type '${resourceType}' is not one the change history can be filtered by.`,\n fix: {\n action: \"retry_with_flag\",\n explanation: `Use one of ${CHANGE_RESOURCE_TYPES.join(\", \")}, or drop --resource-type and filter the rows by their resource type.`,\n },\n };\n }\n return null;\n}\n\nfunction lookbackTooLong(\n scope: ChangeScope,\n days: number,\n max: number,\n): {\n code: string;\n message: string;\n fix: QueryFix;\n} {\n if (scope === \"detail\" && days <= CHANGE_SCOPE_MAX_DAYS.summary) {\n return {\n code: \"LOOKBACK_TOO_LONG\",\n message: `Google keeps field-level change detail for ${max} days only; ${days} days is outside that window.`,\n fix: {\n action: \"narrow_date_range\",\n explanation: `Re-run with --scope summary --days ${days} to reach back ${CHANGE_SCOPE_MAX_DAYS.summary} days. Summary tells you which campaigns, ad groups, ads and criteria changed and when, but not the old and new values — read the resource itself for current values.`,\n },\n };\n }\n\n return {\n code: \"LOOKBACK_TOO_LONG\",\n message: `Google's account history API reaches back ${CHANGE_SCOPE_MAX_DAYS.summary} days at most; ${days} days is outside that window.`,\n fix: {\n action: \"use_different_resource\",\n explanation: `Do not abort — infer the change from performance instead. Query monthly metrics per campaign (${monthlySpendTrendQuery()}) to see which campaigns stopped or started spending. That shows what changed and when, though not who changed it. Older history exists only in the Google Ads web UI, which has no API — ask the user to check it if the 'who' matters.`,\n },\n };\n}\n\nfunction hintsFor(scope: ChangeScope, days: number): string[] {\n const hints: string[] = [];\n\n if (scope === \"detail\") {\n hints.push(\n `Detailed history covers the last ${CHANGE_SCOPE_MAX_DAYS.detail} days. For anything older use --scope summary (reaches ${CHANGE_SCOPE_MAX_DAYS.summary} days, reports which resources changed but not their values).`,\n );\n } else {\n hints.push(\n \"Summary history reports which resources changed and when, not old and new values. To see what a changed resource looks like now, query it by resource_name.\",\n );\n if (days > CHANGE_SCOPE_MAX_DAYS.detail) {\n hints.push(\n `Changes inside the last ${CHANGE_SCOPE_MAX_DAYS.detail} days also have field-level detail — re-run with --scope detail for those.`,\n );\n }\n }\n\n return hints;\n}\n\nconst CHANGE_TIME_FIELDS = [\"change_event.change_date_time\", \"change_status.last_change_date_time\"];\n\n/**\n * A read that came back exactly at --limit has, as far as anyone can tell, more\n * behind it: Google returns the newest first, so the window the caller asked for\n * is covered only back to the oldest row. Said in words, because a capped read\n * looks like a complete one and \"nobody touched it in 30 days\" is the conclusion\n * an agent draws from it.\n */\nexport function cappedChangesHint(rows: Array<Record<string, unknown>>, limit: number, days: number): string | null {\n if (rows.length < limit) return null;\n const oldest = rows[rows.length - 1];\n const at = CHANGE_TIME_FIELDS.map((field) => oldest?.[field]).find((value) => typeof value === \"string\");\n const reached = typeof at === \"string\" ? `reaching back only to ${at}` : \"not the whole window\";\n const more =\n limit < CHANGES_MAX_LIMIT\n ? `re-run with --limit ${Math.min(limit * 2, CHANGES_MAX_LIMIT)}, or narrow with --campaign-id or --resource-type`\n : \"narrow with --campaign-id or --resource-type\";\n return `This read came back full at --limit ${limit}, ${reached}, not the ${days} days asked for: older changes almost certainly exist and are NOT shown. Do not conclude nothing changed before then — ${more}.`;\n}\n","import type { PresetDefinition } from \"../types.ts\";\nimport { duringLiteralExplanation, equivalentBetween, isDuringLiteral } from \"./during-literals.ts\";\n\nconst BETWEEN_RE = /^BETWEEN\\s+'[0-9]{4}-[0-9]{2}-[0-9]{2}'\\s+AND\\s+'[0-9]{4}-[0-9]{2}-[0-9]{2}'$/i;\n\n/** What `{dateRange}` may expand to: a literal Google accepts after DURING, or a BETWEEN range. */\nexport function isValidDateRange(value: string): boolean {\n const trimmed = value.trim();\n return isDuringLiteral(trimmed) || BETWEEN_RE.test(trimmed);\n}\n\nfunction dateRangeError(dateRange: string, now: Date): string {\n if (/^[A-Za-z0-9_]+$/.test(dateRange.trim())) {\n return `Invalid date range: \"${dateRange}\". ${duringLiteralExplanation(dateRange, equivalentBetween(dateRange, now))} Pass it as --date-range \"BETWEEN 'YYYY-MM-DD' AND 'YYYY-MM-DD'\".`;\n }\n return `Invalid date range: \"${dateRange}\". Use a GAQL date literal (e.g. LAST_30_DAYS, TODAY) or BETWEEN 'YYYY-MM-DD' AND 'YYYY-MM-DD'.`;\n}\n\n/**\n * The status columns that decide whether a row of each resource is actually serving, outermost\n * first. Google Ads has no single serving flag: an entity runs only when every level of its chain\n * is ENABLED, so an ENABLED keyword under a paused ad group is not live.\n *\n * Only resources with **two or more** rungs are listed. A one-rung resource (campaign,\n * campaign_criterion, shopping_performance_view) carries its own status on the row and has no\n * ancestor to forget, which is the whole failure this table exists to catch.\n *\n * Presets expand `{statusScope}` from their own `statusFields`; hand-written GAQL is checked\n * against this table in preflight. `presets.test.ts` asserts the two never drift apart.\n */\nexport const SERVING_CHAINS: Record<string, string[]> = {\n keyword_view: [\"campaign.status\", \"ad_group.status\", \"ad_group_criterion.status\"],\n ad_group_criterion: [\"campaign.status\", \"ad_group.status\", \"ad_group_criterion.status\"],\n ad_group_ad: [\"campaign.status\", \"ad_group.status\", \"ad_group_ad.status\"],\n search_term_view: [\"campaign.status\", \"ad_group.status\"],\n ad_group: [\"campaign.status\", \"ad_group.status\"],\n asset_group: [\"campaign.status\", \"asset_group.status\"],\n // An asset link carries its own status, and it is not the campaign's, the ad group's or the asset\n // group's. Google returns a REMOVED link like any other row, so a read scoped only to its owners\n // lists extensions that are no longer attached to anything — which is what 74 detaches were planned\n // from on a live account, every one of them refused at publish as `RESOURCE_NOT_FOUND`.\n // `customer_asset` is deliberately absent: one rung, no ancestor to forget.\n asset_group_asset: [\"campaign.status\", \"asset_group.status\", \"asset_group_asset.status\"],\n campaign_asset: [\"campaign.status\", \"campaign_asset.status\"],\n ad_group_asset: [\"campaign.status\", \"ad_group.status\", \"ad_group_asset.status\"],\n};\n\nconst CORE_PRESETS: PresetDefinition[] = [\n {\n name: \"campaign-performance\",\n description: \"Campaign-level metrics overview\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, campaign.advertising_channel_type, campaign.bidding_strategy_type, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, metrics.all_conversions, metrics.conversions_value, metrics.ctr, metrics.average_cpc FROM campaign WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.cost_micros DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\"],\n },\n {\n name: \"budget-limited\",\n description:\n \"Campaigns Google reports as limited by budget, with each one's bid target next to its actual cost per conversion — the state where a target above actual now drives delivery up to the target instead of holding recent cost\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, campaign.advertising_channel_type, campaign.bidding_strategy_type, campaign.primary_status, campaign.primary_status_reasons, campaign.target_cpa.target_cpa_micros, campaign.maximize_conversions.target_cpa_micros, campaign.target_roas.target_roas, campaign.maximize_conversion_value.target_roas, campaign.target_cpc.target_cpc_micros, campaign_budget.amount_micros, metrics.cost_micros, metrics.conversions, metrics.conversions_value, metrics.cost_per_conversion, metrics.search_budget_lost_impression_share FROM campaign WHERE campaign.primary_status_reasons CONTAINS ANY (BUDGET_CONSTRAINED) AND segments.date DURING {dateRange}{statusScope} ORDER BY metrics.cost_micros DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\"],\n },\n {\n name: \"conversions-by-action\",\n description:\n \"Which conversion action each campaign's conversions actually are — the read that says whether two campaigns' conversion rates are measuring the same event\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, segments.conversion_action_name, segments.conversion_action_category, metrics.conversions, metrics.all_conversions FROM campaign WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.conversions DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\"],\n },\n {\n name: \"keyword-analysis\",\n description:\n \"Keyword performance with match type, quality and the first-page, top-of-page and first-position CPC estimates\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, ad_group_criterion.criterion_id, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.status, ad_group_criterion.quality_info.quality_score, ad_group_criterion.position_estimates.first_page_cpc_micros, ad_group_criterion.position_estimates.top_of_page_cpc_micros, ad_group_criterion.position_estimates.first_position_cpc_micros, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, metrics.all_conversions, metrics.ctr FROM keyword_view WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.impressions DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\", \"ad_group.status\", \"ad_group_criterion.status\"],\n },\n {\n name: \"keyword-serving\",\n description:\n \"Why a keyword is limited — Google Ads' 'Eligible (Limited) / Below first page bid' column, with the first-page bid estimate, the current max CPC and quality score\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, ad_group.id, ad_group.name, ad_group_criterion.criterion_id, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.status, ad_group_criterion.primary_status, ad_group_criterion.primary_status_reasons, ad_group_criterion.system_serving_status, ad_group_criterion.approval_status, ad_group_criterion.effective_cpc_bid_micros, ad_group_criterion.effective_cpc_bid_source, ad_group_criterion.position_estimates.first_page_cpc_micros, ad_group_criterion.position_estimates.top_of_page_cpc_micros, ad_group_criterion.quality_info.quality_score, ad_group_criterion.quality_info.creative_quality_score, ad_group_criterion.quality_info.post_click_quality_score, ad_group_criterion.quality_info.search_predicted_ctr FROM ad_group_criterion WHERE ad_group_criterion.type = 'KEYWORD' AND ad_group_criterion.negative = FALSE{statusScope} ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n statusFields: [\"campaign.status\", \"ad_group.status\", \"ad_group_criterion.status\"],\n },\n {\n name: \"positive-keywords\",\n description: \"Positive (targeting) keywords only — excludes negatives\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, ad_group_criterion.criterion_id, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.status, ad_group_criterion.negative FROM ad_group_criterion WHERE ad_group_criterion.type = 'KEYWORD' AND ad_group_criterion.negative = FALSE{statusScope} ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n statusFields: [\"campaign.status\", \"ad_group.status\", \"ad_group_criterion.status\"],\n },\n {\n name: \"negative-keywords\",\n description: \"Negative keywords only — campaign and ad group level\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, ad_group.name, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.negative FROM ad_group_criterion WHERE ad_group_criterion.type = 'KEYWORD' AND ad_group_criterion.negative = TRUE AND campaign.status != 'REMOVED' ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n },\n {\n name: \"negative-keyword-lists\",\n description:\n \"Shared negative keyword lists and the terms inside them (SharedSet members), with each member's resource name — what `negative-keywords remove` / a list-member removal takes\",\n gaqlTemplate: `SELECT shared_set.id, shared_set.name, shared_criterion.resource_name, shared_criterion.criterion_id, shared_criterion.keyword.text, shared_criterion.keyword.match_type FROM shared_criterion WHERE shared_set.type = 'NEGATIVE_KEYWORDS' AND shared_set.status = 'ENABLED' ORDER BY shared_set.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n },\n {\n name: \"negative-list-attachments\",\n description: \"Which campaigns each shared negative keyword list is attached to\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, shared_set.id, shared_set.name FROM campaign_shared_set WHERE shared_set.type = 'NEGATIVE_KEYWORDS' AND campaign_shared_set.status = 'ENABLED' ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n },\n {\n name: \"search-terms\",\n description: \"Actual user search queries triggering ads, with the match type that matched them\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.name, ad_group.status, search_term_view.search_term, segments.search_term_match_type, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions FROM search_term_view WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.impressions DESC`,\n defaultDateRange: \"LAST_7_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\", \"ad_group.status\"],\n },\n {\n name: \"ad-copy-performance\",\n description: \"Every ad's metrics, with its headlines and descriptions when it is a responsive search ad\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, ad_group_ad.ad.id, ad_group_ad.ad.type, ad_group_ad.status, ad_group_ad.ad.responsive_search_ad.headlines, ad_group_ad.ad.responsive_search_ad.descriptions, ad_group_ad.ad.final_urls, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, metrics.all_conversions, metrics.ctr FROM ad_group_ad WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.impressions DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\", \"ad_group.status\", \"ad_group_ad.status\"],\n },\n {\n name: \"asset-performance\",\n // `asset_group_asset.performance_label` is gone (v25 answers UNRECOGNIZED_FIELD): Google retired\n // the BEST/GOOD/LOW label, so the read is each asset's serving status and its own metrics.\n description: \"Performance Max assets: serving status and metrics per asset\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, asset_group.name, asset_group.status, asset_group_asset.status, asset_group_asset.field_type, asset_group_asset.primary_status, asset_group_asset.primary_status_reasons, asset.type, asset.text_asset.text, asset.image_asset.full_size.url, metrics.impressions, metrics.clicks, metrics.conversions, metrics.cost_micros FROM asset_group_asset WHERE campaign.advertising_channel_type = 'PERFORMANCE_MAX' AND segments.date DURING {dateRange}{statusScope}`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\", \"asset_group.status\", \"asset_group_asset.status\"],\n },\n {\n name: \"shopping-products\",\n description: \"Product-level shopping performance metrics\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, segments.product_title, segments.product_item_id, segments.product_brand, segments.product_type_l1, metrics.clicks, metrics.impressions, metrics.cost_micros, metrics.conversions FROM shopping_performance_view WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.cost_micros DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\"],\n },\n {\n name: \"account-summary\",\n description: \"Account-level totals for a date range\",\n gaqlTemplate: `SELECT customer.id, customer.descriptive_name, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, metrics.all_conversions, metrics.conversions_value FROM customer WHERE segments.date DURING {dateRange} LIMIT 1`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 1,\n },\n];\n\n/**\n * Reports the account read most often asks for beyond the core presets: where Performance Max\n * spends, where display ads showed, which RSA assets serve, landing pages, geography, demographics,\n * AI Max matches, the account budget, Google's recommendations and its bid/budget simulations.\n * Every GAQL here was run against a live v25 account before it was added.\n */\nexport const REPORT_PRESETS: PresetDefinition[] = [\n {\n name: \"pmax-channels\",\n description:\n \"Performance Max spend and results split by channel (Search, YouTube, Display, Discover, Gmail, Maps…) — segments.ad_network_type per campaign\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, segments.ad_network_type, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, metrics.conversions_value FROM campaign WHERE campaign.advertising_channel_type = 'PERFORMANCE_MAX' AND segments.date DURING {dateRange}{statusScope} ORDER BY metrics.cost_micros DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\"],\n },\n {\n name: \"pmax-placements\",\n description:\n \"Where Performance Max ads showed on Display / YouTube / apps (Google reports impressions only for these)\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, performance_max_placement_view.display_name, performance_max_placement_view.placement, performance_max_placement_view.placement_type, performance_max_placement_view.target_url, metrics.impressions FROM performance_max_placement_view WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.impressions DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\"],\n },\n {\n name: \"placements\",\n description:\n \"Where Display, Video and Demand Gen ads showed — each website, app or YouTube video, with cost and conversions (exclusion candidates)\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, detail_placement_view.display_name, detail_placement_view.placement, detail_placement_view.placement_type, detail_placement_view.target_url, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions FROM detail_placement_view WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.cost_micros DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\", \"ad_group.status\"],\n },\n {\n name: \"rsa-assets\",\n description:\n \"Each responsive search ad headline and description: its text, pin, whether it is enabled, its approval and its own impressions/clicks/conversions\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, ad_group_ad.ad.id, ad_group_ad.status, ad_group_ad_asset_view.field_type, ad_group_ad_asset_view.pinned_field, ad_group_ad_asset_view.enabled, ad_group_ad_asset_view.policy_summary, asset.id, asset.text_asset.text, metrics.impressions, metrics.clicks, metrics.conversions FROM ad_group_ad_asset_view WHERE ad_group_ad.ad.type = 'RESPONSIVE_SEARCH_AD' AND segments.date DURING {dateRange}{statusScope} ORDER BY metrics.impressions DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 500,\n statusFields: [\"campaign.status\", \"ad_group.status\", \"ad_group_ad.status\"],\n },\n {\n name: \"landing-pages\",\n description:\n \"Final URLs as written on the ads, with clicks, cost, conversions, mobile-friendly click share and speed score\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, landing_page_view.unexpanded_final_url, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, metrics.mobile_friendly_clicks_percentage, metrics.speed_score FROM landing_page_view WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.clicks DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\"],\n },\n {\n name: \"geo-performance\",\n description:\n \"Results by country and location type (people IN vs INTERESTED IN the place) per campaign — the read behind a Presence vs Presence-or-interest decision\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, geographic_view.country_criterion_id, geographic_view.location_type, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions FROM geographic_view WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.cost_micros DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\"],\n },\n {\n name: \"age-performance\",\n description: \"Results by age range per ad group\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, ad_group_criterion.age_range.type, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions FROM age_range_view WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.cost_micros DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\", \"ad_group.status\"],\n },\n {\n name: \"gender-performance\",\n description: \"Results by gender per ad group\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, ad_group_criterion.gender.type, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions FROM gender_view WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.cost_micros DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\", \"ad_group.status\"],\n },\n {\n name: \"ai-max-search-terms\",\n description:\n \"AI Max for Search: each search term with the headline and landing page Google generated or chose for it, with results\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, ai_max_search_term_ad_combination_view.search_term, ai_max_search_term_ad_combination_view.headline, ai_max_search_term_ad_combination_view.landing_page, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions FROM ai_max_search_term_ad_combination_view WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.impressions DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\", \"ad_group.status\"],\n },\n {\n name: \"bidding-strategy-performance\",\n description: \"Each portfolio bidding strategy's type, status, targets and metrics\",\n gaqlTemplate: `SELECT bidding_strategy.id, bidding_strategy.name, bidding_strategy.type, bidding_strategy.status, bidding_strategy.campaign_count, bidding_strategy.target_cpa.target_cpa_micros, bidding_strategy.target_roas.target_roas, bidding_strategy.maximize_conversions.target_cpa_micros, bidding_strategy.maximize_conversion_value.target_roas, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, metrics.all_conversions, metrics.conversions_value FROM bidding_strategy WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.cost_micros DESC`,\n defaultDateRange: \"LAST_30_DAYS\",\n defaultLimit: 200,\n statusFields: [\"bidding_strategy.status\"],\n },\n {\n name: \"conversion-tags\",\n description:\n \"The tracking code of each website and call conversion action: the Google tag and the event snippet to put on the site\",\n gaqlTemplate: `SELECT conversion_action.id, conversion_action.name, conversion_action.type, conversion_action.status, conversion_action.tag_snippets FROM conversion_action WHERE conversion_action.type IN ('WEBPAGE', 'WEBPAGE_CODELESS', 'WEBSITE_CALL') AND conversion_action.status != 'REMOVED' ORDER BY conversion_action.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 50,\n },\n {\n name: \"account-budget\",\n description:\n \"The account budget (invoiced billing): approved spending limit, served amount, dates and any pending change — read-only\",\n gaqlTemplate: `SELECT account_budget.id, account_budget.name, account_budget.status, account_budget.billing_setup, account_budget.approved_spending_limit_micros, account_budget.approved_spending_limit_type, account_budget.amount_served_micros, account_budget.total_adjustments_micros, account_budget.approved_start_date_time, account_budget.approved_end_date_time, account_budget.pending_proposal.proposal_type, account_budget.pending_proposal.spending_limit_micros FROM account_budget ORDER BY account_budget.approved_start_date_time DESC`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 50,\n },\n {\n name: \"recommendations\",\n description:\n \"Google's open recommendations (not dismissed): type, the campaign/ad group it targets, and its estimated impact\",\n gaqlTemplate: `SELECT recommendation.resource_name, recommendation.type, recommendation.campaign, recommendation.ad_group, recommendation.impact FROM recommendation WHERE recommendation.dismissed = FALSE`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 200,\n },\n {\n name: \"campaign-simulations\",\n description:\n \"Google's what-if curves per campaign — budget, target CPA / ROAS, CPC bid or target impression share against the clicks, cost and conversions Google predicts\",\n gaqlTemplate: `SELECT campaign_simulation.campaign_id, campaign_simulation.type, campaign_simulation.modification_method, campaign_simulation.start_date, campaign_simulation.end_date, campaign_simulation.budget_point_list.points, campaign_simulation.target_cpa_point_list.points, campaign_simulation.target_roas_point_list.points, campaign_simulation.cpc_bid_point_list.points, campaign_simulation.target_impression_share_point_list.points FROM campaign_simulation`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 200,\n },\n {\n name: \"keyword-bid-simulations\",\n description: \"Google's what-if curve per keyword: CPC bid against predicted clicks, cost and impressions\",\n gaqlTemplate: `SELECT ad_group_criterion_simulation.ad_group_id, ad_group_criterion_simulation.criterion_id, ad_group_criterion_simulation.type, ad_group_criterion_simulation.start_date, ad_group_criterion_simulation.end_date, ad_group_criterion_simulation.cpc_bid_point_list.points FROM ad_group_criterion_simulation`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 200,\n },\n];\n\n/**\n * What each `<thing> list` command reads: every entity of that kind that is not removed, with the\n * id or resource name its write commands take. Read through `query`, so they page like any read.\n * Run as `query --preset <name>` they are serving-only like every preset; `<thing> list` widens the\n * chain to everything not removed, because the thing you came to edit is often paused.\n */\nexport const INVENTORY_PRESETS: PresetDefinition[] = [\n {\n name: \"campaigns\",\n description: \"Every campaign: id, name, status, channel, bidding, budget and dates\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, campaign.primary_status, campaign.advertising_channel_type, campaign.advertising_channel_sub_type, campaign.bidding_strategy_type, campaign.bidding_strategy, campaign.campaign_budget, campaign_budget.amount_micros, campaign.start_date_time, campaign.end_date_time FROM campaign{statusWhere} ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\"],\n },\n {\n name: \"budgets\",\n description:\n \"Every campaign budget: id, name, daily amount, delivery, whether it is shared and how many campaigns use it\",\n gaqlTemplate: `SELECT campaign_budget.id, campaign_budget.name, campaign_budget.status, campaign_budget.amount_micros, campaign_budget.delivery_method, campaign_budget.explicitly_shared, campaign_budget.reference_count FROM campaign_budget WHERE campaign_budget.status != 'REMOVED' ORDER BY campaign_budget.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 200,\n },\n {\n name: \"ad-groups\",\n description: \"Every ad group: id, name, status, type and default CPC bid, under its campaign\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, ad_group.type, ad_group.cpc_bid_micros FROM ad_group{statusWhere} ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n statusFields: [\"campaign.status\", \"ad_group.status\"],\n },\n {\n name: \"keywords\",\n description:\n \"Every positive keyword: resource name, text, match type, status, bid and final URL — `keywords update|remove` take the resource name\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, ad_group_criterion.resource_name, ad_group_criterion.criterion_id, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.status, ad_group_criterion.negative, ad_group_criterion.cpc_bid_micros, ad_group_criterion.final_urls FROM ad_group_criterion WHERE ad_group_criterion.type = 'KEYWORD' AND ad_group_criterion.negative = FALSE{statusScope} ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n statusFields: [\"campaign.status\", \"ad_group.status\", \"ad_group_criterion.status\"],\n },\n {\n name: \"campaign-negative-keywords\",\n description: \"Campaign-level negative keywords with the resource name `negative-keywords remove` takes\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, campaign_criterion.resource_name, campaign_criterion.keyword.text, campaign_criterion.keyword.match_type FROM campaign_criterion WHERE campaign_criterion.type = 'KEYWORD' AND campaign_criterion.negative = TRUE AND campaign_criterion.status != 'REMOVED' AND campaign.status != 'REMOVED' ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n },\n {\n name: \"ad-group-negative-keywords\",\n description: \"Ad-group-level negative keywords with the resource name `negative-keywords remove` takes\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, ad_group.id, ad_group.name, ad_group_criterion.resource_name, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.negative FROM ad_group_criterion WHERE ad_group_criterion.type = 'KEYWORD' AND ad_group_criterion.negative = TRUE AND ad_group_criterion.status != 'REMOVED' AND ad_group.status != 'REMOVED' AND campaign.status != 'REMOVED' ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n },\n {\n name: \"shared-sets\",\n description:\n \"Every shared list (negative keyword / placement lists): id, name, type, member count and how many campaigns use it\",\n gaqlTemplate: `SELECT shared_set.id, shared_set.name, shared_set.type, shared_set.status, shared_set.member_count, shared_set.reference_count FROM shared_set WHERE shared_set.status != 'REMOVED' ORDER BY shared_set.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 200,\n },\n {\n name: \"ads\",\n description: \"Every ad: id, type, name, status, approval and final URLs, under its ad group\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, ad_group_ad.resource_name, ad_group_ad.ad.id, ad_group_ad.ad.type, ad_group_ad.ad.name, ad_group_ad.status, ad_group_ad.policy_summary.approval_status, ad_group_ad.ad.final_urls FROM ad_group_ad{statusWhere} ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n statusFields: [\"campaign.status\", \"ad_group.status\", \"ad_group_ad.status\"],\n },\n {\n name: \"assets\",\n description: \"Every asset in the account library: id, name, type, text and final URLs\",\n gaqlTemplate: `SELECT asset.id, asset.name, asset.type, asset.text_asset.text, asset.sitelink_asset.link_text, asset.callout_asset.callout_text, asset.image_asset.full_size.url, asset.youtube_video_asset.youtube_video_id, asset.final_urls FROM asset ORDER BY asset.type`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n },\n {\n name: \"asset-groups\",\n description: \"Every Performance Max asset group: id, name, status, final URLs and strength, under its campaign\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, asset_group.resource_name, asset_group.id, asset_group.name, asset_group.status, asset_group.final_urls, asset_group.ad_strength FROM asset_group{statusWhere} ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 200,\n statusFields: [\"campaign.status\", \"asset_group.status\"],\n },\n {\n name: \"audiences\",\n description:\n \"Every audience (user list): id, name, type, membership status, size on search and display, membership duration\",\n gaqlTemplate: `SELECT user_list.id, user_list.name, user_list.type, user_list.membership_status, user_list.size_for_search, user_list.size_for_display, user_list.membership_life_span, user_list.eligible_for_search, user_list.eligible_for_display FROM user_list ORDER BY user_list.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 200,\n },\n {\n name: \"conversion-actions\",\n description: \"Every conversion action: id, name, type, category, origin, status, primary or secondary, counting\",\n gaqlTemplate: `SELECT conversion_action.id, conversion_action.name, conversion_action.type, conversion_action.category, conversion_action.origin, conversion_action.status, conversion_action.primary_for_goal, conversion_action.counting_type FROM conversion_action WHERE conversion_action.status != 'REMOVED' ORDER BY conversion_action.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 200,\n },\n {\n name: \"bidding-strategies\",\n description: \"Every portfolio bidding strategy: id, name, type, status and how many campaigns use it\",\n gaqlTemplate: `SELECT bidding_strategy.id, bidding_strategy.name, bidding_strategy.type, bidding_strategy.status, bidding_strategy.campaign_count FROM bidding_strategy WHERE bidding_strategy.status != 'REMOVED' ORDER BY bidding_strategy.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 200,\n },\n {\n name: \"labels\",\n description: \"Every label: id, name, colour and description\",\n gaqlTemplate: `SELECT label.id, label.name, label.status, label.text_label.background_color, label.text_label.description FROM label WHERE label.status != 'REMOVED' ORDER BY label.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 200,\n },\n {\n name: \"merchant-center\",\n description:\n \"Merchant Center accounts linked to this Google Ads account — the merchantId a Shopping or retail Performance Max campaign names\",\n gaqlTemplate: `SELECT product_link.resource_name, product_link.product_link_id, product_link.type, product_link.merchant_center.merchant_center_id FROM product_link WHERE product_link.type = 'MERCHANT_CENTER'`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 200,\n },\n {\n name: \"campaign-criteria\",\n description:\n \"Every campaign targeting criterion and exclusion — locations, languages, devices, ad schedules, radius, carriers, operating systems, placements, topics, demographics, content types, IP addresses, web pages, brand lists, audiences — with the resource name `campaign-criteria update|remove` takes\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, campaign.advertising_channel_type, campaign_criterion.resource_name, campaign_criterion.type, campaign_criterion.negative, campaign_criterion.bid_modifier, campaign_criterion.location.geo_target_constant, campaign_criterion.language.language_constant, campaign_criterion.device.type, campaign_criterion.ad_schedule.day_of_week, campaign_criterion.ad_schedule.start_hour, campaign_criterion.ad_schedule.end_hour, campaign_criterion.proximity.radius, campaign_criterion.placement.url, campaign_criterion.mobile_application.app_id, campaign_criterion.youtube_channel.channel_id, campaign_criterion.youtube_video.video_id, campaign_criterion.topic.topic_constant, campaign_criterion.age_range.type, campaign_criterion.gender.type, campaign_criterion.income_range.type, campaign_criterion.parental_status.type, campaign_criterion.content_label.type, campaign_criterion.ip_block.ip_address, campaign_criterion.webpage.criterion_name, campaign_criterion.brand_list.shared_set, campaign_criterion.carrier.carrier_constant, campaign_criterion.operating_system_version.operating_system_version_constant, campaign_criterion.user_list.user_list, campaign_criterion.user_interest.user_interest_category FROM campaign_criterion WHERE campaign_criterion.type != 'KEYWORD' AND campaign_criterion.status != 'REMOVED' AND campaign.status != 'REMOVED' ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n },\n {\n name: \"ad-group-criteria\",\n description:\n \"Every ad group targeting criterion and exclusion other than keywords — placements, apps, YouTube, topics, demographics, web pages, Demand Gen locations, languages and audience, audiences — with its bid adjustment, max CPC, status and the resource name `ad-group-criteria update|remove` takes\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, campaign.advertising_channel_type, ad_group.id, ad_group.name, ad_group.status, ad_group_criterion.resource_name, ad_group_criterion.type, ad_group_criterion.negative, ad_group_criterion.status, ad_group_criterion.bid_modifier, ad_group_criterion.cpc_bid_micros, ad_group_criterion.placement.url, ad_group_criterion.mobile_application.app_id, ad_group_criterion.youtube_channel.channel_id, ad_group_criterion.youtube_video.video_id, ad_group_criterion.topic.topic_constant, ad_group_criterion.age_range.type, ad_group_criterion.gender.type, ad_group_criterion.parental_status.type, ad_group_criterion.income_range.type, ad_group_criterion.webpage.criterion_name, ad_group_criterion.location.geo_target_constant, ad_group_criterion.language.language_constant, ad_group_criterion.audience.audience, ad_group_criterion.brand_list.shared_set, ad_group_criterion.user_list.user_list, ad_group_criterion.user_interest.user_interest_category FROM ad_group_criterion WHERE ad_group_criterion.type NOT IN ('KEYWORD', 'LISTING_GROUP'){statusScope} ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n statusFields: [\"campaign.status\", \"ad_group.status\", \"ad_group_criterion.status\"],\n },\n {\n name: \"account-exclusions\",\n description:\n \"Every account-wide exclusion — sites, apps, app categories, YouTube, content types, IP addresses, account negative keyword lists — with the resource name `account-exclusions remove` takes\",\n gaqlTemplate: `SELECT customer_negative_criterion.resource_name, customer_negative_criterion.type, customer_negative_criterion.placement.url, customer_negative_criterion.mobile_application.app_id, customer_negative_criterion.mobile_app_category.mobile_app_category_constant, customer_negative_criterion.youtube_channel.channel_id, customer_negative_criterion.youtube_video.video_id, customer_negative_criterion.content_label.type, customer_negative_criterion.ip_block.ip_address, customer_negative_criterion.negative_keyword_list.shared_set FROM customer_negative_criterion`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n },\n {\n name: \"asset-group-signals\",\n description:\n \"Every Performance Max asset group's signals — search themes and the combined audience — under its campaign and group, with the resource name `asset-group-signals remove` takes\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, asset_group.id, asset_group.name, asset_group_signal.resource_name, asset_group_signal.search_theme.text, asset_group_signal.audience.audience, asset_group_signal.approval_status FROM asset_group_signal WHERE campaign.status != 'REMOVED' AND asset_group.status != 'REMOVED' ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n },\n {\n name: \"ad-group-bid-modifiers\",\n description:\n \"Every ad group's own device bid adjustment, with the resource name `ad-group-bid-modifiers update|remove` takes\",\n gaqlTemplate: `SELECT campaign.id, campaign.name, ad_group.id, ad_group.name, ad_group_bid_modifier.resource_name, ad_group_bid_modifier.device.type, ad_group_bid_modifier.bid_modifier FROM ad_group_bid_modifier WHERE campaign.status != 'REMOVED' AND ad_group.status != 'REMOVED' ORDER BY campaign.name`,\n defaultDateRange: \"ALL_TIME\",\n defaultLimit: 500,\n },\n];\n\nexport const PRESETS: PresetDefinition[] = [...CORE_PRESETS, ...REPORT_PRESETS, ...INVENTORY_PRESETS];\n\nexport function isInventoryPreset(name: string): boolean {\n return INVENTORY_PRESETS.some((preset) => preset.name === name);\n}\n\nexport function getPreset(name: string): PresetDefinition | undefined {\n return PRESETS.find((p) => p.name === name);\n}\n\n/**\n * Build the chained status predicate a preset's `{statusScope}` placeholder expands to.\n * Serving-only (default) requires every level `= 'ENABLED'`; includePaused widens to\n * `!= 'REMOVED'` (keeps paused, still drops removed). Returns a leading-AND fragment so it\n * appends cleanly onto an existing WHERE clause, or \"\" when the preset has no serving chain.\n */\nexport function buildStatusScope(statusFields: string[] | undefined, includePaused: boolean): string {\n if (!statusFields || statusFields.length === 0) return \"\";\n const predicate = includePaused ? \"!= 'REMOVED'\" : \"= 'ENABLED'\";\n return statusFields.map((field) => ` AND ${field} ${predicate}`).join(\"\");\n}\n\nexport function expandPreset(\n preset: PresetDefinition,\n params: { dateRange?: string; includePaused?: boolean; campaignIds?: string[] },\n now: Date = new Date(),\n): { query: string; dateRangeError?: string } {\n const dateRange = params.dateRange ?? preset.defaultDateRange;\n\n // A preset with no date filter (default ALL_TIME) never expands the range, so there is nothing to check.\n if (preset.gaqlTemplate.includes(\"{dateRange}\") && !isValidDateRange(dateRange)) {\n return { query: \"\", dateRangeError: dateRangeError(dateRange, now) };\n }\n\n const statusScope = buildStatusScope(preset.statusFields, params.includePaused ?? false);\n // A literal follows DURING; a range replaces it — \"DURING BETWEEN …\" is a statement Google refuses.\n const range = dateRange.trim();\n const query = preset.gaqlTemplate\n .replace(/DURING\\s+\\{dateRange\\}/g, BETWEEN_RE.test(range) ? range : `DURING ${range}`)\n .replace(/\\{dateRange\\}/g, range)\n .replace(/\\{statusScope\\}/g, statusScope)\n // A template with no WHERE of its own takes the chain as its whole WHERE clause.\n .replace(/\\{statusWhere\\}/g, statusScope ? ` WHERE${statusScope.replace(/^ AND/, \"\")}` : \"\");\n return { query: scopeToCampaigns(query, params.campaignIds) };\n}\n\n/** A preset's GAQL narrowed to `campaignIds` (digits, checked by the caller) in its WHERE. */\nfunction scopeToCampaigns(query: string, campaignIds: string[] | undefined): string {\n if (!campaignIds?.length) return query;\n const predicate = `campaign.id IN (${campaignIds.join(\", \")})`;\n if (query.includes(\" WHERE \")) return query.replace(\" WHERE \", ` WHERE ${predicate} AND `);\n const tail = query.search(/ (ORDER BY|LIMIT|PARAMETERS) /);\n return tail === -1 ? `${query} WHERE ${predicate}` : `${query.slice(0, tail)} WHERE ${predicate}${query.slice(tail)}`;\n}\n","// Every filterable list (repeated) field in Google Ads API v25 — 92 of them. Google filters a list\n// field only with CONTAINS ALL / ANY / NONE and refuses anything else (=, IN, LIKE, IS NULL …) with\n// OPERATOR_FIELD_MISMATCH; 88 were probed live on v23 and each answered exactly that, and v25 added\n// the four `lift_measurement_config.*` lists (regenerated 2026-10-08, none removed). Regenerate\n// on an API version bump (list-fields.test.ts fails until you do) from GoogleAdsFieldService:\n// POST /v<N>/googleAdsFields:search\n// {\"query\": \"SELECT name WHERE is_repeated = true AND filterable = true\"}\nexport const LIST_FIELDS_API_VERSION = \"v25\";\n\nexport const LIST_FIELDS: ReadonlySet<string> = new Set([\n \"ad.final_mobile_urls\",\n \"ad.final_urls\",\n \"ad_group.excluded_parent_asset_field_types\",\n \"ad_group.excluded_parent_asset_set_types\",\n \"ad_group.labels\",\n \"ad_group.primary_status_reasons\",\n \"ad_group_ad.ad.final_mobile_urls\",\n \"ad_group_ad.ad.final_urls\",\n \"ad_group_ad.labels\",\n \"ad_group_ad.primary_status_reasons\",\n \"ad_group_asset.primary_status_reasons\",\n \"ad_group_criterion.disapproval_reasons\",\n \"ad_group_criterion.final_mobile_urls\",\n \"ad_group_criterion.final_urls\",\n \"ad_group_criterion.labels\",\n \"ad_group_criterion.primary_status_reasons\",\n \"ad_group_criterion.topic.path\",\n \"ad_group_criterion.webpage.sample.sample_urls\",\n \"asset.dynamic_custom_asset.contextual_keywords\",\n \"asset.dynamic_custom_asset.similar_ids\",\n \"asset.dynamic_education_asset.contextual_keywords\",\n \"asset.dynamic_education_asset.similar_program_ids\",\n \"asset.dynamic_flights_asset.similar_destination_ids\",\n \"asset.dynamic_hotels_and_rentals_asset.contextual_keywords\",\n \"asset.dynamic_hotels_and_rentals_asset.similar_property_ids\",\n \"asset.dynamic_jobs_asset.contextual_keywords\",\n \"asset.dynamic_jobs_asset.similar_job_ids\",\n \"asset.dynamic_local_asset.contextual_keywords\",\n \"asset.dynamic_local_asset.similar_deal_ids\",\n \"asset.dynamic_real_estate_asset.contextual_keywords\",\n \"asset.dynamic_real_estate_asset.similar_listing_ids\",\n \"asset.dynamic_travel_asset.contextual_keywords\",\n \"asset.dynamic_travel_asset.similar_destination_ids\",\n \"asset.final_mobile_urls\",\n \"asset.final_urls\",\n \"asset.page_feed_asset.labels\",\n \"asset.structured_snippet_asset.values\",\n \"asset_group.final_mobile_urls\",\n \"asset_group.final_urls\",\n \"asset_group.primary_status_reasons\",\n \"asset_group_asset.primary_status_reasons\",\n \"asset_group_signal.disapproval_reasons\",\n \"asset_set.business_profile_location_group.dynamic_business_profile_location_group_filter.label_filters\",\n \"asset_set.business_profile_location_group.dynamic_business_profile_location_group_filter.listing_id_filters\",\n \"asset_set.location_set.business_profile_location_set.label_filters\",\n \"asset_set.location_set.business_profile_location_set.listing_id_filters\",\n \"bidding_data_exclusion.advertising_channel_types\",\n \"bidding_data_exclusion.campaigns\",\n \"bidding_data_exclusion.devices\",\n \"bidding_seasonality_adjustment.advertising_channel_types\",\n \"bidding_seasonality_adjustment.campaigns\",\n \"bidding_seasonality_adjustment.devices\",\n \"campaign.excluded_parent_asset_field_types\",\n \"campaign.excluded_parent_asset_set_types\",\n \"campaign.feed_types\",\n \"campaign.labels\",\n \"campaign.optimization_goal_setting.optimization_goal_types\",\n \"campaign.primary_status_reasons\",\n \"campaign.selective_optimization.conversion_actions\",\n \"campaign.shopping_setting.advertising_partner_ids\",\n \"campaign.text_guidelines.term_exclusions\",\n \"campaign_asset.primary_status_reasons\",\n \"campaign_criterion.location_group.geo_target_constants\",\n \"campaign_criterion.topic.path\",\n \"campaign_criterion.webpage.sample.sample_urls\",\n \"conversion_value_rule.audience_condition.user_interests\",\n \"conversion_value_rule.audience_condition.user_lists\",\n \"conversion_value_rule.device_condition.device_types\",\n \"conversion_value_rule.geo_location_condition.excluded_geo_target_constants\",\n \"conversion_value_rule.geo_location_condition.geo_target_constants\",\n \"conversion_value_rule_set.conversion_value_rules\",\n \"conversion_value_rule_set.dimensions\",\n \"custom_conversion_goal.conversion_actions\",\n \"customer.pay_per_conversion_eligibility_failure_reasons\",\n \"customer_asset.primary_status_reasons\",\n \"customer_client.applied_labels\",\n \"experiment_arm.campaigns\",\n \"experiment_arm.in_design_campaigns\",\n \"keyword_plan_campaign.language_constants\",\n \"lift_measurement_config.campaigns\",\n \"lift_measurement_config.conversion_actions\",\n \"lift_measurement_config.single_measurement_question_set.competitor_choices\",\n \"lift_measurement_config.single_measurement_question_set.question_measurements\",\n \"local_services_employee.category_ids\",\n \"local_services_employee.languages_spoken\",\n \"metrics.interaction_event_types\",\n \"recommendation.campaigns\",\n \"shared_criterion.webpage.sample.sample_urls\",\n \"shopping_product.target_countries\",\n \"topic_constant.path\",\n \"user_list.lookalike_user_list.country_codes\",\n \"user_list.lookalike_user_list.seed_user_list_ids\",\n]);\n\nexport const LIST_FIELD_OPERATORS = \"CONTAINS ALL, CONTAINS ANY, CONTAINS NONE\";\n\n/** Why a list field refused an operator, and the read that works instead. */\nexport function listFieldGuidance(field: string): string {\n return `${field} is a list field: it takes only ${LIST_FIELD_OPERATORS} — no comparison (=, !=, IN), pattern match or null test. 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')`;\n}\n","import type { CorrectionContext, CorrectionRule, QueryFix } from \"../types.ts\";\nimport { monthlySpendTrendQuery } from \"./changes-window.ts\";\nimport { LIST_FIELDS, listFieldGuidance } from \"./list-fields.ts\";\nimport { PRESETS } from \"./presets.ts\";\n\nfunction buildCommand(query: string, ctx: CorrectionContext): string {\n return `baker ads google query \"${query}\" --customer-id ${ctx.customerId}`;\n}\n\n/** GAQL joins WHERE conditions with AND only — what to write instead of an OR. */\nexport const NO_OR_EXPLANATION =\n \"GAQL has no OR: WHERE conditions combine only with AND, and cannot be grouped in parentheses. For several values of one field use IN: field IN ('a', 'b'). For several patterns on one text field use REGEXP_MATCH: field REGEXP_MATCH '(?i).*(a|b).*'. For alternatives on different fields, run one query per condition and merge the rows.\";\n\n/** Every field a shipped preset or the list-field catalogue names — each one read live against this API version. */\nconst KNOWN_FIELDS: ReadonlySet<string> = new Set([\n ...PRESETS.flatMap((preset) => preset.gaqlTemplate.match(/\\b[a-z_]+(?:\\.[a-z0-9_]+)+/g) ?? []),\n ...LIST_FIELDS,\n]);\n\nfunction sharedPrefixLength(a: string, b: string): number {\n let i = 0;\n while (i < a.length && i < b.length && a[i] === b[i]) i++;\n return i;\n}\n\n/**\n * Known fields of the same resource whose name starts with the same word as `field`, closest first:\n * `campaign.start_date` → `campaign.start_date_time`. Google answers an unknown field with its name\n * only, so this is the one place a renamed field's current name can come from.\n */\nexport function similarKnownFields(field: string): string[] {\n const [resource = \"\", attribute = \"\"] = field.split(/\\.(.*)/s);\n const firstWord = attribute.split(/[_.]/)[0];\n if (!firstWord) return [];\n const stem = `${resource}.${firstWord}`;\n return [...KNOWN_FIELDS]\n .filter((known) => known !== field && known.startsWith(stem))\n .sort((a, b) => sharedPrefixLength(b, field) - sharedPrefixLength(a, field) || a.localeCompare(b))\n .slice(0, 3);\n}\n\n/** Fields Google moved onto another resource: no same-resource search can find where they went. */\nconst MOVED_FIELDS: Readonly<Record<string, string>> = {\n \"campaign.conversion_goal_config.goal_config_level\": \"conversion_goal_campaign_config.goal_config_level\",\n};\n\nfunction unknownFieldFix(field: string, ctx: CorrectionContext): QueryFix {\n const similar = similarKnownFields(field);\n const gone = `${field} does not exist in this Google Ads API version (removed, renamed or misspelled).`;\n const moved = MOVED_FIELDS[field];\n if (moved) {\n const resource = moved.split(\".\")[0];\n return {\n action: \"retry_with_modified_query\",\n explanation: `${gone} It moved to ${moved}: select it FROM ${resource} (campaign fields such as campaign.name can be selected alongside).`,\n };\n }\n if (similar.length === 0) {\n return {\n action: \"retry_with_modified_query\",\n explanation: `${gone} Drop it, or find its replacement in Google's field reference for that resource.`,\n };\n }\n // A known field that only extends the name (`start_date` → `start_date_time`) is the rename itself.\n const renamed = similar.filter((known) => known.startsWith(`${field}_`));\n const [replacement] = renamed;\n if (renamed.length === 1 && replacement) {\n const corrected = ctx.originalQuery.replace(\n new RegExp(`(?<![\\\\w.])${field.replace(/\\./g, \"\\\\.\")}(?![\\\\w.])`, \"g\"),\n replacement,\n );\n return {\n action: \"retry_with_modified_query\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: `${gone} Its current name is ${replacement} — swapped in.`,\n };\n }\n return {\n action: \"retry_with_modified_query\",\n explanation: `${gone} Fields with a similar name on this resource: ${similar.join(\", \")}. Use the one you meant, or drop it.`,\n };\n}\n\nexport const CORRECTION_RULES: CorrectionRule[] = [\n // 0. EXPECTED_REFERENCED_FIELD_IN_SELECT_CLAUSE — some resources (e.g. campaign_budget)\n // require fields filtered in WHERE to also be selected. The error names the exact field,\n // so add it to SELECT and retry. Kept first: field-specific rules below must not shadow\n // this with an unrelated rewrite when the named field happens to match their pattern.\n {\n matchApiError: /must be present in SELECT clause:\\s*'([\\w.]+)'/i,\n fix: (ctx) => {\n const field = ctx.apiErrorMessage?.match(/must be present in SELECT clause:\\s*'([\\w.]+)'/i)?.[1];\n if (!field) {\n return {\n action: \"add_required_field\",\n explanation: \"Add the field named in the error to the SELECT clause and retry\",\n };\n }\n const corrected = ctx.originalQuery.replace(/SELECT\\s+/i, `SELECT ${field}, `);\n return {\n action: \"add_required_field\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: `${field} is used in WHERE but this resource requires it in SELECT too — added it`,\n };\n },\n },\n\n // 0b. OPERATOR_FIELD_MISMATCH — the field refuses this operator, and Google names the\n // ones it takes. Kept ahead of the field-specific rules for the same reason as rule 0.\n // A repeated field (final_urls, labels, …) takes only CONTAINS ALL/ANY/NONE, so it has\n // no null test at all: read it unfiltered and filter the rows instead.\n {\n matchApiError: /OPERATOR_FIELD_MISMATCH|is not a valid operator to use with/i,\n fix: (ctx) => {\n const message = ctx.apiErrorMessage ?? \"\";\n const field = message.match(/valid operator to use with '([\\w.]+)'/i)?.[1] ?? \"this field\";\n // Case-sensitive on purpose: Google writes operators uppercase, and with /i the capture would\n // also swallow any lowercase words just before the operator (\"the operator IS NULL\").\n const operator = message.match(/([A-Z=!<>][A-Z_ =!<>]*?) is not a valid operator/)?.[1]?.trim();\n const valid = message.match(/Valid operators: (.+?)\\.?(?:\"|$)/i)?.[1]?.trim();\n const refused = operator ? `${operator} cannot be used on ${field}` : `${field} does not take that operator`;\n const allowed = valid ? `; its valid operators are ${valid}` : \"\";\n const repeated = valid?.split(\",\").every((op) => /^CONTAINS (ALL|ANY|NONE)$/i.test(op.trim())) ?? false;\n const guidance = repeated\n ? `. ${listFieldGuidance(field)}`\n : \". Rewrite that condition with one of them, or drop it and filter the rows\";\n return {\n action: \"change_operator\",\n explanation: `${refused}${allowed}${guidance}`,\n };\n },\n },\n\n // 0c. An OR, or a parenthesised group, in WHERE. Google names the token it choked on\n // (\"unexpected input OR\", \"invalid field name '('\"), never the reason, so without this the\n // \"invalid … field\" wording fell through to the bare-resource rule below.\n {\n matchApiError: /unexpected input (?:OR|\\()|invalid field name \\\\?'\\(/i,\n fix: () => ({ action: \"retry_with_modified_query\", explanation: NO_OR_EXPLANATION }),\n },\n\n // 0d. An enum value this field does not have in this API version.\n {\n matchApiError: /BAD_ENUM_CONSTANT|Invalid enum value/i,\n fix: (ctx) => {\n const value = ctx.apiErrorMessage?.match(/Invalid enum value[^']*\\\\?'([\\w]+)/i)?.[1];\n return {\n action: \"retry_with_modified_query\",\n explanation: `${value ? `'${value}' is` : \"A value in this query is\"} not one of the values Google accepts for the field it filters, in this API version. Use one the field's reference lists, or drop that condition and filter the rows.`,\n };\n },\n },\n\n // 1. bare keyword.text → ad_group_criterion.keyword.text (leaves <resource>.keyword.text untouched)\n {\n matchApiError: /keyword\\.text/i,\n fix: (ctx) => {\n const corrected = ctx.originalQuery.replace(/(?<![\\w.])keyword\\.text\\b/g, \"ad_group_criterion.keyword.text\");\n return {\n action: \"retry_with_modified_query\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: \"Use ad_group_criterion.keyword.text — keywords are accessed through the criterion resource\",\n };\n },\n },\n\n // 2. bare keyword.match_type → ad_group_criterion.keyword.match_type (leaves <resource>.keyword.match_type untouched)\n {\n matchApiError: /keyword\\.match_type/i,\n fix: (ctx) => {\n const corrected = ctx.originalQuery.replace(\n /(?<![\\w.])keyword\\.match_type\\b/g,\n \"ad_group_criterion.keyword.match_type\",\n );\n return {\n action: \"retry_with_modified_query\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: \"Use ad_group_criterion.keyword.match_type for keyword match type\",\n };\n },\n },\n\n // 3. campaign_budget.* queried FROM campaign\n {\n matchApiError: /campaign_budget.*not.*valid.*campaign|cannot.*select.*campaign_budget/i,\n fix: (ctx) => {\n const corrected = ctx.originalQuery.replace(/FROM\\s+campaign\\b/i, \"FROM campaign_budget\");\n return {\n action: \"use_different_resource\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: \"campaign_budget fields must be queried FROM campaign_budget, not FROM campaign\",\n };\n },\n },\n\n // 6. Missing campaign.id in ad_group queries\n {\n matchApiError: /campaign\\.id.*required|must.*include.*campaign\\.id/i,\n fix: (ctx) => {\n const corrected = ctx.originalQuery.replace(/SELECT\\s+/i, \"SELECT campaign.id, \");\n return {\n action: \"add_required_field\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: \"Ad group queries require campaign.id in SELECT for parent context\",\n };\n },\n },\n\n // 6. Missing campaign.id in keyword_view queries\n {\n matchApiError: /campaign\\.id.*required.*keyword/i,\n fix: (ctx) => {\n const corrected = ctx.originalQuery.replace(/SELECT\\s+/i, \"SELECT campaign.id, \");\n return {\n action: \"add_required_field\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: \"Keyword view queries require campaign.id in SELECT\",\n };\n },\n },\n\n // 7. shopping_performance_view.product_* → segments.product_*\n {\n matchApiError: /shopping_performance_view\\.product/i,\n fix: (ctx) => {\n const corrected = ctx.originalQuery.replace(/shopping_performance_view\\.product_(\\w+)/g, \"segments.product_$1\");\n return {\n action: \"retry_with_modified_query\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: \"Product fields are segments (segments.product_*), not fields on shopping_performance_view\",\n };\n },\n },\n\n // 8. Open-ended date range\n {\n matchApiError: /date.*range.*must.*finite|open.*ended/i,\n fix: (ctx) => {\n const match = ctx.originalQuery.match(/segments\\.date\\s*>=\\s*'(\\d{4}-\\d{2}-\\d{2})'/i);\n const startDate = match?.[1] ?? \"2024-01-01\";\n const today = new Date().toISOString().slice(0, 10);\n const corrected = ctx.originalQuery.replace(\n /segments\\.date\\s*>=\\s*'(\\d{4}-\\d{2}-\\d{2})'/i,\n `segments.date BETWEEN '${startDate}' AND '${today}'`,\n );\n return {\n action: \"narrow_date_range\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: \"Use BETWEEN with explicit end date — open-ended ranges are not supported\",\n };\n },\n },\n\n // 10a. Customer not found (wrong customer ID)\n {\n matchApiError: /CUSTOMER_NOT_FOUND|not.*found.*customer/i,\n fix: () => ({\n action: \"reject\",\n explanation:\n \"Customer ID not found. Run 'baker ads google accounts' to list valid customer IDs, then retry with a valid --customer-id.\",\n }),\n },\n\n // 10b. Not accessible / login-customer-id required\n {\n matchApiError: /not.*accessible|login.customer.id/i,\n fix: (ctx) => ({\n action: \"reject\",\n correctedCommand: buildCommand(ctx.originalQuery, ctx),\n explanation:\n \"Account not accessible — may need a manager (MCC) login-customer-id. Run 'baker ads google accounts' to refresh the accounts cache, then retry.\",\n }),\n },\n\n // 12. Incompatible fields\n {\n matchApiError: /incompatible|mutually.*exclusive|cannot.*select.*together/i,\n fix: () => ({\n action: \"split_query\",\n explanation: \"These fields cannot be in the same query — split into separate queries and join client-side\",\n }),\n },\n\n // 15. ad.final_urls → ad_group_ad.ad.final_urls\n {\n matchApiError: /ad\\.final_urls/i,\n fix: (ctx) => {\n const corrected = ctx.originalQuery.replace(/\\bad\\.final_urls\\b/g, \"ad_group_ad.ad.final_urls\");\n return {\n action: \"retry_with_modified_query\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: \"Use the full path: ad_group_ad.ad.final_urls\",\n };\n },\n },\n\n // 15b. asset.<type>_asset.final_urls → asset.final_urls (final URLs live on the asset\n // itself; the typed sub-message only carries type-specific fields like link_text)\n {\n matchApiError: /asset\\.\\w+_asset\\.final_(mobile_)?urls/i,\n fix: (ctx) => {\n const corrected = ctx.originalQuery.replace(/asset\\.\\w+_asset\\.final_(mobile_)?urls\\b/g, \"asset.final_$1urls\");\n return {\n action: \"retry_with_modified_query\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: \"Final URLs are on the asset itself — use asset.final_urls, not asset.<type>_asset.final_urls\",\n };\n },\n },\n\n // 16. Rate limit / quota\n {\n matchApiError: /RESOURCE_EXHAUSTED|quota.*exceeded|rate.*limit/i,\n fix: () => ({\n action: \"wait_and_retry\",\n explanation: \"API quota exceeded — wait 30 seconds before retrying\",\n }),\n },\n\n // 17. WHERE on metrics\n {\n matchApiError: /cannot.*filter.*metric|WHERE.*metrics|prohibited.*where/i,\n fix: () => ({\n action: \"reject\",\n explanation:\n \"Cannot filter on metrics in WHERE clause — remove the metrics filter and filter results client-side\",\n }),\n },\n\n // 18. ORDER BY field not in SELECT\n {\n matchApiError: /order.*by.*field.*not.*selected|must.*select.*field.*order/i,\n fix: (ctx) => {\n const orderMatch = ctx.originalQuery.match(/ORDER\\s+BY\\s+([\\w.]+)/i);\n const field = orderMatch?.[1] ?? \"field\";\n const corrected = ctx.originalQuery.replace(/SELECT\\s+/i, `SELECT ${field}, `);\n return {\n action: \"add_required_field\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: `Add ${field} to SELECT — ORDER BY fields must be selected`,\n };\n },\n },\n\n // The change-history rules must stay ahead of rule 19: its `status.*filter`\n // pattern also matches Google's change_status errors (\"the change_status request\n // is missing filters on ...\"), and the first matching rule wins.\n // 18a. change_event past its 30-day reach → change_status, which reaches 90 days.\n // These three rules match on the error code only, never on the resource in the query:\n // keyed on the query, they would answer every unrelated failure on a history query with\n // \"switch resources\", which is never the real fix. The backend forwards the\n // code as JSON (`\"changeEventError\":\"START_DATE_TOO_OLD\"`), so match that shape as well\n // as the dotted enum spelling.\n {\n matchApiError: /changeEventError\\W{0,4}START_DATE_TOO_OLD/i,\n fix: (ctx) => {\n const limit = ctx.originalQuery.match(/LIMIT\\s+(\\d+)/i)?.[1] ?? \"50\";\n const requested = ctx.originalQuery.match(/change_date_time\\s*>=\\s*'([^']+)'/i)?.[1]?.slice(0, 10);\n // 89, not 90: the window includes today, so counting back a full 90 days would put\n // the start one day outside what change_status accepts.\n const oldestStart = new Date(Date.now() - 89 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);\n const start = requested && requested > oldestStart ? requested : oldestStart;\n const corrected = `SELECT change_status.last_change_date_time, change_status.resource_type, change_status.resource_status, change_status.resource_name, change_status.campaign, change_status.ad_group FROM change_status WHERE change_status.last_change_date_time >= '${start}' ORDER BY change_status.last_change_date_time DESC LIMIT ${limit}`;\n return {\n action: \"use_different_resource\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: `change_event only reaches back 30 days. change_status reaches 90 (from ${start}) but reports only which resources changed and whether they were added, changed or removed — no old/new values and no user email. Read a changed resource by its resource_name to see its current values.`,\n };\n },\n },\n\n // 18b. Past 90 days no history resource reaches — infer the change from spend instead.\n {\n matchApiError: /changeStatusError\\W{0,4}START_DATE_TOO_OLD/i,\n fix: () => ({\n action: \"use_different_resource\",\n explanation: `Google's account history reaches back 90 days at most, and this query asks for more. Do not abort — infer the change from performance: ${monthlySpendTrendQuery()} shows which campaigns started or stopped spending and when, though not who changed them. Anything older with attribution exists only in the Google Ads web UI, which has no API.`,\n }),\n },\n\n // 18c. change_status rejects a date range it cannot bound. Google raises this both for\n // a half-open range and for no date filter at all, so supply whichever end is missing.\n {\n matchApiError: /CHANGE_DATE_RANGE_INFINITE/i,\n fix: (ctx) => {\n const today = new Date().toISOString().slice(0, 10);\n const oldestStart = new Date(Date.now() - 89 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);\n const hasLowerBound = /last_change_date_time\\s*>=?/i.test(ctx.originalQuery);\n const hasUpperBound = /last_change_date_time\\s*<=?/i.test(ctx.originalQuery);\n const bounds = [\n ...(hasLowerBound ? [] : [`change_status.last_change_date_time >= '${oldestStart}'`]),\n ...(hasUpperBound ? [] : [`change_status.last_change_date_time <= '${today}'`]),\n ];\n const hasWhere = /\\bWHERE\\b/i.test(ctx.originalQuery);\n const clause = hasWhere ? ` AND ${bounds.join(\" AND \")}` : ` WHERE ${bounds.join(\" AND \")}`;\n const corrected = /\\s+(ORDER\\s+BY|LIMIT)\\b/i.test(ctx.originalQuery)\n ? ctx.originalQuery.replace(/(\\s+)(ORDER\\s+BY|LIMIT)\\b/i, `${clause}$1$2`)\n : ctx.originalQuery.trimEnd() + clause;\n return {\n action: \"add_required_field\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation:\n \"change_status needs a date range bounded at both ends — added the missing bound(s) on last_change_date_time.\",\n };\n },\n },\n\n // 19. Results include REMOVED entities\n {\n matchApiError: /REMOVED.*entities|status.*filter/i,\n fix: (ctx) => {\n const resourceMatch = ctx.originalQuery.match(/FROM\\s+(\\w+)/i);\n const resource = resourceMatch?.[1] ?? \"campaign\";\n const hasWhere = /WHERE/i.test(ctx.originalQuery);\n const suffix = hasWhere ? ` AND ${resource}.status != 'REMOVED'` : ` WHERE ${resource}.status != 'REMOVED'`;\n const limitMatch = ctx.originalQuery.match(/(\\s+LIMIT\\s+\\d+)/i);\n let corrected: string;\n if (limitMatch) {\n corrected = ctx.originalQuery.replace(/(\\s+LIMIT\\s+\\d+)/i, `${suffix}$1`);\n } else {\n corrected = ctx.originalQuery.trimEnd() + suffix;\n }\n return {\n action: \"retry_with_modified_query\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: `Add status filter to exclude REMOVED ${resource}s`,\n };\n },\n },\n\n // 20. change_event without date constraint\n {\n matchApiError: /change_event.*date|date.*required.*change/i,\n fix: (ctx) => {\n const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);\n const hasWhere = /WHERE/i.test(ctx.originalQuery);\n const suffix = hasWhere\n ? ` AND change_event.change_date_time >= '${sevenDaysAgo}'`\n : ` WHERE change_event.change_date_time >= '${sevenDaysAgo}'`;\n const corrected = ctx.originalQuery.trimEnd() + suffix;\n return {\n action: \"add_required_field\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: \"change_event queries require a date constraint on change_date_time\",\n };\n },\n },\n\n // 22. segments.click_type incompatibility\n {\n matchApiError: /click_type.*incompatible|cannot.*click_type/i,\n fix: (ctx) => {\n const corrected = ctx.originalQuery.replace(/,?\\s*segments\\.click_type/g, \"\");\n return {\n action: \"split_query\",\n correctedCommand: buildCommand(corrected, ctx),\n explanation: \"segments.click_type is incompatible with other segments — remove it or query separately\",\n };\n },\n },\n\n // 22b. A field this API version does not have (removed, renamed, or misspelled). The rules above\n // rewrite the known renames; anything left is named back so the agent drops or replaces it —\n // without this, \"invalid argument … field\" fell through to the bare-resource rule below.\n {\n matchApiError: /UNRECOGNIZED_FIELD|Unrecognized field in the query/i,\n fix: (ctx) => {\n const field = ctx.apiErrorMessage?.match(/Unrecognized field in the query:\\s*\\\\?'([\\w.]+)/i)?.[1];\n return field\n ? unknownFieldFix(field, ctx)\n : {\n action: \"retry_with_modified_query\",\n explanation:\n \"A field in this query does not exist in this Google Ads API version. Drop it, or find its replacement in Google's field reference.\",\n };\n },\n },\n\n // 22c. A field that exists but cannot be SELECTed (only filtered on, or read through another resource).\n {\n matchApiError: /PROHIBITED_FIELD_IN_SELECT_CLAUSE|may not be used in SELECT clause/i,\n fix: (ctx) => {\n const field = ctx.apiErrorMessage?.match(/may not be used in SELECT clause:\\s*\\\\?'([\\w.]+)/i)?.[1];\n return {\n action: \"retry_with_modified_query\",\n explanation: `${field ?? \"A field in this query\"} cannot be selected — Google allows it only in WHERE, or not at all on this resource. Drop it from SELECT.`,\n };\n },\n },\n\n // 23. Bare resource in SELECT\n {\n matchApiError: /cannot.*select.*bare.*resource|invalid.*field/i,\n fix: () => ({\n action: \"retry_with_modified_query\",\n explanation: \"Cannot SELECT a bare resource name — use resource.id, resource.name, or resource.resource_name\",\n }),\n },\n\n // 24. Authentication error\n {\n matchApiError: /unauthenticated|authentication.*required|invalid.*credentials/i,\n fix: () => ({\n action: \"authenticate\",\n explanation: \"Google Ads authentication failed — reconnect Google Ads in dashboard settings\",\n }),\n },\n\n // 25. Timeout / deadline exceeded\n {\n matchApiError: /timeout|deadline.*exceeded|DEADLINE_EXCEEDED/i,\n fix: (ctx) => ({\n action: \"retry_with_modified_query\",\n correctedCommand: buildCommand(ctx.originalQuery, ctx),\n explanation: \"Query timed out — narrow the date range, add more WHERE filters, or reduce LIMIT\",\n }),\n },\n];\n","import { connectionFixExplanation, isNotConnectedError } from \"../../../error-handler.ts\";\nimport type { AdsErrorEnvelope, CorrectionContext } from \"../types.ts\";\nimport { CORRECTION_RULES } from \"./correction-table.ts\";\n\nfunction mapErrorCode(message: string): string {\n if (/must be present in SELECT clause/i.test(message)) return \"MISSING_SELECT_FIELD\";\n if (/unexpected input (?:OR|\\()|invalid field name \\\\?'\\(/i.test(message)) return \"INVALID_SYNTAX\";\n if (/BAD_ENUM_CONSTANT|Invalid enum value/i.test(message)) return \"INVALID_ENUM_VALUE\";\n if (/field.*not.*found|unrecognized.*field|not.*valid.*field/i.test(message)) return \"FIELD_NOT_FOUND\";\n if (/not.*valid.*resource|cannot.*select.*from/i.test(message)) return \"WRONG_RESOURCE\";\n if (/operator|CONTAINS|LIKE/i.test(message)) return \"INVALID_OPERATOR\";\n if (/CUSTOMER_NOT_FOUND/i.test(message)) return \"CUSTOMER_NOT_FOUND\";\n if (/login.customer.id|not.*accessible/i.test(message)) return \"MISSING_MANAGER_ID\";\n if (/incompatible|mutually.*exclusive|PROHIBITED_SEGMENT_WITH_METRIC/i.test(message)) return \"INCOMPATIBLE_FIELDS\";\n if (/unauthenticated|authentication/i.test(message)) return \"AUTH_ERROR\";\n if (/permission/i.test(message)) return \"PERMISSION_DENIED\";\n if (/RESOURCE_EXHAUSTED|quota|rate.*limit/i.test(message)) return \"QUOTA_EXCEEDED\";\n if (/timeout|DEADLINE_EXCEEDED/i.test(message)) return \"TIMEOUT\";\n return \"API_ERROR\";\n}\n\nfunction isRetryable(code: string): boolean {\n return code === \"QUOTA_EXCEEDED\" || code === \"TIMEOUT\";\n}\n\nfunction getRetryDelay(code: string): number | undefined {\n if (code === \"QUOTA_EXCEEDED\") return 30000;\n if (code === \"TIMEOUT\") return 5000;\n return undefined;\n}\n\n/** What a `query` call can drop when the same read fails twice — the other commands have no such flags. */\nconst QUERY_NARROWING =\n \" If it fails again, ask for less in one call — a shorter date range, or a lower --limit instead of --all.\";\n\n/**\n * A failure on Google's or Baker's side (a 5xx), where nothing was refused: the same request can\n * succeed when asked again. `narrowing` is what this command can ask for less with, if anything.\n * Null for anything else.\n */\nexport function serverFailure(apiCode: string | undefined, message: string, narrowing = \"\"): AdsErrorEnvelope | null {\n if (apiCode !== \"INTERNAL_ERROR\" && apiCode !== \"UNAVAILABLE\") return null;\n return {\n ok: false,\n error: {\n code: apiCode,\n message,\n fix: {\n action: \"wait_and_retry\",\n explanation: `Google Ads or Baker failed on its own side; nothing in the request was refused. Retry it once as it is.${narrowing}`,\n },\n retryable: true,\n retryAfterMs: 5000,\n },\n };\n}\n\n/** Google throttled the account or spent the day's allowance: waiting is the fix, the request was fine. */\nfunction rateLimited(message: string): AdsErrorEnvelope {\n return {\n ok: false,\n error: {\n code: \"RATE_LIMITED\",\n message,\n fix: {\n action: \"wait_and_retry\",\n explanation:\n \"Google Ads is limiting how often Baker can ask for this account; nothing in the request was refused. Wait as the message says, then retry it as it is.\",\n },\n retryable: true,\n retryAfterMs: 60000,\n },\n };\n}\n\n/**\n * `apiCode` is the client's HTTP mapping (`ApiError.code`). Without it a missing\n * connection is indistinguishable from a GAQL error, and the agent gets told to\n * fix its query when the real answer is \"connect the account\".\n */\nexport function parseApiError(\n errorMessage: string,\n originalQuery: string,\n customerId: string,\n apiCode?: string,\n): AdsErrorEnvelope {\n const ctx: CorrectionContext = {\n originalQuery,\n customerId,\n apiErrorMessage: errorMessage,\n };\n\n // Checked ahead of the correction rules: no query rewrite can fix a missing connection.\n if (apiCode && isNotConnectedError(apiCode, errorMessage)) {\n return {\n ok: false,\n error: {\n code: \"NO_GOOGLE_ADS_CONNECTION\",\n message: errorMessage,\n fix: { action: \"request_connection\", explanation: connectionFixExplanation(\"google_ads\") },\n retryable: false,\n },\n };\n }\n\n // Ahead of the rules too: a server failure, a throttle or a page conflict says nothing about the query.\n const failure = serverFailure(apiCode, errorMessage, originalQuery ? QUERY_NARROWING : \"\");\n if (failure) return failure;\n if (apiCode === \"RATE_LIMITED\") return rateLimited(errorMessage);\n if (apiCode === \"CONFLICT\") {\n return {\n ok: false,\n error: {\n code: \"CONFLICT\",\n message: errorMessage,\n fix: {\n action: \"retry_with_modified_query\",\n explanation:\n \"The rows moved between two pages. Read again from the first page (no --cursor), with a unique field last in the ORDER BY (e.g. ORDER BY metrics.cost_micros DESC, campaign.id) so pages stay stable.\",\n },\n retryable: true,\n },\n };\n }\n\n for (const rule of CORRECTION_RULES) {\n if (rule.matchApiError.test(errorMessage)) {\n const fix = rule.fix(ctx);\n const code = mapErrorCode(errorMessage);\n return {\n ok: false,\n error: {\n code,\n message: errorMessage,\n fix,\n retryable: isRetryable(code),\n retryAfterMs: getRetryDelay(code),\n },\n };\n }\n }\n\n // No rule recognised it, so the fix claims no cause: the message is the only thing that knows.\n const mapped = mapErrorCode(errorMessage);\n const code = mapped === \"API_ERROR\" && apiCode ? apiCode : mapped;\n return {\n ok: false,\n error: {\n code,\n message: errorMessage,\n fix: {\n action: \"reject\",\n explanation:\n \"Baker has no specific fix for this error. The message says what was refused: change that, and do not retry the same request unchanged.\",\n },\n retryable: isRetryable(code),\n retryAfterMs: getRetryDelay(code),\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAKO,IAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,gBAAgB,OAAwB;AACtD,SAAQ,qBAA2C,SAAS,MAAM,YAAY,CAAC;AACjF;AAEA,SAAS,OAAO,MAAoB;AAClC,SAAO,KAAK,YAAY,EAAE,MAAM,GAAG,EAAE;AACvC;AAEA,SAAS,QAAQ,MAAc,OAAe,KAAmB;AAC/D,SAAO,IAAI,KAAK,KAAK,IAAI,MAAM,OAAO,GAAG,CAAC;AAC5C;AAGA,SAAS,aAAa,MAAY,QAAsB;AACtD,QAAM,kBAAkB,QAAQ,KAAK,eAAe,GAAG,KAAK,YAAY,IAAI,SAAS,GAAG,CAAC,EAAE,WAAW;AACtG,SAAO,QAAQ,KAAK,eAAe,GAAG,KAAK,YAAY,IAAI,QAAQ,KAAK,IAAI,KAAK,WAAW,GAAG,eAAe,CAAC;AACjH;AAOO,SAAS,kBAAkB,SAAiB,KAA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AAc,cAAcA,KAAI;AAAA,QAClC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAGA,QAAM,SAAS,aAAa,YAAY;AACxC,QAAM,OAAO,WAAW,eAAe,UAAU,UAAU;AAC3D,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA,SAAS;AAAA,MACT,KAAK;AAAA,QACH,QAAQ;AAAA,QACR,aACE;AAAA,MACJ;AAAA,MACA,WAAW,YAAY,IAAI;AAAA,MAC3B,cAAc,cAAc,IAAI;AAAA,IAClC;AAAA,EACF;AACF;","names":["code"]}
|
package/dist/cli.js
CHANGED
|
@@ -463,7 +463,7 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
|
463
463
|
capabilities: () => import("./capabilities-EDXVGZXC.js").then((m) => m.capabilitiesCommand),
|
|
464
464
|
actions: () => import("./actions-LI43PTFN.js").then((m) => m.actionsCommand),
|
|
465
465
|
"scheduled-agents": () => import("./scheduled-agents-YAHYCFDA.js").then((m) => m.scheduledAgentsCommand),
|
|
466
|
-
ads: () => import("./ads-
|
|
466
|
+
ads: () => import("./ads-OC3ENYUC.js").then((m) => m.adsCommand),
|
|
467
467
|
brand: () => import("./brand-OISTKMY4.js").then((m) => m.brandCommand),
|
|
468
468
|
analytics: () => import("./analytics-XT4ANMLP.js").then((m) => m.analyticsCommand),
|
|
469
469
|
experiment: () => import("./experiment-O6726OBP.js").then((m) => m.experimentCommand),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseApiError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VR6XCLY6.js";
|
|
4
4
|
import "./chunk-Q2JDS6WL.js";
|
|
5
5
|
import {
|
|
6
6
|
cacheGet,
|
|
@@ -85,4 +85,4 @@ Examples:
|
|
|
85
85
|
export {
|
|
86
86
|
currencyCommand
|
|
87
87
|
};
|
|
88
|
-
//# sourceMappingURL=currency-
|
|
88
|
+
//# sourceMappingURL=currency-GLHXNSHY.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runQuery
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NKZDYXEN.js";
|
|
4
4
|
import "./chunk-Y2FAUFWK.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-JQDYH5XP.js";
|
|
6
6
|
import {
|
|
7
7
|
AD_COPY_LIST_USAGE,
|
|
8
8
|
bidModifierFlag,
|
|
@@ -41,7 +41,7 @@ import "./chunk-4NZ47VXO.js";
|
|
|
41
41
|
import "./chunk-D5FY4FAK.js";
|
|
42
42
|
import "./chunk-4H6XLX7E.js";
|
|
43
43
|
import "./chunk-QALAJNBG.js";
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-VR6XCLY6.js";
|
|
45
45
|
import "./chunk-Q2JDS6WL.js";
|
|
46
46
|
import {
|
|
47
47
|
getManagerIdForCustomer
|
|
@@ -115,6 +115,12 @@ var LIST_ARGS = {
|
|
|
115
115
|
},
|
|
116
116
|
"no-cache": { type: "boolean", description: "Skip cache" }
|
|
117
117
|
};
|
|
118
|
+
var CAMPAIGN_ID_ARG = {
|
|
119
|
+
"campaign-id": {
|
|
120
|
+
type: "string",
|
|
121
|
+
description: "Only these campaigns, comma-separated ids (--campaign-id 123,456)"
|
|
122
|
+
}
|
|
123
|
+
};
|
|
118
124
|
var LIST_SPECS = [
|
|
119
125
|
{
|
|
120
126
|
thing: "campaigns",
|
|
@@ -132,19 +138,21 @@ var LIST_SPECS = [
|
|
|
132
138
|
thing: "ad-groups",
|
|
133
139
|
preset: "ad-groups",
|
|
134
140
|
description: "List ad groups under their campaigns: id, name, status, type, default CPC bid",
|
|
141
|
+
extraArgs: CAMPAIGN_ID_ARG,
|
|
135
142
|
example: "baker ads google ad-groups list --customer-id 1234567890"
|
|
136
143
|
},
|
|
137
144
|
{
|
|
138
145
|
thing: "keywords",
|
|
139
146
|
preset: "keywords",
|
|
140
147
|
description: "List positive keywords with the resource name `keywords update|remove` take",
|
|
141
|
-
|
|
148
|
+
extraArgs: CAMPAIGN_ID_ARG,
|
|
149
|
+
example: "baker ads google keywords list --customer-id 1234567890 --campaign-id 23837707642"
|
|
142
150
|
},
|
|
143
151
|
{
|
|
144
152
|
thing: "negative-keywords",
|
|
145
153
|
preset: (args) => args.level === "adGroup" ? "ad-group-negative-keywords" : "campaign-negative-keywords",
|
|
146
154
|
description: "List negative keywords (campaign level by default) with the resource name `negative-keywords remove` takes",
|
|
147
|
-
extraArgs: { level: { type: "string", description: "campaign (default) | adGroup" } },
|
|
155
|
+
extraArgs: { level: { type: "string", description: "campaign (default) | adGroup" }, ...CAMPAIGN_ID_ARG },
|
|
148
156
|
example: "baker ads google negative-keywords list --customer-id 1234567890 --level adGroup"
|
|
149
157
|
},
|
|
150
158
|
{
|
|
@@ -160,6 +168,7 @@ var LIST_SPECS = [
|
|
|
160
168
|
thing: "ads",
|
|
161
169
|
preset: "ads",
|
|
162
170
|
description: "List ads under their ad groups: id, type, name, status, approval, final URLs",
|
|
171
|
+
extraArgs: CAMPAIGN_ID_ARG,
|
|
163
172
|
example: "baker ads google ads list --customer-id 1234567890"
|
|
164
173
|
},
|
|
165
174
|
{
|
|
@@ -172,6 +181,7 @@ var LIST_SPECS = [
|
|
|
172
181
|
thing: "asset-groups",
|
|
173
182
|
preset: "asset-groups",
|
|
174
183
|
description: "List Performance Max asset groups: id, name, status, final URLs, ad strength",
|
|
184
|
+
extraArgs: CAMPAIGN_ID_ARG,
|
|
175
185
|
example: "baker ads google asset-groups list --customer-id 1234567890"
|
|
176
186
|
},
|
|
177
187
|
{
|
|
@@ -208,12 +218,14 @@ var LIST_SPECS = [
|
|
|
208
218
|
thing: "campaign-criteria",
|
|
209
219
|
preset: "campaign-criteria",
|
|
210
220
|
description: "List campaign targeting and exclusions (locations, languages, devices, schedules, radius, placements, topics, demographics, content types, IP addresses, web pages, brand lists, audiences) with the resource name `campaign-criteria update|remove` take",
|
|
221
|
+
extraArgs: CAMPAIGN_ID_ARG,
|
|
211
222
|
example: "baker ads google campaign-criteria list --customer-id 1234567890"
|
|
212
223
|
},
|
|
213
224
|
{
|
|
214
225
|
thing: "ad-group-criteria",
|
|
215
226
|
preset: "ad-group-criteria",
|
|
216
227
|
description: "List ad group targeting and exclusions other than keywords (placements, topics, demographics, web pages, Demand Gen locations and audiences) with the resource name `ad-group-criteria update|remove` take",
|
|
228
|
+
extraArgs: CAMPAIGN_ID_ARG,
|
|
217
229
|
example: "baker ads google ad-group-criteria list --customer-id 1234567890"
|
|
218
230
|
},
|
|
219
231
|
{
|
|
@@ -226,12 +238,14 @@ var LIST_SPECS = [
|
|
|
226
238
|
thing: "asset-group-signals",
|
|
227
239
|
preset: "asset-group-signals",
|
|
228
240
|
description: "List Performance Max asset groups' signals (search themes and the combined audience) with the resource name `asset-group-signals remove` takes",
|
|
241
|
+
extraArgs: CAMPAIGN_ID_ARG,
|
|
229
242
|
example: "baker ads google asset-group-signals list --customer-id 1234567890"
|
|
230
243
|
},
|
|
231
244
|
{
|
|
232
245
|
thing: "ad-group-bid-modifiers",
|
|
233
246
|
preset: "ad-group-bid-modifiers",
|
|
234
247
|
description: "List ad groups' own device bid adjustments with the resource name `ad-group-bid-modifiers update|remove` take",
|
|
248
|
+
extraArgs: CAMPAIGN_ID_ARG,
|
|
235
249
|
example: "baker ads google ad-group-bid-modifiers list --customer-id 1234567890"
|
|
236
250
|
}
|
|
237
251
|
];
|
|
@@ -246,7 +260,8 @@ function listQueryArgs(spec, args) {
|
|
|
246
260
|
out: args.out,
|
|
247
261
|
output: args.output,
|
|
248
262
|
"no-cache": args["no-cache"],
|
|
249
|
-
"include-paused": !args["serving-only"]
|
|
263
|
+
"include-paused": !args["serving-only"],
|
|
264
|
+
"campaign-id": args["campaign-id"]
|
|
250
265
|
};
|
|
251
266
|
}
|
|
252
267
|
function listCommand(spec) {
|
|
@@ -3264,15 +3279,15 @@ Staged writes (never touch Google until the chat is published):
|
|
|
3264
3279
|
Full guide: __tooling__/docs/tools/baker/ads-google.md`
|
|
3265
3280
|
},
|
|
3266
3281
|
subCommands: {
|
|
3267
|
-
accounts: () => import("./accounts-
|
|
3268
|
-
currency: () => import("./currency-
|
|
3269
|
-
"url-options": () => import("./url-options-
|
|
3270
|
-
changes: () => import("./changes-
|
|
3282
|
+
accounts: () => import("./accounts-RRCALMPX.js").then((m) => m.accountsCommand),
|
|
3283
|
+
currency: () => import("./currency-GLHXNSHY.js").then((m) => m.currencyCommand),
|
|
3284
|
+
"url-options": () => import("./url-options-5PUWQKWS.js").then((m) => m.urlOptionsCommand),
|
|
3285
|
+
changes: () => import("./changes-AEAVFB3M.js").then((m) => m.changesCommand),
|
|
3271
3286
|
invoices: () => import("./account-reads-GQWTMLTY.js").then((m) => m.invoicesCommand),
|
|
3272
3287
|
"identity-verification": () => import("./account-reads-GQWTMLTY.js").then((m) => m.identityVerificationCommand),
|
|
3273
3288
|
previews: () => import("./account-reads-GQWTMLTY.js").then((m) => m.previewsCommand),
|
|
3274
3289
|
brands: () => import("./account-reads-GQWTMLTY.js").then((m) => m.brandsCommand),
|
|
3275
|
-
query: () => import("./query-
|
|
3290
|
+
query: () => import("./query-YWDUKFS7.js").then((m) => m.queryCommand),
|
|
3276
3291
|
keywords: keywordsWithWrites,
|
|
3277
3292
|
...googleWriteCommandsWithLists,
|
|
3278
3293
|
"merchant-center": merchantCenterCommand,
|
|
@@ -3282,4 +3297,4 @@ Full guide: __tooling__/docs/tools/baker/ads-google.md`
|
|
|
3282
3297
|
export {
|
|
3283
3298
|
googleCommand
|
|
3284
3299
|
};
|
|
3285
|
-
//# sourceMappingURL=google-
|
|
3300
|
+
//# sourceMappingURL=google-TKRS4CGR.js.map
|