@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
|
@@ -347,7 +347,7 @@ var leadFormsUnarchiveCommand = statusCommand(
|
|
|
347
347
|
// src/commands/ads/meta/leads.ts
|
|
348
348
|
registerSchema({
|
|
349
349
|
command: "ads.meta.lead-forms",
|
|
350
|
-
description: "List the instant (lead) forms on a Facebook Page, with how many leads each has collected. Start here: a lead is fetched by form id. Use a Page from `baker ads meta pages` with hasPageAccessToken: true.",
|
|
350
|
+
description: "List the instant (lead) forms on a Facebook Page, with how many leads each has collected. Start here: a lead is fetched by form id. Which ads open a form: `baker ads meta ads --lead-form <formId> --all-statuses`. Use a Page from `baker ads meta pages` with hasPageAccessToken: true.",
|
|
351
351
|
args: {
|
|
352
352
|
"page-id": {
|
|
353
353
|
type: "string",
|
|
@@ -487,6 +487,7 @@ A form is permanent on Meta and nothing on it changes once made: to change one,
|
|
|
487
487
|
Examples:
|
|
488
488
|
baker ads meta lead-forms --page-id 100635183117758
|
|
489
489
|
baker ads meta lead-forms --page-id 100635183117758 --full
|
|
490
|
+
baker ads meta ads --account-id act_123 --lead-form 987654321 --all-statuses \u2014 the ads that open a form
|
|
490
491
|
baker ads meta lead-forms create --account-id act_123 --page-id 555 --file form.json
|
|
491
492
|
baker ads meta lead-forms spec 987654321 \u2014 a live form as a create --file payload
|
|
492
493
|
baker ads meta lead-forms duplicate 987654321 --account-id act_123 --name "Free audit (ES)" --locale ES_LA
|
|
@@ -571,4 +572,4 @@ export {
|
|
|
571
572
|
leadPageHints,
|
|
572
573
|
leadsCommand
|
|
573
574
|
};
|
|
574
|
-
//# sourceMappingURL=leads-
|
|
575
|
+
//# sourceMappingURL=leads-DAXPX7V5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/ads/meta/leads.ts","../src/commands/ads/meta/lead-form-writes.ts"],"sourcesContent":["import { isMetaLeadAdsRefusal } from \"@baker/api/ads-meta\";\nimport { defineCommand } from \"citty\";\nimport { ApiError, apiGet } from \"../../../client.ts\";\nimport { withWindowSpellings } from \"../../../date-window.ts\";\nimport { registerSchema } from \"../../../schemas.ts\";\nimport { writeAdsJson, writeAdsOutput, writeJsonEnvelope } from \"../output.ts\";\nimport {\n leadFormsArchiveCommand,\n leadFormsCreateCommand,\n leadFormsDuplicateCommand,\n leadFormsSpecCommand,\n leadFormsUnarchiveCommand,\n} from \"./lead-form-writes.ts\";\nimport { csvOrJson, handleMetaError } from \"./shared.ts\";\n\n/** An instant form attached to a Facebook Page. */\nexport interface MetaLeadForm {\n id: string;\n name?: string;\n status?: string;\n locale?: string;\n leads_count?: number;\n created_time?: string;\n}\n\n/** One page of leads plus the cursor that continues it. */\nexport interface MetaLeadPage {\n leads: MetaLead[];\n /** Present only while Meta says another page exists. */\n nextCursor?: string;\n /** What the backend says about this page (every answer masked when it could not tell contact questions apart). */\n hints?: string[];\n}\n\n/** One lead, already shaped by the backend (contact values masked unless --full). */\nexport interface MetaLead {\n id: string;\n created_time?: string;\n ad_id?: string;\n ad_name?: string;\n adset_id?: string;\n adset_name?: string;\n campaign_id?: string;\n campaign_name?: string;\n form_id?: string;\n is_organic?: boolean;\n platform?: string;\n answers: Record<string, string>;\n /** Each disclaimer checkbox by its key: ticked or not. */\n consents?: Record<string, boolean>;\n partner_name?: string;\n}\n\nregisterSchema({\n command: \"ads.meta.lead-forms\",\n description:\n \"List the instant (lead) forms on a Facebook Page, with how many leads each has collected. Start here: a lead is fetched by form id. Which ads open a form: `baker ads meta ads --lead-form <formId> --all-statuses`. Use a Page from `baker ads meta pages` with hasPageAccessToken: true.\",\n args: {\n \"page-id\": {\n type: \"string\",\n description: \"Facebook Page ID — from `baker ads meta pages` with hasPageAccessToken: true\",\n required: true,\n },\n full: { type: \"boolean\", description: \"Include each form's questions\", required: false },\n output: { type: \"string\", description: \"json|csv\", required: false, default: \"json\" },\n },\n});\n\nregisterSchema({\n command: \"ads.meta.leads\",\n description:\n \"Read the leads an instant form collected. Contact details (email, phone) come back masked; pass --full only when the raw values are genuinely needed, e.g. handing them to a CRM.\",\n args: withWindowSpellings({\n \"form-id\": { type: \"string\", description: \"Instant form ID — from `baker ads meta lead-forms`\", required: false },\n \"ad-id\": { type: \"string\", description: \"Read the leads of one ad instead of a whole form\", required: false },\n \"adset-id\": { type: \"string\", description: \"Read the leads of every ad in an ad set\", required: false },\n \"campaign-id\": { type: \"string\", description: \"Read the leads of every ad in a campaign\", required: false },\n since: { type: \"string\", description: \"Earliest submission date, YYYY-MM-DD\", required: false },\n until: { type: \"string\", description: \"Latest submission date, YYYY-MM-DD (inclusive)\", required: false },\n limit: { type: \"string\", description: \"Leads per page (default 100, max 500)\", required: false },\n after: {\n type: \"string\",\n description: \"Cursor from a previous call's nextCursor — fetches the following page\",\n required: false,\n },\n full: { type: \"boolean\", description: \"Return raw contact details instead of masked ones\", required: false },\n output: { type: \"string\", description: \"json|csv\", required: false, default: \"json\" },\n }),\n});\n\n/**\n * A form that exists but has never collected anything is the single most common\n * thing to misread here — it looks identical to a permissions problem in the\n * output, and the remedies are opposite. Say which it is.\n */\n/** The backend drains instant forms up to this many; see `META_LEAD_FORMS_MAX`. */\nconst LEAD_FORMS_CAP = 500;\n\nexport function leadFormHints(forms: MetaLeadForm[]): string[] {\n if (forms.length === 0) {\n return [\"This Page has NO instant forms. Nothing to read leads from — the form has to be created first.\"];\n }\n if (forms.length >= LEAD_FORMS_CAP) {\n return [\n `PARTIAL LIST — this Page has at least ${LEAD_FORMS_CAP} instant forms and only the first ${LEAD_FORMS_CAP} came back. Do not describe this as every form on the Page.`,\n ];\n }\n const empty = forms.filter((form) => (form.leads_count ?? 0) === 0);\n if (empty.length === forms.length) {\n return [\n \"Every form on this Page has collected 0 leads. That is a real, readable answer — the connection works. Do not retry and do not report it as a permissions problem.\",\n ];\n }\n return [];\n}\n\n/**\n * A `FORBIDDEN` that Baker itself produced is already conclusive, so it must not\n * collect the generic ambiguous-403 remedy.\n *\n * `metaForbiddenFix` exists for Meta's own 403, which covers two causes with\n * opposite fixes and can only be told apart by testing the blast radius. Pasting\n * that after *\"this needs switching on by the Baker team\"* would hand the agent\n * a paragraph suggesting a reconnect right underneath a sentence saying a\n * reconnect cannot help — and the agent would pass it on, costing the client a\n * pointless round trip through their Meta login. Everything that is genuinely\n * Meta's still goes through the normal handler.\n */\nfunction handleLeadsError(err: unknown): never {\n if (err instanceof ApiError && err.code === \"FORBIDDEN\" && isMetaLeadAdsRefusal(err.message)) {\n writeAdsJson({\n ok: false,\n error: {\n code: err.code,\n message: err.message,\n fix: { action: \"reject\", explanation: err.message },\n retryable: false,\n },\n });\n process.exit(1);\n }\n handleMetaError(err);\n}\n\n/**\n * What the agent has to know before it reports a number.\n *\n * Counting is what this command is mostly used for, so a page that is full is\n * the dangerous case: without a word, 100 rows read as \"100 leads\" and the\n * client is told something false. The cursor is the remedy, and it has to be\n * named in the same breath as the warning.\n */\nexport function leadPageHints(page: MetaLeadPage, full: boolean): string[] {\n const hints: string[] = [];\n if (page.nextCursor) {\n hints.push(\n `PARTIAL PAGE — more leads exist. This is ${page.leads.length} of an unknown larger number; do NOT report it as a total. Fetch the next page with \\`--after ${page.nextCursor}\\` (repeat until no nextCursor), or narrow the window with --since/--until.`,\n );\n }\n if (!full) {\n hints.push(\n \"Answers that give contact details (email, phone, any question asking for one) are masked. Report on them as they are; pass --full only when the raw values have to leave Baker (a CRM hand-off), and never paste them into the chat otherwise.\",\n );\n }\n hints.push(...(page.hints ?? []));\n return hints;\n}\n\nconst LEAD_SOURCE_NOUNS = {\n \"form-id\": \"form\",\n \"ad-id\": \"ad\",\n \"adset-id\": \"ad set\",\n \"campaign-id\": \"campaign\",\n} as const;\n\n/**\n * An empty page is only an answer for the scope it searched. Name the form, ad,\n * ad set or campaign and the window, so \"no leads\" is never mistaken for a wrong scope.\n * A page reached by `--after` follows pages that may have held leads: it ends the read, nothing more.\n */\nfunction emptyLeadsHints(page: MetaLeadPage, params: Record<string, string>): string[] {\n if (page.leads.length > 0 || page.nextCursor) return [];\n const source = Object.entries(LEAD_SOURCE_NOUNS)\n .filter(([flag]) => params[flag])\n .map(([flag, noun]) => `${noun} ${params[flag]}`)\n .join(\", \");\n const window =\n [params.since ? `since ${params.since}` : \"\", params.until ? `through ${params.until}` : \"\"]\n .filter(Boolean)\n .join(\" \") || \"at any date\";\n if (params.after) {\n return [`No more leads on ${source} ${window}: this page ends the read, so add it to the earlier pages' leads.`];\n }\n return [\n `No leads on ${source} ${window}. That is the answer for this scope; widen the window or read another form only if the question was wider.`,\n ];\n}\n\nconst leadFormsListArgs = {\n \"page-id\": { type: \"string\", description: \"Facebook Page ID\" },\n full: { type: \"boolean\", description: \"Include each form's questions\" },\n output: { type: \"string\", description: \"Output format: json|csv|jsonl|md\", default: \"json\" },\n} as const;\n\nconst leadFormsListCommand = defineCommand({\n meta: {\n name: \"list\",\n description:\n \"List the Instant Forms on a Facebook Page, with lead counts. Choose a Page with hasPageAccessToken: true from `baker ads meta pages`. Pass --full to include questions.\",\n },\n args: leadFormsListArgs,\n run: async ({ args }) => {\n try {\n const pageId = args[\"page-id\"] as string | undefined;\n if (!pageId) {\n handleLeadsError(\n new Error(\n \"--page-id is required. Run `baker ads meta pages` and choose a Page with hasPageAccessToken: true.\",\n ),\n );\n }\n const params: Record<string, string> = { \"page-id\": pageId };\n if (args.full) params.full = \"true\";\n const data = await apiGet<MetaLeadForm[]>(\"/api/ads/meta/lead-forms\", params);\n const fmt = csvOrJson(args);\n if (fmt !== \"json\") {\n writeAdsOutput(data as unknown as Array<Record<string, unknown>>, fmt);\n return;\n }\n const hints = leadFormHints(data);\n writeJsonEnvelope(hints.length > 0 ? { ok: true, data, hints } : { ok: true, data });\n } catch (err) {\n handleLeadsError(err);\n }\n },\n});\n\nexport const leadFormsCommand = defineCommand({\n meta: {\n name: \"lead-forms\",\n description: `List Instant Forms on a Facebook Page, or stage a new one, a changed copy, an archive.\nA form is permanent on Meta and nothing on it changes once made: to change one, duplicate it with changes and archive the old one.\nExamples:\n baker ads meta lead-forms --page-id 100635183117758\n baker ads meta lead-forms --page-id 100635183117758 --full\n baker ads meta ads --account-id act_123 --lead-form 987654321 --all-statuses — the ads that open a form\n baker ads meta lead-forms create --account-id act_123 --page-id 555 --file form.json\n baker ads meta lead-forms spec 987654321 — a live form as a create --file payload\n baker ads meta lead-forms duplicate 987654321 --account-id act_123 --name \"Free audit (ES)\" --locale ES_LA\n baker ads meta lead-forms archive 987654321 --account-id act_123`,\n },\n args: leadFormsListArgs,\n subCommands: {\n list: leadFormsListCommand,\n create: leadFormsCreateCommand,\n spec: leadFormsSpecCommand,\n duplicate: leadFormsDuplicateCommand,\n archive: leadFormsArchiveCommand,\n unarchive: leadFormsUnarchiveCommand,\n },\n default: \"list\",\n});\n\nexport const leadsCommand = defineCommand({\n meta: {\n name: \"leads\",\n description: `Read the leads an instant form collected. Every question comes back; email and phone answers are MASKED unless you pass --full, so you can report on what a form is collecting without moving contact details around.\n\nExamples:\n baker ads meta leads --form-id 987654321\n baker ads meta leads --form-id 987654321 --since 2026-08-01 --until 2026-08-31\n baker ads meta leads --ad-id 6123456789 --limit 50\n baker ads meta leads --adset-id 6123456780 --since 2026-08-01 # every ad in the ad set (Meta has no ad set edge)\n baker ads meta leads --form-id 987654321 --after <nextCursor> # the next page\n baker ads meta leads --form-id 987654321 --full # raw contact details — only when handing leads over\n\nResults are PAGED. A response carrying \\`nextCursor\\` is not the whole set — follow it before reporting any total.`,\n },\n args: withWindowSpellings({\n \"form-id\": { type: \"string\", description: \"Instant form ID (from `baker ads meta lead-forms`)\" },\n \"ad-id\": { type: \"string\", description: \"Read one ad's leads instead of a whole form\" },\n \"adset-id\": { type: \"string\", description: \"Read the leads of every ad in an ad set\" },\n \"campaign-id\": { type: \"string\", description: \"Read the leads of every ad in a campaign\" },\n since: { type: \"string\", description: \"Earliest submission date, YYYY-MM-DD\" },\n until: { type: \"string\", description: \"Latest submission date, YYYY-MM-DD (inclusive)\" },\n limit: { type: \"string\", description: \"Leads per page (default 100, max 500)\" },\n after: { type: \"string\", description: \"Cursor from a previous call's nextCursor\" },\n full: { type: \"boolean\", description: \"Return raw contact details instead of masked ones\" },\n output: { type: \"string\", description: \"Output format: json|csv|jsonl|md\", default: \"json\" },\n }),\n run: async ({ args }) => {\n try {\n const params: Record<string, string> = {};\n for (const flag of [\"form-id\", \"ad-id\", \"adset-id\", \"campaign-id\"] as const) {\n const value = args[flag];\n if (typeof value === \"string\" && value.length > 0) params[flag] = value;\n }\n if (Object.keys(params).length !== 1) {\n handleLeadsError(\n new Error(\"Pass one of --form-id (from `baker ads meta lead-forms`), --ad-id, --adset-id or --campaign-id.\"),\n );\n }\n if (args.since) params.since = args.since as string;\n if (args.until) params.until = args.until as string;\n if (args.limit) params.limit = String(args.limit);\n if (args.after) params.after = String(args.after);\n if (args.full) params.full = \"true\";\n const page = await apiGet<MetaLeadPage>(\"/api/ads/meta/leads\", params);\n const emptyHints = emptyLeadsHints(page, params);\n const fmt = csvOrJson(args);\n if (fmt !== \"json\") {\n writeAdsOutput(page.leads as unknown as Array<Record<string, unknown>>, fmt, undefined, emptyHints);\n return;\n }\n writeJsonEnvelope({\n ok: true,\n data: page.leads,\n ...(page.nextCursor ? { nextCursor: page.nextCursor } : {}),\n hints: [...emptyHints, ...leadPageHints(page, args.full === true)],\n });\n } catch (err) {\n handleLeadsError(err);\n }\n },\n});\n","import { defineCommand } from \"citty\";\nimport { apiGet } from \"../../../client.ts\";\nimport { repeatedValues } from \"../../../lib/repeatedFlags.ts\";\nimport { registerSchema, withEffect } from \"../../../schemas.ts\";\nimport { writeJsonEnvelope } from \"../output.ts\";\nimport { handleMetaError } from \"./shared.ts\";\nimport {\n bareAccountId,\n failWriteValidation,\n fileArg,\n loadJsonFileArg,\n mergePayload,\n metaStages,\n requireTarget,\n stageOp,\n upper,\n} from \"./write-shared.ts\";\n\n/**\n * Staging Instant Forms. A form is permanent on Meta — it is never deleted,\n * only archived — and nothing on it changes once it exists, so every write\n * here is a new form (create, duplicate) or an archive / unarchive, all staged\n * on this chat's draft and applied at publish.\n */\n\ntype Args = Record<string, unknown>;\n\nconst STAGED_NOTE = \"Staged until publish — review with `baker ads meta draft`.\";\n\nconst str = (value: unknown): string | undefined => (typeof value === \"string\" && value.length > 0 ? value : undefined);\n\n/** `\"Question? => answer | answer\"` → a CUSTOM question, multiple choice when it lists answers. */\nfunction customQuestion(value: string): Record<string, unknown> {\n const [label = \"\", answers] = value.split(\"=>\").map((part) => part.trim());\n const options = answers\n ?.split(\"|\")\n .map((answer) => answer.trim())\n .filter(Boolean)\n .map((answer) => ({ value: answer }));\n return { type: \"CUSTOM\", label, ...(options && options.length > 0 ? { options } : {}) };\n}\n\nfunction questionsFromFlags(args: Args, rawArgs: readonly string[] | undefined): unknown[] | undefined {\n const predefined = (str(args.questions) ?? \"\")\n .split(\",\")\n .map((type) => type.trim().toUpperCase())\n .filter(Boolean)\n .map((type) => ({ type }));\n const custom = repeatedValues(rawArgs, \"question\", args.question).map(customQuestion);\n const all = [...predefined, ...custom];\n return all.length > 0 ? all : undefined;\n}\n\n/**\n * The intro fields the flags name, and only those: a duplicate keeps every\n * other intro field of the live form (`mergeDuplicateSpec`), so `--intro-title`\n * alone does not wipe the text and `--intro-button` alone is not dropped.\n */\nfunction introFromFlags(args: Args, rawArgs: readonly string[] | undefined): Record<string, unknown> | undefined {\n const content = repeatedValues(rawArgs, \"intro-text\", args[\"intro-text\"]);\n const set = {\n ...(str(args[\"intro-title\"]) ? { title: str(args[\"intro-title\"]) } : {}),\n ...(content.length > 0 ? { style: content.length > 1 ? \"LIST_STYLE\" : \"PARAGRAPH_STYLE\", content } : {}),\n ...(str(args[\"intro-button\"]) ? { buttonText: str(args[\"intro-button\"]) } : {}),\n };\n return Object.keys(set).length > 0 ? set : undefined;\n}\n\nfunction thankYouFromFlags(args: Args): Record<string, unknown> | undefined {\n const fields = {\n title: str(args[\"thank-you-title\"]),\n body: str(args[\"thank-you-body\"]),\n buttonType: upper(args[\"thank-you-button\"]),\n buttonText: str(args[\"thank-you-button-text\"]),\n websiteUrl: str(args[\"thank-you-url\"]),\n businessPhoneNumber: str(args[\"thank-you-phone\"]),\n countryCode: upper(args[\"thank-you-country\"]),\n };\n const set = Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined));\n return Object.keys(set).length > 0 ? set : undefined;\n}\n\nfunction trackingFromFlags(args: Args, rawArgs: readonly string[] | undefined): Record<string, string> | undefined {\n const pairs = repeatedValues(rawArgs, \"tracking\", args.tracking).map((pair) => {\n const at = pair.indexOf(\"=\");\n if (at <= 0) failWriteValidation(`--tracking takes name=value, got \"${pair}\"`);\n return [pair.slice(0, at).trim(), pair.slice(at + 1).trim()] as const;\n });\n return pairs.length > 0 ? Object.fromEntries(pairs) : undefined;\n}\n\n/** The `leadForm.create` fields the flags name; anything a flag leaves out comes from `--file`. */\nexport function leadFormPayloadFromFlags(args: Args, rawArgs?: readonly string[]): Record<string, unknown> {\n const quality = args[\"higher-intent\"] ?? args[\"optimized-for-quality\"];\n return {\n page_id: str(args[\"page-id\"]),\n name: str(args.name),\n locale: upper(args.locale),\n questionPageHeadline: str(args.headline),\n questions: questionsFromFlags(args, rawArgs),\n privacyPolicyUrl: str(args[\"privacy-policy-url\"]),\n privacyPolicyLinkText: str(args[\"privacy-link-text\"]),\n followUpActionUrl: str(args[\"follow-up-url\"]),\n optimizedForQuality: typeof quality === \"boolean\" ? quality : undefined,\n intro: introFromFlags(args, rawArgs),\n thankYou: thankYouFromFlags(args),\n sharing: str(args.sharing)?.toLowerCase(),\n smsVerification: args[\"sms-verification\"] === true ? true : undefined,\n trackingParameters: trackingFromFlags(args, rawArgs),\n };\n}\n\n/**\n * A `--file` form as staged. `lead-forms spec > form.json` writes the CLI's\n * `{ok, data, hints}` envelope, so the form is its `data`; a hand-written file\n * is the form itself.\n */\nexport function formFileForStaging(raw: Record<string, unknown>): Record<string, unknown> {\n const data = raw.ok === true && \"data\" in raw ? raw.data : raw;\n return data && typeof data === \"object\" && !Array.isArray(data) ? (data as Record<string, unknown>) : raw;\n}\n\n/** The screens a duplicate changes field by field, so a flag naming one field keeps the others. */\nconst SCREENS = [\"intro\", \"thankYou\"] as const;\n\nfunction record(value: unknown): Record<string, unknown> | undefined {\n return value && typeof value === \"object\" && !Array.isArray(value) ? (value as Record<string, unknown>) : undefined;\n}\n\n/** `over` on `base`, the intro and thank-you screens merged a field at a time. */\nfunction mergeOver(base: Record<string, unknown>, over: Record<string, unknown>): Record<string, unknown> {\n const merged = mergePayload(base, over);\n for (const screen of SCREENS) {\n const from = record(base[screen]);\n const to = record(over[screen]);\n if (from && to) merged[screen] = mergePayload(from, to);\n }\n return merged;\n}\n\n/**\n * A duplicate: the live form, then the `--file` changes over it, then the\n * flags over both. Forms are permanent, so the intro and thank-you screens\n * change only in the fields named — never wholesale.\n */\nexport function mergeDuplicateSpec(\n live: Record<string, unknown>,\n changes: Record<string, unknown>,\n flags: Record<string, unknown>,\n): Record<string, unknown> {\n return mergeOver(mergeOver(live, changes), flags);\n}\n\nconst FORM_FLAG_ARGS = {\n name: { type: \"string\", description: \"Form name — unique among the Page's forms (archived ones count)\" },\n locale: {\n type: \"string\",\n description:\n \"Form language, e.g. EN_US, ES_LA, PT_BR, FR_FR, DE_DE (Meta's 32) — Meta words its own questions in it\",\n },\n headline: { type: \"string\", description: \"Headline above the questions\" },\n questions: {\n type: \"string\",\n description:\n \"Questions Meta words itself, comma-separated: FULL_NAME,EMAIL,PHONE,WORK_EMAIL,COMPANY_NAME,JOB_TITLE,CITY,ZIP,DOB…\",\n },\n question: {\n type: \"string\",\n description: 'A custom question, repeatable: \"Question?\" or multiple choice \"Question? => Answer | Answer\"',\n },\n \"privacy-policy-url\": { type: \"string\", description: \"Public https privacy policy (required)\" },\n \"privacy-link-text\": { type: \"string\", description: \"Words of the privacy link (≤70, default Privacy Policy)\" },\n \"follow-up-url\": { type: \"string\", description: \"https link of the default View website button\" },\n \"higher-intent\": {\n type: \"boolean\",\n description: \"Higher intent: people review their answers before submitting (default: more volume)\",\n },\n \"optimized-for-quality\": { type: \"boolean\", description: \"Same as --higher-intent\" },\n \"intro-title\": { type: \"string\", description: \"Intro screen title\" },\n \"intro-text\": { type: \"string\", description: \"Intro paragraph; repeat for bullet points\" },\n \"intro-button\": { type: \"string\", description: \"Intro screen button text\" },\n \"thank-you-title\": { type: \"string\", description: \"Thank-you screen title\" },\n \"thank-you-body\": { type: \"string\", description: \"Thank-you screen text\" },\n \"thank-you-button\": {\n type: \"string\",\n description: \"VIEW_WEBSITE|DOWNLOAD|BOOK_ON_WEBSITE|CALL_BUSINESS|WHATSAPP|P2B_MESSENGER|PROMO_CODE|NONE\",\n },\n \"thank-you-button-text\": { type: \"string\", description: \"Thank-you button text\" },\n \"thank-you-url\": { type: \"string\", description: \"Website the thank-you button opens\" },\n \"thank-you-phone\": { type: \"string\", description: \"CALL_BUSINESS: phone number, e.g. +14155550100\" },\n \"thank-you-country\": { type: \"string\", description: \"CALL_BUSINESS: the number's country, e.g. US\" },\n sharing: { type: \"string\", description: \"restricted (only people shown the ad, Meta's default) | open\" },\n \"sms-verification\": { type: \"boolean\", description: \"Confirm the PHONE answer with a text-message code\" },\n tracking: { type: \"string\", description: \"name=value Meta adds to every lead, repeatable\" },\n} as const;\n\nconst SCHEMA_FORM_ARGS = Object.fromEntries(\n Object.entries(FORM_FLAG_ARGS).map(([key, arg]) => [key, { ...arg, required: false }]),\n);\n\n// --- Create ---\n\nregisterSchema({\n command: \"ads.meta.lead-forms.create\",\n description:\n \"Start here to stage a Page-owned Meta Instant Form. The form is created only when this Session publishes, and it is permanent (Meta archives, never deletes). Use the returned meta_temp_* ref as --lead-form on a creative in the same Session. --file takes the whole spec (questions with keys, options, inlineContext; intro; disclaimer with checkboxes; thankYou; sharing; trackingParameters). Before staging: lead ads switched on for the company (`baker ads meta account` → bakerPermissions.leadAds) and the Page's lead terms accepted (`baker ads terms --platform meta --account-id act_<id> --page-id <id>`). The whole lead campaign (ad set ON_AD, creative --lead-form): the ads-meta tool doc § Lead ads.\",\n args: {\n \"account-id\": { type: \"string\", description: \"Selected Meta ad account, act_<id>\", required: true },\n \"page-id\": {\n type: \"string\",\n description:\n \"Facebook Page that owns the form — choose one with this account in promotingAccountIds and hasPageAccessToken: true from `baker ads meta pages`\",\n required: true,\n },\n ...SCHEMA_FORM_ARGS,\n file: {\n type: \"string\",\n description: \"JSON file with the full form payload; flags override its keys\",\n required: false,\n },\n },\n});\n\nexport const leadFormsCreateCommand = withEffect(\n metaStages(\"leadForm.create\"),\n defineCommand({\n meta: {\n name: \"create\",\n description: `Stage a Meta Instant Form on a Facebook Page. ${STAGED_NOTE} The form is permanent once published (archive it to retire it).\nChoose a Page with this account in promotingAccountIds and hasPageAccessToken: true from \\`baker ads meta pages\\`.\nExample: baker ads meta lead-forms create --account-id act_123 --page-id 456 --name \"Free audit\" --questions FULL_NAME,EMAIL,PHONE --question \"Budget? => Under 1k | 1k+\" --privacy-policy-url https://example.com/privacy --follow-up-url https://example.com\nFull spec: --file form.json (see \\`baker schema ads.meta.lead-forms.create\\`). The whole lead campaign, prerequisites first: the ads-meta tool doc § Lead ads.`,\n },\n args: {\n \"account-id\": { type: \"string\", description: \"Selected Meta ad account\" },\n \"page-id\": { type: \"string\", description: \"Facebook Page ID\" },\n ...FORM_FLAG_ARGS,\n ...fileArg(\"leadForm.create\", \"JSON form payload; flags override file keys\"),\n },\n run: async ({ args, rawArgs }) => {\n const accountId = await bareAccountId(args as Args);\n const payload = mergePayload(\n formFileForStaging(loadJsonFileArg(args.file)),\n leadFormPayloadFromFlags(args as Args, rawArgs),\n );\n await stageOp({ kind: \"leadForm.create\", accountId, payload }, [\n \"An ad opens it with `creatives create --cta SIGN_UP --lead-form <ref>` into an ad set with destination ON_AD.\",\n ]);\n },\n }),\n);\n\n// --- Spec + duplicate ---\n\ninterface FormSpec {\n spec: Record<string, unknown>;\n notCopied: string[];\n status?: string;\n}\n\nregisterSchema({\n command: \"ads.meta.lead-forms.spec\",\n description:\n \"Read a live Instant Form as the exact payload `lead-forms create --file` takes — the starting point for a changed copy. Lists what could not be carried over.\",\n args: { id: { type: \"positional\", description: \"Instant Form id\", required: true } },\n});\n\nexport const leadFormsSpecCommand = defineCommand({\n meta: {\n name: \"spec\",\n description: `A live form as the payload \\`lead-forms create --file\\` / \\`lead-forms duplicate --file\\` take.\nExample: baker ads meta lead-forms spec 1460955752594831 > form.json`,\n },\n args: { id: { type: \"positional\", description: \"Instant Form id\", required: true } },\n run: async ({ args }) => {\n try {\n const data = await apiGet<FormSpec>(\"/api/ads/meta/lead-forms/spec\", { \"form-id\": String(args.id) });\n writeJsonEnvelope({\n ok: true,\n data: data.spec,\n ...(data.notCopied.length > 0 ? { hints: [`Not carried over: ${data.notCopied.join(\"; \")}`] } : {}),\n });\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nregisterSchema({\n command: \"ads.meta.lead-forms.duplicate\",\n description:\n \"Stage a NEW Instant Form copied from a live one, with changes — the only way Meta lets a form change (it keeps a form's questions, texts and settings as made). --file holds the changed keys; flags override both. Point ads at the copy, then archive the original.\",\n args: {\n id: { type: \"positional\", description: \"Instant Form id to copy\", required: true },\n \"account-id\": { type: \"string\", description: \"Selected Meta ad account, act_<id>\", required: true },\n ...SCHEMA_FORM_ARGS,\n name: { type: \"string\", description: \"Name of the copy — unique on the Page\", required: true },\n file: { type: \"string\", description: \"JSON with the keys to change (same shape as create)\", required: false },\n },\n});\n\nexport const leadFormsDuplicateCommand = defineCommand({\n meta: {\n name: \"duplicate\",\n description: `Stage a changed copy of a live Instant Form (Meta changes nothing on an existing form). ${STAGED_NOTE}\nExample: baker ads meta lead-forms duplicate 1460955752594831 --account-id act_123 --name \"Free audit (ES)\" --locale ES_LA\nThen point the ads at the copy (\\`creatives create --lead-form <ref>\\`) and \\`lead-forms archive <old id>\\`.`,\n },\n args: {\n id: { type: \"positional\", description: \"Instant Form id to copy\", required: true },\n \"account-id\": { type: \"string\", description: \"Selected Meta ad account\" },\n ...FORM_FLAG_ARGS,\n file: { type: \"string\", description: \"JSON with the keys to change\" },\n },\n run: async ({ args, rawArgs }) => {\n const accountId = await bareAccountId(args as Args);\n if (!str(args.name)) failWriteValidation(\"--name is required: Meta refuses a second form with the same name\");\n let source: FormSpec;\n try {\n source = await apiGet<FormSpec>(\"/api/ads/meta/lead-forms/spec\", { \"form-id\": String(args.id) });\n } catch (err) {\n handleMetaError(err);\n }\n const flags = leadFormPayloadFromFlags(args as Args, rawArgs);\n const payload = mergeDuplicateSpec(source.spec, formFileForStaging(loadJsonFileArg(args.file)), flags);\n const notCopied = source.notCopied.length > 0 ? [`Not carried over: ${source.notCopied.join(\"; \")}`] : [];\n await stageOp({ kind: \"leadForm.create\", accountId, payload }, [\n ...notCopied,\n `Point the ads at the copy, then \\`baker ads meta lead-forms archive ${String(args.id)}\\` to retire the original.`,\n ]);\n },\n});\n\n// --- Archive / unarchive ---\n\nfunction statusCommand(name: \"archive\" | \"unarchive\", status: \"ARCHIVED\" | \"ACTIVE\", description: string) {\n registerSchema({\n command: `ads.meta.lead-forms.${name}`,\n description,\n args: {\n id: { type: \"positional\", description: \"Instant Form id\", required: true },\n \"account-id\": { type: \"string\", description: \"Ad account the change is staged under\", required: true },\n },\n });\n return withEffect(\n metaStages(\"leadForm.update\"),\n defineCommand({\n meta: {\n name,\n description: `${description} ${STAGED_NOTE}\nExample: baker ads meta lead-forms ${name} 1460955752594831 --account-id act_123`,\n },\n args: {\n id: { type: \"positional\", description: \"Instant Form id\", required: true },\n \"account-id\": { type: \"string\", description: \"Numeric account ID or act_N\" },\n },\n run: async ({ args }) => {\n await stageOp({\n kind: \"leadForm.update\",\n accountId: await bareAccountId(args as Args),\n target: requireTarget(args as Args, \"Instant Form\"),\n payload: { status },\n });\n },\n }),\n );\n}\n\nexport const leadFormsArchiveCommand = statusCommand(\n \"archive\",\n \"ARCHIVED\",\n \"Archive an Instant Form: it leaves the Page's form library and no ad can use it. Meta never deletes a form; this is how one is retired.\",\n);\n\nexport const leadFormsUnarchiveCommand = statusCommand(\n \"unarchive\",\n \"ACTIVE\",\n \"Bring an archived Instant Form back so ads can use it again.\",\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,iBAAAA,sBAAqB;;;ACD9B,SAAS,qBAAqB;AA2B9B,IAAM,cAAc;AAEpB,IAAM,MAAM,CAAC,UAAwC,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,QAAQ;AAG7G,SAAS,eAAe,OAAwC;AAC9D,QAAM,CAAC,QAAQ,IAAI,OAAO,IAAI,MAAM,MAAM,IAAI,EAAE,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC;AACzE,QAAM,UAAU,SACZ,MAAM,GAAG,EACV,IAAI,CAAC,WAAW,OAAO,KAAK,CAAC,EAC7B,OAAO,OAAO,EACd,IAAI,CAAC,YAAY,EAAE,OAAO,OAAO,EAAE;AACtC,SAAO,EAAE,MAAM,UAAU,OAAO,GAAI,WAAW,QAAQ,SAAS,IAAI,EAAE,QAAQ,IAAI,CAAC,EAAG;AACxF;AAEA,SAAS,mBAAmB,MAAY,SAA+D;AACrG,QAAM,cAAc,IAAI,KAAK,SAAS,KAAK,IACxC,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE,YAAY,CAAC,EACvC,OAAO,OAAO,EACd,IAAI,CAAC,UAAU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O,QAAO,QAAQ,KAAK;AACpC,UAAI,KAAK,MAAO,QAAO,QAAQ,KAAK;AACpC,UAAI,KAAK,MAAO,QAAO,QAAQ,OAAO,KAAK,KAAK;AAChD,UAAI,KAAK,MAAO,QAAO,QAAQ,OAAO,KAAK,KAAK;AAChD,UAAI,KAAK,KAAM,QAAO,OAAO;AAC7B,YAAM,OAAO,MAAM,OAAqB,uBAAuB,MAAM;AACrE,YAAM,aAAa,gBAAgB,MAAM,MAAM;AAC/C,YAAM,MAAM,UAAU,IAAI;AAC1B,UAAI,QAAQ,QAAQ;AAClB,uBAAe,KAAK,OAAoD,KAAK,QAAW,UAAU;AAClG;AAAA,MACF;AACA,wBAAkB;AAAA,QAChB,IAAI;AAAA,QACJ,MAAM,KAAK;AAAA,QACX,GAAI,KAAK,aAAa,EAAE,YAAY,KAAK,WAAW,IAAI,CAAC;AAAA,QACzD,OAAO,CAAC,GAAG,YAAY,GAAG,cAAc,MAAM,KAAK,SAAS,IAAI,CAAC;AAAA,MACnE,CAAC;AAAA,IACH,SAAS,KAAK;AACZ,uBAAiB,GAAG;AAAA,IACtB;AAAA,EACF;AACF,CAAC;","names":["defineCommand","defineCommand"]}
|
|
@@ -110,21 +110,21 @@ Full guide: __tooling__/docs/tools/baker/ads-meta.md`
|
|
|
110
110
|
account: () => import("./account-B57D3OSA.js").then((m) => m.accountCommand),
|
|
111
111
|
businesses: () => import("./businesses-Y555ZAIW.js").then((m) => m.businessesCommand),
|
|
112
112
|
pages: () => import("./pages-G5DNWE2G.js").then((m) => m.pagesCommand),
|
|
113
|
-
"lead-forms": () => import("./leads-
|
|
113
|
+
"lead-forms": () => import("./leads-DAXPX7V5.js").then((m) => m.leadFormsCommand),
|
|
114
114
|
"instant-experiences": () => import("./instant-experiences-IRBTOXAW.js").then((m) => m.instantExperiencesCommand),
|
|
115
|
-
leads: () => import("./leads-
|
|
116
|
-
campaigns: () => import("./campaigns-
|
|
117
|
-
adsets: () => import("./adsets-
|
|
118
|
-
ads: () => import("./ads-
|
|
119
|
-
creatives: () => import("./creatives-
|
|
120
|
-
audiences: () => import("./audiences-
|
|
115
|
+
leads: () => import("./leads-DAXPX7V5.js").then((m) => m.leadsCommand),
|
|
116
|
+
campaigns: () => import("./campaigns-RNPLAVXM.js").then((m) => m.campaignsCommand),
|
|
117
|
+
adsets: () => import("./adsets-PMEPGGAI.js").then((m) => m.adsetsCommand),
|
|
118
|
+
ads: () => import("./ads-2O3DC7ZM.js").then((m) => m.adsListCommand),
|
|
119
|
+
creatives: () => import("./creatives-OTKJRMBJ.js").then((m) => m.creativesCommand),
|
|
120
|
+
audiences: () => import("./audiences-Y6UFKHZ5.js").then((m) => m.audiencesCommand),
|
|
121
121
|
"custom-conversions": () => import("./custom-conversions-RFFTAVXT.js").then((m) => m.customConversionsCommand),
|
|
122
122
|
pixels: () => import("./pixels-IEIARQNK.js").then((m) => m.pixelsCommand),
|
|
123
|
-
activities: () => import("./activities-
|
|
123
|
+
activities: () => import("./activities-SUUW5KH7.js").then((m) => m.activitiesCommand),
|
|
124
124
|
insights: () => import("./insights-HCLFFFFV.js").then((m) => m.insightsCommand),
|
|
125
125
|
preview: () => import("./preview-S5QKIKNG.js").then((m) => m.previewCommand),
|
|
126
126
|
videos: () => import("./videos-KN2TUWQ6.js").then((m) => m.videosCommand),
|
|
127
|
-
targeting: () => import("./targeting-
|
|
127
|
+
targeting: () => import("./targeting-HIXQGQ7A.js").then((m) => m.targetingCommand),
|
|
128
128
|
"instagram-accounts": () => import("./account-assets-MQK5BDAJ.js").then((m) => m.instagramAccountsCommand),
|
|
129
129
|
apps: () => import("./account-assets-MQK5BDAJ.js").then((m) => m.appsCommand),
|
|
130
130
|
"dsa-recommendations": () => import("./account-assets-MQK5BDAJ.js").then((m) => m.dsaRecommendationsCommand),
|
|
@@ -149,4 +149,4 @@ Full guide: __tooling__/docs/tools/baker/ads-meta.md`
|
|
|
149
149
|
export {
|
|
150
150
|
metaCommand
|
|
151
151
|
};
|
|
152
|
-
//# sourceMappingURL=meta-
|
|
152
|
+
//# sourceMappingURL=meta-GSTM6EBD.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AUDIENCE_SIZE_NOT_REPORTED,
|
|
3
3
|
metaSizeWithheld
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PRPSV4VB.js";
|
|
5
5
|
import {
|
|
6
6
|
loadJsonFileArg
|
|
7
7
|
} from "./chunk-7M2EY3CA.js";
|
|
@@ -774,4 +774,4 @@ Start here before writing interests, behaviors, places or languages into an ad s
|
|
|
774
774
|
export {
|
|
775
775
|
targetingCommand
|
|
776
776
|
};
|
|
777
|
-
//# sourceMappingURL=targeting-
|
|
777
|
+
//# sourceMappingURL=targeting-HIXQGQ7A.js.map
|
package/package.json
CHANGED
package/dist/ads-EUQYHCBO.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 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) and url_tags — 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}`,\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 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) and 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 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,OAAO,EAAE,MAAM,UAAU,aAAa,0BAA0B;AAAA,EAChE,YAAY;AAAA,EACZ,GAAG;AACL;AAEA;AAAA,EACE;AAAA,EACA,0eAAqe,iBAAiB;AAAA,EACtf;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,QAAO,UAAU,IAAI,KAAK,UAAU;AAC1D,UAAI,KAAK,aAAa,EAAG,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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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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\n/** Where an ad sends people and the URL parameters it adds, 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 return {\n ...(link !== undefined ? { link } : {}),\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,IA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I,UAAU,SAAY,EAAE,UAAU,MAAM,IAAI,CAAC;AAAA,MACjD,GAAI,UAAU,SAAY,EAAE,UAAU,MAAM,IAAI,CAAC;AAAA,IACnD;AAAA,IACJ,GAAI,aAAa,CAAC,wBAAwB,IAAI,UAAU,IAAI,KAAK,OAAO,UAAU,gBAAgB,WAC9F,EAAE,QAAQ,UAAU,YAAY,IAChC,CAAC;AAAA,EACP;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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 and the URL parameters it adds — read off its creative, which the listing expands. */\nconst AD_WHEN_PRESENT = [\"link\", \"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 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 } : {}),\n },\n ]),\n ),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAS,KAAK,KAAc,MAAkC;AAC5D,QAAM,SAAkB,CAAC;AACzB,aAAW,OAAO,MAAM;AACtB,QAAI,IAAI,GAAG,MAAM,OAAW,QAAO,GAAG,IAAI,IAAI,GAAG;AAAA,EACnD;AACA,SAAO;AACT;AASA,IAAM,mBAAmB,CAAC,MAAM,QAAQ,oBAAoB,gBAAgB,mBAAmB,cAAc;AAG7G,IAAM,qBAAqB,CAAC,UAAU,aAAa;AAOnD,IAAM,uBAAuB,CAAC,gBAAgB,sBAAsB,uBAAuB;AAC3F,IAAM,wBAAwB,CAAC,GAAG,sBAAsB,GAAG,kBAAkB;AAE7E,SAAS,gBAAgB,KAAuB;AAC9C,QAAM,UAAU,IAAI;AACpB,SAAO;AAAA,IACL,GAAG,KAAK,KAAK,CAAC,MAAM,QAAQ,oBAAoB,gBAAgB,iBAAiB,CAAC;AAAA,IAClF,GAAI,OAAO,YAAY,WAAW,EAAE,cAAc,QAAQ,MAAM,GAAG,EAAE,EAAE,IAAI,CAAC;AAAA,IAC5E,GAAG,mBAAmB,GAAG;AAAA,IACzB,GAAG,YAAY,GAAG;AAAA,EACpB;AACF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W,QAAQ,OAAO,KAAK,WAAW,GAAG;AAC/C,YAAQ,OAAO,MAAM,GAAG,MAAM,SAAS,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,MAAM,IAAI,CAAC,WAAW;AAAA,CAAI;AAC9F;AAAA,EACF;AACA,iBAAe,OAAO,MAAM,QAAQ,OAAO,QAAQ,CAAC,GAAG,OAAO,GAAI,OAAO,SAAS,CAAC,CAAE,CAAC;AACxF;AAGO,IAAM,uBAAuB;AAAA,EAClC,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,MAAM,EAAE,MAAM,WAAW,aAAa,2EAA2E;AAAA,EACjH,QAAQ;AAAA,IACN,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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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: {\n type: \"string\",\n description:\n \"Case-insensitive match on the meeting name or slug, or a pasted booking link (meetings.hubspot.com/<slug>)\",\n required: false,\n },\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, slug or a pasted booking link\", 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(\n args.search\n ? `No meeting link's name, slug or booking link matched \"${args.search}\". Drop --search to see every calendar on the connected account.`\n : \"No meeting links matched. Check the connected HubSpot account.\",\n );\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,qDAAqD,UAAU,MAAM;AAAA,IAC5G,oBAAoB;AAAA,MAClB,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,MACV,SAAS;AAAA,IACX;AAAA,IACA,cAAc,EAAE,MAAM,UAAU,aAAa,6BAA6B,UAAU,OAAO,MAAM,CAAC,GAAG,WAAW,EAAE;AAAA,EACpH;AACF,CAAC;AAED,eAAe;AAAA,EACb,SAAS;AAAA,EACT,aACE;AAAA,EACF,MAAM;AAAA,IACJ,QAAQ,EAAE,MAAM,cAAc,aAAa,qDAAqD,UAAU,KAAK;AAAA,IAC/G,MAAM,EAAE,MAAM,WAAW,aAAa,mCAAmC,UAAU,OAAO,SAAS,MAAM;AAAA,IACzG,WAAW;AAAA,MACT,MAAM;AAAA,MACN,aACE;AAAA,MACF,UAAU;AAAA,MACV,SAAS;AAAA,IACX;AAAA,EACF;AACF,CAAC;AAED,eAAe;AAAA,EACb,SAAS;AAAA,EACT,QAAQ,CAAC,qCAAqC;AAAA,EAC9C,QAAQ;AAAA,EACR,aACE;AAAA,EACF,MAAM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