@koda-sl/baker-cli 0.883.0 → 0.884.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/{account-reads-TSDWJ3A2.js → account-reads-7DPRPWBK.js} +3 -2
- package/dist/{account-reads-TSDWJ3A2.js.map → account-reads-7DPRPWBK.js.map} +1 -1
- package/dist/{ads-ZSHBQHNK.js → ads-Z2YUBDUF.js} +2 -2
- package/dist/{analytics-6TNLZ4LA.js → analytics-E5OPCERI.js} +6 -5
- package/dist/{analytics-6TNLZ4LA.js.map → analytics-E5OPCERI.js.map} +1 -1
- package/dist/{changes-7WLOTKVE.js → changes-FQ2NWBJQ.js} +3 -2
- package/dist/{changes-7WLOTKVE.js.map → changes-FQ2NWBJQ.js.map} +1 -1
- package/dist/{chunk-Z65I6WS6.js → chunk-DX4SRYED.js} +13 -5
- package/dist/chunk-DX4SRYED.js.map +1 -0
- package/dist/{chunk-J464JWY7.js → chunk-ENTB4ILS.js} +8 -4
- package/dist/chunk-ENTB4ILS.js.map +1 -0
- package/dist/{chunk-JOQBRK4E.js → chunk-FRWCTFTP.js} +9 -4
- package/dist/chunk-FRWCTFTP.js.map +1 -0
- package/dist/{chunk-BX5AAH7T.js → chunk-IDLSLJIM.js} +4 -2
- package/dist/{chunk-BX5AAH7T.js.map → chunk-IDLSLJIM.js.map} +1 -1
- package/dist/chunk-LVLAFUXQ.js +37 -0
- package/dist/chunk-LVLAFUXQ.js.map +1 -0
- package/dist/cli.js +6 -6
- package/dist/{config-UR3ZKS25.js → config-Z52BRC3M.js} +3 -2
- package/dist/{config-UR3ZKS25.js.map → config-Z52BRC3M.js.map} +1 -1
- package/dist/{conversion-upload-command-CWMZEFCT.js → conversion-upload-command-ZZ5JYMBL.js} +7 -4
- package/dist/conversion-upload-command-ZZ5JYMBL.js.map +1 -0
- package/dist/{draft-KMRFGWIO.js → draft-3L5UZ3JP.js} +7 -4
- package/dist/draft-3L5UZ3JP.js.map +1 -0
- package/dist/{draft-XWJF772C.js → draft-CZEMQHTX.js} +3 -2
- package/dist/{draft-XWJF772C.js.map → draft-CZEMQHTX.js.map} +1 -1
- package/dist/{draft-5H6MKAKW.js → draft-FOHLBTWV.js} +3 -2
- package/dist/{draft-5H6MKAKW.js.map → draft-FOHLBTWV.js.map} +1 -1
- package/dist/{forecast-WTVRSFFA.js → forecast-SXZBIHFB.js} +3 -2
- package/dist/{forecast-WTVRSFFA.js.map → forecast-SXZBIHFB.js.map} +1 -1
- package/dist/{ga4-K6ARTEPX.js → ga4-6J3IMDSU.js} +12 -12
- package/dist/{google-N3GW4MDV.js → google-F77XV4ZC.js} +59 -40
- package/dist/google-F77XV4ZC.js.map +1 -0
- package/dist/{hubspot-BG4BI3RU.js → hubspot-24MLH5N7.js} +2 -2
- package/dist/{plan-C5U4U55M.js → plan-JVD6BMEO.js} +3 -2
- package/dist/{plan-C5U4U55M.js.map → plan-JVD6BMEO.js.map} +1 -1
- package/dist/{read-UXFNPEQ5.js → read-VI63RNL6.js} +3 -2
- package/dist/{read-UXFNPEQ5.js.map → read-VI63RNL6.js.map} +1 -1
- package/dist/{search-terms-WKE47TW5.js → search-terms-SWRRTKBV.js} +3 -2
- package/dist/{search-terms-WKE47TW5.js.map → search-terms-SWRRTKBV.js.map} +1 -1
- package/dist/{sends-5UCPQZ7F.js → sends-PEQJOPRM.js} +19 -4
- package/dist/sends-PEQJOPRM.js.map +1 -0
- package/dist/{shopify-NJFARTN3.js → shopify-IRHELCGF.js} +3 -2
- package/dist/{shopify-NJFARTN3.js.map → shopify-IRHELCGF.js.map} +1 -1
- package/dist/{sources-XYKENWZF.js → sources-CACBM65R.js} +38 -17
- package/dist/sources-CACBM65R.js.map +1 -0
- package/dist/{tag-manager-5Q5MHQPL.js → tag-manager-QO6VW57E.js} +10 -10
- package/dist/{themes-LWG3LX7O.js → themes-GMZOWC3X.js} +3 -2
- package/dist/{themes-LWG3LX7O.js.map → themes-GMZOWC3X.js.map} +1 -1
- package/dist/{write-commands-IAMIUSK4.js → write-commands-GRBE5V34.js} +3 -2
- package/dist/{write-commands-IAMIUSK4.js.map → write-commands-GRBE5V34.js.map} +1 -1
- package/dist/{write-commands-JXP2NHRY.js → write-commands-MZUVJBGO.js} +3 -2
- package/dist/{write-commands-JXP2NHRY.js.map → write-commands-MZUVJBGO.js.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-J464JWY7.js.map +0 -1
- package/dist/chunk-JOQBRK4E.js.map +0 -1
- package/dist/chunk-Z65I6WS6.js.map +0 -1
- package/dist/conversion-upload-command-CWMZEFCT.js.map +0 -1
- package/dist/draft-KMRFGWIO.js.map +0 -1
- package/dist/google-N3GW4MDV.js.map +0 -1
- package/dist/sends-5UCPQZ7F.js.map +0 -1
- package/dist/sources-XYKENWZF.js.map +0 -1
- /package/dist/{ads-ZSHBQHNK.js.map → ads-Z2YUBDUF.js.map} +0 -0
- /package/dist/{ga4-K6ARTEPX.js.map → ga4-6J3IMDSU.js.map} +0 -0
- /package/dist/{hubspot-BG4BI3RU.js.map → hubspot-24MLH5N7.js.map} +0 -0
- /package/dist/{tag-manager-5Q5MHQPL.js.map → tag-manager-QO6VW57E.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hubspotDefaultMapping,
|
|
3
3
|
hubspotTriggerInputSchema
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IDLSLJIM.js";
|
|
5
5
|
import {
|
|
6
6
|
hubspotRefusal
|
|
7
7
|
} from "./chunk-WN5FEDWT.js";
|
|
@@ -198,7 +198,7 @@ var args = {
|
|
|
198
198
|
},
|
|
199
199
|
full: {
|
|
200
200
|
type: "boolean",
|
|
201
|
-
description: "Also return each source's masked sample body. The paths and the guess are always returned; the body is only for reading what a path held",
|
|
201
|
+
description: "Also return each source's masked sample body. The paths and the guess are always returned; the body is only for reading what a path held. On a change, every source instead of the one changed and the total",
|
|
202
202
|
required: false
|
|
203
203
|
}
|
|
204
204
|
};
|
|
@@ -429,6 +429,39 @@ function handleError(err) {
|
|
|
429
429
|
});
|
|
430
430
|
process.exit(1);
|
|
431
431
|
}
|
|
432
|
+
var SOURCE_CHANGES = ["setTrigger", "setAmount", "map", "pause", "resume", "remove"];
|
|
433
|
+
function touchedSource(response, request) {
|
|
434
|
+
const { applied } = response.data;
|
|
435
|
+
if (applied !== void 0) return response.data.sources.find((source) => source.id === applied);
|
|
436
|
+
if (request.create !== void 0) {
|
|
437
|
+
return response.data.sources.find((source) => source.name === request.create?.name);
|
|
438
|
+
}
|
|
439
|
+
for (const change of SOURCE_CHANGES) {
|
|
440
|
+
const target = request[change];
|
|
441
|
+
if (target !== void 0) return response.data.sources.find((source) => source.id === target.sourceId);
|
|
442
|
+
}
|
|
443
|
+
return void 0;
|
|
444
|
+
}
|
|
445
|
+
function isSourceWrite(request) {
|
|
446
|
+
return request.create !== void 0 || request.createHubspot !== void 0 || request.createActiveCampaign !== void 0 || SOURCE_CHANGES.some((change) => request[change] !== void 0);
|
|
447
|
+
}
|
|
448
|
+
function sourcesAnswer(response, request, full) {
|
|
449
|
+
const compact = (source2) => {
|
|
450
|
+
const { sample, ...rest } = source2;
|
|
451
|
+
return full || sample === void 0 ? source2 : { ...rest, sample: { receivedAt: sample.receivedAt } };
|
|
452
|
+
};
|
|
453
|
+
const { preview, staged } = response.data;
|
|
454
|
+
const source = full || !isSourceWrite(request) ? void 0 : touchedSource(response, request);
|
|
455
|
+
return {
|
|
456
|
+
ok: true,
|
|
457
|
+
data: {
|
|
458
|
+
...full || !isSourceWrite(request) ? { sources: response.data.sources.map(compact) } : { ...source === void 0 ? {} : { source: compact(source) }, total: response.data.sources.length },
|
|
459
|
+
...preview === void 0 ? {} : { preview },
|
|
460
|
+
...staged === void 0 ? {} : { staged }
|
|
461
|
+
},
|
|
462
|
+
...response.hints && response.hints.length > 0 ? { hints: response.hints } : {}
|
|
463
|
+
};
|
|
464
|
+
}
|
|
432
465
|
var sourcesCommand = defineCommand({
|
|
433
466
|
meta: {
|
|
434
467
|
name: "sources",
|
|
@@ -439,20 +472,7 @@ var sourcesCommand = defineCommand({
|
|
|
439
472
|
try {
|
|
440
473
|
const request = sourcesRequest(raw, process.argv);
|
|
441
474
|
const response = await apiPost("/api/analytics/sources", request);
|
|
442
|
-
|
|
443
|
-
const sources = response.data.sources.map((source) => {
|
|
444
|
-
const { sample, ...rest } = source;
|
|
445
|
-
return full || sample === void 0 ? source : { ...rest, sample: { receivedAt: sample.receivedAt } };
|
|
446
|
-
});
|
|
447
|
-
writeJsonEnvelope({
|
|
448
|
-
ok: true,
|
|
449
|
-
data: {
|
|
450
|
-
sources,
|
|
451
|
-
...response.data.preview === void 0 ? {} : { preview: response.data.preview },
|
|
452
|
-
...response.data.staged === void 0 ? {} : { staged: response.data.staged }
|
|
453
|
-
},
|
|
454
|
-
...response.hints && response.hints.length > 0 ? { hints: response.hints } : {}
|
|
455
|
-
});
|
|
475
|
+
writeJsonEnvelope(sourcesAnswer(response, request, raw.full === true));
|
|
456
476
|
} catch (err) {
|
|
457
477
|
if (err instanceof ConversionArgsError) {
|
|
458
478
|
handleError(new ApiError("VALIDATION_ERROR", err.message));
|
|
@@ -464,7 +484,8 @@ var sourcesCommand = defineCommand({
|
|
|
464
484
|
export {
|
|
465
485
|
parseFieldArgs,
|
|
466
486
|
parseRepeated,
|
|
487
|
+
sourcesAnswer,
|
|
467
488
|
sourcesCommand,
|
|
468
489
|
sourcesRequest
|
|
469
490
|
};
|
|
470
|
-
//# sourceMappingURL=sources-
|
|
491
|
+
//# sourceMappingURL=sources-CACBM65R.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/analytics/sources.ts"],"sourcesContent":["import { REJECTION_MESSAGES, validateEventName } from \"@baker/api/event-ingest\";\nimport {\n HUBSPOT_DEAL_CONTACTS,\n HUBSPOT_OBJECTS,\n type HubspotDealContacts,\n type HubspotObject,\n hubspotDefaultMapping,\n hubspotTriggerInputSchema,\n mappingRowProblem,\n readsAssociatedContact,\n SOURCE_FIELD_NAMES,\n type SourcesRequestInput,\n type SourcesResponse,\n type SourceView,\n templateMentions,\n} from \"@baker/api/event-sources\";\nimport { defineCommand } from \"citty\";\nimport { ApiError, apiPost } from \"../../client.ts\";\nimport { registerSchema } from \"../../schemas.ts\";\nimport { writeJsonEnvelope } from \"../ads/output.ts\";\nimport { hubspotRefusal } from \"../hubspot/refusal.ts\";\nimport { ConversionArgsError, onlyOnce } from \"./conversionArgs.ts\";\n\n/**\n * `baker analytics sources` — an address for each of the client's own tools to\n * send events to, and what each one's payloads are read as.\n *\n * ## Why a URL and not a key\n *\n * `POST /v1/events` needs the sender to write code to our contract. A CRM's\n * webhook, an automation platform, a billing system cannot be told what to\n * send — they post what they post, to a URL, and set nothing else. A source\n * is that URL: the token in it is the whole credential, the first send\n * teaches Baker the shape, and a person confirms once which path is the\n * email, which the amount. From then on every arrival is an ordinary event.\n *\n * ## `--field` and `--value` repeat, and citty keeps only the last\n *\n * citty hands the LAST value of a repeated flag over as a plain string, so\n * `--field email=a --field value=b` would map `value` and silently drop\n * `email`, and `--value lead --value customer` would watch `customer` alone.\n * Both are read off `process.argv` instead, the way `conversions` reads its\n * repeats.\n */\n\nconst args = {\n server: {\n type: \"boolean\",\n description:\n \"The client's own server door: one address for their developers, made once and the same for ever after, counting at once in Baker's own format (`baker analytics sending-events` has the contract). Prints it; nothing else to set\",\n required: false,\n },\n create: {\n type: \"boolean\",\n description:\n \"Make an address for a tool that cannot be told what to send (a CRM webhook, an automation step). Needs --name. Its first send is kept as a sample and counted as nothing until --map\",\n required: false,\n },\n \"create-hubspot\": {\n type: \"boolean\",\n description:\n \"Make a HubSpot event: HubSpot keeps each change to --property for Baker (Baker's app subscribes the account to that property with the condition as HubSpot's own filter, and nothing else), and every contact whose new value satisfies --operator --value is an event, counted within a minute. Needs --property (names, kinds and operators from `baker hubspot contacts properties`); --operator defaults to `is`; --value repeats for a list (`is` on a dropdown) or a between; --name is optional and defaults to the trigger's words; --field rows (names from `baker hubspot contacts fields`) replace the default rows they name. Counts from now on, never earlier contacts\",\n required: false,\n },\n \"create-activecampaign\": {\n type: \"boolean\",\n description:\n \"Make an ActiveCampaign event source: when this chat is published, ActiveCampaign's own webhook is set up on the account to send --events here, and each one counts as `activecampaign.<event>` (a contact subscribing is `activecampaign.subscribe`) from then on — a scheduled agent can run on any of them (`baker scheduled-agents create --trigger event.received --event activecampaign.deal_update`). --events defaults to subscribe,contact_tag_added,deal_add,deal_update; --name to ActiveCampaign; --account picks the connection when there are several. Removing the source takes the webhook off the account\",\n required: false,\n },\n events: {\n type: \"string\",\n description:\n \"With --create-activecampaign: ActiveCampaign's events, comma-separated — subscribe, unsubscribe, update, contact_tag_added, contact_tag_removed, subscriber_note, contact_task_add, sent, open, click, reply, forward, share, bounce, list_add, deal_add, deal_update, deal_note_add, deal_task_add, deal_task_complete, deal_pipeline_add, deal_stage_add, deal_tasktype_add, account_add, account_update, account_contact_add, account_contact_update\",\n required: false,\n },\n account: {\n type: \"string\",\n description:\n \"With --create-activecampaign: which ActiveCampaign connection, by id, when the company has more than one (the refusal lists them)\",\n required: false,\n },\n \"set-trigger\": {\n type: \"boolean\",\n description:\n \"Change what a HubSpot event watches. Needs --source and the same --property --operator --value as --create-hubspot. The rows stay; it counts from now on under the new trigger\",\n required: false,\n },\n preview: {\n type: \"boolean\",\n description:\n \"Ask HubSpot what --property --operator --value would count today, and read one real contact — the one most recently there, or --contact — with the properties the --field rows mention (the defaults when none), to check every row against real data BEFORE --create-hubspot. Makes nothing\",\n required: false,\n },\n breakdown: {\n type: \"boolean\",\n description:\n \"With --preview on one dropdown --property (operator `is`) and several --value: also a total for each value, as `preview.counts: [{value, total}]` — sizing every stage of a funnel in one call: `--preview --object deal --property dealstage --value appointmentscheduled --value closedwon --breakdown`. Never loop --preview over values\",\n required: false,\n },\n object: {\n type: \"string\",\n description:\n \"With --create-hubspot or --preview: what the trigger is on — `contact` (the default), `deal` or `lead`. A deal's and a lead's event is about the contact the record is associated with: its rows read the record's own properties bare ({{amount}}, {{dealstage}}, {{hs_pipeline_stage}}) and the contact's as {{contact.<name>}} (`baker hubspot deals fields` / `baker hubspot leads fields`). A deal's amount defaults to its own amount in its currency; a lead has none, so it counts the step rather than money. Use `lead` for qualification and disqualification — HubSpot records both as a lead stage, and nothing on the contact or the deal says a lead was disqualified\",\n required: false,\n },\n contacts: {\n type: \"string\",\n description:\n \"With --object deal or --object lead (on --create-hubspot or --set-trigger): whose event it is — `every` (the default: every contact on the record, each its own event; on a deal each worth the deal's amount) or `first` (the record's first contact only)\",\n required: false,\n },\n property: {\n type: \"string\",\n description:\n \"With --create-hubspot, --set-trigger or --preview: the property to watch, by HubSpot's internal name (lifecyclestage, hs_lead_status, a custom one on a contact; dealstage, amount, closedate on a deal; hs_pipeline_stage, hs_lead_label on a lead) — any property, whatever its kind\",\n required: false,\n },\n operator: {\n type: \"string\",\n description:\n \"With --property: how the property has to read. By the property's kind — select: is, isNot, isEmpty, isNotEmpty · text: is, isNot, contains, doesNotContain, startsWith, endsWith, isEmpty, isNotEmpty · number: equal, notEqual, lessThan, lessThanOrEqual, greaterThan, greaterThanOrEqual, isEmpty, isNotEmpty · date: is, isBefore, isAfter, isOnOrBefore, isOnOrAfter, isBetween, isEmpty, isNotEmpty · yes/no: is, isNot. `is` when unsaid\",\n required: false,\n },\n value: {\n type: \"string\",\n description:\n \"With --property: the value, as HubSpot spells it — a dropdown's internal value (customer, QUALIFIED…), a number, a YYYY-MM-DD, true/false. Repeat it for a list (--value lead --value customer) or the two ends of isBetween; none for isEmpty / isNotEmpty\",\n required: false,\n },\n conditions: {\n type: \"string\",\n description:\n 'With --create-hubspot, --set-trigger or --preview, instead of --property/--operator/--value: several conditions combined the way a Form\\'s filter combines them, as JSON — `{\"logic\":\"And\",\"conditions\":[{\"property\":\"lifecyclestage\",\"values\":[\"customer\"]},{\"logic\":\"Or\",\"conditions\":[{\"property\":\"country\",\"values\":[\"Spain\"]},{\"property\":\"amount\",\"operator\":\"greaterThan\",\"values\":[\"1000\"]}]}]}`. `logic` is And (every row) or Or (any row); a row is a condition or a group with its own logic, one level deep; at most 10 conditions. The event fires when a change to any named property makes the whole combination hold',\n required: false,\n },\n contact: {\n type: \"string\",\n description:\n \"With --preview: the record to draw the sample from — a HubSpot id, or text to search (an email or a name for a contact, a deal's or a lead's name). The one most recently satisfying the trigger when unsaid\",\n required: false,\n },\n \"amount-property\": {\n type: \"string\",\n description:\n \"With --create-hubspot or --set-amount: a NUMBER property of the watched object to read as the event's amount (a deal value synced onto the contact; a deal's own `amount` is read by default on a deal). Needs --currency beside it\",\n required: false,\n },\n currency: {\n type: \"string\",\n description: \"With --amount-property: the three-letter currency the property is in, like EUR or USD\",\n required: false,\n },\n \"set-amount\": {\n type: \"boolean\",\n description:\n \"Change where a HubSpot-read source takes its amount from. Needs --source; with --amount-property and --currency it reads them, with neither it stops reading an amount\",\n required: false,\n },\n backfill: {\n type: \"boolean\",\n description:\n \"Count a HubSpot event's history: every moment its trigger came to hold since --since, at the instant HubSpot says it did. Needs --source and --since. Nothing is invented — a record that merely satisfies the trigger today is not an event today, and only moments HubSpot has a timestamp for are counted. Dry without --write. Reach for it when an event was made after the deals it should have counted, or after fixing one that was refusing everything it received\",\n required: false,\n },\n since: {\n type: \"string\",\n description:\n \"With --backfill: the date to count this event's history from, `2026-09-19` or an ISO instant. At most 400 days back — the store keeps no more\",\n required: false,\n },\n before: {\n type: \"string\",\n description:\n \"With --backfill: carry on from where a capped run stopped, by passing back the `reachedBack` it returned. One run reads at most 500 records, most recently changed first, so a capped run has covered the newest and the rest are the ones nearest --since — narrowing --since cannot reach them, this can. Repeat until `capped` is false; nothing is counted twice. It bounds which records are read, never which of their moments count: those are still the whole of --since to now\",\n required: false,\n },\n write: {\n type: \"boolean\",\n description:\n \"With --backfill: actually count what it found. Without it nothing is counted and the answer says what would be. Events inside the last 72 hours are uploaded to this event's ad platforms within minutes of counting, which spends real budget\",\n required: false,\n },\n name: {\n type: \"string\",\n description:\n \"The tool the source is for — HubSpot, Zapier, Stripe. It is the event's name when the payload does not say one, and every event it sends carries it as `baker_source`\",\n required: false,\n },\n map: {\n type: \"boolean\",\n description:\n \"Set what each field is read from. For an address this starts counting; needs --source, and one --field per row. With no --field the guess is used, which is right for a tool already sending Baker's own format. For a HubSpot-read source it replaces the whole mapping (the row list is on the source as `mapping`; empty means HubSpot's standard properties), so repeat every row you want kept\",\n required: false,\n },\n source: { type: \"string\", description: \"The source id, from the list\", required: false },\n field: {\n type: \"string\",\n description: `<field>=<template>, repeatable. A template is text with {{path}} mentions, one thing per mention: --field email={{contact.email}} --field currency=EUR --field first_name=\"{{who.first}} {{who.last}}\". A bare path (--field email=contact.email) is read as its mention when the sample has that path, so the short spelling still works. Fields: ${SOURCE_FIELD_NAMES.join(\", \")}. An EXTRA PROPERTY of the event — a plan, a stage, anything Measure → Events should break it down by and a send may pass on to a platform — is --field properties.<name>=<template>, e.g. --field properties.plan={{plan_tier}}. Paths come from \\`paths\\` on the source's sample; for a HubSpot event they are contact property names (\\`baker hubspot contacts fields\\`) plus \\`id\\` for the contact id`,\n required: false,\n },\n pause: {\n type: \"boolean\",\n description: \"Stop counting a source's arrivals; they are answered and dropped. Needs --source\",\n required: false,\n },\n resume: { type: \"boolean\", description: \"Count a paused source's arrivals again. Needs --source\", required: false },\n remove: {\n type: \"boolean\",\n description: \"Delete a source; its address stops working at once. Needs --source\",\n required: false,\n },\n full: {\n type: \"boolean\",\n description:\n \"Also return each source's masked sample body. The paths and the guess are always returned; the body is only for reading what a path held. On a change, every source instead of the one changed and the total\",\n required: false,\n },\n} as const;\n\nregisterSchema({\n command: \"analytics.sources\",\n routes: [\"POST /api/analytics/sources\"],\n effect: \"write\",\n description:\n \"Where events reach Baker from a server: the client's own server door, HubSpot events Baker reads, and ActiveCampaign events its webhook sends — what each one watches and reads, and how it is doing\",\n args,\n});\n\n/** The value a repeated flag carries at this position, in either spelling, or nothing. */\nfunction flagValueAt(argv: readonly string[], flag: string, index: number): string | undefined {\n const arg = argv[index] ?? \"\";\n if (arg === flag) return argv[index + 1];\n return arg.startsWith(`${flag}=`) ? arg.slice(flag.length + 1) : undefined;\n}\n\n/** Every value of a repeated flag on the command line, in order. */\nexport function parseRepeated(argv: readonly string[], flag: string): string[] {\n const values: string[] = [];\n for (let index = 0; index < argv.length; index += 1) {\n const value = flagValueAt(argv, flag, index);\n if (value !== undefined) values.push(value);\n }\n return values;\n}\n\n/** Every `--field k=v` on the command line, in order, refusing a malformed one. */\nexport function parseFieldArgs(argv: readonly string[]): Record<string, string> {\n const mapping: Record<string, string> = {};\n for (const pair of parseRepeated(argv, \"--field\")) {\n const eq = pair.indexOf(\"=\");\n const field = eq === -1 ? pair : pair.slice(0, eq);\n const path = eq === -1 ? \"\" : pair.slice(eq + 1).trim();\n const problem = mappingRowProblem(field);\n if (problem !== null) throw new ConversionArgsError(problem);\n if (path === \"\") throw new ConversionArgsError(`--field ${field} needs a path: --field ${field}=<dotted.path>.`);\n mapping[field] = path;\n }\n return mapping;\n}\n\n/** The amount pair, which travels together or not at all. */\nfunction amountArgs(raw: Record<string, unknown>, argv: readonly string[]) {\n const amountProperty = onlyOnce(raw[\"amount-property\"], \"--amount-property\", argv);\n const currency = onlyOnce(raw.currency, \"--currency\", argv);\n if ((amountProperty === undefined) !== (currency === undefined)) {\n throw new ConversionArgsError(\"--amount-property and --currency go together: name both or neither.\");\n }\n return {\n ...(amountProperty === undefined ? {} : { amountProperty }),\n ...(currency === undefined ? {} : { currency }),\n };\n}\n\nconst NO_VALUE_OPERATORS = new Set([\"isEmpty\", \"isNotEmpty\"]);\n\n/**\n * The trigger every HubSpot verb needs: the property, how it has to read,\n * and the values — repeated on the command line, read off argv. Refused with\n * where the names come from; what the property's kind allows is checked\n * against the account by the backend.\n */\nfunction triggerArgs(raw: Record<string, unknown>, argv: readonly string[], verb: string): TriggerInput {\n const conditions = onlyOnce(raw.conditions, \"--conditions\", argv);\n if (conditions !== undefined) return conditionsArg(conditions, raw, verb);\n const property = onlyOnce(raw.property, \"--property\", argv);\n const operator = onlyOnce(raw.operator, \"--operator\", argv) ?? \"is\";\n // The last --value is what citty kept; every one is what was typed.\n const values = argv.length === 0 && typeof raw.value === \"string\" ? [raw.value] : parseRepeated(argv, \"--value\");\n if (property === undefined) {\n throw new ConversionArgsError(\n `--${verb} needs --property <name> [--operator <op>] --value <value>…, from \\`baker hubspot contacts properties\\`.`,\n );\n }\n if (values.length === 0 && !NO_VALUE_OPERATORS.has(operator)) {\n throw new ConversionArgsError(\n `--${verb} needs --value <value> (repeat it for a list); only --operator isEmpty / isNotEmpty take none.`,\n );\n }\n return { property, operator, values };\n}\n\ntype TriggerInput = NonNullable<SourcesRequestInput[\"createHubspot\"]>[\"trigger\"];\n\n/** `--conditions <json>`: a combination, checked for shape here so a typo is refused before the call. */\nfunction conditionsArg(text: string, raw: Record<string, unknown>, verb: string): TriggerInput {\n if (raw.property !== undefined || raw.value !== undefined || raw.operator !== undefined) {\n throw new ConversionArgsError(`--${verb} takes --conditions or --property/--operator/--value, not both.`);\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch {\n throw new ConversionArgsError(\n '--conditions is JSON: {\"logic\":\"And\",\"conditions\":[{\"property\":\"lifecyclestage\",\"values\":[\"customer\"]}]}.',\n );\n }\n const checked = hubspotTriggerInputSchema.safeParse(parsed);\n if (!checked.success) {\n throw new ConversionArgsError(`--conditions: ${checked.error.issues.map((issue) => issue.message).join(\"; \")}`);\n }\n return parsed as TriggerInput;\n}\n\n/** `--object contact|deal`, spelled the two ways the wire takes and nothing else. */\nfunction objectArg(raw: Record<string, unknown>, argv: readonly string[]): HubspotObject {\n const object = onlyOnce(raw.object, \"--object\", argv) ?? \"contact\";\n if (!(HUBSPOT_OBJECTS as readonly string[]).includes(object)) {\n throw new ConversionArgsError(`--object is one of ${HUBSPOT_OBJECTS.join(\", \")}, not \"${object}\".`);\n }\n return object as HubspotObject;\n}\n\n/** `--contacts first|every`, which only means something on a deal or a lead. */\nfunction contactsArg(raw: Record<string, unknown>, argv: readonly string[]): HubspotDealContacts | undefined {\n const contacts = onlyOnce(raw.contacts, \"--contacts\", argv);\n if (contacts === undefined) return undefined;\n if (!(HUBSPOT_DEAL_CONTACTS as readonly string[]).includes(contacts)) {\n throw new ConversionArgsError(`--contacts is one of ${HUBSPOT_DEAL_CONTACTS.join(\", \")}, not \"${contacts}\".`);\n }\n return contacts as HubspotDealContacts;\n}\n\nfunction createHubspotArgs(\n raw: Record<string, unknown>,\n argv: readonly string[],\n name: string | undefined,\n): NonNullable<SourcesRequestInput[\"createHubspot\"]> {\n const mapping = parseFieldArgs(argv);\n const object = objectArg(raw, argv);\n const contacts = contactsArg(raw, argv);\n if (contacts !== undefined && !readsAssociatedContact(object)) {\n throw new ConversionArgsError(\n \"--contacts says whose event a deal's or a lead's is; it needs --object deal or --object lead.\",\n );\n }\n return {\n // A contact is the wire's default, so it is left unsaid — the way the schema reads it back.\n ...(object === \"contact\" ? {} : { object }),\n trigger: triggerArgs(raw, argv, \"create-hubspot\"),\n ...(contacts === undefined ? {} : { contacts }),\n ...(name === undefined ? {} : { name }),\n ...(Object.keys(mapping).length === 0 ? {} : { mapping }),\n ...amountArgs(raw, argv),\n };\n}\n\n/** What to read off the sample contact: whatever the rows mention, or the default rows' properties. */\nfunction previewArgs(\n raw: Record<string, unknown>,\n argv: readonly string[],\n): NonNullable<SourcesRequestInput[\"preview\"]> {\n const rows = parseFieldArgs(argv);\n const object = objectArg(raw, argv);\n const templates = Object.values(Object.keys(rows).length === 0 ? hubspotDefaultMapping(\"\", object) : rows);\n const properties = [...new Set(templates.flatMap((template) => templateMentions(template ?? \"\")))];\n const contact = onlyOnce(raw.contact, \"--contact\", argv);\n return {\n ...(object === \"contact\" ? {} : { object }),\n trigger: triggerArgs(raw, argv, \"preview\"),\n properties,\n ...(contact === undefined ? {} : { contact }),\n ...(raw.breakdown === true ? { breakdown: true } : {}),\n };\n}\n\nconst VERBS = [\n \"server\",\n \"create\",\n \"create-hubspot\",\n \"create-activecampaign\",\n \"set-trigger\",\n \"preview\",\n \"backfill\",\n \"set-amount\",\n \"map\",\n \"pause\",\n \"resume\",\n \"remove\",\n] as const;\n\n/**\n * The name, refused here when the ingest door could never accept it.\n *\n * A source's name is the `event_name` of every event it raises, so this is\n * not a label being tidied: a name outside the rule makes a source that\n * counts **nothing**, for ever, while `baker analytics sources` goes on\n * listing it as counting and the only trace is one red line per event on the\n * feed. The contract refuses it too (`sourceNameSchema`), but that comes back\n * as a wire-validation error; the agent is better served by the sentence.\n */\nfunction checkedName(raw: Record<string, unknown>, argv: readonly string[]): string | undefined {\n const name = onlyOnce(raw.name, \"--name\", argv);\n if (name === undefined || validateEventName(name) === null) return name;\n throw new ConversionArgsError(\n `\"${name}\" cannot be an event name, and the name is what every event this source raises will carry. ${REJECTION_MESSAGES.invalid_name}`,\n );\n}\n\n/** What a backfill reads back to, and whether it counts what it finds. */\nfunction backfillArgs(\n raw: Record<string, unknown>,\n argv: readonly string[],\n sourceId: string,\n): NonNullable<SourcesRequestInput[\"backfill\"]> {\n const since = onlyOnce(raw.since, \"--since\", argv);\n if (since === undefined) {\n throw new ConversionArgsError(\n \"--backfill needs --since <date>, e.g. --since 2026-09-19. Nothing before it is read.\",\n );\n }\n const before = onlyOnce(raw.before, \"--before\", argv);\n return {\n sourceId,\n since,\n ...(before === undefined ? {} : { before }),\n ...(raw.write === true ? { write: true } : {}),\n };\n}\n\nfunction createActiveCampaignArgs(\n raw: Record<string, unknown>,\n argv: readonly string[],\n name: string | undefined,\n): NonNullable<SourcesRequestInput[\"createActiveCampaign\"]> {\n const events = onlyOnce(raw.events, \"--events\", argv);\n const account = onlyOnce(raw.account, \"--account\", argv);\n return {\n ...(name === undefined ? {} : { name }),\n ...(events === undefined\n ? {}\n : {\n events: events\n .split(\",\")\n .map((item) => item.trim())\n .filter((item) => item !== \"\"),\n }),\n ...(account === undefined ? {} : { account }),\n };\n}\n\n/** The three ways to make a source: an address for a tool, a HubSpot event, ActiveCampaign events. */\nfunction createRequest(\n verb: (typeof VERBS)[number],\n raw: Record<string, unknown>,\n argv: readonly string[],\n name: string | undefined,\n): SourcesRequestInput | null {\n if (verb === \"create\") {\n if (name === undefined) throw new ConversionArgsError(\"--create needs --name <tool>.\");\n return { create: { name } };\n }\n if (verb === \"create-hubspot\") return { createHubspot: createHubspotArgs(raw, argv, name) };\n if (verb === \"create-activecampaign\") return { createActiveCampaign: createActiveCampaignArgs(raw, argv, name) };\n return null;\n}\n\nexport function sourcesRequest(raw: Record<string, unknown>, argv: readonly string[]): SourcesRequestInput {\n const name = checkedName(raw, argv);\n const source = onlyOnce(raw.source, \"--source\", argv);\n const verbs = VERBS.filter((verb) => raw[verb] === true);\n if (verbs.length > 1) throw new ConversionArgsError(`One of --${verbs.join(\", --\")} per call.`);\n const verb = verbs[0];\n if (verb === undefined) return {};\n if (verb === \"server\") return { server: {} };\n const made = createRequest(verb, raw, argv, name);\n if (made !== null) return made;\n if (verb === \"preview\") return { preview: previewArgs(raw, argv) };\n if (source === undefined) throw new ConversionArgsError(`--${verb} needs --source <id>, from the list.`);\n if (verb === \"backfill\") return { backfill: backfillArgs(raw, argv, source) };\n if (verb === \"set-trigger\") {\n const contacts = contactsArg(raw, argv);\n return {\n setTrigger: {\n sourceId: source,\n trigger: triggerArgs(raw, argv, verb),\n ...(contacts === undefined ? {} : { contacts }),\n },\n };\n }\n if (verb === \"set-amount\") return { setAmount: { sourceId: source, ...amountArgs(raw, argv) } };\n if (verb === \"map\") return { map: { sourceId: source, mapping: parseFieldArgs(argv) } };\n return { [verb]: { sourceId: source } };\n}\n\nfunction handleError(err: unknown): never {\n if (err instanceof ApiError) {\n // A HubSpot event needs HubSpot connected, and allowed to read what it watches.\n const refusal = hubspotRefusal(err.code, err.message);\n writeJsonEnvelope({\n ok: false,\n error:\n refusal === null\n ? { code: err.code, message: err.message }\n : { code: refusal.code, message: err.message, fix: refusal.fix },\n });\n process.exit(1);\n }\n writeJsonEnvelope({\n ok: false,\n error: { code: \"NETWORK_ERROR\", message: err instanceof Error ? err.message : \"Unexpected error\" },\n });\n process.exit(1);\n}\n\n/** The requests that change a source, each naming the one it changes by id. */\nconst SOURCE_CHANGES = [\"setTrigger\", \"setAmount\", \"map\", \"pause\", \"resume\", \"remove\"] as const;\n\n/** The source a write is on: the one the server applied it to, the one it names by id, or a new address by its name. */\nfunction touchedSource(response: SourcesResponse, request: SourcesRequestInput): SourceView | undefined {\n const { applied } = response.data;\n if (applied !== undefined) return response.data.sources.find((source) => source.id === applied);\n if (request.create !== undefined) {\n return response.data.sources.find((source) => source.name === request.create?.name);\n }\n for (const change of SOURCE_CHANGES) {\n const target = request[change];\n if (target !== undefined) return response.data.sources.find((source) => source.id === target.sourceId);\n }\n return undefined;\n}\n\nfunction isSourceWrite(request: SourcesRequestInput): boolean {\n return (\n request.create !== undefined ||\n request.createHubspot !== undefined ||\n request.createActiveCampaign !== undefined ||\n SOURCE_CHANGES.some((change) => request[change] !== undefined)\n );\n}\n\n/**\n * What to print. A read lists every source; a write answers with what this\n * chat staged, the source it is on and how many there are, so the answer\n * grows with the change and not with the company. `--full` keeps the whole\n * listing, and each sample body, on either.\n */\nexport function sourcesAnswer(\n response: SourcesResponse,\n request: SourcesRequestInput,\n full: boolean,\n): Record<string, unknown> {\n const compact = (source: SourceView) => {\n const { sample, ...rest } = source;\n return full || sample === undefined ? source : { ...rest, sample: { receivedAt: sample.receivedAt } };\n };\n const { preview, staged } = response.data;\n const source = full || !isSourceWrite(request) ? undefined : touchedSource(response, request);\n return {\n ok: true,\n data: {\n ...(full || !isSourceWrite(request)\n ? { sources: response.data.sources.map(compact) }\n : { ...(source === undefined ? {} : { source: compact(source) }), total: response.data.sources.length }),\n ...(preview === undefined ? {} : { preview }),\n ...(staged === undefined ? {} : { staged }),\n },\n ...(response.hints && response.hints.length > 0 ? { hints: response.hints } : {}),\n };\n}\n\nexport const sourcesCommand = defineCommand({\n meta: {\n name: \"sources\",\n description:\n 'Where events reach Baker from a server, and what each one reads. Two doors. **The client\\'s own server**: `--server` prints one address for their developers — made once, the same for ever, counting at once, Baker\\'s own `POST /v1/events` format (`baker analytics sending-events` has the contract, `X-Baker-Mode: test` rehearses). **HubSpot events**: HubSpot keeps each change to a watched property in a journal Baker reads every half minute — Baker\\'s app subscribes the account to that one property with the condition as HubSpot\\'s own filter, so an account with a million contacts costs nothing to watch — on every plan, nothing to set up in HubSpot. The trigger is *when a contact\\'s* property satisfies a condition — the same conditions a Form\\'s filters take: `--property lifecyclestage --value customer` (a dropdown; `--value lead --value customer` for either), `--property deal_value --operator greaterThan --value 1000`, `--property email --operator endsWith --value @acme.com`, `--property closed_at --operator isAfter --value 2026-01-01`, `--property phone --operator isEmpty`. Several conditions combine the way a Form\\'s filter does — `--conditions \\'{\"logic\":\"And\",\"conditions\":[{\"property\":\"lifecyclestage\",\"values\":[\"customer\"]},{\"property\":\"country\",\"values\":[\"Spain\"]}]}\\'` (AND / OR, groups one level deep, 10 conditions at most) in place of --property/--operator/--value, on --create-hubspot, --set-trigger and --preview; the event fires when a change to any named property makes the whole combination hold. `baker hubspot contacts properties` lists every property with its kind, the operators that kind takes and a dropdown\\'s values; `baker hubspot contacts fields` every property a row can read. `--preview --property … [--operator …] --value … [--breakdown] [--field …] [--contact <id or email>]` says how many contacts satisfy it today (NOT counted — only contacts that come to satisfy it from now on are), `--breakdown` a total per --value in the same call, and reads one real contact so every row can be checked against real data; then `--create-hubspot --property … --value … --name \"Deal won\" --field email={{work_email}} --field value={{deal_value}} --field currency=EUR` makes the event, rows over the defaults (email, phone, the contact id, name, address, hs_google_click_id, hs_facebook_click_id). `--set-trigger --source <id> --property … --operator … --value …` changes what an event watches later (rows kept, counting from now on). Every row is a template — text with {{property}} mentions, one thing per mention; `--map --source <id> --field …` replaces the whole row set later, `--amount-property <number property> --currency EUR` is the short spelling for the amount rows. Each event is an ordinary event named after the source, carrying `baker_source`, listed by `feed --source <name>`, counted with `conversions` under `page:<name>`, and sent to the ad platforms with `sends`. **ActiveCampaign events**: `--create-activecampaign [--events subscribe,deal_update] [--name …] [--account <id>]` stages a source that the ActiveCampaign webhook sends to once the chat is published; each arrival is an event called `activecampaign.<event>` — whatever the source is called — carrying the contact and the rest of the ActiveCampaign payload as `properties.*` (the stage of a deal, the tag, the campaign), which is what a scheduled agent on `event.received --event activecampaign.<event>` runs on. `--pause`, `--resume`, `--remove` by --source; removing an ActiveCampaign source deletes its webhook. `--create --name <tool>` still makes an address for a tool that cannot be told what to send; its first send is a masked sample counted as nothing until `--map` confirms the rows.',\n },\n args,\n run: async ({ args: raw }) => {\n try {\n const request = sourcesRequest(raw as Record<string, unknown>, process.argv);\n const response = await apiPost<SourcesResponse>(\"/api/analytics/sources\", request);\n writeJsonEnvelope(sourcesAnswer(response, request, raw.full === true));\n } catch (err) {\n if (err instanceof ConversionArgsError) {\n handleError(new ApiError(\"VALIDATION_ERROR\", err.message));\n }\n handleError(err);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAS,qBAAqB;AA6B9B,IAAM,OAAO;AAAA,EACX,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,aACE;AAAA,IACF,UAAU;AAAA,EACZ;AAAA,EACA,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,aACE;AAAA,IACF,UAAU;AAAA,EACZ;AAAA,EACA,kBAAkB;AAAA,IAChB,MAAM;AAAA,IACN,aACE;AAAA,IACF,UAAU;AAAA,EACZ;AAAA,EACA,yBAAyB;AAAA,IACvB,MAAM;AAAA,IACN,aACE;AAAA,IACF,UAAU;AAAA,EACZ;AAAA,EACA,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,aACE;AAAA,IACF,UAAU;AAAA,EACZ;AAAA,EACA,SAAS;AAAA,IACP,MAAM;AAAA,IACN,aACE;AAAA,IACF,UAAU;AAAA,EACZ;AAAA,EACA,eAAe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,EAAE,MAAM,IAAI,MAAM;AAC5B,QAAI;AACF,YAAM,UAAU,eAAe,KAAgC,QAAQ,IAAI;AAC3E,YAAM,WAAW,MAAM,QAAyB,0BAA0B,OAAO;AACjF,wBAAkB,cAAc,UAAU,SAAS,IAAI,SAAS,IAAI,CAAC;AAAA,IACvE,SAAS,KAAK;AACZ,UAAI,eAAe,qBAAqB;AACtC,oBAAY,IAAI,SAAS,oBAAoB,IAAI,OAAO,CAAC;AAAA,MAC3D;AACA,kBAAY,GAAG;AAAA,IACjB;AAAA,EACF;AACF,CAAC;","names":["verb","source"]}
|
|
@@ -28,18 +28,18 @@ different job \u2014 that is \`baker tags\` with the googleTagManager tag.
|
|
|
28
28
|
Full guide: __tooling__/docs/tools/baker/tag-manager.md`
|
|
29
29
|
},
|
|
30
30
|
subCommands: {
|
|
31
|
-
containers: () => import("./read-
|
|
32
|
-
read: () => import("./read-
|
|
33
|
-
changes: () => import("./changes-
|
|
34
|
-
tag: () => import("./write-commands-
|
|
35
|
-
trigger: () => import("./write-commands-
|
|
36
|
-
variable: () => import("./write-commands-
|
|
37
|
-
folder: () => import("./write-commands-
|
|
38
|
-
builtin: () => import("./write-commands-
|
|
39
|
-
draft: () => import("./draft-
|
|
31
|
+
containers: () => import("./read-VI63RNL6.js").then((m) => m.containersCommand),
|
|
32
|
+
read: () => import("./read-VI63RNL6.js").then((m) => m.readCommand),
|
|
33
|
+
changes: () => import("./changes-FQ2NWBJQ.js").then((m) => m.changesCommand),
|
|
34
|
+
tag: () => import("./write-commands-MZUVJBGO.js").then((m) => m.tagCommand),
|
|
35
|
+
trigger: () => import("./write-commands-MZUVJBGO.js").then((m) => m.triggerCommand),
|
|
36
|
+
variable: () => import("./write-commands-MZUVJBGO.js").then((m) => m.variableCommand),
|
|
37
|
+
folder: () => import("./write-commands-MZUVJBGO.js").then((m) => m.folderCommand),
|
|
38
|
+
builtin: () => import("./write-commands-MZUVJBGO.js").then((m) => m.builtinCommand),
|
|
39
|
+
draft: () => import("./draft-CZEMQHTX.js").then((m) => m.draftCommand)
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
export {
|
|
43
43
|
tagManagerCommand
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=tag-manager-
|
|
45
|
+
//# sourceMappingURL=tag-manager-QO6VW57E.js.map
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
failWriteValidation,
|
|
6
6
|
listFlag,
|
|
7
7
|
requireCustomerId
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FRWCTFTP.js";
|
|
9
|
+
import "./chunk-LVLAFUXQ.js";
|
|
9
10
|
import "./chunk-MTMWOUKN.js";
|
|
10
11
|
import "./chunk-S7J2JP3U.js";
|
|
11
12
|
import "./chunk-UKENQSZ2.js";
|
|
@@ -99,4 +100,4 @@ Example:
|
|
|
99
100
|
export {
|
|
100
101
|
themesCommand
|
|
101
102
|
};
|
|
102
|
-
//# sourceMappingURL=themes-
|
|
103
|
+
//# sourceMappingURL=themes-GMZOWC3X.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/ads/google/keywords/themes.ts"],"sourcesContent":["import type { GoogleAdGroupThemesResponse } from \"@baker/api/ads-google\";\nimport { defineCommand } from \"citty\";\nimport { apiPost } from \"../../../../client.ts\";\nimport { registerSchema } from \"../../../../schemas.ts\";\nimport { getManagerIdForCustomer } from \"../../cache.ts\";\nimport { writeJsonEnvelope } from \"../../output.ts\";\nimport { exitWithServiceReadError } from \"../service-read-errors.ts\";\nimport { failWriteValidation, listFlag, requireCustomerId } from \"../write-shared.ts\";\n\nconst ARGS = {\n \"customer-id\": { type: \"string\", description: \"Google Ads customer ID (10 digits; dashes are fine)\" },\n keywords: { type: \"string\", description: \"Comma-separated keywords to place\" },\n \"ad-groups\": {\n type: \"string\",\n description:\n \"Comma-separated existing ad group ids (or resource names) to sort them into — read them with `ad-groups list`\",\n },\n} as const;\n\nregisterSchema({\n command: \"ads.google.keywords.themes\",\n routes: [\"POST /api/ads/google/keywords/themes\"],\n effect: \"read_live\",\n description:\n \"Which existing ad group each keyword belongs in, by Google's reading of the ad groups' themes (Keyword Planner GenerateAdGroupThemes). Start here: `baker ads google keywords themes --customer-id 1234567890 --keywords \\\"solar panels,heat pumps\\\" --ad-groups 111,222`. Returns suggestions (keyword → suggested keyword, match type, ad group) and unusable_ad_groups (ones Google could not read a theme from).\",\n args: Object.fromEntries(\n Object.entries(ARGS).map(([name, arg]) => [\n name,\n { type: arg.type, description: arg.description, required: false },\n ]),\n ),\n});\n\nexport const themesCommand = defineCommand({\n meta: {\n name: \"themes\",\n description: `Sort keywords into the existing ad groups whose theme fits them (Keyword Planner).\n\nExample:\n baker ads google keywords themes --customer-id 1234567890 --keywords \"solar panels,heat pumps\" --ad-groups 111,222`,\n },\n args: ARGS,\n run: async ({ args }) => {\n const customerId = requireCustomerId(args);\n const keywords = listFlag(args.keywords);\n const adGroups = listFlag(args[\"ad-groups\"]);\n if (!keywords?.length || !adGroups?.length) failWriteValidation(\"pass --keywords and --ad-groups\");\n const managerId = getManagerIdForCustomer(customerId);\n try {\n const { data } = await apiPost<{ ok: true; data: GoogleAdGroupThemesResponse }>(\n \"/api/ads/google/keywords/themes\",\n {\n customerId,\n ...(managerId ? { managerId } : {}),\n keywords,\n adGroups,\n },\n );\n const hints =\n data.unusable_ad_groups.length > 0\n ? [\n `${data.unusable_ad_groups.length} ad group(s) gave Google no theme to match against (removed, empty or under a removed campaign) — they received no keywords.`,\n ]\n : [];\n writeJsonEnvelope(hints.length > 0 ? { ok: true, data, hints } : { ok: true, data });\n } catch (err) {\n exitWithServiceReadError(err);\n }\n },\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/commands/ads/google/keywords/themes.ts"],"sourcesContent":["import type { GoogleAdGroupThemesResponse } from \"@baker/api/ads-google\";\nimport { defineCommand } from \"citty\";\nimport { apiPost } from \"../../../../client.ts\";\nimport { registerSchema } from \"../../../../schemas.ts\";\nimport { getManagerIdForCustomer } from \"../../cache.ts\";\nimport { writeJsonEnvelope } from \"../../output.ts\";\nimport { exitWithServiceReadError } from \"../service-read-errors.ts\";\nimport { failWriteValidation, listFlag, requireCustomerId } from \"../write-shared.ts\";\n\nconst ARGS = {\n \"customer-id\": { type: \"string\", description: \"Google Ads customer ID (10 digits; dashes are fine)\" },\n keywords: { type: \"string\", description: \"Comma-separated keywords to place\" },\n \"ad-groups\": {\n type: \"string\",\n description:\n \"Comma-separated existing ad group ids (or resource names) to sort them into — read them with `ad-groups list`\",\n },\n} as const;\n\nregisterSchema({\n command: \"ads.google.keywords.themes\",\n routes: [\"POST /api/ads/google/keywords/themes\"],\n effect: \"read_live\",\n description:\n \"Which existing ad group each keyword belongs in, by Google's reading of the ad groups' themes (Keyword Planner GenerateAdGroupThemes). Start here: `baker ads google keywords themes --customer-id 1234567890 --keywords \\\"solar panels,heat pumps\\\" --ad-groups 111,222`. Returns suggestions (keyword → suggested keyword, match type, ad group) and unusable_ad_groups (ones Google could not read a theme from).\",\n args: Object.fromEntries(\n Object.entries(ARGS).map(([name, arg]) => [\n name,\n { type: arg.type, description: arg.description, required: false },\n ]),\n ),\n});\n\nexport const themesCommand = defineCommand({\n meta: {\n name: \"themes\",\n description: `Sort keywords into the existing ad groups whose theme fits them (Keyword Planner).\n\nExample:\n baker ads google keywords themes --customer-id 1234567890 --keywords \"solar panels,heat pumps\" --ad-groups 111,222`,\n },\n args: ARGS,\n run: async ({ args }) => {\n const customerId = requireCustomerId(args);\n const keywords = listFlag(args.keywords);\n const adGroups = listFlag(args[\"ad-groups\"]);\n if (!keywords?.length || !adGroups?.length) failWriteValidation(\"pass --keywords and --ad-groups\");\n const managerId = getManagerIdForCustomer(customerId);\n try {\n const { data } = await apiPost<{ ok: true; data: GoogleAdGroupThemesResponse }>(\n \"/api/ads/google/keywords/themes\",\n {\n customerId,\n ...(managerId ? { managerId } : {}),\n keywords,\n adGroups,\n },\n );\n const hints =\n data.unusable_ad_groups.length > 0\n ? [\n `${data.unusable_ad_groups.length} ad group(s) gave Google no theme to match against (removed, empty or under a removed campaign) — they received no keywords.`,\n ]\n : [];\n writeJsonEnvelope(hints.length > 0 ? { ok: true, data, hints } : { ok: true, data });\n } catch (err) {\n exitWithServiceReadError(err);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,qBAAqB;AAQ9B,IAAM,OAAO;AAAA,EACX,eAAe,EAAE,MAAM,UAAU,aAAa,sDAAsD;AAAA,EACpG,UAAU,EAAE,MAAM,UAAU,aAAa,oCAAoC;AAAA,EAC7E,aAAa;AAAA,IACX,MAAM;AAAA,IACN,aACE;AAAA,EACJ;AACF;AAEA,eAAe;AAAA,EACb,SAAS;AAAA,EACT,QAAQ,CAAC,sCAAsC;AAAA,EAC/C,QAAQ;AAAA,EACR,aACE;AAAA,EACF,MAAM,OAAO;AAAA,IACX,OAAO,QAAQ,IAAI,EAAE,IAAI,CAAC,CAAC,MAAM,GAAG,MAAM;AAAA,MACxC;AAAA,MACA,EAAE,MAAM,IAAI,MAAM,aAAa,IAAI,aAAa,UAAU,MAAM;AAAA,IAClE,CAAC;AAAA,EACH;AACF,CAAC;AAEM,IAAM,gBAAgB,cAAc;AAAA,EACzC,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA;AAAA;AAAA;AAAA,EAIf;AAAA,EACA,MAAM;AAAA,EACN,KAAK,OAAO,EAAE,KAAK,MAAM;AACvB,UAAM,aAAa,kBAAkB,IAAI;AACzC,UAAM,WAAW,SAAS,KAAK,QAAQ;AACvC,UAAM,WAAW,SAAS,KAAK,WAAW,CAAC;AAC3C,QAAI,CAAC,UAAU,UAAU,CAAC,UAAU,OAAQ,qBAAoB,iCAAiC;AACjG,UAAM,YAAY,wBAAwB,UAAU;AACpD,QAAI;AACF,YAAM,EAAE,KAAK,IAAI,MAAM;AAAA,QACrB;AAAA,QACA;AAAA,UACE;AAAA,UACA,GAAI,YAAY,EAAE,UAAU,IAAI,CAAC;AAAA,UACjC;AAAA,UACA;AAAA,QACF;AAAA,MACF;AACA,YAAM,QACJ,KAAK,mBAAmB,SAAS,IAC7B;AAAA,QACE,GAAG,KAAK,mBAAmB,MAAM;AAAA,MACnC,IACA,CAAC;AACP,wBAAkB,MAAM,SAAS,IAAI,EAAE,IAAI,MAAM,MAAM,MAAM,IAAI,EAAE,IAAI,MAAM,KAAK,CAAC;AAAA,IACrF,SAAS,KAAK;AACZ,+BAAyB,GAAG;AAAA,IAC9B;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
requireTarget,
|
|
6
6
|
stageOp,
|
|
7
7
|
stageOps
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DX4SRYED.js";
|
|
9
|
+
import "./chunk-LVLAFUXQ.js";
|
|
9
10
|
import "./chunk-MTMWOUKN.js";
|
|
10
11
|
import "./chunk-D5FY4FAK.js";
|
|
11
12
|
import "./chunk-7W5KGO5H.js";
|
|
@@ -719,4 +720,4 @@ export {
|
|
|
719
720
|
propertyCommand,
|
|
720
721
|
retentionValue
|
|
721
722
|
};
|
|
722
|
-
//# sourceMappingURL=write-commands-
|
|
723
|
+
//# sourceMappingURL=write-commands-GRBE5V34.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/ga4/write-commands.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { registerSchema } from \"../../schemas.ts\";\nimport { failValidation, loadJsonArg, loadJsonPayloads, requireTarget, stageOp, stageOps } from \"./shared.ts\";\n\n/**\n * Staged write verbs for Google Analytics configuration. Each stages one change\n * onto this chat's draft; nothing reaches the property until the chat completes,\n * and once it does the change is in effect immediately — there is no version to\n * publish and no undo.\n */\n\nconst PROPERTY_ARG_DESCRIPTION =\n \"GA4 property id (optional only when one property is connected — run `baker ga4 properties`)\";\n\nconst propertyArg = { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false } as const;\n\n/**\n * Every `create` takes a JSON array as readily as a single object, and staging\n * the whole list costs one read of the property instead of one per definition.\n * Said in the arg description because that is where the agent looks.\n */\nfunction createJsonDescription(noun: string): string {\n return `Inline JSON ${noun} definition, or a JSON array of them to stage several in one call (all or none)`;\n}\n\nfunction withProperty(args: Record<string, unknown>): Record<string, unknown> {\n return typeof args[\"property-id\"] === \"string\" ? { propertyId: args[\"property-id\"] } : {};\n}\n\n// ---------------------------------------------------------------------------\n// Key events — what GA4 counts as a conversion\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.keyEvent\",\n description:\n \"Mark an event as a key event (what Google Analytics calls a conversion, and what Google Ads imports for bidding), change how it is counted, or stop counting it. Read `baker ga4 config` first: the event has to be one the site actually sends, and marking an automatic event like page_view poisons Smart Bidding.\",\n args: {\n json: { type: \"string\", description: createJsonDescription(\"key-event\"), required: false },\n file: { type: \"string\", description: \"Path to a JSON file with the definition\", required: false },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\nexport const keyEventCommand = defineCommand({\n meta: {\n name: \"key-event\",\n description: `Stage key-event (conversion) changes\n\nExamples:\n baker ga4 key-event create --json '{\"eventName\":\"generate_lead\",\"countingMethod\":\"ONCE_PER_EVENT\"}'\n baker ga4 key-event create --json '{\"eventName\":\"purchase\",\"countingMethod\":\"ONCE_PER_EVENT\",\"defaultValue\":{\"numericValue\":50,\"currencyCode\":\"EUR\"}}'\n baker ga4 key-event create --json '[{…}, {…}]' — several in one call, one read of the property\n baker ga4 key-event update 4185 --json '{\"countingMethod\":\"ONCE_PER_SESSION\"}'\n baker ga4 key-event delete 4185`,\n },\n subCommands: {\n create: defineCommand({\n meta: {\n name: \"create\",\n description:\n \"Stage a new key event. Needs eventName and countingMethod (ONCE_PER_EVENT or ONCE_PER_SESSION); defaultValue sets a monetary value when the event does not send one.\",\n },\n args: {\n json: { type: \"string\", description: createJsonDescription(\"key-event\"), required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const input = args as Record<string, unknown>;\n await stageOps(\n loadJsonPayloads(input).map((payload) => ({\n kind: \"ga4.keyEvent.create\",\n payload,\n ...withProperty(input),\n })),\n );\n },\n }),\n update: defineCommand({\n meta: {\n name: \"update\",\n description:\n \"Stage a change to an existing key event (pass its id). Only countingMethod and defaultValue can change — Google will not rename a key event.\",\n },\n args: {\n id: { type: \"positional\", description: \"Key event id\", required: false },\n json: { type: \"string\", description: \"Inline JSON with the changed fields\", required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"ga4.keyEvent.update\",\n target: requireTarget(args as Record<string, unknown>, \"key event\"),\n payload: loadJsonArg(args as Record<string, unknown>),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n delete: defineCommand({\n meta: {\n name: \"delete\",\n description:\n \"Stage removing a key event, so the event stops counting as a conversion. The event itself keeps being collected. Irreversible once the chat completes — confirm with the user first.\",\n },\n args: {\n id: { type: \"positional\", description: \"Key event id\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"ga4.keyEvent.delete\",\n target: requireTarget(args as Record<string, unknown>, \"key event\"),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n },\n});\n\n// ---------------------------------------------------------------------------\n// Custom dimensions and metrics — making event parameters reportable\n// ---------------------------------------------------------------------------\n\nconst DEFINITIONS = [\n {\n command: \"custom-dimension\",\n kind: \"customDimension\",\n noun: \"custom dimension\",\n createHint:\n \"Needs parameterName (the event parameter the site sends), displayName, and scope (EVENT, USER or ITEM). Until a parameter has a custom dimension, it is collected but cannot be reported on.\",\n example: '{\"parameterName\":\"plan_tier\",\"displayName\":\"Plan tier\",\"scope\":\"EVENT\"}',\n },\n {\n command: \"custom-metric\",\n kind: \"customMetric\",\n noun: \"custom metric\",\n createHint:\n \"Needs parameterName, displayName, scope EVENT and measurementUnit (STANDARD, CURRENCY, SECONDS…). A CURRENCY metric must also declare restrictedMetricType: COST_DATA or REVENUE_DATA.\",\n example:\n '{\"parameterName\":\"deal_value\",\"displayName\":\"Deal value\",\"scope\":\"EVENT\",\"measurementUnit\":\"CURRENCY\",\"restrictedMetricType\":[\"REVENUE_DATA\"]}',\n },\n] as const;\n\nfor (const { kind, noun, createHint } of DEFINITIONS) {\n registerSchema({\n command: `ga4.${kind}`,\n description: `Create, update or archive a Google Analytics ${noun}. ${createHint} Archiving frees the slot and takes it out of reporting; historical data stays. Read \\`baker ga4 config\\` first — a duplicate parameter name is refused.`,\n args: {\n json: { type: \"string\", description: createJsonDescription(noun), required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n });\n}\n\nfunction definitionCommand(definition: (typeof DEFINITIONS)[number]) {\n const { command, kind, noun, example } = definition;\n return defineCommand({\n meta: {\n name: command,\n description: `Stage ${noun} changes\n\nExamples:\n baker ga4 ${command} create --json '${example}'\n baker ga4 ${command} create --json '[${example}, …]' — several in one call, one read of the property\n baker ga4 ${command} update 12 --json '{\"displayName\":\"Renamed\"}'\n baker ga4 ${command} archive 12`,\n },\n subCommands: {\n create: defineCommand({\n meta: { name: \"create\", description: `Stage a new ${noun} (or a JSON array of them, staged together)` },\n args: {\n json: { type: \"string\", description: createJsonDescription(noun), required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const input = args as Record<string, unknown>;\n await stageOps(\n loadJsonPayloads(input).map((payload) => ({\n kind: `ga4.${kind}.create`,\n payload,\n ...withProperty(input),\n })),\n );\n },\n }),\n update: defineCommand({\n meta: {\n name: \"update\",\n description: `Stage a change to an existing ${noun} (pass its id). The parameter name and scope cannot change — archive and recreate for that.`,\n },\n args: {\n id: { type: \"positional\", description: `${noun} id`, required: false },\n json: { type: \"string\", description: \"Inline JSON with the changed fields\", required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: `ga4.${kind}.update`,\n target: requireTarget(args as Record<string, unknown>, noun),\n payload: loadJsonArg(args as Record<string, unknown>),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n archive: defineCommand({\n meta: {\n name: \"archive\",\n description: `Stage archiving a ${noun} (pass its id). It stops collecting and leaves reporting; past data stays. Irreversible once the chat completes — confirm with the user first.`,\n },\n args: {\n id: { type: \"positional\", description: `${noun} id`, required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: `ga4.${kind}.archive`,\n target: requireTarget(args as Record<string, unknown>, noun),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n },\n });\n}\n\nexport const customDimensionCommand = definitionCommand(DEFINITIONS[0]);\nexport const customMetricCommand = definitionCommand(DEFINITIONS[1]);\n\n// ---------------------------------------------------------------------------\n// Custom events — GA4's \"Create event\" rules\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.customEvent\",\n description:\n \"Create a new Google Analytics event out of one the site already sends — the 'Create event' rule in the Analytics interface. Use it to turn a generic event into a meaningful one (a form_submit on the quote page becomes quote_request) so it can be marked a key event. Needs destinationEvent and 1-10 eventConditions; sourceCopyParameters carries the original parameters over.\",\n args: {\n json: { type: \"string\", description: createJsonDescription(\"custom-event rule\"), required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"data-stream\": {\n type: \"string\",\n description: \"Data stream id (optional when the property has one website stream)\",\n required: false,\n },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\nconst CUSTOM_EVENT_EXAMPLE =\n '{\"destinationEvent\":\"quote_request\",\"eventConditions\":[{\"field\":\"event_name\",\"comparisonType\":\"EQUALS\",\"value\":\"form_submit\"},{\"field\":\"page_location\",\"comparisonType\":\"CONTAINS\",\"value\":\"/quote\"}],\"sourceCopyParameters\":true}';\n\nconst dataStreamArg = {\n type: \"string\",\n description: \"Data stream id (optional when the property has one website stream)\",\n required: false,\n} as const;\n\nfunction withStream(args: Record<string, unknown>): Record<string, unknown> {\n return typeof args[\"data-stream\"] === \"string\" ? { dataStream: args[\"data-stream\"] } : {};\n}\n\nexport const customEventCommand = defineCommand({\n meta: {\n name: \"custom-event\",\n description: `Stage custom events — new events built from events the site already sends\n\nExamples:\n baker ga4 custom-event create --json '${CUSTOM_EVENT_EXAMPLE}'\n baker ga4 custom-event update 7 --json '{\"sourceCopyParameters\":false}'\n baker ga4 custom-event delete 7`,\n },\n subCommands: {\n create: defineCommand({\n meta: {\n name: \"create\",\n description:\n \"Stage a new custom event. Conditions match the source event: use field `event_name` to match the event itself, or any parameter name to match its value.\",\n },\n args: {\n json: { type: \"string\", description: createJsonDescription(\"custom event\"), required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"data-stream\": dataStreamArg,\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const input = args as Record<string, unknown>;\n await stageOps(\n loadJsonPayloads(input).map((payload) => ({\n kind: \"ga4.eventCreateRule.create\",\n payload,\n ...withStream(input),\n ...withProperty(input),\n })),\n );\n },\n }),\n update: defineCommand({\n meta: { name: \"update\", description: \"Stage a change to an existing custom event (pass its id)\" },\n args: {\n id: { type: \"positional\", description: \"Custom event rule id\", required: false },\n json: { type: \"string\", description: \"Inline JSON with the changed fields\", required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"data-stream\": dataStreamArg,\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"ga4.eventCreateRule.update\",\n target: requireTarget(args as Record<string, unknown>, \"custom event\"),\n payload: loadJsonArg(args as Record<string, unknown>),\n ...withStream(args as Record<string, unknown>),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n delete: defineCommand({\n meta: {\n name: \"delete\",\n description:\n \"Stage removing a custom event (pass its id). The event stops being created from then on; data already collected under it stays. Confirm with the user first.\",\n },\n args: {\n id: { type: \"positional\", description: \"Custom event rule id\", required: false },\n \"data-stream\": dataStreamArg,\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"ga4.eventCreateRule.delete\",\n target: requireTarget(args as Record<string, unknown>, \"custom event\"),\n ...withStream(args as Record<string, unknown>),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n },\n});\n\n// ---------------------------------------------------------------------------\n// Data retention\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.dataRetention\",\n description:\n \"Set how long Google Analytics keeps event and user data. Standard properties allow 2 or 14 months; longer windows need an Analytics 360 licence. Two months is the default on many properties and makes year-on-year and long-window attribution impossible, so 14 is almost always the right answer.\",\n args: {\n \"event-data\": { type: \"string\", description: \"Months to keep event data: 2, 14, 26, 38 or 50\", required: false },\n \"user-data\": { type: \"string\", description: \"Months to keep user data: 2, 14, 26, 38 or 50\", required: false },\n \"reset-on-activity\": {\n type: \"string\",\n description: \"true|false — restart a user's retention window on every new event from them\",\n required: false,\n },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\n/** Months as the agent (and the Analytics interface) says them → Google's enum. */\nconst RETENTION_BY_MONTHS: Record<string, string> = {\n \"2\": \"TWO_MONTHS\",\n \"14\": \"FOURTEEN_MONTHS\",\n \"26\": \"TWENTY_SIX_MONTHS\",\n \"38\": \"THIRTY_EIGHT_MONTHS\",\n \"50\": \"FIFTY_MONTHS\",\n};\n\nexport function retentionValue(input: string, flag: string): string {\n const normalized = input.trim();\n const mapped =\n RETENTION_BY_MONTHS[normalized] ??\n (Object.values(RETENTION_BY_MONTHS).includes(normalized.toUpperCase()) ? normalized.toUpperCase() : undefined);\n if (!mapped) {\n failValidation(`--${flag} must be one of 2, 14, 26, 38 or 50 (months)`);\n }\n return mapped;\n}\n\nfunction booleanArg(input: string, flag: string): boolean {\n if (input === \"true\") return true;\n if (input === \"false\") return false;\n return failValidation(`--${flag} must be true or false`);\n}\n\nexport const dataRetentionCommand = defineCommand({\n meta: {\n name: \"data-retention\",\n description: `Stage a change to how long Google Analytics keeps data\n\nExamples:\n baker ga4 data-retention set --event-data 14\n baker ga4 data-retention set --event-data 14 --user-data 14 --reset-on-activity true`,\n },\n subCommands: {\n set: defineCommand({\n meta: { name: \"set\", description: \"Stage the retention window (months)\" },\n args: {\n \"event-data\": { type: \"string\", description: \"2, 14, 26, 38 or 50\", required: false },\n \"user-data\": { type: \"string\", description: \"2, 14, 26, 38 or 50\", required: false },\n \"reset-on-activity\": { type: \"string\", description: \"true|false\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const payload: Record<string, unknown> = {};\n if (typeof args[\"event-data\"] === \"string\") {\n payload.eventDataRetention = retentionValue(args[\"event-data\"], \"event-data\");\n }\n if (typeof args[\"user-data\"] === \"string\") {\n payload.userDataRetention = retentionValue(args[\"user-data\"], \"user-data\");\n }\n if (typeof args[\"reset-on-activity\"] === \"string\") {\n payload.resetUserDataOnNewActivity = booleanArg(args[\"reset-on-activity\"], \"reset-on-activity\");\n }\n if (Object.keys(payload).length === 0) {\n failValidation(\"pass at least one of --event-data, --user-data or --reset-on-activity\");\n }\n await stageOp({ kind: \"ga4.dataRetention.update\", payload, ...withProperty(args as Record<string, unknown>) });\n },\n }),\n },\n});\n\n// ---------------------------------------------------------------------------\n// Audiences — who gets retargeted\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.audience\",\n description:\n \"Create an audience (a saved group of users, e.g. everyone who started a demo but never finished), rename one, or archive one. Read `baker ga4 config` first to see the audiences that already exist. Everything that defines who is in an audience — the conditions, the membership window — is frozen the moment it is created and cannot be edited afterwards, so get it right in one go. An audience only reaches Google Ads for retargeting if the property is linked to a Google Ads account.\",\n args: {\n json: { type: \"string\", description: createJsonDescription(\"audience\"), required: false },\n file: { type: \"string\", description: \"Path to a JSON file with the definition\", required: false },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\nexport const audienceCommand = defineCommand({\n meta: {\n name: \"audience\",\n description: `Stage audience changes (saved groups of users, for retargeting and analysis)\n\nThe definition is PERMANENT: conditions and membership window cannot be edited after creation.\nFixing one means archiving it and building a replacement, which does not carry its users over.\n\nExamples:\n # Everyone who visited but never submitted the demo form, kept for 90 days\n baker ga4 audience create --json '{\n \"displayName\":\"Visited without demo\",\n \"description\":\"Reached the site, never submitted the demo form\",\n \"membershipDurationDays\":90,\n \"filterClauses\":[\n {\"clauseType\":\"INCLUDE\",\"simpleFilter\":{\"scope\":\"AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS\",\n \"filterExpression\":{\"eventFilter\":{\"eventName\":\"page_view\"}}}},\n {\"clauseType\":\"EXCLUDE\",\"simpleFilter\":{\"scope\":\"AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS\",\n \"filterExpression\":{\"eventFilter\":{\"eventName\":\"demo_form_submitted\"}}}}\n ]}'\n\n # Everyone who landed on a pricing page\n baker ga4 audience create --json '{\"displayName\":\"Saw pricing\",\"description\":\"Viewed a pricing page\",\n \"membershipDurationDays\":60,\n \"filterClauses\":[{\"clauseType\":\"INCLUDE\",\"simpleFilter\":{\"scope\":\"AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS\",\n \"filterExpression\":{\"dimensionOrMetricFilter\":{\"fieldName\":\"pagePath\",\n \"stringFilter\":{\"matchType\":\"CONTAINS\",\"value\":\"/pricing\"}}}}}]}'\n\n baker ga4 audience update 8813 --json '{\"displayName\":\"Visited without demo (90d)\"}' — name/description only\n baker ga4 audience archive 8813`,\n },\n subCommands: {\n create: defineCommand({\n meta: { name: \"create\", description: createJsonDescription(\"audience\") },\n args: {\n json: { type: \"string\", description: createJsonDescription(\"audience\"), required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const payloads = loadJsonPayloads(args);\n await stageOps(\n payloads.map((payload) => ({\n kind: \"ga4.audience.create\" as const,\n payload,\n ...withProperty(args as Record<string, unknown>),\n })),\n );\n },\n }),\n update: defineCommand({\n meta: {\n name: \"update\",\n description: \"Stage a new name or description (pass the audience id). Who is in it cannot be changed.\",\n },\n args: {\n id: { type: \"positional\", description: \"Audience id\", required: false },\n json: { type: \"string\", description: 'Inline JSON, e.g. {\"displayName\":\"…\"}', required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const target = requireTarget(args, \"audience id\");\n const payload = loadJsonArg(args);\n await stageOp({\n kind: \"ga4.audience.update\",\n target,\n payload,\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n archive: defineCommand({\n meta: {\n name: \"archive\",\n description: \"Stage retiring an audience. Cannot be undone — the users it gathered do not come back.\",\n },\n args: {\n id: { type: \"positional\", description: \"Audience id\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"ga4.audience.archive\",\n target: requireTarget(args, \"audience id\"),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n },\n});\n\n// ---------------------------------------------------------------------------\n// Property settings\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.property\",\n description:\n \"Set the property's name or industry category. The industry decides which businesses Google benchmarks this property against, so a property left on OTHER is being compared to nothing useful. Time zone and currency are deliberately not changeable here — both re-bucket every future day without reprocessing history, so they belong to a person who knows the reporting calendar.\",\n args: {\n name: { type: \"string\", description: \"New property display name\", required: false },\n industry: {\n type: \"string\",\n description: \"Industry category, e.g. TECHNOLOGY, FINANCE, HEALTHCARE, REAL_ESTATE, JOBS_AND_EDUCATION\",\n required: false,\n },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\nexport const propertyCommand = defineCommand({\n meta: {\n name: \"property\",\n description: `Stage a change to the property's own settings\n\nExamples:\n baker ga4 property set --industry TECHNOLOGY\n baker ga4 property set --name \"Acme — Web\" --industry REAL_ESTATE`,\n },\n subCommands: {\n set: defineCommand({\n meta: { name: \"set\", description: \"Stage the property name and/or industry category\" },\n args: {\n name: { type: \"string\", description: \"New property display name\", required: false },\n industry: { type: \"string\", description: \"Industry category, e.g. TECHNOLOGY\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const payload: Record<string, unknown> = {};\n if (typeof args.name === \"string\" && args.name.length > 0) {\n payload.displayName = args.name;\n }\n if (typeof args.industry === \"string\" && args.industry.length > 0) {\n payload.industryCategory = args.industry.trim().toUpperCase();\n }\n if (Object.keys(payload).length === 0) {\n failValidation(\"pass --name, --industry, or both\");\n }\n await stageOp({ kind: \"ga4.property.update\", payload, ...withProperty(args as Record<string, unknown>) });\n },\n }),\n },\n});\n\n// ---------------------------------------------------------------------------\n// Google Ads link — what makes an audience targetable\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.adsLink\",\n description:\n \"Link this Analytics property to a Google Ads account, or unlink it. This is what lets Google Ads import the property's key events for bidding and makes audiences built here targetable — `baker ga4 audit` reports the gap as NO_ADS_LINK. It reaches outside Analytics and moves the client's data between two products, so agree it with the user before staging it.\",\n args: {\n \"customer-id\": {\n type: \"string\",\n description: \"Google Ads customer id, with or without dashes (123-456-7890)\",\n required: false,\n },\n \"ads-personalization\": {\n type: \"string\",\n description: \"true|false — may this property's audiences be used for ads personalisation\",\n required: false,\n },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\nexport const adsLinkCommand = defineCommand({\n meta: {\n name: \"ads-link\",\n description: `Stage linking this property to a Google Ads account\n\nWithout this link, Google Ads imports no key events from the property and audiences built\nhere cannot be retargeted. It moves the client's data between two products — agree it first.\n\nExamples:\n baker ga4 ads-link create --customer-id 123-456-7890\n baker ga4 ads-link create --customer-id 1234567890 --ads-personalization true\n baker ga4 ads-link update L1234 --ads-personalization false\n baker ga4 ads-link delete L1234`,\n },\n subCommands: {\n create: defineCommand({\n meta: { name: \"create\", description: \"Stage linking the property to a Google Ads account\" },\n args: {\n \"customer-id\": { type: \"string\", description: \"Google Ads customer id (123-456-7890)\", required: false },\n \"ads-personalization\": { type: \"string\", description: \"true|false\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const customerId = args[\"customer-id\"];\n if (typeof customerId !== \"string\" || customerId.length === 0) {\n failValidation(\"pass --customer-id, the Google Ads account to link (123-456-7890)\");\n }\n const payload: Record<string, unknown> = { customerId };\n if (typeof args[\"ads-personalization\"] === \"string\") {\n payload.adsPersonalizationEnabled = booleanArg(args[\"ads-personalization\"], \"ads-personalization\");\n }\n await stageOp({ kind: \"ga4.googleAdsLink.create\", payload, ...withProperty(args as Record<string, unknown>) });\n },\n }),\n update: defineCommand({\n meta: {\n name: \"update\",\n description: \"Stage the ads-personalisation setting on an existing link (pass its id)\",\n },\n args: {\n id: { type: \"positional\", description: \"Google Ads link id\", required: false },\n \"ads-personalization\": { type: \"string\", description: \"true|false\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const target = requireTarget(args, \"Google Ads link id\");\n if (typeof args[\"ads-personalization\"] !== \"string\") {\n failValidation(\"pass --ads-personalization true|false — it is the only thing a link update can change\");\n }\n await stageOp({\n kind: \"ga4.googleAdsLink.update\",\n target,\n payload: { adsPersonalizationEnabled: booleanArg(args[\"ads-personalization\"], \"ads-personalization\") },\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n delete: defineCommand({\n meta: {\n name: \"delete\",\n description: \"Stage unlinking. Stops conversion imports and strands every audience on this property.\",\n },\n args: {\n id: { type: \"positional\", description: \"Google Ads link id\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"ga4.googleAdsLink.delete\",\n target: requireTarget(args, \"Google Ads link id\"),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n },\n});\n\n// ---------------------------------------------------------------------------\n// Enhanced measurement — the events GA4 collects without a tag\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.enhancedMeasurement\",\n description:\n \"Turn the automatic web-stream events on or off: scrolls, outbound clicks, site search, video engagement, file downloads, page changes (single-page apps), form interactions. These are collected by Google Analytics itself with no tag to add, so this is usually the cheapest measurement win available. Run `baker ga4 config --full` to see what is on today.\",\n args: {\n scrolls: { type: \"string\", description: \"true|false\", required: false },\n \"outbound-clicks\": { type: \"string\", description: \"true|false\", required: false },\n \"site-search\": { type: \"string\", description: \"true|false — needs --search-parameters\", required: false },\n \"search-parameters\": {\n type: \"string\",\n description: \"URL parameters carrying the search term, e.g. q,s,search,query,keyword\",\n required: false,\n },\n video: { type: \"string\", description: \"true|false\", required: false },\n \"file-downloads\": { type: \"string\", description: \"true|false\", required: false },\n \"page-changes\": { type: \"string\", description: \"true|false — page views in a single-page app\", required: false },\n \"form-interactions\": { type: \"string\", description: \"true|false\", required: false },\n enabled: { type: \"string\", description: \"true|false — the master switch for the whole feature\", required: false },\n \"data-stream\": {\n type: \"string\",\n description: \"Only when the property has several website streams\",\n required: false,\n },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\n/** Flag → the Admin API field it sets. Names verified against the v1alpha discovery document. */\nconst MEASUREMENT_FLAGS: Record<string, string> = {\n enabled: \"streamEnabled\",\n scrolls: \"scrollsEnabled\",\n \"outbound-clicks\": \"outboundClicksEnabled\",\n \"site-search\": \"siteSearchEnabled\",\n video: \"videoEngagementEnabled\",\n \"file-downloads\": \"fileDownloadsEnabled\",\n \"page-changes\": \"pageChangesEnabled\",\n \"form-interactions\": \"formInteractionsEnabled\",\n};\n\nexport const enhancedMeasurementCommand = defineCommand({\n meta: {\n name: \"enhanced-measurement\",\n description: `Stage the automatic events GA4 collects on a website stream\n\nNo tag to add — Google Analytics collects these itself. Usually the cheapest measurement win there is.\n\nExamples:\n baker ga4 enhanced-measurement set --scrolls true --outbound-clicks true --file-downloads true\n baker ga4 enhanced-measurement set --site-search true --search-parameters \"q,s,search,query,keyword\"\n baker ga4 enhanced-measurement set --page-changes true # page views in a single-page app\n baker ga4 enhanced-measurement set --video false`,\n },\n subCommands: {\n set: defineCommand({\n meta: { name: \"set\", description: \"Stage which automatic events the website stream collects\" },\n args: {\n scrolls: { type: \"string\", description: \"true|false\", required: false },\n \"outbound-clicks\": { type: \"string\", description: \"true|false\", required: false },\n \"site-search\": { type: \"string\", description: \"true|false\", required: false },\n \"search-parameters\": { type: \"string\", description: \"e.g. q,s,search,query,keyword\", required: false },\n video: { type: \"string\", description: \"true|false\", required: false },\n \"file-downloads\": { type: \"string\", description: \"true|false\", required: false },\n \"page-changes\": { type: \"string\", description: \"true|false\", required: false },\n \"form-interactions\": { type: \"string\", description: \"true|false\", required: false },\n enabled: { type: \"string\", description: \"true|false — master switch\", required: false },\n \"data-stream\": { type: \"string\", description: \"Stream id, when there are several\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const payload: Record<string, unknown> = {};\n for (const [flag, field] of Object.entries(MEASUREMENT_FLAGS)) {\n const value = args[flag];\n if (typeof value === \"string\") {\n payload[field] = booleanArg(value, flag);\n }\n }\n if (typeof args[\"search-parameters\"] === \"string\" && args[\"search-parameters\"].length > 0) {\n payload.searchQueryParameter = args[\"search-parameters\"];\n }\n if (Object.keys(payload).length === 0) {\n failValidation(\n \"pass at least one setting, e.g. --scrolls true --outbound-clicks true. Run `baker ga4 config --full` to see what is on today.\",\n );\n }\n await stageOp({\n kind: \"ga4.enhancedMeasurement.update\",\n payload,\n ...(typeof args[\"data-stream\"] === \"string\" ? { dataStream: args[\"data-stream\"] } : {}),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAW9B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EAAE,MAAM,UAAU,aAAa,cAAc,UAAU,MAAM;AAAA,QAC7E,qBAAqB,EAAE,MAAM,UAAU,aAAa,cAAc,UAAU,MAAM;AAAA,QAClF,SAAS,EAAE,MAAM,UAAU,aAAa,mCAA8B,UAAU,MAAM;AAAA,QACtF,eAAe,EAAE,MAAM,UAAU,aAAa,qCAAqC,UAAU,MAAM;AAAA,QACnG,eAAe;AAAA,MACjB;AAAA,MACA,KAAK,OAAO,EAAE,KAAK,MAAM;AACvB,cAAM,UAAmC,CAAC;AAC1C,mBAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,iBAAiB,GAAG;AAC7D,gBAAM,QAAQ,KAAK,IAAI;AACvB,cAAI,OAAO,UAAU,UAAU;AAC7B,oBAAQ,KAAK,IAAI,WAAW,OAAO,IAAI;AAAA,UACzC;AAAA,QACF;AACA,YAAI,OAAO,KAAK,mBAAmB,MAAM,YAAY,KAAK,mBAAmB,EAAE,SAAS,GAAG;AACzF,kBAAQ,uBAAuB,KAAK,mBAAmB;AAAA,QACzD;AACA,YAAI,OAAO,KAAK,OAAO,EAAE,WAAW,GAAG;AACrC;AAAA,YACE;AAAA,UACF;AAAA,QACF;AACA,cAAM,QAAQ;AAAA,UACZ,MAAM;AAAA,UACN;AAAA,UACA,GAAI,OAAO,KAAK,aAAa,MAAM,WAAW,EAAE,YAAY,KAAK,aAAa,EAAE,IAAI,CAAC;AAAA,UACrF,GAAG,aAAa,IAA+B;AAAA,QACjD,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AACF,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/commands/ga4/write-commands.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { registerSchema } from \"../../schemas.ts\";\nimport { failValidation, loadJsonArg, loadJsonPayloads, requireTarget, stageOp, stageOps } from \"./shared.ts\";\n\n/**\n * Staged write verbs for Google Analytics configuration. Each stages one change\n * onto this chat's draft; nothing reaches the property until the chat completes,\n * and once it does the change is in effect immediately — there is no version to\n * publish and no undo.\n */\n\nconst PROPERTY_ARG_DESCRIPTION =\n \"GA4 property id (optional only when one property is connected — run `baker ga4 properties`)\";\n\nconst propertyArg = { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false } as const;\n\n/**\n * Every `create` takes a JSON array as readily as a single object, and staging\n * the whole list costs one read of the property instead of one per definition.\n * Said in the arg description because that is where the agent looks.\n */\nfunction createJsonDescription(noun: string): string {\n return `Inline JSON ${noun} definition, or a JSON array of them to stage several in one call (all or none)`;\n}\n\nfunction withProperty(args: Record<string, unknown>): Record<string, unknown> {\n return typeof args[\"property-id\"] === \"string\" ? { propertyId: args[\"property-id\"] } : {};\n}\n\n// ---------------------------------------------------------------------------\n// Key events — what GA4 counts as a conversion\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.keyEvent\",\n description:\n \"Mark an event as a key event (what Google Analytics calls a conversion, and what Google Ads imports for bidding), change how it is counted, or stop counting it. Read `baker ga4 config` first: the event has to be one the site actually sends, and marking an automatic event like page_view poisons Smart Bidding.\",\n args: {\n json: { type: \"string\", description: createJsonDescription(\"key-event\"), required: false },\n file: { type: \"string\", description: \"Path to a JSON file with the definition\", required: false },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\nexport const keyEventCommand = defineCommand({\n meta: {\n name: \"key-event\",\n description: `Stage key-event (conversion) changes\n\nExamples:\n baker ga4 key-event create --json '{\"eventName\":\"generate_lead\",\"countingMethod\":\"ONCE_PER_EVENT\"}'\n baker ga4 key-event create --json '{\"eventName\":\"purchase\",\"countingMethod\":\"ONCE_PER_EVENT\",\"defaultValue\":{\"numericValue\":50,\"currencyCode\":\"EUR\"}}'\n baker ga4 key-event create --json '[{…}, {…}]' — several in one call, one read of the property\n baker ga4 key-event update 4185 --json '{\"countingMethod\":\"ONCE_PER_SESSION\"}'\n baker ga4 key-event delete 4185`,\n },\n subCommands: {\n create: defineCommand({\n meta: {\n name: \"create\",\n description:\n \"Stage a new key event. Needs eventName and countingMethod (ONCE_PER_EVENT or ONCE_PER_SESSION); defaultValue sets a monetary value when the event does not send one.\",\n },\n args: {\n json: { type: \"string\", description: createJsonDescription(\"key-event\"), required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const input = args as Record<string, unknown>;\n await stageOps(\n loadJsonPayloads(input).map((payload) => ({\n kind: \"ga4.keyEvent.create\",\n payload,\n ...withProperty(input),\n })),\n );\n },\n }),\n update: defineCommand({\n meta: {\n name: \"update\",\n description:\n \"Stage a change to an existing key event (pass its id). Only countingMethod and defaultValue can change — Google will not rename a key event.\",\n },\n args: {\n id: { type: \"positional\", description: \"Key event id\", required: false },\n json: { type: \"string\", description: \"Inline JSON with the changed fields\", required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"ga4.keyEvent.update\",\n target: requireTarget(args as Record<string, unknown>, \"key event\"),\n payload: loadJsonArg(args as Record<string, unknown>),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n delete: defineCommand({\n meta: {\n name: \"delete\",\n description:\n \"Stage removing a key event, so the event stops counting as a conversion. The event itself keeps being collected. Irreversible once the chat completes — confirm with the user first.\",\n },\n args: {\n id: { type: \"positional\", description: \"Key event id\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"ga4.keyEvent.delete\",\n target: requireTarget(args as Record<string, unknown>, \"key event\"),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n },\n});\n\n// ---------------------------------------------------------------------------\n// Custom dimensions and metrics — making event parameters reportable\n// ---------------------------------------------------------------------------\n\nconst DEFINITIONS = [\n {\n command: \"custom-dimension\",\n kind: \"customDimension\",\n noun: \"custom dimension\",\n createHint:\n \"Needs parameterName (the event parameter the site sends), displayName, and scope (EVENT, USER or ITEM). Until a parameter has a custom dimension, it is collected but cannot be reported on.\",\n example: '{\"parameterName\":\"plan_tier\",\"displayName\":\"Plan tier\",\"scope\":\"EVENT\"}',\n },\n {\n command: \"custom-metric\",\n kind: \"customMetric\",\n noun: \"custom metric\",\n createHint:\n \"Needs parameterName, displayName, scope EVENT and measurementUnit (STANDARD, CURRENCY, SECONDS…). A CURRENCY metric must also declare restrictedMetricType: COST_DATA or REVENUE_DATA.\",\n example:\n '{\"parameterName\":\"deal_value\",\"displayName\":\"Deal value\",\"scope\":\"EVENT\",\"measurementUnit\":\"CURRENCY\",\"restrictedMetricType\":[\"REVENUE_DATA\"]}',\n },\n] as const;\n\nfor (const { kind, noun, createHint } of DEFINITIONS) {\n registerSchema({\n command: `ga4.${kind}`,\n description: `Create, update or archive a Google Analytics ${noun}. ${createHint} Archiving frees the slot and takes it out of reporting; historical data stays. Read \\`baker ga4 config\\` first — a duplicate parameter name is refused.`,\n args: {\n json: { type: \"string\", description: createJsonDescription(noun), required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n });\n}\n\nfunction definitionCommand(definition: (typeof DEFINITIONS)[number]) {\n const { command, kind, noun, example } = definition;\n return defineCommand({\n meta: {\n name: command,\n description: `Stage ${noun} changes\n\nExamples:\n baker ga4 ${command} create --json '${example}'\n baker ga4 ${command} create --json '[${example}, …]' — several in one call, one read of the property\n baker ga4 ${command} update 12 --json '{\"displayName\":\"Renamed\"}'\n baker ga4 ${command} archive 12`,\n },\n subCommands: {\n create: defineCommand({\n meta: { name: \"create\", description: `Stage a new ${noun} (or a JSON array of them, staged together)` },\n args: {\n json: { type: \"string\", description: createJsonDescription(noun), required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const input = args as Record<string, unknown>;\n await stageOps(\n loadJsonPayloads(input).map((payload) => ({\n kind: `ga4.${kind}.create`,\n payload,\n ...withProperty(input),\n })),\n );\n },\n }),\n update: defineCommand({\n meta: {\n name: \"update\",\n description: `Stage a change to an existing ${noun} (pass its id). The parameter name and scope cannot change — archive and recreate for that.`,\n },\n args: {\n id: { type: \"positional\", description: `${noun} id`, required: false },\n json: { type: \"string\", description: \"Inline JSON with the changed fields\", required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: `ga4.${kind}.update`,\n target: requireTarget(args as Record<string, unknown>, noun),\n payload: loadJsonArg(args as Record<string, unknown>),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n archive: defineCommand({\n meta: {\n name: \"archive\",\n description: `Stage archiving a ${noun} (pass its id). It stops collecting and leaves reporting; past data stays. Irreversible once the chat completes — confirm with the user first.`,\n },\n args: {\n id: { type: \"positional\", description: `${noun} id`, required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: `ga4.${kind}.archive`,\n target: requireTarget(args as Record<string, unknown>, noun),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n },\n });\n}\n\nexport const customDimensionCommand = definitionCommand(DEFINITIONS[0]);\nexport const customMetricCommand = definitionCommand(DEFINITIONS[1]);\n\n// ---------------------------------------------------------------------------\n// Custom events — GA4's \"Create event\" rules\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.customEvent\",\n description:\n \"Create a new Google Analytics event out of one the site already sends — the 'Create event' rule in the Analytics interface. Use it to turn a generic event into a meaningful one (a form_submit on the quote page becomes quote_request) so it can be marked a key event. Needs destinationEvent and 1-10 eventConditions; sourceCopyParameters carries the original parameters over.\",\n args: {\n json: { type: \"string\", description: createJsonDescription(\"custom-event rule\"), required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"data-stream\": {\n type: \"string\",\n description: \"Data stream id (optional when the property has one website stream)\",\n required: false,\n },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\nconst CUSTOM_EVENT_EXAMPLE =\n '{\"destinationEvent\":\"quote_request\",\"eventConditions\":[{\"field\":\"event_name\",\"comparisonType\":\"EQUALS\",\"value\":\"form_submit\"},{\"field\":\"page_location\",\"comparisonType\":\"CONTAINS\",\"value\":\"/quote\"}],\"sourceCopyParameters\":true}';\n\nconst dataStreamArg = {\n type: \"string\",\n description: \"Data stream id (optional when the property has one website stream)\",\n required: false,\n} as const;\n\nfunction withStream(args: Record<string, unknown>): Record<string, unknown> {\n return typeof args[\"data-stream\"] === \"string\" ? { dataStream: args[\"data-stream\"] } : {};\n}\n\nexport const customEventCommand = defineCommand({\n meta: {\n name: \"custom-event\",\n description: `Stage custom events — new events built from events the site already sends\n\nExamples:\n baker ga4 custom-event create --json '${CUSTOM_EVENT_EXAMPLE}'\n baker ga4 custom-event update 7 --json '{\"sourceCopyParameters\":false}'\n baker ga4 custom-event delete 7`,\n },\n subCommands: {\n create: defineCommand({\n meta: {\n name: \"create\",\n description:\n \"Stage a new custom event. Conditions match the source event: use field `event_name` to match the event itself, or any parameter name to match its value.\",\n },\n args: {\n json: { type: \"string\", description: createJsonDescription(\"custom event\"), required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"data-stream\": dataStreamArg,\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const input = args as Record<string, unknown>;\n await stageOps(\n loadJsonPayloads(input).map((payload) => ({\n kind: \"ga4.eventCreateRule.create\",\n payload,\n ...withStream(input),\n ...withProperty(input),\n })),\n );\n },\n }),\n update: defineCommand({\n meta: { name: \"update\", description: \"Stage a change to an existing custom event (pass its id)\" },\n args: {\n id: { type: \"positional\", description: \"Custom event rule id\", required: false },\n json: { type: \"string\", description: \"Inline JSON with the changed fields\", required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"data-stream\": dataStreamArg,\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"ga4.eventCreateRule.update\",\n target: requireTarget(args as Record<string, unknown>, \"custom event\"),\n payload: loadJsonArg(args as Record<string, unknown>),\n ...withStream(args as Record<string, unknown>),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n delete: defineCommand({\n meta: {\n name: \"delete\",\n description:\n \"Stage removing a custom event (pass its id). The event stops being created from then on; data already collected under it stays. Confirm with the user first.\",\n },\n args: {\n id: { type: \"positional\", description: \"Custom event rule id\", required: false },\n \"data-stream\": dataStreamArg,\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"ga4.eventCreateRule.delete\",\n target: requireTarget(args as Record<string, unknown>, \"custom event\"),\n ...withStream(args as Record<string, unknown>),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n },\n});\n\n// ---------------------------------------------------------------------------\n// Data retention\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.dataRetention\",\n description:\n \"Set how long Google Analytics keeps event and user data. Standard properties allow 2 or 14 months; longer windows need an Analytics 360 licence. Two months is the default on many properties and makes year-on-year and long-window attribution impossible, so 14 is almost always the right answer.\",\n args: {\n \"event-data\": { type: \"string\", description: \"Months to keep event data: 2, 14, 26, 38 or 50\", required: false },\n \"user-data\": { type: \"string\", description: \"Months to keep user data: 2, 14, 26, 38 or 50\", required: false },\n \"reset-on-activity\": {\n type: \"string\",\n description: \"true|false — restart a user's retention window on every new event from them\",\n required: false,\n },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\n/** Months as the agent (and the Analytics interface) says them → Google's enum. */\nconst RETENTION_BY_MONTHS: Record<string, string> = {\n \"2\": \"TWO_MONTHS\",\n \"14\": \"FOURTEEN_MONTHS\",\n \"26\": \"TWENTY_SIX_MONTHS\",\n \"38\": \"THIRTY_EIGHT_MONTHS\",\n \"50\": \"FIFTY_MONTHS\",\n};\n\nexport function retentionValue(input: string, flag: string): string {\n const normalized = input.trim();\n const mapped =\n RETENTION_BY_MONTHS[normalized] ??\n (Object.values(RETENTION_BY_MONTHS).includes(normalized.toUpperCase()) ? normalized.toUpperCase() : undefined);\n if (!mapped) {\n failValidation(`--${flag} must be one of 2, 14, 26, 38 or 50 (months)`);\n }\n return mapped;\n}\n\nfunction booleanArg(input: string, flag: string): boolean {\n if (input === \"true\") return true;\n if (input === \"false\") return false;\n return failValidation(`--${flag} must be true or false`);\n}\n\nexport const dataRetentionCommand = defineCommand({\n meta: {\n name: \"data-retention\",\n description: `Stage a change to how long Google Analytics keeps data\n\nExamples:\n baker ga4 data-retention set --event-data 14\n baker ga4 data-retention set --event-data 14 --user-data 14 --reset-on-activity true`,\n },\n subCommands: {\n set: defineCommand({\n meta: { name: \"set\", description: \"Stage the retention window (months)\" },\n args: {\n \"event-data\": { type: \"string\", description: \"2, 14, 26, 38 or 50\", required: false },\n \"user-data\": { type: \"string\", description: \"2, 14, 26, 38 or 50\", required: false },\n \"reset-on-activity\": { type: \"string\", description: \"true|false\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const payload: Record<string, unknown> = {};\n if (typeof args[\"event-data\"] === \"string\") {\n payload.eventDataRetention = retentionValue(args[\"event-data\"], \"event-data\");\n }\n if (typeof args[\"user-data\"] === \"string\") {\n payload.userDataRetention = retentionValue(args[\"user-data\"], \"user-data\");\n }\n if (typeof args[\"reset-on-activity\"] === \"string\") {\n payload.resetUserDataOnNewActivity = booleanArg(args[\"reset-on-activity\"], \"reset-on-activity\");\n }\n if (Object.keys(payload).length === 0) {\n failValidation(\"pass at least one of --event-data, --user-data or --reset-on-activity\");\n }\n await stageOp({ kind: \"ga4.dataRetention.update\", payload, ...withProperty(args as Record<string, unknown>) });\n },\n }),\n },\n});\n\n// ---------------------------------------------------------------------------\n// Audiences — who gets retargeted\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.audience\",\n description:\n \"Create an audience (a saved group of users, e.g. everyone who started a demo but never finished), rename one, or archive one. Read `baker ga4 config` first to see the audiences that already exist. Everything that defines who is in an audience — the conditions, the membership window — is frozen the moment it is created and cannot be edited afterwards, so get it right in one go. An audience only reaches Google Ads for retargeting if the property is linked to a Google Ads account.\",\n args: {\n json: { type: \"string\", description: createJsonDescription(\"audience\"), required: false },\n file: { type: \"string\", description: \"Path to a JSON file with the definition\", required: false },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\nexport const audienceCommand = defineCommand({\n meta: {\n name: \"audience\",\n description: `Stage audience changes (saved groups of users, for retargeting and analysis)\n\nThe definition is PERMANENT: conditions and membership window cannot be edited after creation.\nFixing one means archiving it and building a replacement, which does not carry its users over.\n\nExamples:\n # Everyone who visited but never submitted the demo form, kept for 90 days\n baker ga4 audience create --json '{\n \"displayName\":\"Visited without demo\",\n \"description\":\"Reached the site, never submitted the demo form\",\n \"membershipDurationDays\":90,\n \"filterClauses\":[\n {\"clauseType\":\"INCLUDE\",\"simpleFilter\":{\"scope\":\"AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS\",\n \"filterExpression\":{\"eventFilter\":{\"eventName\":\"page_view\"}}}},\n {\"clauseType\":\"EXCLUDE\",\"simpleFilter\":{\"scope\":\"AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS\",\n \"filterExpression\":{\"eventFilter\":{\"eventName\":\"demo_form_submitted\"}}}}\n ]}'\n\n # Everyone who landed on a pricing page\n baker ga4 audience create --json '{\"displayName\":\"Saw pricing\",\"description\":\"Viewed a pricing page\",\n \"membershipDurationDays\":60,\n \"filterClauses\":[{\"clauseType\":\"INCLUDE\",\"simpleFilter\":{\"scope\":\"AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS\",\n \"filterExpression\":{\"dimensionOrMetricFilter\":{\"fieldName\":\"pagePath\",\n \"stringFilter\":{\"matchType\":\"CONTAINS\",\"value\":\"/pricing\"}}}}}]}'\n\n baker ga4 audience update 8813 --json '{\"displayName\":\"Visited without demo (90d)\"}' — name/description only\n baker ga4 audience archive 8813`,\n },\n subCommands: {\n create: defineCommand({\n meta: { name: \"create\", description: createJsonDescription(\"audience\") },\n args: {\n json: { type: \"string\", description: createJsonDescription(\"audience\"), required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const payloads = loadJsonPayloads(args);\n await stageOps(\n payloads.map((payload) => ({\n kind: \"ga4.audience.create\" as const,\n payload,\n ...withProperty(args as Record<string, unknown>),\n })),\n );\n },\n }),\n update: defineCommand({\n meta: {\n name: \"update\",\n description: \"Stage a new name or description (pass the audience id). Who is in it cannot be changed.\",\n },\n args: {\n id: { type: \"positional\", description: \"Audience id\", required: false },\n json: { type: \"string\", description: 'Inline JSON, e.g. {\"displayName\":\"…\"}', required: false },\n file: { type: \"string\", description: \"Path to a JSON file\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const target = requireTarget(args, \"audience id\");\n const payload = loadJsonArg(args);\n await stageOp({\n kind: \"ga4.audience.update\",\n target,\n payload,\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n archive: defineCommand({\n meta: {\n name: \"archive\",\n description: \"Stage retiring an audience. Cannot be undone — the users it gathered do not come back.\",\n },\n args: {\n id: { type: \"positional\", description: \"Audience id\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"ga4.audience.archive\",\n target: requireTarget(args, \"audience id\"),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n },\n});\n\n// ---------------------------------------------------------------------------\n// Property settings\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.property\",\n description:\n \"Set the property's name or industry category. The industry decides which businesses Google benchmarks this property against, so a property left on OTHER is being compared to nothing useful. Time zone and currency are deliberately not changeable here — both re-bucket every future day without reprocessing history, so they belong to a person who knows the reporting calendar.\",\n args: {\n name: { type: \"string\", description: \"New property display name\", required: false },\n industry: {\n type: \"string\",\n description: \"Industry category, e.g. TECHNOLOGY, FINANCE, HEALTHCARE, REAL_ESTATE, JOBS_AND_EDUCATION\",\n required: false,\n },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\nexport const propertyCommand = defineCommand({\n meta: {\n name: \"property\",\n description: `Stage a change to the property's own settings\n\nExamples:\n baker ga4 property set --industry TECHNOLOGY\n baker ga4 property set --name \"Acme — Web\" --industry REAL_ESTATE`,\n },\n subCommands: {\n set: defineCommand({\n meta: { name: \"set\", description: \"Stage the property name and/or industry category\" },\n args: {\n name: { type: \"string\", description: \"New property display name\", required: false },\n industry: { type: \"string\", description: \"Industry category, e.g. TECHNOLOGY\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const payload: Record<string, unknown> = {};\n if (typeof args.name === \"string\" && args.name.length > 0) {\n payload.displayName = args.name;\n }\n if (typeof args.industry === \"string\" && args.industry.length > 0) {\n payload.industryCategory = args.industry.trim().toUpperCase();\n }\n if (Object.keys(payload).length === 0) {\n failValidation(\"pass --name, --industry, or both\");\n }\n await stageOp({ kind: \"ga4.property.update\", payload, ...withProperty(args as Record<string, unknown>) });\n },\n }),\n },\n});\n\n// ---------------------------------------------------------------------------\n// Google Ads link — what makes an audience targetable\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.adsLink\",\n description:\n \"Link this Analytics property to a Google Ads account, or unlink it. This is what lets Google Ads import the property's key events for bidding and makes audiences built here targetable — `baker ga4 audit` reports the gap as NO_ADS_LINK. It reaches outside Analytics and moves the client's data between two products, so agree it with the user before staging it.\",\n args: {\n \"customer-id\": {\n type: \"string\",\n description: \"Google Ads customer id, with or without dashes (123-456-7890)\",\n required: false,\n },\n \"ads-personalization\": {\n type: \"string\",\n description: \"true|false — may this property's audiences be used for ads personalisation\",\n required: false,\n },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\nexport const adsLinkCommand = defineCommand({\n meta: {\n name: \"ads-link\",\n description: `Stage linking this property to a Google Ads account\n\nWithout this link, Google Ads imports no key events from the property and audiences built\nhere cannot be retargeted. It moves the client's data between two products — agree it first.\n\nExamples:\n baker ga4 ads-link create --customer-id 123-456-7890\n baker ga4 ads-link create --customer-id 1234567890 --ads-personalization true\n baker ga4 ads-link update L1234 --ads-personalization false\n baker ga4 ads-link delete L1234`,\n },\n subCommands: {\n create: defineCommand({\n meta: { name: \"create\", description: \"Stage linking the property to a Google Ads account\" },\n args: {\n \"customer-id\": { type: \"string\", description: \"Google Ads customer id (123-456-7890)\", required: false },\n \"ads-personalization\": { type: \"string\", description: \"true|false\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const customerId = args[\"customer-id\"];\n if (typeof customerId !== \"string\" || customerId.length === 0) {\n failValidation(\"pass --customer-id, the Google Ads account to link (123-456-7890)\");\n }\n const payload: Record<string, unknown> = { customerId };\n if (typeof args[\"ads-personalization\"] === \"string\") {\n payload.adsPersonalizationEnabled = booleanArg(args[\"ads-personalization\"], \"ads-personalization\");\n }\n await stageOp({ kind: \"ga4.googleAdsLink.create\", payload, ...withProperty(args as Record<string, unknown>) });\n },\n }),\n update: defineCommand({\n meta: {\n name: \"update\",\n description: \"Stage the ads-personalisation setting on an existing link (pass its id)\",\n },\n args: {\n id: { type: \"positional\", description: \"Google Ads link id\", required: false },\n \"ads-personalization\": { type: \"string\", description: \"true|false\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const target = requireTarget(args, \"Google Ads link id\");\n if (typeof args[\"ads-personalization\"] !== \"string\") {\n failValidation(\"pass --ads-personalization true|false — it is the only thing a link update can change\");\n }\n await stageOp({\n kind: \"ga4.googleAdsLink.update\",\n target,\n payload: { adsPersonalizationEnabled: booleanArg(args[\"ads-personalization\"], \"ads-personalization\") },\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n delete: defineCommand({\n meta: {\n name: \"delete\",\n description: \"Stage unlinking. Stops conversion imports and strands every audience on this property.\",\n },\n args: {\n id: { type: \"positional\", description: \"Google Ads link id\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"ga4.googleAdsLink.delete\",\n target: requireTarget(args, \"Google Ads link id\"),\n ...withProperty(args as Record<string, unknown>),\n });\n },\n }),\n },\n});\n\n// ---------------------------------------------------------------------------\n// Enhanced measurement — the events GA4 collects without a tag\n// ---------------------------------------------------------------------------\n\nregisterSchema({\n command: \"ga4.enhancedMeasurement\",\n description:\n \"Turn the automatic web-stream events on or off: scrolls, outbound clicks, site search, video engagement, file downloads, page changes (single-page apps), form interactions. These are collected by Google Analytics itself with no tag to add, so this is usually the cheapest measurement win available. Run `baker ga4 config --full` to see what is on today.\",\n args: {\n scrolls: { type: \"string\", description: \"true|false\", required: false },\n \"outbound-clicks\": { type: \"string\", description: \"true|false\", required: false },\n \"site-search\": { type: \"string\", description: \"true|false — needs --search-parameters\", required: false },\n \"search-parameters\": {\n type: \"string\",\n description: \"URL parameters carrying the search term, e.g. q,s,search,query,keyword\",\n required: false,\n },\n video: { type: \"string\", description: \"true|false\", required: false },\n \"file-downloads\": { type: \"string\", description: \"true|false\", required: false },\n \"page-changes\": { type: \"string\", description: \"true|false — page views in a single-page app\", required: false },\n \"form-interactions\": { type: \"string\", description: \"true|false\", required: false },\n enabled: { type: \"string\", description: \"true|false — the master switch for the whole feature\", required: false },\n \"data-stream\": {\n type: \"string\",\n description: \"Only when the property has several website streams\",\n required: false,\n },\n \"property-id\": { type: \"string\", description: PROPERTY_ARG_DESCRIPTION, required: false },\n },\n});\n\n/** Flag → the Admin API field it sets. Names verified against the v1alpha discovery document. */\nconst MEASUREMENT_FLAGS: Record<string, string> = {\n enabled: \"streamEnabled\",\n scrolls: \"scrollsEnabled\",\n \"outbound-clicks\": \"outboundClicksEnabled\",\n \"site-search\": \"siteSearchEnabled\",\n video: \"videoEngagementEnabled\",\n \"file-downloads\": \"fileDownloadsEnabled\",\n \"page-changes\": \"pageChangesEnabled\",\n \"form-interactions\": \"formInteractionsEnabled\",\n};\n\nexport const enhancedMeasurementCommand = defineCommand({\n meta: {\n name: \"enhanced-measurement\",\n description: `Stage the automatic events GA4 collects on a website stream\n\nNo tag to add — Google Analytics collects these itself. Usually the cheapest measurement win there is.\n\nExamples:\n baker ga4 enhanced-measurement set --scrolls true --outbound-clicks true --file-downloads true\n baker ga4 enhanced-measurement set --site-search true --search-parameters \"q,s,search,query,keyword\"\n baker ga4 enhanced-measurement set --page-changes true # page views in a single-page app\n baker ga4 enhanced-measurement set --video false`,\n },\n subCommands: {\n set: defineCommand({\n meta: { name: \"set\", description: \"Stage which automatic events the website stream collects\" },\n args: {\n scrolls: { type: \"string\", description: \"true|false\", required: false },\n \"outbound-clicks\": { type: \"string\", description: \"true|false\", required: false },\n \"site-search\": { type: \"string\", description: \"true|false\", required: false },\n \"search-parameters\": { type: \"string\", description: \"e.g. q,s,search,query,keyword\", required: false },\n video: { type: \"string\", description: \"true|false\", required: false },\n \"file-downloads\": { type: \"string\", description: \"true|false\", required: false },\n \"page-changes\": { type: \"string\", description: \"true|false\", required: false },\n \"form-interactions\": { type: \"string\", description: \"true|false\", required: false },\n enabled: { type: \"string\", description: \"true|false — master switch\", required: false },\n \"data-stream\": { type: \"string\", description: \"Stream id, when there are several\", required: false },\n \"property-id\": propertyArg,\n },\n run: async ({ args }) => {\n const payload: Record<string, unknown> = {};\n for (const [flag, field] of Object.entries(MEASUREMENT_FLAGS)) {\n const value = args[flag];\n if (typeof value === \"string\") {\n payload[field] = booleanArg(value, flag);\n }\n }\n if (typeof args[\"search-parameters\"] === \"string\" && args[\"search-parameters\"].length > 0) {\n payload.searchQueryParameter = args[\"search-parameters\"];\n }\n if (Object.keys(payload).length === 0) {\n failValidation(\n \"pass at least one setting, e.g. --scrolls true --outbound-clicks true. Run `baker ga4 config --full` to see what is on today.\",\n );\n }\n await stageOp({\n kind: \"ga4.enhancedMeasurement.update\",\n payload,\n ...(typeof args[\"data-stream\"] === \"string\" ?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5
|
+
} from "./chunk-ENTB4ILS.js";
|
|
6
|
+
import "./chunk-LVLAFUXQ.js";
|
|
6
7
|
import "./chunk-MTMWOUKN.js";
|
|
7
8
|
import "./chunk-D5FY4FAK.js";
|
|
8
9
|
import "./chunk-7W5KGO5H.js";
|
|
@@ -204,4 +205,4 @@ export {
|
|
|
204
205
|
triggerCommand,
|
|
205
206
|
variableCommand
|
|
206
207
|
};
|
|
207
|
-
//# sourceMappingURL=write-commands-
|
|
208
|
+
//# sourceMappingURL=write-commands-MZUVJBGO.js.map
|