@koda-sl/baker-cli 0.851.0-dev.914922aaf → 0.852.0-dev.0fbe16456
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 +4 -1
- package/dist/{activities-NWXWO7T2.js → activities-SUUW5KH7.js} +3 -3
- package/dist/{ads-EUQYHCBO.js → ads-2O3DC7ZM.js} +12 -5
- package/dist/ads-2O3DC7ZM.js.map +1 -0
- package/dist/{ads-BYETTX2Y.js → ads-DJHUXK2O.js} +2 -2
- package/dist/{adsets-CZFTSQQC.js → adsets-PMEPGGAI.js} +3 -3
- package/dist/{audiences-SDFCRXHD.js → audiences-Y6UFKHZ5.js} +3 -3
- package/dist/{campaigns-4JY3JKPY.js → campaigns-RNPLAVXM.js} +3 -3
- package/dist/{chunk-S2WUFUSW.js → chunk-GN6X5C57.js} +4 -3
- package/dist/chunk-GN6X5C57.js.map +1 -0
- package/dist/{chunk-DKRPMGEN.js → chunk-PRPSV4VB.js} +17 -1
- package/dist/chunk-PRPSV4VB.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{creatives-Q3DWV55N.js → creatives-OTKJRMBJ.js} +3 -3
- package/dist/{hubspot-XZYXZ24P.js → hubspot-W5LYFWTH.js} +4 -10
- package/dist/hubspot-W5LYFWTH.js.map +1 -0
- package/dist/{leads-UTBT62TH.js → leads-DAXPX7V5.js} +3 -2
- package/dist/leads-DAXPX7V5.js.map +1 -0
- package/dist/{meta-2ZQ3CWLF.js → meta-GSTM6EBD.js} +10 -10
- package/dist/{targeting-T2HTV2OD.js → targeting-HIXQGQ7A.js} +2 -2
- package/package.json +1 -1
- package/dist/ads-EUQYHCBO.js.map +0 -1
- package/dist/chunk-DKRPMGEN.js.map +0 -1
- package/dist/chunk-S2WUFUSW.js.map +0 -1
- package/dist/hubspot-XZYXZ24P.js.map +0 -1
- package/dist/leads-UTBT62TH.js.map +0 -1
- /package/dist/{activities-NWXWO7T2.js.map → activities-SUUW5KH7.js.map} +0 -0
- /package/dist/{ads-BYETTX2Y.js.map → ads-DJHUXK2O.js.map} +0 -0
- /package/dist/{adsets-CZFTSQQC.js.map → adsets-PMEPGGAI.js.map} +0 -0
- /package/dist/{audiences-SDFCRXHD.js.map → audiences-Y6UFKHZ5.js.map} +0 -0
- /package/dist/{campaigns-4JY3JKPY.js.map → campaigns-RNPLAVXM.js.map} +0 -0
- /package/dist/{creatives-Q3DWV55N.js.map → creatives-OTKJRMBJ.js.map} +0 -0
- /package/dist/{meta-2ZQ3CWLF.js.map → meta-GSTM6EBD.js.map} +0 -0
- /package/dist/{targeting-T2HTV2OD.js.map → targeting-HIXQGQ7A.js.map} +0 -0
package/README.md
CHANGED
|
@@ -1464,6 +1464,9 @@ baker ads meta ads --account-id act_123 --all-statuses --name-contains octubre -
|
|
|
1464
1464
|
# "Where do the live ads send people, with which UTMs?" — one call: each row carries its creative's link and url_tags
|
|
1465
1465
|
baker ads meta ads --account-id act_123 --fields id,name,link,url_tags
|
|
1466
1466
|
|
|
1467
|
+
# "Which ads use this instant form?" — one call: each row carries the form its button opens (lead_form_id)
|
|
1468
|
+
baker ads meta ads --account-id act_123 --lead-form 987654321 --all-statuses
|
|
1469
|
+
|
|
1467
1470
|
# "Check these five ads" — Meta returns only the ids named, whatever their status
|
|
1468
1471
|
# (campaigns, adsets and audiences take --ids too); --fields is what Meta is asked for
|
|
1469
1472
|
baker ads meta ads --ids 6123,6124,6125 --fields id,name,effective_status
|
|
@@ -5283,7 +5286,7 @@ baker hubspot meetings view <slug> --as-node # the form.external blob for a f
|
|
|
5283
5286
|
**`contacts summary` flags:** `--days <1-365>` (default 30) over contact creation date. Returns counts only — total contacts, how many have an owner, and the lifecycle-stage split — never a name or an email. `truncated: true` means the page budget ran out, so the counts are floors.
|
|
5284
5287
|
**`contacts lookup`:** positional `<email>`; returns that contact's lifecycle stage, owner, the account (company) it was filed under, and associated deals with their stage. `dealsReadable: false` / `companyReadable: false` mean the connection does not cover deals or accounts, so an empty `deals` or a null `company` is unknown rather than absent. `found: false` means no contact with that email — the lead never reached the CRM, which is a finding rather than an error. `--properties utm_campaign,utm_source` (up to 25) also returns those contact properties under `contact.properties`, each value or `null`; a name the account does not define is left out and named in a hint.
|
|
5285
5288
|
**`contacts properties`:** no flags; returns every contact property with a closed list of values — `{ name, label, groupName, options: [{ value, label }] }` — the ones a HubSpot-read source can watch. Names are HubSpot's internal ones; hand them to `baker analytics sources --create-hubspot --property <name> --value <value>` as printed. No personal data.
|
|
5286
|
-
**`meetings list` flags:** `--search <text
|
|
5289
|
+
**`meetings list` flags:** `--search <text>`, `--redirecting-only`.
|
|
5287
5290
|
**`meetings view`:** positional `<slug>` — the only reliable source for a calendar's booking fields (HubSpot omits `customParams` from the list endpoint, so `fieldCount: null` there means unknown, not zero); `--as-node` as above.
|
|
5288
5291
|
|
|
5289
5292
|
**`HUBSPOT_RECONNECT_REQUIRED`** is returned when HubSpot is connected but that account never granted access to what the command needs — a HubSpot grant is fixed at the moment the user approves it, so an account connected before a capability shipped cannot serve it. It is not the same as `NO_HUBSPOT_CONNECTION`: the connection works, and only the user can widen it by reconnecting from Brain → Integrations → Platforms. The error carries a `fix` describing exactly that.
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
registerMetaListSchema,
|
|
4
4
|
shapeMetaListRows,
|
|
5
5
|
writeMetaListRows
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-GN6X5C57.js";
|
|
7
|
+
import "./chunk-PRPSV4VB.js";
|
|
8
8
|
import {
|
|
9
9
|
csvOrJson,
|
|
10
10
|
handleMetaError,
|
|
@@ -81,4 +81,4 @@ Examples:
|
|
|
81
81
|
export {
|
|
82
82
|
activitiesCommand
|
|
83
83
|
};
|
|
84
|
-
//# sourceMappingURL=activities-
|
|
84
|
+
//# sourceMappingURL=activities-SUUW5KH7.js.map
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
registerMetaListSchema,
|
|
7
7
|
shapeMetaListRows,
|
|
8
8
|
writeMetaListRows
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-GN6X5C57.js";
|
|
10
|
+
import "./chunk-PRPSV4VB.js";
|
|
11
11
|
import {
|
|
12
12
|
NAME_CONTAINS_ARG,
|
|
13
13
|
csvOrJson,
|
|
@@ -44,13 +44,17 @@ var listArgs = {
|
|
|
44
44
|
"all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
|
|
45
45
|
"name-contains": NAME_CONTAINS_ARG,
|
|
46
46
|
ids: IDS_ARG,
|
|
47
|
+
"lead-form": {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "Only the ads whose button opens this instant form (a form id from `baker ads meta lead-forms`). Add --all-statuses to count paused ones too. Example: --lead-form 1290001 --all-statuses"
|
|
50
|
+
},
|
|
47
51
|
limit: { type: "string", description: "Max rows (default 1000)" },
|
|
48
52
|
"no-cache": NO_CACHE_ARG,
|
|
49
53
|
...META_LIST_SHAPE_ARGS
|
|
50
54
|
};
|
|
51
55
|
registerMetaListSchema(
|
|
52
56
|
"ads",
|
|
53
|
-
`List ads in a Meta ad account, as a table by default: id, name, adset_id, campaign_id, effective_status, creative_id, issues (why an ad is WITH_ISSUES), created_time, plus each creative's link (destination) and url_tags \u2014 audit live ads' tracking in this one call, not a creatives call per ad. Start here: baker ads meta ads --adset-id 6123. --fields takes dotted paths (e.g. id,tracking_specs); --full returns every field Meta sent; --output json returns the rows in the envelope. ${ACCOUNT_SELECTION}`,
|
|
57
|
+
`List ads in a Meta ad account, as a table by default: id, name, adset_id, campaign_id, effective_status, creative_id, issues (why an ad is WITH_ISSUES), created_time, plus each creative's link (destination), lead_form_id (the instant form its button opens) and url_tags \u2014 audit live ads' tracking in this one call, not a creatives call per ad. Which ads use a form: --lead-form <id> --all-statuses. Start here: baker ads meta ads --adset-id 6123. --fields takes dotted paths (e.g. id,tracking_specs); --full returns every field Meta sent; --output json returns the rows in the envelope. ${ACCOUNT_SELECTION}`,
|
|
54
58
|
listArgs
|
|
55
59
|
);
|
|
56
60
|
var listCommand = defineCommand({
|
|
@@ -69,6 +73,7 @@ var listCommand = defineCommand({
|
|
|
69
73
|
if (effectiveStatus) params["effective-status"] = effectiveStatus;
|
|
70
74
|
if (args["name-contains"]) params["name-contains"] = args["name-contains"];
|
|
71
75
|
if (args.ids) params.ids = args.ids;
|
|
76
|
+
if (args["lead-form"]) params["lead-form"] = args["lead-form"];
|
|
72
77
|
const fields = metaListFields("ads", args);
|
|
73
78
|
if (fields) params.fields = fields;
|
|
74
79
|
if (args.limit) params.limit = args.limit;
|
|
@@ -94,7 +99,8 @@ ${ACCOUNT_SELECTION}
|
|
|
94
99
|
The dashboard shows effective_status (e.g. WITH_ISSUES, PENDING_REVIEW, DISAPPROVED, ADSET_PAUSED), not status.
|
|
95
100
|
|
|
96
101
|
Listings print a table by default: id, name, adset_id, campaign_id, effective_status, creative_id, issues
|
|
97
|
-
(why an ad is WITH_ISSUES), created_time, and the creative's link (destination)
|
|
102
|
+
(why an ad is WITH_ISSUES), created_time, and the creative's link (destination), lead_form_id (the instant form it opens)
|
|
103
|
+
and url_tags. --fields takes dotted paths (e.g. tracking_specs,
|
|
98
104
|
preview_shareable_link); --full returns every field; --output json returns the rows as JSON.
|
|
99
105
|
|
|
100
106
|
Examples:
|
|
@@ -103,6 +109,7 @@ Examples:
|
|
|
103
109
|
baker ads meta ads --account-id act_123 --all-statuses --name-contains octubre --fields id,name,adset_id,creative_id \u2014 find one ad by name
|
|
104
110
|
baker ads meta ads --adset-id 6123 --fields id,name,preview_shareable_link
|
|
105
111
|
baker ads meta ads --ids 6123,6124 \u2014 the ads you have ids for, any status
|
|
112
|
+
baker ads meta ads --account-id act_123 --lead-form 1290001 --all-statuses \u2014 the ads that open one instant form
|
|
106
113
|
baker ads meta ads create --name "Ad 1" --adset meta_temp_as01 --creative meta_temp_cr01
|
|
107
114
|
baker ads meta ads pause 6123 --account-id act_123
|
|
108
115
|
baker ads meta ads retag 6123 --set "utm_medium=paid-social" \u2014 fix tracking on a LIVE ad, keeping everything else`
|
|
@@ -129,4 +136,4 @@ Examples:
|
|
|
129
136
|
export {
|
|
130
137
|
adsListCommand
|
|
131
138
|
};
|
|
132
|
-
//# sourceMappingURL=ads-
|
|
139
|
+
//# sourceMappingURL=ads-2O3DC7ZM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/ads/meta/ads.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { NO_CACHE_ARG } from \"../../../cache-flag.ts\";\nimport { apiGet } from \"../../../client.ts\";\nimport {\n IDS_ARG,\n largeListingHints,\n META_LIST_SHAPE_ARGS,\n metaListFields,\n registerMetaListSchema,\n shapeMetaListRows,\n writeMetaListRows,\n} from \"./list-rows.ts\";\nimport {\n csvOrJson,\n handleMetaError,\n NAME_CONTAINS_ARG,\n resolveAccountIdArg,\n resolveEffectiveStatus,\n statusFilterHints,\n} from \"./shared.ts\";\n\nconst ACCOUNT_SELECTION =\n \"Account: --account-id, else BAKER_META_AD_ACCOUNT_ID, else the company's only connected Meta ad account. With several connected it refuses with MISSING_ACCOUNT_ID listing each — re-run naming one.\";\n\nconst listArgs = {\n \"account-id\": {\n type: \"string\",\n description:\n \"Meta ad account ID (act_123). Optional when the company connected only one account (or BAKER_META_AD_ACCOUNT_ID is set); required when several are connected.\",\n },\n \"adset-id\": { type: \"string\", alias: \"adset\", description: \"Filter to one adset\" },\n \"campaign-id\": { type: \"string\", alias: \"campaign\", description: \"Filter to one campaign\" },\n \"effective-status\": { type: \"string\", description: \"Comma-separated effective_status filter (overrides default)\" },\n \"all-statuses\": { type: \"boolean\", description: \"Drop the default ACTIVE filter\" },\n \"name-contains\": NAME_CONTAINS_ARG,\n ids: IDS_ARG,\n \"lead-form\": {\n type: \"string\",\n description:\n \"Only the ads whose button opens this instant form (a form id from `baker ads meta lead-forms`). Add --all-statuses to count paused ones too. Example: --lead-form 1290001 --all-statuses\",\n },\n limit: { type: \"string\", description: \"Max rows (default 1000)\" },\n \"no-cache\": NO_CACHE_ARG,\n ...META_LIST_SHAPE_ARGS,\n} as const;\n\nregisterMetaListSchema(\n \"ads\",\n `List ads in a Meta ad account, as a table by default: id, name, adset_id, campaign_id, effective_status, creative_id, issues (why an ad is WITH_ISSUES), created_time, plus each creative's link (destination), lead_form_id (the instant form its button opens) and url_tags — audit live ads' tracking in this one call, not a creatives call per ad. Which ads use a form: --lead-form <id> --all-statuses. Start here: baker ads meta ads --adset-id 6123. --fields takes dotted paths (e.g. id,tracking_specs); --full returns every field Meta sent; --output json returns the rows in the envelope. ${ACCOUNT_SELECTION}`,\n listArgs,\n);\n\nconst listCommand = defineCommand({\n meta: {\n name: \"list\",\n description: `List ads in a Meta ad account. Runs by default when no subcommand is given. ${ACCOUNT_SELECTION} Example: baker ads meta ads --account-id act_123`,\n },\n args: listArgs,\n run: async ({ args }) => {\n const accountId = await resolveAccountIdArg(args);\n const effectiveStatus = resolveEffectiveStatus(args);\n try {\n const params: Record<string, string> = { \"account-id\": accountId };\n if (args[\"adset-id\"]) params[\"adset-id\"] = args[\"adset-id\"] as string;\n if (args[\"campaign-id\"]) params[\"campaign-id\"] = args[\"campaign-id\"] as string;\n if (effectiveStatus) params[\"effective-status\"] = effectiveStatus;\n if (args[\"name-contains\"]) params[\"name-contains\"] = args[\"name-contains\"] as string;\n if (args.ids) params.ids = args.ids as string;\n if (args[\"lead-form\"]) params[\"lead-form\"] = args[\"lead-form\"] as string;\n const fields = metaListFields(\"ads\", args);\n if (fields) params.fields = fields;\n if (args.limit) params.limit = args.limit as string;\n if (args[\"no-cache\"]) params[\"skip-cache\"] = \"true\";\n const data = await apiGet<Array<Record<string, unknown>>>(\"/api/ads/meta/ads\", params);\n const shaped = shapeMetaListRows(\"ads\", data, args);\n writeMetaListRows(\"ads\", shaped, csvOrJson(args), [\n ...statusFilterHints(data, effectiveStatus, \"ads\"),\n ...largeListingHints(\"ads\", data.length),\n ]);\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nexport const adsListCommand = defineCommand({\n meta: {\n name: \"ads\",\n description: `List ads in a Meta ad account, or stage writes (create/update/pause/resume/archive/delete/duplicate/copy/retag).\nDefaults to ACTIVE only — pass --all-statuses to widen. Write subcommands stage ops on this chat's draft.\n${ACCOUNT_SELECTION}\n\nThe dashboard shows effective_status (e.g. WITH_ISSUES, PENDING_REVIEW, DISAPPROVED, ADSET_PAUSED), not status.\n\nListings print a table by default: id, name, adset_id, campaign_id, effective_status, creative_id, issues\n(why an ad is WITH_ISSUES), created_time, and the creative's link (destination), lead_form_id (the instant form it opens)\nand url_tags. --fields takes dotted paths (e.g. tracking_specs,\npreview_shareable_link); --full returns every field; --output json returns the rows as JSON.\n\nExamples:\n baker ads meta ads --account-id act_123\n baker ads meta ads --adset-id 6123\n baker ads meta ads --account-id act_123 --all-statuses --name-contains octubre --fields id,name,adset_id,creative_id — find one ad by name\n baker ads meta ads --adset-id 6123 --fields id,name,preview_shareable_link\n baker ads meta ads --ids 6123,6124 — the ads you have ids for, any status\n baker ads meta ads --account-id act_123 --lead-form 1290001 --all-statuses — the ads that open one instant form\n baker ads meta ads create --name \"Ad 1\" --adset meta_temp_as01 --creative meta_temp_cr01\n baker ads meta ads pause 6123 --account-id act_123\n baker ads meta ads retag 6123 --set \"utm_medium=paid-social\" — fix tracking on a LIVE ad, keeping everything else`,\n },\n subCommands: {\n list: listCommand,\n create: () => import(\"./write-commands.ts\").then((m) => m.adsCreateCommand),\n update: () => import(\"./write-commands.ts\").then((m) => m.adsUpdateCommand),\n pause: () => import(\"./write-commands.ts\").then((m) => m.adsPauseCommand),\n resume: () => import(\"./write-commands.ts\").then((m) => m.adsResumeCommand),\n archive: () => import(\"./write-commands.ts\").then((m) => m.adsArchiveCommand),\n delete: () => import(\"./write-commands.ts\").then((m) => m.adsDeleteCommand),\n duplicate: () => import(\"./write-commands.ts\").then((m) => m.adsDuplicateCommand),\n copy: () => import(\"./copy-writes.ts\").then((m) => m.adsCopyCommand),\n retag: () => import(\"./write-commands.ts\").then((m) => m.adsRetagCommand),\n },\n // `args` stays even though the parent has no `run`: citty scans rawArgs for the\n // subcommand name using THIS command's arg defs, so without them `--account-id act_1`\n // would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare\n // invocation — citty falls through to `run` after a subcommand, double-executing it.\n args: listArgs,\n default: \"list\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAqB9B,IAAM,oBACJ;AAEF,IAAM,WAAW;AAAA,EACf,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,aACE;AAAA,EACJ;AAAA,EACA,YAAY,EAAE,MAAM,UAAU,OAAO,SAAS,aAAa,sBAAsB;AAAA,EACjF,eAAe,EAAE,MAAM,UAAU,OAAO,YAAY,aAAa,yBAAyB;AAAA,EAC1F,oBAAoB,EAAE,MAAM,UAAU,aAAa,8DAA8D;AAAA,EACjH,gBAAgB,EAAE,MAAM,WAAW,aAAa,iCAAiC;AAAA,EACjF,iBAAiB;AAAA,EACjB,KAAK;AAAA,EACL,aAAa;AAAA,IACX,MAAM;AAAA,IACN,aACE;AAAA,EACJ;AAAA,EACA,OAAO,EAAE,MAAM,UAAU,aAAa,0BAA0B;AAAA,EAChE,YAAY;AAAA,EACZ,GAAG;AACL;AAEA;AAAA,EACE;AAAA,EACA,mlBAA8kB,iBAAiB;AAAA,EAC/lB;AACF;AAEA,IAAM,cAAc,cAAc;AAAA,EAChC,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aAAa,+EAA+E,iBAAiB;AAAA,EAC/G;AAAA,EACA,MAAM;AAAA,EACN,KAAK,OAAO,EAAE,KAAK,MAAM;AACvB,UAAM,YAAY,MAAM,oBAAoB,IAAI;AAChD,UAAM,kBAAkB,uBAAuB,IAAI;AACnD,QAAI;AACF,YAAM,SAAiC,EAAE,cAAc,UAAU;AACjE,UAAI,KAAK,UAAU,EAAG,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BAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,eAAe;AAAA,IACxE,QAAQ,MAAM,OAAO,8BAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,gBAAgB;AAAA,IAC1E,SAAS,MAAM,OAAO,8BAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,iBAAiB;AAAA,IAC5E,QAAQ,MAAM,OAAO,8BAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,gBAAgB;AAAA,IAC1E,WAAW,MAAM,OAAO,8BAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,mBAAmB;AAAA,IAChF,MAAM,MAAM,OAAO,2BAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,cAAc;AAAA,IACnE,OAAO,MAAM,OAAO,8BAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,eAAe;AAAA,EAC1E;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM;AAAA,EACN,SAAS;AACX,CAAC;","names":[]}
|
|
@@ -34,7 +34,7 @@ Full guides: __tooling__/docs/tools/baker/ads-<platform>.md (google|meta|linkedi
|
|
|
34
34
|
},
|
|
35
35
|
subCommands: {
|
|
36
36
|
google: () => import("./google-GBGLPAP5.js").then((m) => m.googleCommand),
|
|
37
|
-
meta: () => import("./meta-
|
|
37
|
+
meta: () => import("./meta-GSTM6EBD.js").then((m) => m.metaCommand),
|
|
38
38
|
linkedin: () => import("./linkedin-BD63QPGK.js").then((m) => m.linkedinCommand),
|
|
39
39
|
x: () => import("./x-WVWMOUAQ.js").then((m) => m.xCommand),
|
|
40
40
|
chatgpt: () => import("./chatgpt-DPLD452Q.js").then((m) => m.chatgptCommand),
|
|
@@ -45,4 +45,4 @@ Full guides: __tooling__/docs/tools/baker/ads-<platform>.md (google|meta|linkedi
|
|
|
45
45
|
export {
|
|
46
46
|
adsCommand
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=ads-
|
|
48
|
+
//# sourceMappingURL=ads-DJHUXK2O.js.map
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
registerMetaListSchema,
|
|
15
15
|
shapeMetaListRows,
|
|
16
16
|
writeMetaListRows
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-GN6X5C57.js";
|
|
18
|
+
import "./chunk-PRPSV4VB.js";
|
|
19
19
|
import {
|
|
20
20
|
NAME_CONTAINS_ARG,
|
|
21
21
|
csvOrJson,
|
|
@@ -195,4 +195,4 @@ Examples:
|
|
|
195
195
|
export {
|
|
196
196
|
adsetsCommand
|
|
197
197
|
};
|
|
198
|
-
//# sourceMappingURL=adsets-
|
|
198
|
+
//# sourceMappingURL=adsets-PMEPGGAI.js.map
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
registerMetaListSchema,
|
|
5
5
|
shapeMetaListRows,
|
|
6
6
|
writeMetaListRows
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-GN6X5C57.js";
|
|
8
|
+
import "./chunk-PRPSV4VB.js";
|
|
9
9
|
import {
|
|
10
10
|
csvOrJson,
|
|
11
11
|
handleMetaError,
|
|
@@ -114,4 +114,4 @@ Examples:
|
|
|
114
114
|
export {
|
|
115
115
|
audiencesCommand
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=audiences-
|
|
117
|
+
//# sourceMappingURL=audiences-Y6UFKHZ5.js.map
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
registerMetaListSchema,
|
|
7
7
|
shapeMetaListRows,
|
|
8
8
|
writeMetaListRows
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-GN6X5C57.js";
|
|
10
|
+
import "./chunk-PRPSV4VB.js";
|
|
11
11
|
import {
|
|
12
12
|
NAME_CONTAINS_ARG,
|
|
13
13
|
csvOrJson,
|
|
@@ -136,4 +136,4 @@ export {
|
|
|
136
136
|
advantagePlusHints,
|
|
137
137
|
campaignsCommand
|
|
138
138
|
};
|
|
139
|
-
//# sourceMappingURL=campaigns-
|
|
139
|
+
//# sourceMappingURL=campaigns-RNPLAVXM.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
oneOrMany,
|
|
9
9
|
optimizesTo,
|
|
10
10
|
texts
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PRPSV4VB.js";
|
|
12
12
|
import {
|
|
13
13
|
asRecord,
|
|
14
14
|
shapeListRows
|
|
@@ -102,7 +102,7 @@ function diagnostics(row) {
|
|
|
102
102
|
...suggested.length > 0 ? { suggestions: suggested } : {}
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
var AD_WHEN_PRESENT = ["link", "url_tags"];
|
|
105
|
+
var AD_WHEN_PRESENT = ["link", "lead_form_id", "url_tags"];
|
|
106
106
|
function compactAd(row) {
|
|
107
107
|
const creative = asRecord(row.creative);
|
|
108
108
|
const issues = adIssues(row.issues_info);
|
|
@@ -305,6 +305,7 @@ var DERIVED_FROM = {
|
|
|
305
305
|
suggestions: "recommendations",
|
|
306
306
|
creative_id: "creative",
|
|
307
307
|
link: "creative",
|
|
308
|
+
lead_form_id: "creative",
|
|
308
309
|
url_tags: "creative",
|
|
309
310
|
optimizes_to: "promoted_object",
|
|
310
311
|
adset_daily_budget: "adsets",
|
|
@@ -396,4 +397,4 @@ export {
|
|
|
396
397
|
META_LIST_SHAPE_ARGS,
|
|
397
398
|
registerMetaListSchema
|
|
398
399
|
};
|
|
399
|
-
//# sourceMappingURL=chunk-
|
|
400
|
+
//# sourceMappingURL=chunk-GN6X5C57.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/ads/meta/list-rows.ts"],"sourcesContent":["import {\n AUDIENCE_SIZE_NOT_REPORTED,\n AUDIENCE_SIZE_NOTE,\n adCreativeColumns,\n adSetBudgetColumns,\n audienceColumns,\n creativeLink,\n oneOrMany,\n optimizesTo,\n texts,\n} from \"@baker/api/ads-meta/listColumns\";\nimport type { CommandRoute } from \"@baker/api/cli-catalog/entry\";\nimport { registerSchema } from \"../../../schemas.ts\";\nimport { asRecord, type CompactProjection, type ShapedRows, shapeListRows } from \"../list-rows.ts\";\nimport { writeAdsOutput } from \"../output.ts\";\n\n/**\n * The compact row of each Meta listing. The backend asks Graph for every field a\n * write or an audit might need (targeting, tracking specs, three status fields),\n * and 100 campaigns or two days of activity passed through whole ran to 55–78 KB.\n * A compact row carries what an agent decides with; `--fields` reaches any other\n * path and `--full` returns the record Graph sent.\n *\n * `effective_status` is the one status kept: it is what Ads Manager shows, and\n * `status`/`configured_status` only restate the toggle it already folds in.\n *\n * Listings print a table by default: keyed JSON repeats every column name on\n * every row, and 100 campaigns stayed near 30 KB even compact. `--output json`\n * returns the same rows in the envelope.\n */\n\ntype MetaRow = Record<string, unknown>;\n\nexport type MetaListKind = \"campaigns\" | \"adsets\" | \"ads\" | \"activities\" | \"audiences\" | \"creatives\";\n\nfunction pick(row: MetaRow, keys: readonly string[]): MetaRow {\n const picked: MetaRow = {};\n for (const key of keys) {\n if (row[key] !== undefined) picked[key] = row[key];\n }\n return picked;\n}\n\n/**\n * An account's campaign list is the widest listing an agent reads (100+ rows), so\n * its row is the narrowest: what a campaign is called, whether it runs and what\n * it spends. Objective, bid strategy and Special Ad Category are one `--fields`\n * away; the creation day is enough to order by, and `--fields created_time` has\n * the timestamp.\n */\nconst CAMPAIGN_COLUMNS = [\"id\", \"name\", \"effective_status\", \"daily_budget\", \"lifetime_budget\", \"created_date\"] as const;\n\n/** Why delivery stops and what Meta suggests: columns only when a row has one. */\nconst DIAGNOSTIC_COLUMNS = [\"issues\", \"suggestions\"] as const;\n\n/**\n * A campaign budgeted on its ad sets has no budget of its own, so its row marks\n * `budget_level: adset` and carries the sum of its active ad sets' budgets\n * (`adSetBudgetColumns`).\n */\nconst ADSET_BUDGET_COLUMNS = [\"budget_level\", \"adset_daily_budget\", \"adset_lifetime_budget\"] as const;\nconst CAMPAIGN_WHEN_PRESENT = [...ADSET_BUDGET_COLUMNS, ...DIAGNOSTIC_COLUMNS] as const;\n\nfunction compactCampaign(row: MetaRow): MetaRow {\n const created = row.created_time;\n return {\n ...pick(row, [\"id\", \"name\", \"effective_status\", \"daily_budget\", \"lifetime_budget\"]),\n ...(typeof created === \"string\" ? { created_date: created.slice(0, 10) } : {}),\n ...adSetBudgetColumns(row),\n ...diagnostics(row),\n };\n}\n\nconst ADSET_KEYS = [\n \"id\",\n \"name\",\n \"campaign_id\",\n \"effective_status\",\n \"optimization_goal\",\n \"billing_event\",\n \"bid_strategy\",\n \"daily_budget\",\n \"lifetime_budget\",\n \"destination_type\",\n // A Dynamic Creative ad set refuses every new ad, which changes the plan before anything is staged.\n \"is_dynamic_creative\",\n] as const;\n\nconst ADSET_COLUMNS = [...ADSET_KEYS, \"learning_stage\", \"end_time\", \"created_time\"] as const;\nconst ADSET_WHEN_PRESENT = [\"optimizes_to\", ...DIAGNOSTIC_COLUMNS] as const;\n\nfunction compactAdSet(row: MetaRow): MetaRow {\n const learning = asRecord(row.learning_stage_info)?.status;\n const optimizes = optimizesTo(row.promoted_object);\n return {\n ...pick(row, ADSET_KEYS),\n ...(typeof learning === \"string\" ? { learning_stage: learning } : {}),\n ...pick(row, [\"end_time\", \"created_time\"]),\n ...(optimizes !== undefined ? { optimizes_to: optimizes } : {}),\n ...diagnostics(row),\n };\n}\n\nconst AD_COLUMNS = [\n \"id\",\n \"name\",\n \"adset_id\",\n \"campaign_id\",\n \"effective_status\",\n \"creative_id\",\n \"issues\",\n \"created_time\",\n] as const;\n\n/** Why an ad is WITH_ISSUES — the one reason to open `issues_info`, in its own words. */\nfunction adIssues(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.flatMap((entry) => {\n const issue = asRecord(entry);\n const text = issue?.error_summary ?? issue?.error_message;\n return typeof text === \"string\" && text ? [text] : [];\n });\n}\n\n/** Meta's suggestions for a campaign or ad set (`recommendations`), by their titles. */\nfunction suggestions(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value.flatMap((entry) => {\n const recommendation = asRecord(entry);\n const text = recommendation?.title ?? recommendation?.message;\n return typeof text === \"string\" && text ? [text] : [];\n });\n}\n\n/** Why a campaign or ad set cannot deliver, and what Meta suggests — only when Meta says something. */\nfunction diagnostics(row: MetaRow): MetaRow {\n const issues = adIssues(row.issues_info);\n const suggested = suggestions(row.recommendations);\n return {\n ...(issues.length > 0 ? { issues } : {}),\n ...(suggested.length > 0 ? { suggestions: suggested } : {}),\n };\n}\n\n/** Where an ad sends people, the URL parameters it adds and the instant form it opens — read off its creative, which the listing expands. */\nconst AD_WHEN_PRESENT = [\"link\", \"lead_form_id\", \"url_tags\"] as const;\n\nfunction compactAd(row: MetaRow): MetaRow {\n const creative = asRecord(row.creative);\n const issues = adIssues(row.issues_info);\n return {\n ...pick(row, [\"id\", \"name\", \"adset_id\", \"campaign_id\", \"effective_status\"]),\n ...(creative?.id !== undefined ? { creative_id: creative.id } : {}),\n ...(issues.length > 0 ? { issues } : {}),\n ...pick(row, [\"created_time\"]),\n ...adCreativeColumns(creative),\n };\n}\n\nconst ACTIVITY_COLUMNS = [\n \"event_time\",\n \"event_type\",\n \"actor_name\",\n \"object_type\",\n \"object_name\",\n \"object_id\",\n \"change\",\n] as const;\n\nfunction isScalar(value: unknown): value is string | number | null {\n return value === null || typeof value === \"string\" || typeof value === \"number\";\n}\n\n/**\n * `extra_data` is a JSON string whose shape varies by event type and carries most\n * of an activity's bytes (image URLs, whole targeting specs). A status, name,\n * budget or goal change stores its before and after as two plain values — those\n * read as one line; any richer change stays behind `--fields extra_data`.\n */\nexport function activityChange(extraData: unknown): string | undefined {\n if (typeof extraData !== \"string\") return undefined;\n let parsed: unknown;\n try {\n parsed = JSON.parse(extraData);\n } catch {\n return undefined;\n }\n const data = asRecord(parsed);\n // An absent old_value is one this read did not observe, not an unset one — only `null` means \"none\".\n if (!data || !(\"new_value\" in data) || !(\"old_value\" in data)) return undefined;\n const { old_value: before, new_value: after } = data;\n if (!isScalar(before) || !isScalar(after)) return undefined;\n const show = (value: string | number | null) => (value === null ? \"(none)\" : String(value));\n return `${show(before)} → ${show(after)}`;\n}\n\nfunction compactActivity(row: MetaRow): MetaRow {\n const change = activityChange(row.extra_data);\n return {\n ...pick(row, [\"event_time\", \"event_type\", \"actor_name\", \"object_type\", \"object_name\", \"object_id\"]),\n ...(change !== undefined ? { change } : {}),\n };\n}\n\n/**\n * An account can hold hundreds of audiences (one held 414, ~424 KB printed), and a\n * lookup is usually for one of them and its lookalikes. The row says what the audience\n * is, how big (or that Meta did not say), and — only when it is so — that it is still\n * processing, why it cannot be used and which audience a lookalike was built from. Its\n * rule and data source are one `--fields` away.\n */\nconst AUDIENCE_COLUMNS = [\"id\", \"name\", \"subtype\", \"size_min\", \"size_max\", \"retention_days\", \"updated_date\"] as const;\nconst AUDIENCE_WHEN_PRESENT = [\"size\", \"status\", \"delivery\", \"seed_id\"] as const;\n\nfunction compactAudience(row: MetaRow): MetaRow {\n const updated = row.time_updated;\n const delivery = asRecord(row.delivery_status);\n const origin = asRecord(row.lookalike_spec)?.origin;\n const seed = Array.isArray(origin) ? asRecord(origin[0])?.id : undefined;\n return {\n ...pick(row, [\"id\", \"name\", \"subtype\"]),\n ...audienceColumns(row),\n ...pick(row, [\"retention_days\"]),\n ...(typeof updated === \"number\" ? { updated_date: new Date(updated * 1000).toISOString().slice(0, 10) } : {}),\n ...(delivery && delivery.code !== 200 && typeof delivery.description === \"string\"\n ? { delivery: delivery.description }\n : {}),\n ...(seed !== undefined ? { seed_id: seed } : {}),\n };\n}\n\n/**\n * A creative's copy, destination and assets live in one of three places — the\n * top-level fields Meta derives, `object_story_spec`, or a dynamic creative's\n * `asset_feed_spec`, a carousel's cards in `link_data.child_attachments` — next to specs that carry most of its bytes and none of its\n * meaning (`degrees_of_freedom_spec`, per-placement rules, signed image URLs). The\n * row reads each value from wherever the creative keeps it: one value as itself,\n * several (a dynamic creative's variants) as a list.\n */\nconst CREATIVE_COLUMNS = [\n \"id\",\n \"name\",\n \"status\",\n \"object_type\",\n \"dynamic\",\n \"body\",\n \"title\",\n \"description\",\n \"link\",\n \"cta\",\n \"url_tags\",\n \"image_hash\",\n \"video_id\",\n \"page_id\",\n \"instagram_user_id\",\n \"effective_object_story_id\",\n] as const;\n\nfunction compactCreative(row: MetaRow): MetaRow {\n const story = asRecord(row.object_story_spec);\n const link = asRecord(story?.link_data);\n const video = asRecord(story?.video_data);\n const feed = asRecord(row.asset_feed_spec);\n // A carousel's cards: each one's headline, description, destination and media.\n const cards = link?.child_attachments;\n const derived: MetaRow = {\n dynamic: feed ? (typeof feed.optimization_type === \"string\" ? feed.optimization_type : \"ASSET_FEED\") : undefined,\n body: oneOrMany(row.body, link?.message, video?.message, texts(feed?.bodies, \"text\")),\n title: oneOrMany(row.title, link?.name, video?.title, texts(feed?.titles, \"text\"), texts(cards, \"name\")),\n description: oneOrMany(\n link?.description,\n video?.link_description,\n texts(feed?.descriptions, \"text\"),\n texts(cards, \"description\"),\n ),\n link: creativeLink(row),\n cta: oneOrMany(row.call_to_action_type, feed?.call_to_action_types),\n url_tags: row.url_tags,\n image_hash: oneOrMany(\n row.image_hash,\n link?.image_hash,\n video?.image_hash,\n texts(feed?.images, \"hash\"),\n texts(cards, \"image_hash\"),\n ),\n video_id: oneOrMany(row.video_id, video?.video_id, texts(feed?.videos, \"video_id\"), texts(cards, \"video_id\")),\n page_id: story?.page_id,\n instagram_user_id: row.instagram_user_id ?? story?.instagram_user_id,\n effective_object_story_id: row.effective_object_story_id,\n };\n const compact: MetaRow = pick(row, [\"id\", \"name\", \"status\", \"object_type\"]);\n for (const [key, value] of Object.entries(derived)) if (value !== undefined) compact[key] = value;\n return compact;\n}\n\n/**\n * The unit a listing's budgets are in, said once rather than as a column (a\n * 100-campaign table stays small). Meta lists money in the account currency's\n * smallest unit and Baker passes it through unchanged (published reports read\n * it that way), while every money flag takes whole currency. An agent that once\n * took a listed \"8000\" for the flag's unit staged 10,000 EUR a day instead of 100.\n */\nexport function budgetUnitHints(rows: ReadonlyArray<Record<string, unknown>>): string[] {\n const listed = rows\n .flatMap((row) => [row.daily_budget, row.lifetime_budget, row.adset_daily_budget, row.adset_lifetime_budget])\n .map(Number)\n .find((amount) => Number.isFinite(amount) && amount > 0);\n if (listed === undefined) return [];\n const whole = listed / 100;\n return [\n `Budgets here are in the account currency's smallest unit, as Meta sends them: daily_budget ${listed} is ${whole} in EUR or USD (currencies without cents, such as JPY, are not divided). Money flags take whole currency: --daily-budget ${whole}, never ${listed}.`,\n ];\n}\n\n/** Past this many rows a listing is an account read whole, not an answer to a question. */\nconst LARGE_LISTING_ROWS = 100;\n\n/**\n * A large account lists ad sets and ads by the thousand — one listed 1,000 ad\n * sets, 1.4 MB as Meta sent them. Even compact, that table is more than an agent\n * reads to decide, so a long listing says how to ask for the part it needs.\n */\nexport function largeListingHints(kind: \"adsets\" | \"ads\", rowCount: number): string[] {\n if (rowCount < LARGE_LISTING_ROWS) return [];\n const parent = kind === \"ads\" ? \"--campaign-id <id> or --adset-id <id>\" : \"--campaign-id <id>\";\n return [\n `${rowCount} ${NOUNS[kind]} listed. On a large account, ask for the part you need: ${parent} (from baker ads meta campaigns), --effective-status ACTIVE or PAUSED, --name-contains <text>, or --ids <id>,<id>.`,\n ];\n}\n\nconst PROJECTIONS: Record<MetaListKind, CompactProjection<MetaRow>> = {\n campaigns: { row: compactCampaign, columns: CAMPAIGN_COLUMNS, whenPresent: CAMPAIGN_WHEN_PRESENT },\n adsets: { row: compactAdSet, columns: ADSET_COLUMNS, whenPresent: ADSET_WHEN_PRESENT },\n ads: { row: compactAd, columns: AD_COLUMNS, whenPresent: AD_WHEN_PRESENT },\n activities: { row: compactActivity, columns: ACTIVITY_COLUMNS },\n audiences: { row: compactAudience, columns: AUDIENCE_COLUMNS, whenPresent: AUDIENCE_WHEN_PRESENT },\n creatives: { row: compactCreative, columns: CREATIVE_COLUMNS },\n};\n\nexport function shapeMetaListRows(kind: MetaListKind, rows: MetaRow[], args: Record<string, unknown>): ShapedRows {\n const shaped = withheldSizeHint(kind, shapeListRows(rows, args, PROJECTIONS[kind]));\n if (!(kind in COMPACT_SOURCES) || !shaped.hints?.some((hint) => hint.startsWith(\"--fields matched nothing\"))) {\n return shaped;\n }\n // Meta was asked for the named fields only, so the rows cannot show the ones a typo missed.\n return {\n ...shaped,\n hints: [\n ...shaped.hints,\n `Only the fields --fields names are read from Meta, so these rows list no others: --full --limit 1 shows every field ${NOUNS[kind]} carry.`,\n ],\n };\n}\n\n/** A withheld size reads as Meta's placeholder once, not as a number on every row. */\nfunction withheldSizeHint(kind: MetaListKind, shaped: ShapedRows): ShapedRows {\n if (kind !== \"audiences\" || !shaped.rows.some((row) => row.size === AUDIENCE_SIZE_NOT_REPORTED)) return shaped;\n return { ...shaped, hints: [...(shaped.hints ?? []), AUDIENCE_SIZE_NOTE] };\n}\n\ntype ListedKind = \"campaigns\" | \"adsets\" | \"ads\" | \"audiences\";\n\n/** The fields Meta is asked for to build each compact row (and the hints read beside it). */\nconst COMPACT_SOURCES: Record<ListedKind, readonly string[]> = {\n campaigns: [\n \"id\",\n \"name\",\n \"effective_status\",\n \"daily_budget\",\n \"lifetime_budget\",\n \"created_time\",\n \"issues_info\",\n \"recommendations\",\n \"advantage_state_info\",\n \"adsets\",\n ],\n adsets: [\n ...ADSET_KEYS,\n \"learning_stage_info\",\n \"end_time\",\n \"created_time\",\n \"promoted_object\",\n \"issues_info\",\n \"recommendations\",\n ],\n ads: [\"id\", \"name\", \"adset_id\", \"campaign_id\", \"effective_status\", \"creative\", \"issues_info\", \"created_time\"],\n audiences: [\n \"id\",\n \"name\",\n \"subtype\",\n \"approximate_count_lower_bound\",\n \"approximate_count_upper_bound\",\n \"retention_days\",\n \"time_updated\",\n \"delivery_status\",\n \"operation_status\",\n \"lookalike_spec\",\n ],\n};\n\n/** The fields a listing's own hints read, asked for beside any `--fields`. */\nconst HINT_SOURCES: Partial<Record<ListedKind, readonly string[]>> = {\n campaigns: [\"advantage_state_info\"],\n};\n\n/** A compact column `--fields` may name, and the field Meta keeps it in. */\nconst DERIVED_FROM: Record<string, string> = {\n created_date: \"created_time\",\n updated_date: \"time_updated\",\n learning_stage: \"learning_stage_info\",\n issues: \"issues_info\",\n suggestions: \"recommendations\",\n creative_id: \"creative\",\n link: \"creative\",\n lead_form_id: \"creative\",\n url_tags: \"creative\",\n optimizes_to: \"promoted_object\",\n adset_daily_budget: \"adsets\",\n adset_lifetime_budget: \"adsets\",\n budget_level: \"adsets\",\n size_min: \"approximate_count_lower_bound\",\n size_max: \"approximate_count_upper_bound\",\n delivery: \"delivery_status\",\n seed_id: \"lookalike_spec\",\n};\n\n/** Columns only an audience row derives: campaigns, ad sets and ads keep their own `status`. */\nconst DERIVED_FROM_KIND: Partial<Record<ListedKind, Record<string, string>>> = {\n audiences: {\n size: \"approximate_count_lower_bound,approximate_count_upper_bound\",\n status: \"operation_status\",\n },\n};\n\n/**\n * What a listing asks the server to read from Meta: the source of the compact row,\n * or of each `--fields` path (its top-level key), and everything under `--full`.\n * The server read every field it knows of — an account's ads with their creatives\n * and specs ran to 1 MB and past 60 s — for a table that prints a handful.\n */\nexport function metaListFields(kind: ListedKind, args: Record<string, unknown>): string | undefined {\n const paths =\n typeof args.fields === \"string\"\n ? args.fields\n .split(\",\")\n .map((path) => path.trim())\n .filter(Boolean)\n : [];\n if (paths.length > 0) {\n const tops = paths.map((path) => {\n const top = path.split(\".\")[0] ?? path;\n return DERIVED_FROM_KIND[kind]?.[top] ?? DERIVED_FROM[top] ?? top;\n });\n return [...new Set([\"id\", ...tops, ...(HINT_SOURCES[kind] ?? [])])].join(\",\");\n }\n if (args.full) return undefined;\n return COMPACT_SOURCES[kind].join(\",\");\n}\n\n/** Read the named rows by id, matched by Meta — whatever their status, unless one is named. */\nexport const IDS_ARG = {\n type: \"string\",\n description:\n \"Comma-separated ids: only these rows, whatever their status (unless --effective-status names one). Start here when you have the ids: --ids 120250141735400031,120250141735400032\",\n} as const;\n\nconst NOUNS: Record<MetaListKind, string> = {\n campaigns: \"campaigns\",\n adsets: \"ad sets\",\n ads: \"ads\",\n activities: \"activities\",\n audiences: \"audiences\",\n creatives: \"creatives\",\n};\n\n/**\n * A table of no rows prints nothing at all, which reads as a failed call — so an empty\n * listing says so, and says why when a status filter may be hiding rows.\n */\nexport function writeMetaListRows(kind: MetaListKind, shaped: ShapedRows, format: string, hints: string[] = []): void {\n if (format === \"md\" && shaped.rows.length === 0) {\n process.stdout.write(`${hints.length > 0 ? hints.join(\"\\n\") : `No ${NOUNS[kind]} matched.`}\\n`);\n return;\n }\n writeAdsOutput(shaped.rows, format, shaped.fields, [...hints, ...(shaped.hints ?? [])]);\n}\n\n/** The projection flags every Meta listing shares, worded once for help and `baker schema`. */\nexport const META_LIST_SHAPE_ARGS = {\n fields: {\n type: \"string\",\n description: \"CSV of dotted paths to return instead of the compact row, e.g. id,name,targeting.geo_locations\",\n },\n full: { type: \"boolean\", description: \"Return every field Meta sent (targeting, tracking specs, raw extra_data)\" },\n output: {\n type: \"string\",\n description: \"md|json|csv|jsonl — md (default) prints a table; json returns the rows in the { ok, data } envelope\",\n default: \"md\",\n },\n} as const;\n\ninterface ListArgDef {\n type: string;\n description?: string;\n default?: unknown;\n}\n\n/**\n * `baker schema ads.meta.<list>`, read off the same arg defs the command parses,\n * so the introspection an agent checks before a call cannot promise a flag the\n * command refuses — `--full` on `adsets` was guessed three times in one Session.\n */\nexport function registerMetaListSchema(\n kind: MetaListKind,\n description: string,\n args: Record<string, ListArgDef>,\n alsoReads: readonly CommandRoute[] = [],\n): void {\n registerSchema({\n command: `ads.meta.${kind}`,\n // Read live from Meta, for the account named or the only one.\n routes: [`GET /api/ads/meta/${kind}`, \"GET /api/ads/meta/accounts\", ...alsoReads],\n effect: \"read_live\",\n description,\n args: Object.fromEntries(\n Object.entries(args).map(([name, def]) => [\n name,\n {\n type: def.type,\n description: def.description ?? \"\",\n required: false,\n ...(def.default !== undefined ? { default: def.default } : {}),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N,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AACF;AAaO,SAAS,uBACd,MACA,aACA,MACA,YAAqC,CAAC,GAChC;AACN,iBAAe;AAAA,IACb,SAAS,YAAY,IAAI;AAAA;AAAA,IAEzB,QAAQ,CAAC,qBAAqB,IAAI,IAAI,8BAA8B,GAAG,SAAS;AAAA,IAChF,QAAQ;AAAA,IACR;AAAA,IACA,MAAM,OAAO;AAAA,MACX,OAAO,QAAQ,IAAI,EAAE,IAAI,CAAC,CAAC,MAAM,GAAG,MAAM;AAAA,QACxC;AAAA,QACA;AAAA,UACE,MAAM,IAAI;AAAA,UACV,aAAa,IAAI,eAAe;AAAA,UAChC,UAAU;AAAA,UACV,GAAI,IAAI,YAAY,SAAY,EAAE,SAAS,IAAI,QAAQ,IAAI,CAAC;AAAA,QAC9D;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -46,12 +46,28 @@ function creativeLink(creative) {
|
|
|
46
46
|
texts(link?.child_attachments, "link")
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
+
function formOf(source) {
|
|
50
|
+
return record(record(record(source)?.call_to_action)?.value)?.lead_gen_form_id;
|
|
51
|
+
}
|
|
52
|
+
function creativeLeadForm(creative) {
|
|
53
|
+
const story = record(creative.object_story_spec);
|
|
54
|
+
const link = record(story?.link_data);
|
|
55
|
+
const feedButtons = record(creative.asset_feed_spec)?.call_to_actions;
|
|
56
|
+
return oneOrMany(
|
|
57
|
+
formOf(story?.video_data),
|
|
58
|
+
formOf(link),
|
|
59
|
+
Array.isArray(link?.child_attachments) ? link.child_attachments.map(formOf) : [],
|
|
60
|
+
Array.isArray(feedButtons) ? feedButtons.map((button) => record(record(button)?.value)?.lead_gen_form_id) : []
|
|
61
|
+
);
|
|
62
|
+
}
|
|
49
63
|
function adCreativeColumns(creativeValue) {
|
|
50
64
|
const creative = record(creativeValue);
|
|
51
65
|
if (!creative) return {};
|
|
52
66
|
const link = creativeLink(creative);
|
|
67
|
+
const leadForm = creativeLeadForm(creative);
|
|
53
68
|
return {
|
|
54
69
|
...link !== void 0 ? { link } : {},
|
|
70
|
+
...leadForm !== void 0 ? { lead_form_id: leadForm } : {},
|
|
55
71
|
...typeof creative.url_tags === "string" && creative.url_tags ? { url_tags: creative.url_tags } : {}
|
|
56
72
|
};
|
|
57
73
|
}
|
|
@@ -86,4 +102,4 @@ export {
|
|
|
86
102
|
AUDIENCE_SIZE_NOTE,
|
|
87
103
|
audienceColumns
|
|
88
104
|
};
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
105
|
+
//# sourceMappingURL=chunk-PRPSV4VB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../api/src/ads-meta/listColumns.ts"],"sourcesContent":["/**\n * The columns a Meta listing reads off the related object the backend expands in\n * the same Graph request — a campaign's ad sets, an ad set's promoted object, an\n * ad's creative. The CLI's compact rows and the channel engine's live lists both\n * print them, so an agent in either answers the question in one read.\n */\n\ntype Row = Record<string, unknown>;\n\nfunction record(value: unknown): Row | undefined {\n return typeof value === \"object\" && value !== null && !Array.isArray(value) ? (value as Row) : undefined;\n}\n\nexport function texts(value: unknown, key: string): unknown[] {\n return Array.isArray(value) ? value.map((entry) => record(entry)?.[key]) : [];\n}\n\n/** The distinct non-empty strings among the candidates: none, one as itself, or several as a list. */\nexport function oneOrMany(...candidates: unknown[]): string | string[] | undefined {\n const values = [...new Set(candidates.flat().filter((v): v is string => typeof v === \"string\" && v !== \"\"))];\n if (values.length === 0) return undefined;\n return values.length === 1 ? values[0] : values;\n}\n\n/**\n * A campaign budgeted on its ad sets has no budget of its own. Its row says so\n * (`budget_level: adset`) and carries the sum of its ACTIVE ad sets' budgets, in\n * the same unit as `daily_budget` — `0` when every budgeted ad set is paused, so\n * a campaign about to be reactivated never reads as one whose budget is unknown.\n */\nexport function adSetBudgetColumns(campaign: Row): Row {\n if (campaign.daily_budget !== undefined || campaign.lifetime_budget !== undefined) return {};\n const adsets = record(campaign.adsets)?.data;\n if (!Array.isArray(adsets) || adsets.length === 0) return {};\n const budgets = adsets.map(record);\n const column = (key: string) => {\n const amounts = budgets.map((adset) => ({ active: adset?.status === \"ACTIVE\", amount: Number(adset?.[key]) }));\n if (!amounts.some(({ amount }) => Number.isFinite(amount) && amount > 0)) return undefined;\n return String(amounts.reduce((total, { active, amount }) => (active && amount > 0 ? total + amount : total), 0));\n };\n const daily = column(\"daily_budget\");\n const lifetime = column(\"lifetime_budget\");\n return {\n budget_level: \"adset\",\n ...(daily !== undefined ? { adset_daily_budget: daily } : {}),\n ...(lifetime !== undefined ? { adset_lifetime_budget: lifetime } : {}),\n };\n}\n\n/** The conversion a conversion-optimized ad set bids for — its optimization_goal says nothing without it. */\nexport function optimizesTo(promotedObject: unknown): string | undefined {\n const promoted = record(promotedObject);\n if (!promoted) return undefined;\n if (typeof promoted.custom_conversion_id === \"string\") return `custom conversion ${promoted.custom_conversion_id}`;\n const event = promoted.custom_event_str ?? promoted.custom_event_type;\n return typeof event === \"string\" && event ? event : undefined;\n}\n\n/** A creative's destination, from wherever it keeps it: one URL as itself, a dynamic creative's or a carousel's several as a list. */\nexport function creativeLink(creative: Row): string | string[] | undefined {\n const story = record(creative.object_story_spec);\n const link = record(story?.link_data);\n return oneOrMany(\n creative.link_url,\n link?.link,\n record(record(record(story?.video_data)?.call_to_action)?.value)?.link,\n texts(record(creative.asset_feed_spec)?.link_urls, \"website_url\"),\n texts(link?.child_attachments, \"link\"),\n );\n}\n\nfunction formOf(source: unknown): unknown {\n return record(record(record(source)?.call_to_action)?.value)?.lead_gen_form_id;\n}\n\n/**\n * The instant form a creative's button opens, from every place Meta keeps it: a\n * video's or an image's button, a carousel's cards, a dynamic creative's buttons.\n * Meta allows one form per creative, so several is a list only to show it.\n */\nexport function creativeLeadForm(creative: Row): string | string[] | undefined {\n const story = record(creative.object_story_spec);\n const link = record(story?.link_data);\n const feedButtons = record(creative.asset_feed_spec)?.call_to_actions;\n return oneOrMany(\n formOf(story?.video_data),\n formOf(link),\n Array.isArray(link?.child_attachments) ? link.child_attachments.map(formOf) : [],\n Array.isArray(feedButtons) ? feedButtons.map((button) => record(record(button)?.value)?.lead_gen_form_id) : [],\n );\n}\n\n/** Where an ad sends people, the URL parameters it adds and the instant form it opens, read off its expanded creative. */\nexport function adCreativeColumns(creativeValue: unknown): Row {\n const creative = record(creativeValue);\n if (!creative) return {};\n const link = creativeLink(creative);\n const leadForm = creativeLeadForm(creative);\n return {\n ...(link !== undefined ? { link } : {}),\n ...(leadForm !== undefined ? { lead_form_id: leadForm } : {}),\n ...(typeof creative.url_tags === \"string\" && creative.url_tags ? { url_tags: creative.url_tags } : {}),\n };\n}\n\n/**\n * Meta answers `1000`–`1000` (or `-1`, its documented \"inactive lookalike\") when it\n * withholds an audience's size, not when the audience is small: live on\n * act_1342210013621203 (2026-11-11) an empty customer list read 1000–1000 while a\n * 20-person website audience read 20–20.\n */\nexport function metaSizeWithheld(lower: unknown, upper: unknown): boolean {\n return lower === upper && (lower === 1000 || lower === -1);\n}\n\nexport const AUDIENCE_SIZE_NOT_REPORTED = \"not reported by Meta\";\n\nexport const AUDIENCE_SIZE_NOTE =\n \"size: not reported by Meta — Meta answered 1000–1000 (or -1), a placeholder it gives when it withholds a size, not a count: the audience may hold millions or nobody. Judge it by its delivery column (Meta says there when it is too small to use), by reach in insights or by Ads Manager, never as small.\";\n\n/**\n * `operation_status` codes that say nothing about what can be done with the audience\n * next: none reported, Normal, and the two notices about disuse (100 expiring, 450\n * out of date — the audience still delivers). Every other code is the audience\n * still being built (300 Updating, 414 being replaced, 441 populating) or a problem.\n */\nconst SETTLED_OPERATION_CODES: ReadonlySet<unknown> = new Set([0, 100, 200, 450]);\n\n/**\n * An audience's size and the state of its last operation, as a listing prints them:\n * `size_min` / `size_max` when Meta reported a size, `size` when it withheld one, and\n * `status` only while the audience is still processing or Meta reports a problem.\n */\nexport function audienceColumns(audience: Row): Row {\n const lower = audience.approximate_count_lower_bound;\n const upper = audience.approximate_count_upper_bound;\n const operation = record(audience.operation_status);\n return {\n ...(metaSizeWithheld(lower, upper)\n ? { size: AUDIENCE_SIZE_NOT_REPORTED }\n : {\n ...(lower !== undefined ? { size_min: lower } : {}),\n ...(upper !== undefined ? { size_max: upper } : {}),\n }),\n ...(operation && !SETTLED_OPERATION_CODES.has(operation.code) && typeof operation.description === \"string\"\n ? { status: operation.description }\n : {}),\n };\n}\n"],"mappings":";AASA,SAAS,OAAO,OAAiC;AAC/C,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK,IAAK,QAAgB;AACjG;AAEO,SAAS,MAAM,OAAgB,KAAwB;AAC5D,SAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,IAAI,CAAC,UAAU,OAAO,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC;AAC9E;AAGO,SAAS,aAAa,YAAsD;AACjF,QAAM,SAAS,CAAC,GAAG,IAAI,IAAI,WAAW,KAAK,EAAE,OAAO,CAAC,MAAmB,OAAO,MAAM,YAAY,MAAM,EAAE,CAAC,CAAC;AAC3G,MAAI,OAAO,WAAW,EAAG,QAAO;AAChC,SAAO,OAAO,WAAW,IAAI,OAAO,CAAC,IAAI;AAC3C;AAQO,SAAS,mBAAmB,UAAoB;AACrD,MAAI,SAAS,iBAAiB,UAAa,SAAS,oBAAoB,OAAW,QAAO,CAAC;AAC3F,QAAM,SAAS,OAAO,SAAS,MAAM,GAAG;AACxC,MAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,EAAG,QAAO,CAAC;AAC3D,QAAM,UAAU,OAAO,IAAI,MAAM;AACjC,QAAM,SAAS,CAAC,QAAgB;AAC9B,UAAM,UAAU,QAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,OAAO,WAAW,UAAU,QAAQ,OAAO,QAAQ,GAAG,CAAC,EAAE,EAAE;AAC7G,QAAI,CAAC,QAAQ,KAAK,CAAC,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,GAAI,aAAa,CAAC,wBAAwB,IAAI,UAAU,IAAI,KAAK,OAAO,UAAU,gBAAgB,WAC9F,EAAE,QAAQ,UAAU,YAAY,IAChC,CAAC;AAAA,EACP;AACF;","names":[]}
|
package/dist/cli.js
CHANGED
|
@@ -694,7 +694,7 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
|
694
694
|
capabilities: () => import("./capabilities-U53QPNBQ.js").then((m) => m.capabilitiesCommand),
|
|
695
695
|
actions: () => import("./actions-Q7DDN427.js").then((m) => m.actionsCommand),
|
|
696
696
|
"scheduled-agents": () => import("./scheduled-agents-YHZUPS2I.js").then((m) => m.scheduledAgentsCommand),
|
|
697
|
-
ads: () => import("./ads-
|
|
697
|
+
ads: () => import("./ads-DJHUXK2O.js").then((m) => m.adsCommand),
|
|
698
698
|
brand: () => import("./brand-SDDWXOOT.js").then((m) => m.brandCommand),
|
|
699
699
|
analytics: () => import("./analytics-SVV7JZ2J.js").then((m) => m.analyticsCommand),
|
|
700
700
|
experiment: () => import("./experiment-WEWASTVO.js").then((m) => m.experimentCommand),
|
|
@@ -721,7 +721,7 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
|
721
721
|
chats: () => import("./chats-QVGXEYT6.js").then((m) => m.chatsCommand),
|
|
722
722
|
history: () => import("./history-M6VLA7TD.js").then((m) => m.historyCommand),
|
|
723
723
|
credentials: () => import("./credentials-T7F2PFNY.js").then((m) => m.credentialsCommand),
|
|
724
|
-
hubspot: () => import("./hubspot-
|
|
724
|
+
hubspot: () => import("./hubspot-W5LYFWTH.js").then((m) => m.hubspotCommand),
|
|
725
725
|
activecampaign: () => import("./activecampaign-BAWTDTSA.js").then((m) => m.activecampaignCommand),
|
|
726
726
|
pipedrive: () => import("./pipedrive-7AA7ZD7M.js").then((m) => m.pipedriveCommand),
|
|
727
727
|
accounts: () => import("./accounts-FGWJDM52.js").then((m) => m.accountsCommand),
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
registerMetaListSchema,
|
|
4
4
|
shapeMetaListRows,
|
|
5
5
|
writeMetaListRows
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-GN6X5C57.js";
|
|
7
|
+
import "./chunk-PRPSV4VB.js";
|
|
8
8
|
import {
|
|
9
9
|
csvOrJson,
|
|
10
10
|
handleMetaError,
|
|
@@ -116,4 +116,4 @@ Examples:
|
|
|
116
116
|
export {
|
|
117
117
|
creativesCommand
|
|
118
118
|
};
|
|
119
|
-
//# sourceMappingURL=creatives-
|
|
119
|
+
//# sourceMappingURL=creatives-OTKJRMBJ.js.map
|
|
@@ -153,11 +153,7 @@ registerSchema({
|
|
|
153
153
|
command: "hubspot.meetings.list",
|
|
154
154
|
description: "Every HubSpot meeting link (calendar) on the connected account, with just enough to choose one: name, slug, link type (personal / group / round-robin), whether booking redirects somewhere, and how many booking fields it asks for (null = unknown, read it with `meetings view`). Next step is usually `hubspot meetings view <slug> --as-node`, which gives you the blob to write straight into a hubspotMeeting step.",
|
|
155
155
|
args: {
|
|
156
|
-
search: {
|
|
157
|
-
type: "string",
|
|
158
|
-
description: "Case-insensitive match on the meeting name or slug, or a pasted booking link (meetings.hubspot.com/<slug>)",
|
|
159
|
-
required: false
|
|
160
|
-
},
|
|
156
|
+
search: { type: "string", description: "Case-insensitive substring match on the meeting name", required: false },
|
|
161
157
|
"redirecting-only": {
|
|
162
158
|
type: "boolean",
|
|
163
159
|
description: "Only meeting links that redirect after booking",
|
|
@@ -303,7 +299,7 @@ var meetingsListCommand = defineCommand({
|
|
|
303
299
|
description: "List HubSpot meeting links (calendars). Example: baker hubspot meetings list"
|
|
304
300
|
},
|
|
305
301
|
args: {
|
|
306
|
-
search: { type: "string", description: "Match on meeting name
|
|
302
|
+
search: { type: "string", description: "Match on meeting name", required: false },
|
|
307
303
|
"redirecting-only": { type: "boolean", description: "Only links that redirect after booking", required: false }
|
|
308
304
|
},
|
|
309
305
|
run: async ({ args }) => {
|
|
@@ -319,9 +315,7 @@ var meetingsListCommand = defineCommand({
|
|
|
319
315
|
const { meetings } = response.data;
|
|
320
316
|
const hints = [];
|
|
321
317
|
if (meetings.length === 0) {
|
|
322
|
-
hints.push(
|
|
323
|
-
args.search ? `No meeting link's name, slug or booking link matched "${args.search}". Drop --search to see every calendar on the connected account.` : "No meeting links matched. Check the connected HubSpot account."
|
|
324
|
-
);
|
|
318
|
+
hints.push("No meeting links matched. Drop --search, or check the connected HubSpot account.");
|
|
325
319
|
} else {
|
|
326
320
|
hints.push(
|
|
327
321
|
"To put one on a page: `baker hubspot meetings view <slug> --as-node` returns the object to write into the step's form.external."
|
|
@@ -856,4 +850,4 @@ export {
|
|
|
856
850
|
hubspotCommand,
|
|
857
851
|
workflowViewHints
|
|
858
852
|
};
|
|
859
|
-
//# sourceMappingURL=hubspot-
|
|
853
|
+
//# sourceMappingURL=hubspot-W5LYFWTH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/hubspot/index.ts"],"sourcesContent":["import type {\n HubspotContactFieldsListResponse,\n HubspotContactLookupResponse,\n HubspotContactPropertiesListResponse,\n HubspotContactsSummaryResponse,\n HubspotFormSubmissionsResponse,\n HubspotFormsListResponse,\n HubspotFormsViewResponse,\n HubspotMeetingsListResponse,\n HubspotMeetingsViewResponse,\n HubspotPipelinesListResponse,\n HubspotWorkflowsListResponse,\n HubspotWorkflowsViewResponse,\n} from \"@baker/api\";\nimport { HUBSPOT_OPERATORS } from \"@baker/api/event-sources\";\nimport { defineCommand } from \"citty\";\nimport { ApiError, apiPost } from \"../../client.ts\";\nimport { rowsAsData, writeJson } from \"../../output.ts\";\nimport { registerSchema } from \"../../schemas.ts\";\nimport { failNotConnected } from \"./refusal.ts\";\n\nconst EMBED_TYPES = [\"legacy\", \"v4\", \"unknown\"] as const;\n\nfunction assertEmbedType(value: string | undefined): (typeof EMBED_TYPES)[number] | undefined {\n if (value === undefined) {\n return undefined;\n }\n if (!(EMBED_TYPES as readonly string[]).includes(value)) {\n throw new Error(`--embed-type must be one of: ${EMBED_TYPES.join(\"|\")}`);\n }\n return value as (typeof EMBED_TYPES)[number];\n}\n\nregisterSchema({\n command: \"hubspot.forms.list\",\n routes: [\"POST /api/hubspot/forms/list\"],\n effect: \"read_live\",\n description:\n \"Start here for HubSpot forms: every form on the connected account, with just enough to choose one — embed type (legacy vs v4), field count, its post-submit action (inline thank-you vs redirect to a URL), and whether spam prevention (captcha) is on. A form with captcha on can be embedded on a page but can never receive a submission from a Form, so check it before wiring one as a destination. Answers 'which of my forms redirect after submit?' and 'is this form legacy or v4?'. portalId is returned once on meta, not per row. Next step is usually `hubspot forms view <id> --as-node`, which gives you the blob to write straight into a Form step — you do not need request_flow_input for HubSpot.\",\n args: {\n search: { type: \"string\", description: \"Case-insensitive substring match on the form name\", required: false },\n \"redirecting-only\": {\n type: \"boolean\",\n description: \"Only forms whose post-submit action redirects away\",\n required: false,\n default: false,\n },\n \"embed-type\": { type: \"string\", description: \"Filter: legacy|v4|unknown\", required: false, enum: [...EMBED_TYPES] },\n },\n});\n\nregisterSchema({\n command: \"hubspot.forms.view\",\n description:\n \"One HubSpot form in detail: every field (name, label, type, required, hidden, options), the legal-consent mode, the post-submit action, captcha, and language. Read it before wiring a form into a Form (flow) so you know what fields exist to autofill. Add --full for the untouched HubSpot payload, or --as-node to get the object to write into the step's form.external instead.\",\n args: {\n formId: { type: \"positional\", description: \"HubSpot form id (from `baker hubspot forms list`)\", required: true },\n full: { type: \"boolean\", description: \"Include the raw HubSpot payload\", required: false, default: false },\n \"as-node\": {\n type: \"boolean\",\n description:\n \"Emit the resource blob to write into a flow node's form.external, instead of the readable view. Write it into the node yourself; no need for request_flow_input when the account is connected and the form is unambiguous.\",\n required: false,\n default: false,\n },\n },\n});\n\nregisterSchema({\n command: \"hubspot.forms.submissions\",\n routes: [\"POST /api/hubspot/forms/submissions\"],\n effect: \"read_live\",\n description:\n \"How many leads a form actually received over a window, and on which days — the difference between 'this form is live' and 'this form is working'. Start here when asked whether a form or a campaign is producing leads. Returns counts and dates only; the leads' own answers need --full and are personal data, so do not put them in a report. Pair with `hubspot pipelines list` to see whether those leads were then worked.\",\n args: {\n formId: { type: \"positional\", description: \"HubSpot form id (from `baker hubspot forms list`)\", required: true },\n days: { type: \"string\", description: \"Window in days, 1-365 (default 30)\", required: false },\n full: {\n type: \"boolean\",\n description: \"Include each submission's field values — personal data, request only when actually needed\",\n required: false,\n default: false,\n },\n },\n});\n\nregisterSchema({\n command: \"hubspot.contacts.summary\",\n routes: [\"POST /api/hubspot/contacts/summary\"],\n effect: \"read_live\",\n description:\n \"Whether the leads that arrived recently are actually being worked, as counts: how many contacts were created in the window, how many have someone assigned, and how they split across lifecycle stages. This is the 'have these leads been treated?' answer. Returns no names or emails — use `hubspot contacts lookup` for one specific person.\",\n args: {\n days: { type: \"string\", description: \"Window in days, 1-365 (default 30)\", required: false },\n },\n});\n\nregisterSchema({\n command: \"hubspot.contacts.properties\",\n description:\n \"Every contact property a HubSpot event can watch, with its `kind` (select, string, number, date, boolean) — which decides the operators the trigger takes — and, for a select, the `options` its values come from. Start here to make a HubSpot event: pick the property and condition that mean the outcome (a deal won is usually `lifecyclestage` is `customer`, a custom property the client's team sets, or a number crossing a threshold), then `baker analytics sources --create-hubspot --property <name> [--operator <op>] --value <value>…` reads it every five minutes. Names are HubSpot's internal ones; use them as printed.\",\n args: {},\n});\n\nregisterSchema({\n command: \"hubspot.contacts.fields\",\n description:\n \"Every contact property on the connected HubSpot account — name, label, group and HubSpot's type — which is what a HubSpot event's rows can read: `baker analytics sources --create-hubspot … --field email={{work_email}} --field value={{deal_value}} --field currency=EUR`, or `--map` on an existing one. Names are HubSpot's internal ones; use them as printed, and `{{id}}` for the contact's own id. No personal data.\",\n args: {},\n});\n\nregisterSchema({\n command: \"hubspot.contacts.lookup\",\n routes: [\"POST /api/hubspot/contacts/lookup\"],\n effect: \"read_live\",\n description:\n \"One contact by email: lifecycle stage, whether anyone is assigned, its account (company) and deals with their stage — settles whether a lead was picked up. `--properties utm_campaign,utm_source` also reads those into `contact.properties`, to check a form's tracking reached it: each value, or null when empty; a name the account does not define is left out, never null. `found: false` means the lead never reached the CRM at all — that is a finding, not an error. `dealsReadable: false` / `companyReadable: false` mean deals or account details were not readable on this connection, so an empty deals list or a null company is unknown rather than absent.\",\n args: {\n email: { type: \"positional\", description: \"The contact's email address\", required: true },\n properties: {\n type: \"string\",\n description:\n \"Comma-separated contact properties to read, by HubSpot's internal name (up to 25; `baker hubspot contacts fields` lists them): --properties utm_campaign,utm_source\",\n required: false,\n },\n },\n});\n\nregisterSchema({\n command: \"hubspot.workflows.list\",\n description:\n \"Every workflow on the connected account, with whether it is switched on. Read it when auditing what happens to a lead after it is captured — a form wired to a workflow that is off looks connected and does nothing.\",\n args: {\n search: { type: \"string\", description: \"Case-insensitive substring match on the workflow name\", required: false },\n \"enabled-only\": { type: \"boolean\", description: \"Only workflows that are on\", required: false, default: false },\n },\n});\n\nregisterSchema({\n command: \"hubspot.workflows.view\",\n description:\n \"One workflow's actual configuration: what enrols a record, whether it re-enrols, and every step with the property it writes. Read it before saying a workflow is correct — `workflows list` only tells you it exists and whether it is on. Branches come back in HubSpot's order, and on a LIST_BRANCH step that is evaluation order (`order: 1` wins over `order: 2`) — which is where this kind of setup silently breaks: a broad branch placed above a narrow one swallows the records the narrow one was written for, and nothing reports it. A STATIC_BRANCH matches on a value instead, so its order carries no precedence. Steps are NOT in execution order — follow `nextActionId` from step to step. Add --full for the branch filter criteria (which property is compared to which value).\",\n args: {\n workflowId: {\n type: \"positional\",\n description: \"Workflow id (from `baker hubspot workflows list`)\",\n required: true,\n },\n full: {\n type: \"boolean\",\n description: \"Include the raw HubSpot payload — the only place the branch filter criteria can be read\",\n required: false,\n default: false,\n },\n },\n});\n\nregisterSchema({\n command: \"hubspot.pipelines.list\",\n description:\n \"The account's deal pipelines and their stages, in the order they run, each stage with `isClosed` / `isWon` (HubSpot's closed-won is closed with probability 1). Use it to answer where a lead lands once captured and whether it moved — the 'have these leads been worked?' half of a form audit — and to pick the pipeline ids for `hubspot deals list --pipeline`.\",\n args: {},\n});\n\nregisterSchema({\n command: \"hubspot.meetings.list\",\n description:\n \"Every HubSpot meeting link (calendar) on the connected account, with just enough to choose one: name, slug, link type (personal / group / round-robin), whether booking redirects somewhere, and how many booking fields it asks for (null = unknown, read it with `meetings view`). Next step is usually `hubspot meetings view <slug> --as-node`, which gives you the blob to write straight into a hubspotMeeting step.\",\n args: {\n search: { type: \"string\", description: \"Case-insensitive substring match on the meeting name\", required: false },\n \"redirecting-only\": {\n type: \"boolean\",\n description: \"Only meeting links that redirect after booking\",\n required: false,\n default: false,\n },\n },\n});\n\nregisterSchema({\n command: \"hubspot.meetings.view\",\n description:\n \"One HubSpot meeting link in detail: its booking-form fields (name, label, type, required, custom), link, and redirect URL. This is the source of truth for a calendar's fields — the list command cannot see them reliably. Add --as-node to get the object to write into the step's form.external instead.\",\n args: {\n slug: { type: \"positional\", description: \"Meeting slug (from `baker hubspot meetings list`)\", required: true },\n \"as-node\": {\n type: \"boolean\",\n description: \"Emit the resource blob to write into a flow node's form.external, instead of the readable view.\",\n required: false,\n default: false,\n },\n },\n});\n\nconst formsListCommand = defineCommand({\n meta: {\n name: \"list\",\n description:\n \"List HubSpot forms with embed type and post-submit action. Example: baker hubspot forms list --redirecting-only\",\n },\n args: {\n search: { type: \"string\", description: \"Match on form name\", required: false },\n \"redirecting-only\": { type: \"boolean\", description: \"Only forms that redirect on submit\", required: false },\n \"embed-type\": { type: \"string\", description: \"Filter: legacy|v4|unknown\", required: false },\n },\n run: async ({ args }) => {\n try {\n const body: Record<string, unknown> = {};\n if (args.search) {\n body.search = args.search;\n }\n if (args[\"redirecting-only\"]) {\n body.redirectingOnly = true;\n }\n const embedType = assertEmbedType(args[\"embed-type\"]);\n if (embedType) {\n body.embedType = embedType;\n }\n\n const response = await apiPost<HubspotFormsListResponse>(\"/api/hubspot/forms/list\", body, { read: true });\n const { forms } = response.data;\n const redirecting = forms.filter((form) => form.postSubmitAction?.type === \"redirect_url\");\n const hints: string[] = [];\n if (forms.length === 0) {\n hints.push(\"No forms matched. Drop --search/--embed-type, or check the connected HubSpot account.\");\n } else {\n hints.push(\n \"To put one on a page: `baker hubspot forms view <id> --as-node` returns the object to write into the step's form.external. No request_flow_input needed for HubSpot.\",\n );\n }\n if (redirecting.length > 0) {\n hints.push(\n `${redirecting.length} form(s) redirect after submit. That is fine mid-Form: the renderer suppresses the redirect whenever a step follows the form, and honors it when the form is the last step.`,\n );\n }\n const blocked = forms.filter((form) => form.captchaEnabled);\n if (blocked.length > 0) {\n // Named rather than counted, because the next thing the agent does with\n // this is tell a person which of their forms is the problem — but\n // bounded, since every row already carries `captchaEnabled` and an\n // account with forty blocked forms would otherwise print forty names.\n const shown = blocked.slice(0, 3).map((form) => form.name);\n const rest = blocked.length - shown.length;\n hints.push(\n `${blocked.length} form(s) have spam prevention (captcha) on: ${shown.join(\", \")}${rest > 0 ? `, and ${rest} more` : \"\"}. HubSpot refuses every submission sent to those, so they can be embedded on a page but never wired as a Form's destination. Only the user can switch it off, on the form in HubSpot.`,\n );\n }\n\n writeJson({ ok: true, ...rowsAsData(response.data, \"forms\"), ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\n/**\n * The one HubSpot setting that decides whether a form can receive a lead at\n * all. HubSpot refuses every API submission to a form with spam prevention on\n * (`FORM_HAS_RECAPTCHA_ENABLED`) and there is no token to attach, so the answer\n * is never \"send it differently\" — it is a switch only the client can flip.\n */\nconst CAPTCHA_VIEW_HINT =\n \"This form has spam prevention (captcha) on. HubSpot refuses every submission sent to it, so it cannot be a Form's destination — embedding it on a page still works, because the visitor solves the captcha in the browser. Only the user can switch it off, on the form in HubSpot; do not wire a delivery to it, and tell them what has to change.\";\n\nconst CAPTCHA_NODE_HINT =\n \"This form has spam prevention (captcha) on. That is fine for embedding it on a page — the visitor solves it in the browser — but it can never be a Form's delivery destination, so do not also wire a hubspotForm side effect to this form.\";\n\n/**\n * What to say about one form beyond its fields.\n *\n * Pure and exported so the wording is testable: these are the three facts about\n * a HubSpot form that decide whether wiring it works, and each of them is\n * invisible in the form's own field list.\n */\nexport function formViewHints(form: {\n postSubmitAction: { type: string; value: string } | null;\n captchaEnabled: boolean;\n embedType: string;\n}): string[] {\n const hints: string[] = [];\n if (form.postSubmitAction?.type === \"redirect_url\") {\n hints.push(\n `This form redirects to ${form.postSubmitAction.value} on submit. Placed anywhere but the last step of a Form, that redirect is suppressed so the next step can render.`,\n );\n }\n if (form.captchaEnabled) {\n hints.push(CAPTCHA_VIEW_HINT);\n }\n if (form.embedType === \"unknown\") {\n hints.push(\"Embed type could not be determined from HubSpot's response; the renderer treats it as legacy.\");\n }\n return hints;\n}\n\n/**\n * The same for the `--as-node` blob, where the reader is about to *embed* the\n * form. Captcha reads the opposite way here and has to say so: an embedded form\n * with captcha works, because the visitor solves it in the browser. Silence\n * would leave an agent that just read the refusal elsewhere to conclude the\n * form is unusable and quietly pick another.\n */\nexport function formNodeHints(\n external:\n | {\n captchaEnabled: boolean;\n embedType?: string;\n region?: string;\n configuration?: { postSubmitAction: { type: string } };\n }\n | undefined,\n): string[] {\n return [\n \"Write this object into the node's `form.external` in the flow's _data.json, keeping the rest of the node as-is. No request_flow_input needed — the account is already connected.\",\n ...(external?.captchaEnabled ? [CAPTCHA_NODE_HINT] : []),\n ...(external?.configuration?.postSubmitAction.type === \"redirect_url\"\n ? [\n \"This form redirects on submit. Safe unless it is the last step: the renderer suppresses the redirect whenever a step follows it.\",\n ]\n : []),\n ...(external?.embedType === \"v4\" && !external.region\n ? [\n \"WARNING: this is a v4 form and the connected account has no region recorded, so the step will load HubSpot's na1 script host. That is correct for US portals and breaks the form on eu1/ap1 ones. If it renders blank, have the user reconnect HubSpot from Brain -> Integrations -> Tools, then re-run this command.\",\n ]\n : []),\n ];\n}\n\nconst formsViewCommand = defineCommand({\n meta: {\n name: \"view\",\n description: \"Show one HubSpot form's fields and configuration. Example: baker hubspot forms view 1a2b3c\",\n },\n args: {\n formId: { type: \"positional\", description: \"HubSpot form id\", required: true },\n full: { type: \"boolean\", description: \"Include the raw HubSpot payload\", required: false },\n \"as-node\": { type: \"boolean\", description: \"Emit the node-ready form.external blob\", required: false },\n },\n run: async ({ args }) => {\n try {\n const response = await apiPost<HubspotFormsViewResponse>(\n \"/api/hubspot/forms/view\",\n {\n formId: args.formId,\n ...(args.full ? { full: true } : {}),\n ...(args[\"as-node\"] ? { asNode: true } : {}),\n },\n { read: true },\n );\n\n if (args[\"as-node\"]) {\n writeJson({ ...response, hints: formNodeHints(response.data.external) });\n return;\n }\n\n const form = response.data.form;\n if (!form) {\n throw new Error(\"Response did not include the form view\");\n }\n const hints = formViewHints(form);\n\n writeJson({ ...response, meta: { count: form.fields.length }, ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\nconst meetingsListCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List HubSpot meeting links (calendars). Example: baker hubspot meetings list\",\n },\n args: {\n search: { type: \"string\", description: \"Match on meeting name\", required: false },\n \"redirecting-only\": { type: \"boolean\", description: \"Only links that redirect after booking\", required: false },\n },\n run: async ({ args }) => {\n try {\n const body: Record<string, unknown> = {};\n if (args.search) {\n body.search = args.search;\n }\n if (args[\"redirecting-only\"]) {\n body.redirectingOnly = true;\n }\n\n const response = await apiPost<HubspotMeetingsListResponse>(\"/api/hubspot/meetings/list\", body, { read: true });\n const { meetings } = response.data;\n const hints: string[] = [];\n if (meetings.length === 0) {\n hints.push(\"No meeting links matched. Drop --search, or check the connected HubSpot account.\");\n } else {\n hints.push(\n \"To put one on a page: `baker hubspot meetings view <slug> --as-node` returns the object to write into the step's form.external.\",\n );\n }\n const unknown = meetings.filter((meeting) => !meeting.redirectKnown);\n if (unknown.length > 0) {\n hints.push(\n `HubSpot did not report booking settings for ${unknown.length} of these (${unknown\n .map((meeting) => meeting.slug)\n .join(\n \", \",\n )}), so their redirect and field count are UNKNOWN, not absent. Run \\`baker hubspot meetings view <slug>\\` before concluding one does not redirect.`,\n );\n }\n\n writeJson({ ok: true, ...rowsAsData(response.data, \"meetings\"), ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\nconst meetingsViewCommand = defineCommand({\n meta: {\n name: \"view\",\n description: \"Show one HubSpot meeting link's booking fields. Example: baker hubspot meetings view discovery-call\",\n },\n args: {\n slug: { type: \"positional\", description: \"Meeting slug\", required: true },\n \"as-node\": { type: \"boolean\", description: \"Emit the node-ready form.external blob\", required: false },\n },\n run: async ({ args }) => {\n try {\n const response = await apiPost<HubspotMeetingsViewResponse>(\n \"/api/hubspot/meetings/view\",\n {\n slug: args.slug,\n ...(args[\"as-node\"] ? { asNode: true } : {}),\n },\n { read: true },\n );\n\n if (args[\"as-node\"]) {\n const { external } = response.data;\n writeJson({\n ...response,\n hints: [\n \"Write this object into the node's `form.external` in the flow's _data.json, keeping the rest of the node as-is. No request_flow_input needed — the account is already connected.\",\n ...(external?.customParams.redirectUrl\n ? [\n `This calendar redirects to ${external.customParams.redirectUrl} after booking, and that redirect is NOT suppressed — any step placed after it is unreachable. Keep it as the last step, or ask the user to clear the redirect in HubSpot.`,\n ]\n : []),\n ],\n });\n return;\n }\n\n const meeting = response.data.meeting;\n if (!meeting) {\n throw new Error(\"Response did not include the meeting view\");\n }\n const hints: string[] = [];\n if (meeting.redirectUrl) {\n hints.push(\n `This calendar redirects to ${meeting.redirectUrl} after booking. A step placed after it will not be reached — keep it as the last step, or clear the redirect in HubSpot.`,\n );\n }\n\n writeJson({ ...response, meta: { count: meeting.fields.length }, ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\nconst formsSubmissionsCommand = defineCommand({\n meta: {\n name: \"submissions\",\n description:\n \"How many leads a form received, and when. Example: baker hubspot forms submissions <formId> --days 30\",\n },\n args: {\n formId: { type: \"positional\", description: \"HubSpot form id\", required: true },\n days: { type: \"string\", description: \"Window in days (default 30)\", required: false },\n full: { type: \"boolean\", description: \"Include each lead's answers\", required: false },\n },\n run: async ({ args }) => {\n try {\n const days = args.days === undefined ? 30 : Number(args.days);\n if (!Number.isInteger(days) || days < 1 || days > 365) {\n throw new ApiError(\"VALIDATION_ERROR\", \"--days must be a whole number between 1 and 365.\");\n }\n\n const response = await apiPost<HubspotFormSubmissionsResponse>(\n \"/api/hubspot/forms/submissions\",\n {\n formId: args.formId,\n days,\n ...(args.full ? { full: true } : {}),\n },\n { read: true },\n );\n const { inWindow, total, truncated, lastSubmittedAt } = response.data;\n\n const hints: string[] = [];\n if (inWindow === 0) {\n hints.push(\n total === 0\n ? \"This form has received nothing at all — check it is the form actually embedded on the page before concluding the campaign is at fault.\"\n : `No leads in the last ${days} days, though the form has ${total} older submission(s). It worked once and has gone quiet.`,\n );\n }\n if (truncated) {\n hints.push(\n \"Stopped before reaching the end of the window, so `inWindow` is a floor, not a count. Say so rather than reporting it as exact.\",\n );\n }\n if (!args.full && inWindow > 0) {\n hints.push(\n \"Counts only — the leads' own answers are not included. Add --full if you genuinely need the field values; it returns personal data, so do not paste it into a report or a chat message.\",\n );\n }\n if (lastSubmittedAt !== null) {\n hints.push(\n \"To find out whether these leads were worked, cross-check the deal pipeline: `baker hubspot pipelines list`.\",\n );\n }\n\n writeJson({ ...response, meta: { count: inWindow }, ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\nconst workflowsListCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List HubSpot workflows. Example: baker hubspot workflows list --enabled-only\",\n },\n args: {\n search: { type: \"string\", description: \"Match on workflow name\", required: false },\n \"enabled-only\": { type: \"boolean\", description: \"Only workflows that are on\", required: false },\n },\n run: async ({ args }) => {\n try {\n const body: Record<string, unknown> = {};\n if (args.search) {\n body.search = args.search;\n }\n if (args[\"enabled-only\"]) {\n body.enabledOnly = true;\n }\n\n const response = await apiPost<HubspotWorkflowsListResponse>(\"/api/hubspot/workflows/list\", body, { read: true });\n const { workflows } = response.data;\n const off = workflows.filter((workflow) => !workflow.enabled);\n const hints: string[] = [];\n if (workflows.length === 0) {\n hints.push(\"No workflows matched. Drop --search/--enabled-only, or the account genuinely has none.\");\n }\n if (off.length > 0) {\n hints.push(\n `${off.length} of these are switched off. A form wired to a workflow that is off looks connected and does nothing — worth flagging to the user.`,\n );\n }\n\n writeJson({ ok: true, ...rowsAsData(response.data, \"workflows\"), ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\n/**\n * What the agent should take from one workflow read.\n *\n * All three of these are silent failures in HubSpot — the workflow saves, looks\n * right in the editor, and runs. Nothing surfaces them but reading the order and\n * the flags, so they are stated rather than left for the agent to notice.\n */\nexport function workflowViewHints(workflow: HubspotWorkflowsViewResponse[\"data\"][\"workflow\"]): string[] {\n const hints: string[] = [];\n if (!workflow.enabled) {\n hints.push(\n \"This workflow is switched off, so nothing below it is running now — it may still have run while it was on. Say so before reporting on what it does.\",\n );\n }\n\n // Only a LIST_BRANCH is evaluated top down. A STATIC_BRANCH splits on a value\n // and matches by equality, so \"a broad branch above a narrow one\" cannot\n // happen there — and both arrive here as `branches`, so the kind has to be\n // read off the step rather than off the list.\n const ordered = workflow.steps.filter((step) => step.type === \"LIST_BRANCH\" && (step.branches?.length ?? 0) > 1);\n if (ordered.length > 0) {\n hints.push(\n \"Branches are listed in evaluation order and the first match wins. Check that no broad branch sits above a narrower one — if it does, the narrow branch never runs and nothing in HubSpot reports it.\",\n );\n }\n if (workflow.raw === undefined && ordered.length > 0) {\n hints.push(\n \"This view names the branches but not what they compare. Re-run with --full to read the filter criteria before judging whether a branch matches what it was meant to match.\",\n );\n }\n\n if (workflow.enrollment.reEnrollment === false) {\n hints.push(\n \"Re-enrolment is off: a record that meets the criteria a second time will not run through this again. That is a real choice, not necessarily a fault — but confirm it is the intended one.\",\n );\n } else if (workflow.enrollment.reEnrollment === null) {\n hints.push(\n \"Whether this re-enrols is not reported for this kind of enrolment, so do not state it either way — read it in HubSpot if it matters.\",\n );\n }\n return hints;\n}\n\nconst workflowsViewCommand = defineCommand({\n meta: {\n name: \"view\",\n description:\n \"Read one workflow's real configuration — enrolment, branches in order, and what each step writes. Example: baker hubspot workflows view 121183594 --full\",\n },\n args: {\n workflowId: {\n type: \"positional\",\n description: \"Workflow id (from `baker hubspot workflows list`)\",\n required: true,\n },\n full: { type: \"boolean\", description: \"Include the raw HubSpot payload with the filter criteria\", required: false },\n },\n run: async ({ args }) => {\n try {\n const response = await apiPost<HubspotWorkflowsViewResponse>(\n \"/api/hubspot/workflows/view\",\n {\n workflowId: args.workflowId,\n ...(args.full ? { full: true } : {}),\n },\n { read: true },\n );\n const { workflow } = response.data;\n const hints = workflowViewHints(workflow);\n\n writeJson({ ...response, meta: { count: workflow.steps.length }, ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\nconst pipelinesListCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List HubSpot deal pipelines and their stages. Example: baker hubspot pipelines list\",\n },\n args: {},\n run: async () => {\n try {\n const response = await apiPost<HubspotPipelinesListResponse>(\"/api/hubspot/pipelines/list\", {}, { read: true });\n const { pipelines } = response.data;\n const hints: string[] =\n pipelines.length === 0\n ? [\"This account has no deal pipelines, so there is nowhere for a lead to be worked.\"]\n : [\"Stages are listed in the order they run in HubSpot, so the first stage is where a new lead lands.\"];\n\n writeJson({ ok: true, ...rowsAsData(response.data, \"pipelines\"), hints });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\ntype HubspotObjectWord = \"contact\" | \"deal\" | \"lead\";\n\nconst OBJECT_WORDS: Record<HubspotObjectWord, { plural: string; command: string; rows: string }> = {\n contact: {\n plural: \"contacts\",\n command: \"baker hubspot contacts\",\n rows: '`--field email={{work_email}}`, `--field currency=EUR`, `--field first_name=\"{{firstname}} {{lastname}}\"`; `{{id}}` is the contact\\'s own id',\n },\n deal: {\n plural: \"deals\",\n command: \"baker hubspot deals\",\n rows: \"`--field value={{amount}}`, `--field currency={{deal_currency_code}}`, `--field email={{contact.email}}` — a deal's own properties bare, its contact's as `contact.<name>`; `{{id}}` is the deal's own id, `{{contact.id}}` the contact's\",\n },\n lead: {\n plural: \"leads\",\n command: \"baker hubspot leads\",\n rows: \"`--field email={{contact.email}}`, `--field properties.stage={{hs_pipeline_stage}}` — a lead's own properties bare, its contact's as `contact.<name>`; `{{id}}` is the lead's own id, `{{contact.id}}` the contact's. A lead carries no amount of its own, so `value` is empty unless you point it at a property\",\n },\n};\n\n/** `properties`, for contacts and for deals: what a HubSpot event can watch. */\nfunction propertiesCommand(object: HubspotObjectWord) {\n const words = OBJECT_WORDS[object];\n return defineCommand({\n meta: {\n name: \"properties\",\n description: `List every ${object} property a HubSpot event can watch, with its kind, the operators that kind takes, and a select's values. Example: ${words.command} properties`,\n },\n args: {},\n run: async () => {\n try {\n const response = await apiPost<HubspotContactPropertiesListResponse>(\n \"/api/hubspot/contacts/properties\",\n {\n object,\n },\n { read: true },\n );\n const { properties } = response.data;\n const operators = Object.entries(HUBSPOT_OPERATORS)\n .map(([kind, list]) => `${kind}: ${list.map((operator) => operator.value).join(\", \")}`)\n .join(\" · \");\n const objectFlag = object === \"contact\" ? \"\" : ` --object ${object}`;\n const hints =\n properties.length === 0\n ? [`This account has no visible ${object} property, so there is nothing an event could watch.`]\n : [\n `Pick the property and the condition that mean the outcome, then \\`baker analytics sources --create-hubspot${objectFlag} --property <name> [--operator <op>] --value <value>…\\` (\\`--value\\` repeats for a list). Operators by kind — ${operators}. Counting starts from creation: a ${object} already satisfying it is not counted until it leaves and comes back.`,\n ];\n writeJson({ ok: true, ...rowsAsData(response.data, \"properties\"), hints });\n } catch (err) {\n failNotConnected(err);\n }\n },\n });\n}\n\nconst contactsPropertiesCommand = propertiesCommand(\"contact\");\n\nconst contactsSummaryCommand = defineCommand({\n meta: {\n name: \"summary\",\n description: \"Whether recent leads are being worked, as counts. Example: baker hubspot contacts summary --days 30\",\n },\n args: {\n days: { type: \"string\", description: \"Window in days (default 30)\", required: false },\n },\n run: async ({ args }) => {\n try {\n const days = args.days === undefined ? 30 : Number(args.days);\n if (!Number.isInteger(days) || days < 1 || days > 365) {\n throw new ApiError(\"VALIDATION_ERROR\", \"--days must be a whole number between 1 and 365.\");\n }\n\n const response = await apiPost<HubspotContactsSummaryResponse>(\n \"/api/hubspot/contacts/summary\",\n { days },\n { read: true },\n );\n const { total, withOwner, withoutOwner, byStage, truncated } = response.data;\n\n const hints: string[] = [];\n if (total === 0) {\n hints.push(`No contacts were created in the last ${days} days — nothing reached the CRM in that window.`);\n } else if (withOwner === 0) {\n hints.push(\n `None of these ${total} contacts has anyone assigned. That is the strongest available signal that the leads are arriving and nobody is picking them up — worth raising with the user.`,\n );\n } else if (withoutOwner > withOwner) {\n hints.push(`${withoutOwner} of ${total} contacts have nobody assigned — more unworked than worked.`);\n }\n const unset = byStage.find((entry) => entry.stage === \"unset\");\n if (unset && unset.count > 0) {\n hints.push(\n `${unset.count} contact(s) have no lifecycle stage set at all, so they were created and never staged.`,\n );\n }\n if (truncated) {\n hints.push(\"Stopped before reading every contact in the window, so these counts are floors, not totals.\");\n }\n\n writeJson({ ...response, meta: { count: total }, ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\n/**\n * What the agent should take from one contact lookup.\n *\n * An empty `deals` or a null `company` means two different things depending on\n * whether the connection could read them at all, and the wrong reading — \"this\n * lead was never worked\" — is the one conclusion the command exists to settle.\n * So each is paired with its readability flag rather than reported bare.\n */\nexport function contactLookupHints(\n data: HubspotContactLookupResponse[\"data\"],\n askedProperties: readonly string[] = [],\n): string[] {\n const { found, contact, deals, dealsReadable, company, companyReadable } = data;\n if (!found) {\n return [\n \"No contact with that email. The lead never reached the CRM — check the form's submissions before assuming the CRM lost it.\",\n ];\n }\n\n const hints: string[] = [];\n if (contact?.ownerId === null) {\n hints.push(\"Nobody is assigned to this contact.\");\n }\n const undefinedProperties = askedProperties.filter((name) => !Object.hasOwn(contact?.properties ?? {}, name));\n if (undefinedProperties.length > 0) {\n hints.push(\n `No contact property named ${undefinedProperties.join(\", \")} on this account, so there is nothing to read — this is not an empty value. \\`baker hubspot contacts fields\\` lists the names this account uses.`,\n );\n }\n if (!dealsReadable) {\n hints.push(\n \"Deals were not read: this HubSpot connection does not cover them. Do not report the lead as having no deal — you cannot tell. The user can enable it by reconnecting HubSpot.\",\n );\n } else if (deals.length === 0) {\n hints.push(\"No deal is associated, so this contact was never taken into the pipeline.\");\n }\n if (!companyReadable) {\n hints.push(\n \"Account details were not read: this HubSpot connection does not cover them. Do not report the lead as having no account — you cannot tell. The user can enable it by reconnecting HubSpot.\",\n );\n } else if (company === null) {\n hints.push(\n \"No account is associated either. Most B2B setups create one automatically when a contact arrives, so this usually means the lead was never processed at all — not that the account is missing.\",\n );\n }\n return hints;\n}\n\nfunction commaList(raw: string): string[] {\n return [\n ...new Set(\n raw\n .split(\",\")\n .map((item) => item.trim())\n .filter(Boolean),\n ),\n ];\n}\n\nconst contactsLookupCommand = defineCommand({\n meta: {\n name: \"lookup\",\n description:\n \"Find one contact by email and see whether it was worked; --properties reads named contact properties too. Example: baker hubspot contacts lookup a@b.com --properties utm_campaign,utm_source\",\n },\n args: {\n email: { type: \"positional\", description: \"The contact's email address\", required: true },\n properties: {\n type: \"string\",\n description:\n \"Comma-separated contact properties to read, by HubSpot's internal name: --properties utm_campaign,utm_source\",\n required: false,\n },\n },\n run: async ({ args }) => {\n try {\n const properties = typeof args.properties === \"string\" ? commaList(args.properties) : [];\n const response = await apiPost<HubspotContactLookupResponse>(\n \"/api/hubspot/contacts/lookup\",\n {\n email: args.email,\n ...(properties.length > 0 ? { properties } : {}),\n },\n { read: true },\n );\n const hints = contactLookupHints(response.data, properties);\n\n writeJson({\n ...response,\n meta: { count: response.data.found ? 1 : 0 },\n ...(hints.length > 0 ? { hints } : {}),\n });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\n/** `fields`, for contacts and for deals: what a HubSpot event's rows can read. */\nfunction fieldsCommand(object: HubspotObjectWord) {\n const words = OBJECT_WORDS[object];\n return defineCommand({\n meta: {\n name: \"fields\",\n description: `List every property a HubSpot event on a ${object} can read into its rows, with HubSpot's type${object === \"contact\" ? \"\" : ` — the ${object}'s own, and its contact's as contact.<name>`}. Example: ${words.command} fields`,\n },\n args: {},\n run: async () => {\n try {\n const response = await apiPost<HubspotContactFieldsListResponse>(\n \"/api/hubspot/contacts/fields\",\n { object },\n { read: true },\n );\n writeJson({\n ok: true,\n ...rowsAsData(response.data, \"fields\"),\n hints: [\n `A row of a HubSpot event is a template over these names: ${words.rows}. \\`baker analytics sources --preview${object === \"contact\" ? \"\" : ` --object ${object}`} --property <p> --value <v> --field <row>…\\` reads one real ${object} to check the rows against.`,\n ],\n });\n } catch (err) {\n failNotConnected(err);\n }\n },\n });\n}\n\nconst contactsFieldsCommand = fieldsCommand(\"contact\");\n\nconst dealsCommand = defineCommand({\n meta: {\n name: \"deals\",\n description:\n \"Deals on the connected HubSpot account: the deals themselves with amount and stage (`list`), one deal found by its name (`lookup`), and what a HubSpot event on a deal can watch (`properties`) and read (`fields`).\",\n },\n subCommands: {\n list: () => import(\"./crm.ts\").then((m) => m.dealsListCommand),\n lookup: () => import(\"./crm.ts\").then((m) => m.dealsLookupCommand),\n properties: propertiesCommand(\"deal\"),\n fields: fieldsCommand(\"deal\"),\n },\n});\n\nconst leadsCommand = defineCommand({\n meta: {\n name: \"leads\",\n description:\n \"Leads on the connected HubSpot account: what a HubSpot event on a lead can watch (`properties`) and read (`fields`). Start here for qualification and disqualification — a lead's stage is where HubSpot records both, and `hs_pipeline_stage` lists the account's own stages with their labels. Needs Sales Hub Professional or Enterprise; on any other plan the account has no leads to read.\",\n },\n subCommands: { properties: propertiesCommand(\"lead\"), fields: fieldsCommand(\"lead\") },\n});\n\nconst contactsCommand = defineCommand({\n meta: { name: \"contacts\", description: \"Contacts on the connected HubSpot account.\" },\n subCommands: {\n summary: contactsSummaryCommand,\n lookup: contactsLookupCommand,\n properties: contactsPropertiesCommand,\n fields: contactsFieldsCommand,\n },\n});\n\nconst companiesCommand = defineCommand({\n meta: { name: \"companies\", description: \"Companies (accounts) in the connected HubSpot CRM.\" },\n subCommands: {\n search: () => import(\"./crm.ts\").then((m) => m.companiesSearchCommand),\n contacts: () => import(\"./crm.ts\").then((m) => m.companiesContactsCommand),\n },\n});\n\nconst formsCommand = defineCommand({\n meta: { name: \"forms\", description: \"HubSpot forms on the connected account.\" },\n subCommands: { list: formsListCommand, view: formsViewCommand, submissions: formsSubmissionsCommand },\n});\n\nconst workflowsCommand = defineCommand({\n meta: { name: \"workflows\", description: \"HubSpot workflows on the connected account.\" },\n subCommands: { list: workflowsListCommand, view: workflowsViewCommand },\n});\n\nconst pipelinesCommand = defineCommand({\n meta: { name: \"pipelines\", description: \"HubSpot deal pipelines on the connected account.\" },\n subCommands: { list: pipelinesListCommand },\n});\n\nconst meetingsCommand = defineCommand({\n meta: { name: \"meetings\", description: \"HubSpot meeting links (calendars) on the connected account.\" },\n subCommands: { list: meetingsListCommand, view: meetingsViewCommand },\n});\n\nexport const hubspotCommand = defineCommand({\n meta: {\n name: \"hubspot\",\n description: `Read the connected HubSpot account — forms, the leads they received, workflows, deal pipelines, CRM\ncompanies and deals, and meeting links (calendars) — and get the blob to wire a form into a Form step yourself.\n\nExamples:\n baker hubspot forms list # every form: embed type + post-submit action\n baker hubspot forms list --redirecting-only # which forms redirect away on submit\n baker hubspot forms view <formId> # fields, consent mode, full configuration\n baker hubspot forms view <formId> --as-node # the form.external blob -> write into the step\n baker hubspot forms submissions <formId> # how many leads it got, and when\n baker hubspot workflows list --enabled-only # what runs after a lead is captured\n baker hubspot workflows view <workflowId> # its real branches, in order, and what each step writes\n baker hubspot pipelines list # where a lead lands, and the stages after it\n baker hubspot contacts summary --days 30 # are recent leads being worked? (counts only)\n baker hubspot contacts lookup a@b.com # was this one lead picked up? --properties utm_campaign,… reads those too\n baker hubspot companies search --domains acme.com,globex.io --with-deals # which are accounts, with deals\n baker hubspot deals list --modified-since 2026-01-01 # deals: amount, stage, closed won\n baker hubspot deals lookup --search \"Acme\" # is this sale in the CRM? (by deal name)\n baker hubspot deals properties # what a HubSpot event on a deal can watch (dealstage, amount…)\n baker hubspot deals fields # what its rows can read: the deal's own, its contact's as contact.<name>\n baker hubspot meetings list # every calendar + whether booking redirects\n baker hubspot meetings view <slug> --as-node # same, for a hubspotMeeting step\n\nAn account connected before one of these existed cannot serve it — you get HUBSPOT_RECONNECT_REQUIRED, which\nmeans HubSpot IS connected and the user has to reconnect it to widen what Baker may read. Report that and\ncarry on with the rest; never call it broken and never retry.\n\nNothing here is secret, so HubSpot steps do not need request_flow_input: take --as-node and edit the\nflow's _data.json. Use the approval form only when no account is connected or the right form is unclear.\nFull guide: __tooling__/docs/tools/baker/hubspot.md`,\n },\n subCommands: {\n forms: formsCommand,\n workflows: workflowsCommand,\n pipelines: pipelinesCommand,\n contacts: contactsCommand,\n companies: companiesCommand,\n deals: dealsCommand,\n leads: leadsCommand,\n meetings: meetingsCommand,\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,SAAS,qBAAqB;AAM9B,IAAM,cAAc,CAAC,UAAU,MAAM,SAAS;AAE9C,SAAS,gBAAgB,OAAqE;AAC5F,MAAI,UAAU,QAAW;AACvB,WAAO;AAAA,EACT;AACA,MAAI,CAAE,YAAkC,SAAS,KAAK,GAAG;AACvD,UAAM,IAAI,MAAM,gCAAgC,YAAY,KAAK,GAAG,CAAC,EAAE;AAAA,EACzE;AACA,SAAO;AACT;AAEA,eAAe;AAAA,EACb,SAAS;AAAA,EACT,QAAQ,CAAC,8BAA8B;AAAA,EACvC,QAAQ;AAAA,EACR,aACE;AAAA,EACF,MAAM;AAAA,IACJ,QAAQ,EAAE,MAAM,UAAU,aAAa,qDA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