@koda-sl/baker-cli 0.851.0-dev.914922aaf → 0.852.0-dev.55d5a1c2b

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.
Files changed (70) hide show
  1. package/README.md +7 -3
  2. package/dist/{account-Z62BVYAI.js → account-PKCDR22I.js} +3 -3
  3. package/dist/{account-users-ZDZ7B4BX.js → account-users-UO4OVX3W.js} +3 -3
  4. package/dist/{accounts-SUIMNTTA.js → accounts-3PEIYK7V.js} +2 -2
  5. package/dist/{ads-BYETTX2Y.js → ads-ED5L55ME.js} +2 -2
  6. package/dist/{analytics-WLFBQOO4.js → analytics-DH7JTWW7.js} +2 -2
  7. package/dist/audience-size-NHQZQ7DR.js +137 -0
  8. package/dist/audience-size-NHQZQ7DR.js.map +1 -0
  9. package/dist/{audit-EHKSN2WS.js → audit-PEOYEN4A.js} +2 -2
  10. package/dist/{bid-pricing-HFBQ23DD.js → bid-pricing-HVUVHS3F.js} +2 -2
  11. package/dist/{campaign-groups-DKB3K7L4.js → campaign-groups-YGIZAWMT.js} +8 -8
  12. package/dist/{campaigns-6OYAQVIE.js → campaigns-FIU3FF7Q.js} +11 -11
  13. package/dist/{chunk-63XEBJIX.js → chunk-6G2EVVNW.js} +2 -2
  14. package/dist/{chunk-YXYUHTQM.js → chunk-D2BRYEOF.js} +2 -2
  15. package/dist/{chunk-WVXJYBWA.js → chunk-ZPLZHTWI.js} +2 -1
  16. package/dist/cli.js +2 -2
  17. package/dist/{companies-ITNWR5Q4.js → companies-65CQH5NZ.js} +3 -3
  18. package/dist/{conversation-SKZMGVA5.js → conversation-EUPDVCN5.js} +2 -2
  19. package/dist/{conversions-IMST22UQ.js → conversions-JN2QSYKN.js} +7 -7
  20. package/dist/{creatives-42PW2C24.js → creatives-FLL2NBH2.js} +8 -8
  21. package/dist/{demographics-K5WTHZCW.js → demographics-SR66Q3Q2.js} +2 -2
  22. package/dist/{draft-JGEZVDAS.js → draft-XV3SNAT5.js} +3 -3
  23. package/dist/{experiments-C4R65GA6.js → experiments-BT3QLENT.js} +3 -3
  24. package/dist/{facets-GXBTQCAW.js → facets-RTH4UYOZ.js} +51 -9
  25. package/dist/facets-RTH4UYOZ.js.map +1 -0
  26. package/dist/{forecast-NOQNCFTX.js → forecast-NH7BO45V.js} +2 -2
  27. package/dist/{hubspot-XZYXZ24P.js → hubspot-W5LYFWTH.js} +4 -10
  28. package/dist/hubspot-W5LYFWTH.js.map +1 -0
  29. package/dist/{leads-ZRHPHJRE.js → leads-QAMBOEX7.js} +2 -2
  30. package/dist/{linkedin-BD63QPGK.js → linkedin-DWWA5CGK.js} +46 -32
  31. package/dist/linkedin-DWWA5CGK.js.map +1 -0
  32. package/dist/{preview-66BGLU5H.js → preview-TK4Q53KQ.js} +2 -2
  33. package/dist/{resolve-NVL3FTQU.js → resolve-JEEIJJOP.js} +2 -2
  34. package/dist/{revenue-C24BDD5A.js → revenue-J7YSHGB6.js} +3 -3
  35. package/dist/{top-companies-KEV55RME.js → top-companies-XAZTHC44.js} +3 -3
  36. package/dist/{url-params-CXUAYJBD.js → url-params-5FXKA6J2.js} +2 -2
  37. package/dist/{write-commands-FUXBKDN7.js → write-commands-TDME3RU2.js} +3 -3
  38. package/package.json +1 -1
  39. package/dist/audience-size-ISJSPSRW.js +0 -77
  40. package/dist/audience-size-ISJSPSRW.js.map +0 -1
  41. package/dist/facets-GXBTQCAW.js.map +0 -1
  42. package/dist/hubspot-XZYXZ24P.js.map +0 -1
  43. package/dist/linkedin-BD63QPGK.js.map +0 -1
  44. /package/dist/{account-Z62BVYAI.js.map → account-PKCDR22I.js.map} +0 -0
  45. /package/dist/{account-users-ZDZ7B4BX.js.map → account-users-UO4OVX3W.js.map} +0 -0
  46. /package/dist/{accounts-SUIMNTTA.js.map → accounts-3PEIYK7V.js.map} +0 -0
  47. /package/dist/{ads-BYETTX2Y.js.map → ads-ED5L55ME.js.map} +0 -0
  48. /package/dist/{analytics-WLFBQOO4.js.map → analytics-DH7JTWW7.js.map} +0 -0
  49. /package/dist/{audit-EHKSN2WS.js.map → audit-PEOYEN4A.js.map} +0 -0
  50. /package/dist/{bid-pricing-HFBQ23DD.js.map → bid-pricing-HVUVHS3F.js.map} +0 -0
  51. /package/dist/{campaign-groups-DKB3K7L4.js.map → campaign-groups-YGIZAWMT.js.map} +0 -0
  52. /package/dist/{campaigns-6OYAQVIE.js.map → campaigns-FIU3FF7Q.js.map} +0 -0
  53. /package/dist/{chunk-63XEBJIX.js.map → chunk-6G2EVVNW.js.map} +0 -0
  54. /package/dist/{chunk-YXYUHTQM.js.map → chunk-D2BRYEOF.js.map} +0 -0
  55. /package/dist/{chunk-WVXJYBWA.js.map → chunk-ZPLZHTWI.js.map} +0 -0
  56. /package/dist/{companies-ITNWR5Q4.js.map → companies-65CQH5NZ.js.map} +0 -0
  57. /package/dist/{conversation-SKZMGVA5.js.map → conversation-EUPDVCN5.js.map} +0 -0
  58. /package/dist/{conversions-IMST22UQ.js.map → conversions-JN2QSYKN.js.map} +0 -0
  59. /package/dist/{creatives-42PW2C24.js.map → creatives-FLL2NBH2.js.map} +0 -0
  60. /package/dist/{demographics-K5WTHZCW.js.map → demographics-SR66Q3Q2.js.map} +0 -0
  61. /package/dist/{draft-JGEZVDAS.js.map → draft-XV3SNAT5.js.map} +0 -0
  62. /package/dist/{experiments-C4R65GA6.js.map → experiments-BT3QLENT.js.map} +0 -0
  63. /package/dist/{forecast-NOQNCFTX.js.map → forecast-NH7BO45V.js.map} +0 -0
  64. /package/dist/{leads-ZRHPHJRE.js.map → leads-QAMBOEX7.js.map} +0 -0
  65. /package/dist/{preview-66BGLU5H.js.map → preview-TK4Q53KQ.js.map} +0 -0
  66. /package/dist/{resolve-NVL3FTQU.js.map → resolve-JEEIJJOP.js.map} +0 -0
  67. /package/dist/{revenue-C24BDD5A.js.map → revenue-J7YSHGB6.js.map} +0 -0
  68. /package/dist/{top-companies-KEV55RME.js.map → top-companies-XAZTHC44.js.map} +0 -0
  69. /package/dist/{url-params-CXUAYJBD.js.map → url-params-5FXKA6J2.js.map} +0 -0
  70. /package/dist/{write-commands-FUXBKDN7.js.map → write-commands-TDME3RU2.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  csvOrJson,
3
3
  handleLinkedinError
4
- } from "./chunk-WVXJYBWA.js";
4
+ } from "./chunk-ZPLZHTWI.js";
5
5
  import {
6
6
  NO_CACHE_ARG
7
7
  } from "./chunk-VHKEKK2L.js";
@@ -28,6 +28,7 @@ import "./chunk-YQSBHWOI.js";
28
28
 
29
29
  // src/commands/ads/linkedin/facets.ts
30
30
  import { defineCommand } from "citty";
31
+ import { parse } from "csv-parse/sync";
31
32
  var listCmd = defineCommand({
32
33
  meta: {
33
34
  name: "list",
@@ -56,6 +57,29 @@ seniorities, titles, employers, growthRate, companyCategory, skills, etc.).`
56
57
  }
57
58
  }
58
59
  });
60
+ function refuseArgs(message) {
61
+ writeAdsJson({ ok: false, error: { code: "INVALID_ARGS", message } });
62
+ process.exit(1);
63
+ }
64
+ function parseQueryList(list) {
65
+ let rows;
66
+ try {
67
+ rows = parse(list, { relax_column_count: true, skip_empty_lines: true, trim: true });
68
+ } catch (e) {
69
+ refuseArgs(`--queries is not a valid comma-separated list: ${e instanceof Error ? e.message : "parse error"}`);
70
+ }
71
+ const queries = rows.flat().filter(Boolean);
72
+ if (queries.length === 0) refuseArgs("--queries names no query.");
73
+ return queries;
74
+ }
75
+ async function lookUpEntities(params, queries) {
76
+ const rows = [];
77
+ for (const q of queries) {
78
+ const matches = await apiGet("/api/ads/linkedin/facets/entities", { ...params, query: q });
79
+ rows.push(...matches.length > 0 ? matches.map((match) => ({ query: q, ...match })) : [{ query: q, urn: "" }]);
80
+ }
81
+ return rows;
82
+ }
59
83
  var valuesCmd = defineCommand({
60
84
  meta: {
61
85
  name: "values",
@@ -64,14 +88,26 @@ var valuesCmd = defineCommand({
64
88
  Examples:
65
89
  baker ads linkedin facets values --facet seniorities \u2014 all seniority URNs
66
90
  baker ads linkedin facets values --facet titles --query "marketing director" \u2014 typeahead
91
+ baker ads linkedin facets values --facet titles --queries 'HR manager,"Director, Human Resources"' --output md
92
+ \u2014 several titles in one call
67
93
  baker ads linkedin facets values --facet industries --output csv
68
94
 
69
95
  The --facet flag accepts the bare name (industries, seniorities, titles, etc.)
70
- or the full URN (urn:li:adTargetingFacet:industries).`
96
+ or the full URN (urn:li:adTargetingFacet:industries).
97
+
98
+ --query is one search, sent whole ("Austin, Texas" stays one). --queries is a CSV
99
+ list of searches; quote one that has a comma in it.`
71
100
  },
72
101
  args: {
73
102
  facet: { type: "string", description: "Facet name (e.g. industries) or URN", required: true },
74
- query: { type: "string", description: "Typeahead query (auto-switches finder to typeahead)" },
103
+ query: {
104
+ type: "string",
105
+ description: "Typeahead query (auto-switches finder to typeahead), sent whole \u2014 a comma in it stays part of it"
106
+ },
107
+ queries: {
108
+ type: "string",
109
+ description: "CSV list of typeahead queries to look up in one call (quote one with a comma: 'HR manager,\"Director, HR\"') \u2014 each match carries its `query`; one with no match comes back with an empty `urn`"
110
+ },
75
111
  finder: { type: "string", description: "adTargetingFacet | typeahead | similarEntities (default: auto)" },
76
112
  locale: { type: "string", description: "Locale (default: en_US)" },
77
113
  "no-cache": NO_CACHE_ARG,
@@ -80,15 +116,20 @@ or the full URN (urn:li:adTargetingFacet:industries).`
80
116
  run: async ({ args }) => {
81
117
  try {
82
118
  const params = { facet: String(args.facet) };
83
- const finder = args.finder ?? (args.query ? "typeahead" : "adTargetingFacet");
119
+ if (args.query && args.queries) {
120
+ refuseArgs("Pass --query for one search or --queries for several, not both.");
121
+ }
122
+ const searching = Boolean(args.query || args.queries);
123
+ const finder = args.finder ?? (searching ? "typeahead" : "adTargetingFacet");
84
124
  params.finder = finder;
85
- if (args.query) params.query = String(args.query);
86
125
  if (args.locale) params.locale = String(args.locale);
87
126
  if (args["no-cache"]) params["skip-cache"] = "true";
88
- const data = await apiGet("/api/ads/linkedin/facets/entities", params);
127
+ if (args.query) params.query = String(args.query);
128
+ const data = args.queries ? await lookUpEntities(params, parseQueryList(String(args.queries))) : await apiGet("/api/ads/linkedin/facets/entities", params);
89
129
  const fmt = csvOrJson(args);
90
130
  if (fmt !== "json") {
91
- writeAdsOutput(data, fmt);
131
+ const fields = [...new Set(data.flatMap((row) => Object.keys(row)))];
132
+ writeAdsOutput(data, fmt, fields);
92
133
  return;
93
134
  }
94
135
  writeAdsJson({ ok: true, data });
@@ -105,7 +146,8 @@ var facetsCommand = defineCommand({
105
146
  Subcommands:
106
147
  list \u2014 every facet (industries, seniorities, titles, employers, \u2026)
107
148
  values --facet titles \u2014 entity URNs for one facet
108
- values --facet titles --query "marketing director" \u2014 typeahead`
149
+ values --facet titles --query "marketing director" \u2014 typeahead
150
+ values --facet titles --queries "HR manager,HR director" \u2014 several typeaheads in one call`
109
151
  },
110
152
  subCommands: {
111
153
  list: listCmd,
@@ -115,4 +157,4 @@ Subcommands:
115
157
  export {
116
158
  facetsCommand
117
159
  };
118
- //# sourceMappingURL=facets-GXBTQCAW.js.map
160
+ //# sourceMappingURL=facets-RTH4UYOZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/ads/linkedin/facets.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { parse } from \"csv-parse/sync\";\nimport { NO_CACHE_ARG } from \"../../../cache-flag.ts\";\nimport { apiGet } from \"../../../client.ts\";\nimport { writeAdsJson, writeAdsOutput } from \"../output.ts\";\nimport { csvOrJson, handleLinkedinError } from \"./shared.ts\";\n\ninterface LinkedinFacet {\n facet: string;\n facetUrn: string;\n name: string;\n entityTypes?: string[];\n availableEntityFinders?: string[];\n}\n\ninterface LinkedinFacetEntity {\n urn: string;\n facet?: string;\n name?: string;\n parents?: string[];\n}\n\nconst listCmd = defineCommand({\n meta: {\n name: \"list\",\n description: `List every targeting facet LinkedIn supports.\n\nCached 7 days. Use this to discover what dimensions you can target on (industries,\nseniorities, titles, employers, growthRate, companyCategory, skills, etc.).`,\n },\n args: {\n \"no-cache\": NO_CACHE_ARG,\n output: { type: \"string\", description: \"json|csv|jsonl|md\", default: \"json\" },\n },\n run: async ({ args }) => {\n try {\n const params: Record<string, string> = {};\n if (args[\"no-cache\"]) params[\"skip-cache\"] = \"true\";\n const data = await apiGet<LinkedinFacet[]>(\"/api/ads/linkedin/facets\", 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 writeAdsJson({ ok: true, data });\n } catch (err) {\n handleLinkedinError(err);\n }\n },\n});\n\nfunction refuseArgs(message: string): never {\n writeAdsJson({ ok: false, error: { code: \"INVALID_ARGS\", message } });\n process.exit(1);\n}\n\n/** A CSV row of queries: `\"Director, Human Resources\",Recruiter` is two, the quoted comma kept. */\nfunction parseQueryList(list: string): string[] {\n let rows: string[][];\n try {\n rows = parse(list, { relax_column_count: true, skip_empty_lines: true, trim: true });\n } catch (e) {\n refuseArgs(`--queries is not a valid comma-separated list: ${e instanceof Error ? e.message : \"parse error\"}`);\n }\n const queries = rows.flat().filter(Boolean);\n if (queries.length === 0) refuseArgs(\"--queries names no query.\");\n return queries;\n}\n\n/**\n * One typeahead per query, each match tagged with the query it answers. A query LinkedIn knows\n * nothing for still gets its row, so a miss is never read as a lookup not made.\n */\nasync function lookUpEntities(\n params: Record<string, string>,\n queries: string[],\n): Promise<Array<LinkedinFacetEntity & { query: string }>> {\n const rows: Array<LinkedinFacetEntity & { query: string }> = [];\n // One after another: the backend paces LinkedIn reads per company, and the client waits out its 429s.\n for (const q of queries) {\n const matches = await apiGet<LinkedinFacetEntity[]>(\"/api/ads/linkedin/facets/entities\", { ...params, query: q });\n rows.push(...(matches.length > 0 ? matches.map((match) => ({ query: q, ...match })) : [{ query: q, urn: \"\" }]));\n }\n return rows;\n}\n\nconst valuesCmd = defineCommand({\n meta: {\n name: \"values\",\n description: `Look up entity values for a single facet — full list or typeahead search.\n\nExamples:\n baker ads linkedin facets values --facet seniorities — all seniority URNs\n baker ads linkedin facets values --facet titles --query \"marketing director\" — typeahead\n baker ads linkedin facets values --facet titles --queries 'HR manager,\"Director, Human Resources\"' --output md\n — several titles in one call\n baker ads linkedin facets values --facet industries --output csv\n\nThe --facet flag accepts the bare name (industries, seniorities, titles, etc.)\nor the full URN (urn:li:adTargetingFacet:industries).\n\n--query is one search, sent whole (\"Austin, Texas\" stays one). --queries is a CSV\nlist of searches; quote one that has a comma in it.`,\n },\n args: {\n facet: { type: \"string\", description: \"Facet name (e.g. industries) or URN\", required: true },\n query: {\n type: \"string\",\n description: \"Typeahead query (auto-switches finder to typeahead), sent whole — a comma in it stays part of it\",\n },\n queries: {\n type: \"string\",\n description:\n \"CSV list of typeahead queries to look up in one call (quote one with a comma: 'HR manager,\\\"Director, HR\\\"') — each match carries its `query`; one with no match comes back with an empty `urn`\",\n },\n finder: { type: \"string\", description: \"adTargetingFacet | typeahead | similarEntities (default: auto)\" },\n locale: { type: \"string\", description: \"Locale (default: en_US)\" },\n \"no-cache\": NO_CACHE_ARG,\n output: { type: \"string\", description: \"json|csv|jsonl|md\", default: \"json\" },\n },\n run: async ({ args }) => {\n try {\n const params: Record<string, string> = { facet: String(args.facet) };\n if (args.query && args.queries) {\n refuseArgs(\"Pass --query for one search or --queries for several, not both.\");\n }\n const searching = Boolean(args.query || args.queries);\n const finder = (args.finder as string | undefined) ?? (searching ? \"typeahead\" : \"adTargetingFacet\");\n params.finder = finder;\n if (args.locale) params.locale = String(args.locale);\n if (args[\"no-cache\"]) params[\"skip-cache\"] = \"true\";\n\n if (args.query) params.query = String(args.query);\n const data: Array<LinkedinFacetEntity & { query?: string }> = args.queries\n ? await lookUpEntities(params, parseQueryList(String(args.queries)))\n : await apiGet<LinkedinFacetEntity[]>(\"/api/ads/linkedin/facets/entities\", params);\n const fmt = csvOrJson(args);\n if (fmt !== \"json\") {\n // Every row's columns, so a first query with no match does not drop the others' names.\n const fields = [...new Set(data.flatMap((row) => Object.keys(row)))];\n writeAdsOutput(data as unknown as Array<Record<string, unknown>>, fmt, fields);\n return;\n }\n writeAdsJson({ ok: true, data });\n } catch (err) {\n handleLinkedinError(err);\n }\n },\n});\n\nexport const facetsCommand = defineCommand({\n meta: {\n name: \"facets\",\n description: `LinkedIn targeting facets and entity lookup.\n\nSubcommands:\n list — every facet (industries, seniorities, titles, employers, …)\n values --facet titles — entity URNs for one facet\n values --facet titles --query \"marketing director\" — typeahead\n values --facet titles --queries \"HR manager,HR director\" — several typeaheads in one call`,\n },\n subCommands: {\n list: listCmd,\n values: valuesCmd,\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AAqBtB,IAAM,UAAU,cAAc;AAAA,EAC5B,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA;AAAA;AAAA;AAAA,EAIf;AAAA,EACA,MAAM;AAAA,IACJ,YAAY;AAAA,IACZ,QAAQ,EAAE,MAAM,UAAU,aAAa,qBAAqB,SAAS,OAAO;AAAA,EAC9E;AAAA,EACA,KAAK,OAAO,EAAE,KAAK,MAAM;AACvB,QAAI;AACF,YAAM,SAAiC,CAAC;AACxC,UAAI,KAAK,UAAU,EAAG,QAAO,YAAY,IAAI;AAC7C,YAAM,OAAO,MAAM,OAAwB,4BAA4B,MAAM;AAC7E,YAAM,MAAM,UAAU,IAAI;AAC1B,UAAI,QAAQ,QAAQ;AAClB,uBAAe,MAAmD,GAAG;AACrE;AAAA,MACF;AACA,mBAAa,EAAE,IAAI,MAAM,KAAK,CAAC;AAAA,IACjC,SAAS,KAAK;AACZ,0BAAoB,GAAG;AAAA,IACzB;AAAA,EACF;AACF,CAAC;AAED,SAAS,WAAW,SAAwB;AAC1C,eAAa,EAAE,IAAI,OAAO,OAAO,EAAE,MAAM,gBAAgB,QAAQ,EAAE,CAAC;AACpE,UAAQ,KAAK,CAAC;AAChB;AAGA,SAAS,eAAe,MAAwB;AAC9C,MAAI;AACJ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NO_CACHE_ARG
13
13
  } from "./chunk-VHKEKK2L.js";
@@ -119,4 +119,4 @@ Start here:
119
119
  export {
120
120
  forecastCommand
121
121
  };
122
- //# sourceMappingURL=forecast-NOQNCFTX.js.map
122
+ //# sourceMappingURL=forecast-NH7BO45V.js.map
@@ -153,11 +153,7 @@ registerSchema({
153
153
  command: "hubspot.meetings.list",
154
154
  description: "Every HubSpot meeting link (calendar) on the connected account, with just enough to choose one: name, slug, link type (personal / group / round-robin), whether booking redirects somewhere, and how many booking fields it asks for (null = unknown, read it with `meetings view`). Next step is usually `hubspot meetings view <slug> --as-node`, which gives you the blob to write straight into a hubspotMeeting step.",
155
155
  args: {
156
- search: {
157
- type: "string",
158
- description: "Case-insensitive match on the meeting name or slug, or a pasted booking link (meetings.hubspot.com/<slug>)",
159
- required: false
160
- },
156
+ search: { type: "string", description: "Case-insensitive substring match on the meeting name", required: false },
161
157
  "redirecting-only": {
162
158
  type: "boolean",
163
159
  description: "Only meeting links that redirect after booking",
@@ -303,7 +299,7 @@ var meetingsListCommand = defineCommand({
303
299
  description: "List HubSpot meeting links (calendars). Example: baker hubspot meetings list"
304
300
  },
305
301
  args: {
306
- search: { type: "string", description: "Match on meeting name, slug or a pasted booking link", required: false },
302
+ search: { type: "string", description: "Match on meeting name", required: false },
307
303
  "redirecting-only": { type: "boolean", description: "Only links that redirect after booking", required: false }
308
304
  },
309
305
  run: async ({ args }) => {
@@ -319,9 +315,7 @@ var meetingsListCommand = defineCommand({
319
315
  const { meetings } = response.data;
320
316
  const hints = [];
321
317
  if (meetings.length === 0) {
322
- hints.push(
323
- args.search ? `No meeting link's name, slug or booking link matched "${args.search}". Drop --search to see every calendar on the connected account.` : "No meeting links matched. Check the connected HubSpot account."
324
- );
318
+ hints.push("No meeting links matched. Drop --search, or check the connected HubSpot account.");
325
319
  } else {
326
320
  hints.push(
327
321
  "To put one on a page: `baker hubspot meetings view <slug> --as-node` returns the object to write into the step's form.external."
@@ -856,4 +850,4 @@ export {
856
850
  hubspotCommand,
857
851
  workflowViewHints
858
852
  };
859
- //# sourceMappingURL=hubspot-XZYXZ24P.js.map
853
+ //# sourceMappingURL=hubspot-W5LYFWTH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/hubspot/index.ts"],"sourcesContent":["import type {\n HubspotContactFieldsListResponse,\n HubspotContactLookupResponse,\n HubspotContactPropertiesListResponse,\n HubspotContactsSummaryResponse,\n HubspotFormSubmissionsResponse,\n HubspotFormsListResponse,\n HubspotFormsViewResponse,\n HubspotMeetingsListResponse,\n HubspotMeetingsViewResponse,\n HubspotPipelinesListResponse,\n HubspotWorkflowsListResponse,\n HubspotWorkflowsViewResponse,\n} from \"@baker/api\";\nimport { HUBSPOT_OPERATORS } from \"@baker/api/event-sources\";\nimport { defineCommand } from \"citty\";\nimport { ApiError, apiPost } from \"../../client.ts\";\nimport { rowsAsData, writeJson } from \"../../output.ts\";\nimport { registerSchema } from \"../../schemas.ts\";\nimport { failNotConnected } from \"./refusal.ts\";\n\nconst EMBED_TYPES = [\"legacy\", \"v4\", \"unknown\"] as const;\n\nfunction assertEmbedType(value: string | undefined): (typeof EMBED_TYPES)[number] | undefined {\n if (value === undefined) {\n return undefined;\n }\n if (!(EMBED_TYPES as readonly string[]).includes(value)) {\n throw new Error(`--embed-type must be one of: ${EMBED_TYPES.join(\"|\")}`);\n }\n return value as (typeof EMBED_TYPES)[number];\n}\n\nregisterSchema({\n command: \"hubspot.forms.list\",\n routes: [\"POST /api/hubspot/forms/list\"],\n effect: \"read_live\",\n description:\n \"Start here for HubSpot forms: every form on the connected account, with just enough to choose one — embed type (legacy vs v4), field count, its post-submit action (inline thank-you vs redirect to a URL), and whether spam prevention (captcha) is on. A form with captcha on can be embedded on a page but can never receive a submission from a Form, so check it before wiring one as a destination. Answers 'which of my forms redirect after submit?' and 'is this form legacy or v4?'. portalId is returned once on meta, not per row. Next step is usually `hubspot forms view <id> --as-node`, which gives you the blob to write straight into a Form step — you do not need request_flow_input for HubSpot.\",\n args: {\n search: { type: \"string\", description: \"Case-insensitive substring match on the form name\", required: false },\n \"redirecting-only\": {\n type: \"boolean\",\n description: \"Only forms whose post-submit action redirects away\",\n required: false,\n default: false,\n },\n \"embed-type\": { type: \"string\", description: \"Filter: legacy|v4|unknown\", required: false, enum: [...EMBED_TYPES] },\n },\n});\n\nregisterSchema({\n command: \"hubspot.forms.view\",\n description:\n \"One HubSpot form in detail: every field (name, label, type, required, hidden, options), the legal-consent mode, the post-submit action, captcha, and language. Read it before wiring a form into a Form (flow) so you know what fields exist to autofill. Add --full for the untouched HubSpot payload, or --as-node to get the object to write into the step's form.external instead.\",\n args: {\n formId: { type: \"positional\", description: \"HubSpot form id (from `baker hubspot forms list`)\", required: true },\n full: { type: \"boolean\", description: \"Include the raw HubSpot payload\", required: false, default: false },\n \"as-node\": {\n type: \"boolean\",\n description:\n \"Emit the resource blob to write into a flow node's form.external, instead of the readable view. Write it into the node yourself; no need for request_flow_input when the account is connected and the form is unambiguous.\",\n required: false,\n default: false,\n },\n },\n});\n\nregisterSchema({\n command: \"hubspot.forms.submissions\",\n routes: [\"POST /api/hubspot/forms/submissions\"],\n effect: \"read_live\",\n description:\n \"How many leads a form actually received over a window, and on which days — the difference between 'this form is live' and 'this form is working'. Start here when asked whether a form or a campaign is producing leads. Returns counts and dates only; the leads' own answers need --full and are personal data, so do not put them in a report. Pair with `hubspot pipelines list` to see whether those leads were then worked.\",\n args: {\n formId: { type: \"positional\", description: \"HubSpot form id (from `baker hubspot forms list`)\", required: true },\n days: { type: \"string\", description: \"Window in days, 1-365 (default 30)\", required: false },\n full: {\n type: \"boolean\",\n description: \"Include each submission's field values — personal data, request only when actually needed\",\n required: false,\n default: false,\n },\n },\n});\n\nregisterSchema({\n command: \"hubspot.contacts.summary\",\n routes: [\"POST /api/hubspot/contacts/summary\"],\n effect: \"read_live\",\n description:\n \"Whether the leads that arrived recently are actually being worked, as counts: how many contacts were created in the window, how many have someone assigned, and how they split across lifecycle stages. This is the 'have these leads been treated?' answer. Returns no names or emails — use `hubspot contacts lookup` for one specific person.\",\n args: {\n days: { type: \"string\", description: \"Window in days, 1-365 (default 30)\", required: false },\n },\n});\n\nregisterSchema({\n command: \"hubspot.contacts.properties\",\n description:\n \"Every contact property a HubSpot event can watch, with its `kind` (select, string, number, date, boolean) — which decides the operators the trigger takes — and, for a select, the `options` its values come from. Start here to make a HubSpot event: pick the property and condition that mean the outcome (a deal won is usually `lifecyclestage` is `customer`, a custom property the client's team sets, or a number crossing a threshold), then `baker analytics sources --create-hubspot --property <name> [--operator <op>] --value <value>…` reads it every five minutes. Names are HubSpot's internal ones; use them as printed.\",\n args: {},\n});\n\nregisterSchema({\n command: \"hubspot.contacts.fields\",\n description:\n \"Every contact property on the connected HubSpot account — name, label, group and HubSpot's type — which is what a HubSpot event's rows can read: `baker analytics sources --create-hubspot … --field email={{work_email}} --field value={{deal_value}} --field currency=EUR`, or `--map` on an existing one. Names are HubSpot's internal ones; use them as printed, and `{{id}}` for the contact's own id. No personal data.\",\n args: {},\n});\n\nregisterSchema({\n command: \"hubspot.contacts.lookup\",\n routes: [\"POST /api/hubspot/contacts/lookup\"],\n effect: \"read_live\",\n description:\n \"One contact by email: lifecycle stage, whether anyone is assigned, its account (company) and deals with their stage — settles whether a lead was picked up. `--properties utm_campaign,utm_source` also reads those into `contact.properties`, to check a form's tracking reached it: each value, or null when empty; a name the account does not define is left out, never null. `found: false` means the lead never reached the CRM at all — that is a finding, not an error. `dealsReadable: false` / `companyReadable: false` mean deals or account details were not readable on this connection, so an empty deals list or a null company is unknown rather than absent.\",\n args: {\n email: { type: \"positional\", description: \"The contact's email address\", required: true },\n properties: {\n type: \"string\",\n description:\n \"Comma-separated contact properties to read, by HubSpot's internal name (up to 25; `baker hubspot contacts fields` lists them): --properties utm_campaign,utm_source\",\n required: false,\n },\n },\n});\n\nregisterSchema({\n command: \"hubspot.workflows.list\",\n description:\n \"Every workflow on the connected account, with whether it is switched on. Read it when auditing what happens to a lead after it is captured — a form wired to a workflow that is off looks connected and does nothing.\",\n args: {\n search: { type: \"string\", description: \"Case-insensitive substring match on the workflow name\", required: false },\n \"enabled-only\": { type: \"boolean\", description: \"Only workflows that are on\", required: false, default: false },\n },\n});\n\nregisterSchema({\n command: \"hubspot.workflows.view\",\n description:\n \"One workflow's actual configuration: what enrols a record, whether it re-enrols, and every step with the property it writes. Read it before saying a workflow is correct — `workflows list` only tells you it exists and whether it is on. Branches come back in HubSpot's order, and on a LIST_BRANCH step that is evaluation order (`order: 1` wins over `order: 2`) — which is where this kind of setup silently breaks: a broad branch placed above a narrow one swallows the records the narrow one was written for, and nothing reports it. A STATIC_BRANCH matches on a value instead, so its order carries no precedence. Steps are NOT in execution order — follow `nextActionId` from step to step. Add --full for the branch filter criteria (which property is compared to which value).\",\n args: {\n workflowId: {\n type: \"positional\",\n description: \"Workflow id (from `baker hubspot workflows list`)\",\n required: true,\n },\n full: {\n type: \"boolean\",\n description: \"Include the raw HubSpot payload — the only place the branch filter criteria can be read\",\n required: false,\n default: false,\n },\n },\n});\n\nregisterSchema({\n command: \"hubspot.pipelines.list\",\n description:\n \"The account's deal pipelines and their stages, in the order they run, each stage with `isClosed` / `isWon` (HubSpot's closed-won is closed with probability 1). Use it to answer where a lead lands once captured and whether it moved — the 'have these leads been worked?' half of a form audit — and to pick the pipeline ids for `hubspot deals list --pipeline`.\",\n args: {},\n});\n\nregisterSchema({\n command: \"hubspot.meetings.list\",\n description:\n \"Every HubSpot meeting link (calendar) on the connected account, with just enough to choose one: name, slug, link type (personal / group / round-robin), whether booking redirects somewhere, and how many booking fields it asks for (null = unknown, read it with `meetings view`). Next step is usually `hubspot meetings view <slug> --as-node`, which gives you the blob to write straight into a hubspotMeeting step.\",\n args: {\n search: { type: \"string\", description: \"Case-insensitive substring match on the meeting name\", required: false },\n \"redirecting-only\": {\n type: \"boolean\",\n description: \"Only meeting links that redirect after booking\",\n required: false,\n default: false,\n },\n },\n});\n\nregisterSchema({\n command: \"hubspot.meetings.view\",\n description:\n \"One HubSpot meeting link in detail: its booking-form fields (name, label, type, required, custom), link, and redirect URL. This is the source of truth for a calendar's fields — the list command cannot see them reliably. Add --as-node to get the object to write into the step's form.external instead.\",\n args: {\n slug: { type: \"positional\", description: \"Meeting slug (from `baker hubspot meetings list`)\", required: true },\n \"as-node\": {\n type: \"boolean\",\n description: \"Emit the resource blob to write into a flow node's form.external, instead of the readable view.\",\n required: false,\n default: false,\n },\n },\n});\n\nconst formsListCommand = defineCommand({\n meta: {\n name: \"list\",\n description:\n \"List HubSpot forms with embed type and post-submit action. Example: baker hubspot forms list --redirecting-only\",\n },\n args: {\n search: { type: \"string\", description: \"Match on form name\", required: false },\n \"redirecting-only\": { type: \"boolean\", description: \"Only forms that redirect on submit\", required: false },\n \"embed-type\": { type: \"string\", description: \"Filter: legacy|v4|unknown\", required: false },\n },\n run: async ({ args }) => {\n try {\n const body: Record<string, unknown> = {};\n if (args.search) {\n body.search = args.search;\n }\n if (args[\"redirecting-only\"]) {\n body.redirectingOnly = true;\n }\n const embedType = assertEmbedType(args[\"embed-type\"]);\n if (embedType) {\n body.embedType = embedType;\n }\n\n const response = await apiPost<HubspotFormsListResponse>(\"/api/hubspot/forms/list\", body, { read: true });\n const { forms } = response.data;\n const redirecting = forms.filter((form) => form.postSubmitAction?.type === \"redirect_url\");\n const hints: string[] = [];\n if (forms.length === 0) {\n hints.push(\"No forms matched. Drop --search/--embed-type, or check the connected HubSpot account.\");\n } else {\n hints.push(\n \"To put one on a page: `baker hubspot forms view <id> --as-node` returns the object to write into the step's form.external. No request_flow_input needed for HubSpot.\",\n );\n }\n if (redirecting.length > 0) {\n hints.push(\n `${redirecting.length} form(s) redirect after submit. That is fine mid-Form: the renderer suppresses the redirect whenever a step follows the form, and honors it when the form is the last step.`,\n );\n }\n const blocked = forms.filter((form) => form.captchaEnabled);\n if (blocked.length > 0) {\n // Named rather than counted, because the next thing the agent does with\n // this is tell a person which of their forms is the problem — but\n // bounded, since every row already carries `captchaEnabled` and an\n // account with forty blocked forms would otherwise print forty names.\n const shown = blocked.slice(0, 3).map((form) => form.name);\n const rest = blocked.length - shown.length;\n hints.push(\n `${blocked.length} form(s) have spam prevention (captcha) on: ${shown.join(\", \")}${rest > 0 ? `, and ${rest} more` : \"\"}. HubSpot refuses every submission sent to those, so they can be embedded on a page but never wired as a Form's destination. Only the user can switch it off, on the form in HubSpot.`,\n );\n }\n\n writeJson({ ok: true, ...rowsAsData(response.data, \"forms\"), ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\n/**\n * The one HubSpot setting that decides whether a form can receive a lead at\n * all. HubSpot refuses every API submission to a form with spam prevention on\n * (`FORM_HAS_RECAPTCHA_ENABLED`) and there is no token to attach, so the answer\n * is never \"send it differently\" — it is a switch only the client can flip.\n */\nconst CAPTCHA_VIEW_HINT =\n \"This form has spam prevention (captcha) on. HubSpot refuses every submission sent to it, so it cannot be a Form's destination — embedding it on a page still works, because the visitor solves the captcha in the browser. Only the user can switch it off, on the form in HubSpot; do not wire a delivery to it, and tell them what has to change.\";\n\nconst CAPTCHA_NODE_HINT =\n \"This form has spam prevention (captcha) on. That is fine for embedding it on a page — the visitor solves it in the browser — but it can never be a Form's delivery destination, so do not also wire a hubspotForm side effect to this form.\";\n\n/**\n * What to say about one form beyond its fields.\n *\n * Pure and exported so the wording is testable: these are the three facts about\n * a HubSpot form that decide whether wiring it works, and each of them is\n * invisible in the form's own field list.\n */\nexport function formViewHints(form: {\n postSubmitAction: { type: string; value: string } | null;\n captchaEnabled: boolean;\n embedType: string;\n}): string[] {\n const hints: string[] = [];\n if (form.postSubmitAction?.type === \"redirect_url\") {\n hints.push(\n `This form redirects to ${form.postSubmitAction.value} on submit. Placed anywhere but the last step of a Form, that redirect is suppressed so the next step can render.`,\n );\n }\n if (form.captchaEnabled) {\n hints.push(CAPTCHA_VIEW_HINT);\n }\n if (form.embedType === \"unknown\") {\n hints.push(\"Embed type could not be determined from HubSpot's response; the renderer treats it as legacy.\");\n }\n return hints;\n}\n\n/**\n * The same for the `--as-node` blob, where the reader is about to *embed* the\n * form. Captcha reads the opposite way here and has to say so: an embedded form\n * with captcha works, because the visitor solves it in the browser. Silence\n * would leave an agent that just read the refusal elsewhere to conclude the\n * form is unusable and quietly pick another.\n */\nexport function formNodeHints(\n external:\n | {\n captchaEnabled: boolean;\n embedType?: string;\n region?: string;\n configuration?: { postSubmitAction: { type: string } };\n }\n | undefined,\n): string[] {\n return [\n \"Write this object into the node's `form.external` in the flow's _data.json, keeping the rest of the node as-is. No request_flow_input needed — the account is already connected.\",\n ...(external?.captchaEnabled ? [CAPTCHA_NODE_HINT] : []),\n ...(external?.configuration?.postSubmitAction.type === \"redirect_url\"\n ? [\n \"This form redirects on submit. Safe unless it is the last step: the renderer suppresses the redirect whenever a step follows it.\",\n ]\n : []),\n ...(external?.embedType === \"v4\" && !external.region\n ? [\n \"WARNING: this is a v4 form and the connected account has no region recorded, so the step will load HubSpot's na1 script host. That is correct for US portals and breaks the form on eu1/ap1 ones. If it renders blank, have the user reconnect HubSpot from Brain -> Integrations -> Tools, then re-run this command.\",\n ]\n : []),\n ];\n}\n\nconst formsViewCommand = defineCommand({\n meta: {\n name: \"view\",\n description: \"Show one HubSpot form's fields and configuration. Example: baker hubspot forms view 1a2b3c\",\n },\n args: {\n formId: { type: \"positional\", description: \"HubSpot form id\", required: true },\n full: { type: \"boolean\", description: \"Include the raw HubSpot payload\", required: false },\n \"as-node\": { type: \"boolean\", description: \"Emit the node-ready form.external blob\", required: false },\n },\n run: async ({ args }) => {\n try {\n const response = await apiPost<HubspotFormsViewResponse>(\n \"/api/hubspot/forms/view\",\n {\n formId: args.formId,\n ...(args.full ? { full: true } : {}),\n ...(args[\"as-node\"] ? { asNode: true } : {}),\n },\n { read: true },\n );\n\n if (args[\"as-node\"]) {\n writeJson({ ...response, hints: formNodeHints(response.data.external) });\n return;\n }\n\n const form = response.data.form;\n if (!form) {\n throw new Error(\"Response did not include the form view\");\n }\n const hints = formViewHints(form);\n\n writeJson({ ...response, meta: { count: form.fields.length }, ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\nconst meetingsListCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List HubSpot meeting links (calendars). Example: baker hubspot meetings list\",\n },\n args: {\n search: { type: \"string\", description: \"Match on meeting name\", required: false },\n \"redirecting-only\": { type: \"boolean\", description: \"Only links that redirect after booking\", required: false },\n },\n run: async ({ args }) => {\n try {\n const body: Record<string, unknown> = {};\n if (args.search) {\n body.search = args.search;\n }\n if (args[\"redirecting-only\"]) {\n body.redirectingOnly = true;\n }\n\n const response = await apiPost<HubspotMeetingsListResponse>(\"/api/hubspot/meetings/list\", body, { read: true });\n const { meetings } = response.data;\n const hints: string[] = [];\n if (meetings.length === 0) {\n hints.push(\"No meeting links matched. Drop --search, or check the connected HubSpot account.\");\n } else {\n hints.push(\n \"To put one on a page: `baker hubspot meetings view <slug> --as-node` returns the object to write into the step's form.external.\",\n );\n }\n const unknown = meetings.filter((meeting) => !meeting.redirectKnown);\n if (unknown.length > 0) {\n hints.push(\n `HubSpot did not report booking settings for ${unknown.length} of these (${unknown\n .map((meeting) => meeting.slug)\n .join(\n \", \",\n )}), so their redirect and field count are UNKNOWN, not absent. Run \\`baker hubspot meetings view <slug>\\` before concluding one does not redirect.`,\n );\n }\n\n writeJson({ ok: true, ...rowsAsData(response.data, \"meetings\"), ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\nconst meetingsViewCommand = defineCommand({\n meta: {\n name: \"view\",\n description: \"Show one HubSpot meeting link's booking fields. Example: baker hubspot meetings view discovery-call\",\n },\n args: {\n slug: { type: \"positional\", description: \"Meeting slug\", required: true },\n \"as-node\": { type: \"boolean\", description: \"Emit the node-ready form.external blob\", required: false },\n },\n run: async ({ args }) => {\n try {\n const response = await apiPost<HubspotMeetingsViewResponse>(\n \"/api/hubspot/meetings/view\",\n {\n slug: args.slug,\n ...(args[\"as-node\"] ? { asNode: true } : {}),\n },\n { read: true },\n );\n\n if (args[\"as-node\"]) {\n const { external } = response.data;\n writeJson({\n ...response,\n hints: [\n \"Write this object into the node's `form.external` in the flow's _data.json, keeping the rest of the node as-is. No request_flow_input needed — the account is already connected.\",\n ...(external?.customParams.redirectUrl\n ? [\n `This calendar redirects to ${external.customParams.redirectUrl} after booking, and that redirect is NOT suppressed — any step placed after it is unreachable. Keep it as the last step, or ask the user to clear the redirect in HubSpot.`,\n ]\n : []),\n ],\n });\n return;\n }\n\n const meeting = response.data.meeting;\n if (!meeting) {\n throw new Error(\"Response did not include the meeting view\");\n }\n const hints: string[] = [];\n if (meeting.redirectUrl) {\n hints.push(\n `This calendar redirects to ${meeting.redirectUrl} after booking. A step placed after it will not be reached — keep it as the last step, or clear the redirect in HubSpot.`,\n );\n }\n\n writeJson({ ...response, meta: { count: meeting.fields.length }, ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\nconst formsSubmissionsCommand = defineCommand({\n meta: {\n name: \"submissions\",\n description:\n \"How many leads a form received, and when. Example: baker hubspot forms submissions <formId> --days 30\",\n },\n args: {\n formId: { type: \"positional\", description: \"HubSpot form id\", required: true },\n days: { type: \"string\", description: \"Window in days (default 30)\", required: false },\n full: { type: \"boolean\", description: \"Include each lead's answers\", required: false },\n },\n run: async ({ args }) => {\n try {\n const days = args.days === undefined ? 30 : Number(args.days);\n if (!Number.isInteger(days) || days < 1 || days > 365) {\n throw new ApiError(\"VALIDATION_ERROR\", \"--days must be a whole number between 1 and 365.\");\n }\n\n const response = await apiPost<HubspotFormSubmissionsResponse>(\n \"/api/hubspot/forms/submissions\",\n {\n formId: args.formId,\n days,\n ...(args.full ? { full: true } : {}),\n },\n { read: true },\n );\n const { inWindow, total, truncated, lastSubmittedAt } = response.data;\n\n const hints: string[] = [];\n if (inWindow === 0) {\n hints.push(\n total === 0\n ? \"This form has received nothing at all — check it is the form actually embedded on the page before concluding the campaign is at fault.\"\n : `No leads in the last ${days} days, though the form has ${total} older submission(s). It worked once and has gone quiet.`,\n );\n }\n if (truncated) {\n hints.push(\n \"Stopped before reaching the end of the window, so `inWindow` is a floor, not a count. Say so rather than reporting it as exact.\",\n );\n }\n if (!args.full && inWindow > 0) {\n hints.push(\n \"Counts only — the leads' own answers are not included. Add --full if you genuinely need the field values; it returns personal data, so do not paste it into a report or a chat message.\",\n );\n }\n if (lastSubmittedAt !== null) {\n hints.push(\n \"To find out whether these leads were worked, cross-check the deal pipeline: `baker hubspot pipelines list`.\",\n );\n }\n\n writeJson({ ...response, meta: { count: inWindow }, ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\nconst workflowsListCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List HubSpot workflows. Example: baker hubspot workflows list --enabled-only\",\n },\n args: {\n search: { type: \"string\", description: \"Match on workflow name\", required: false },\n \"enabled-only\": { type: \"boolean\", description: \"Only workflows that are on\", required: false },\n },\n run: async ({ args }) => {\n try {\n const body: Record<string, unknown> = {};\n if (args.search) {\n body.search = args.search;\n }\n if (args[\"enabled-only\"]) {\n body.enabledOnly = true;\n }\n\n const response = await apiPost<HubspotWorkflowsListResponse>(\"/api/hubspot/workflows/list\", body, { read: true });\n const { workflows } = response.data;\n const off = workflows.filter((workflow) => !workflow.enabled);\n const hints: string[] = [];\n if (workflows.length === 0) {\n hints.push(\"No workflows matched. Drop --search/--enabled-only, or the account genuinely has none.\");\n }\n if (off.length > 0) {\n hints.push(\n `${off.length} of these are switched off. A form wired to a workflow that is off looks connected and does nothing — worth flagging to the user.`,\n );\n }\n\n writeJson({ ok: true, ...rowsAsData(response.data, \"workflows\"), ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\n/**\n * What the agent should take from one workflow read.\n *\n * All three of these are silent failures in HubSpot — the workflow saves, looks\n * right in the editor, and runs. Nothing surfaces them but reading the order and\n * the flags, so they are stated rather than left for the agent to notice.\n */\nexport function workflowViewHints(workflow: HubspotWorkflowsViewResponse[\"data\"][\"workflow\"]): string[] {\n const hints: string[] = [];\n if (!workflow.enabled) {\n hints.push(\n \"This workflow is switched off, so nothing below it is running now — it may still have run while it was on. Say so before reporting on what it does.\",\n );\n }\n\n // Only a LIST_BRANCH is evaluated top down. A STATIC_BRANCH splits on a value\n // and matches by equality, so \"a broad branch above a narrow one\" cannot\n // happen there — and both arrive here as `branches`, so the kind has to be\n // read off the step rather than off the list.\n const ordered = workflow.steps.filter((step) => step.type === \"LIST_BRANCH\" && (step.branches?.length ?? 0) > 1);\n if (ordered.length > 0) {\n hints.push(\n \"Branches are listed in evaluation order and the first match wins. Check that no broad branch sits above a narrower one — if it does, the narrow branch never runs and nothing in HubSpot reports it.\",\n );\n }\n if (workflow.raw === undefined && ordered.length > 0) {\n hints.push(\n \"This view names the branches but not what they compare. Re-run with --full to read the filter criteria before judging whether a branch matches what it was meant to match.\",\n );\n }\n\n if (workflow.enrollment.reEnrollment === false) {\n hints.push(\n \"Re-enrolment is off: a record that meets the criteria a second time will not run through this again. That is a real choice, not necessarily a fault — but confirm it is the intended one.\",\n );\n } else if (workflow.enrollment.reEnrollment === null) {\n hints.push(\n \"Whether this re-enrols is not reported for this kind of enrolment, so do not state it either way — read it in HubSpot if it matters.\",\n );\n }\n return hints;\n}\n\nconst workflowsViewCommand = defineCommand({\n meta: {\n name: \"view\",\n description:\n \"Read one workflow's real configuration — enrolment, branches in order, and what each step writes. Example: baker hubspot workflows view 121183594 --full\",\n },\n args: {\n workflowId: {\n type: \"positional\",\n description: \"Workflow id (from `baker hubspot workflows list`)\",\n required: true,\n },\n full: { type: \"boolean\", description: \"Include the raw HubSpot payload with the filter criteria\", required: false },\n },\n run: async ({ args }) => {\n try {\n const response = await apiPost<HubspotWorkflowsViewResponse>(\n \"/api/hubspot/workflows/view\",\n {\n workflowId: args.workflowId,\n ...(args.full ? { full: true } : {}),\n },\n { read: true },\n );\n const { workflow } = response.data;\n const hints = workflowViewHints(workflow);\n\n writeJson({ ...response, meta: { count: workflow.steps.length }, ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\nconst pipelinesListCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List HubSpot deal pipelines and their stages. Example: baker hubspot pipelines list\",\n },\n args: {},\n run: async () => {\n try {\n const response = await apiPost<HubspotPipelinesListResponse>(\"/api/hubspot/pipelines/list\", {}, { read: true });\n const { pipelines } = response.data;\n const hints: string[] =\n pipelines.length === 0\n ? [\"This account has no deal pipelines, so there is nowhere for a lead to be worked.\"]\n : [\"Stages are listed in the order they run in HubSpot, so the first stage is where a new lead lands.\"];\n\n writeJson({ ok: true, ...rowsAsData(response.data, \"pipelines\"), hints });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\ntype HubspotObjectWord = \"contact\" | \"deal\" | \"lead\";\n\nconst OBJECT_WORDS: Record<HubspotObjectWord, { plural: string; command: string; rows: string }> = {\n contact: {\n plural: \"contacts\",\n command: \"baker hubspot contacts\",\n rows: '`--field email={{work_email}}`, `--field currency=EUR`, `--field first_name=\"{{firstname}} {{lastname}}\"`; `{{id}}` is the contact\\'s own id',\n },\n deal: {\n plural: \"deals\",\n command: \"baker hubspot deals\",\n rows: \"`--field value={{amount}}`, `--field currency={{deal_currency_code}}`, `--field email={{contact.email}}` — a deal's own properties bare, its contact's as `contact.<name>`; `{{id}}` is the deal's own id, `{{contact.id}}` the contact's\",\n },\n lead: {\n plural: \"leads\",\n command: \"baker hubspot leads\",\n rows: \"`--field email={{contact.email}}`, `--field properties.stage={{hs_pipeline_stage}}` — a lead's own properties bare, its contact's as `contact.<name>`; `{{id}}` is the lead's own id, `{{contact.id}}` the contact's. A lead carries no amount of its own, so `value` is empty unless you point it at a property\",\n },\n};\n\n/** `properties`, for contacts and for deals: what a HubSpot event can watch. */\nfunction propertiesCommand(object: HubspotObjectWord) {\n const words = OBJECT_WORDS[object];\n return defineCommand({\n meta: {\n name: \"properties\",\n description: `List every ${object} property a HubSpot event can watch, with its kind, the operators that kind takes, and a select's values. Example: ${words.command} properties`,\n },\n args: {},\n run: async () => {\n try {\n const response = await apiPost<HubspotContactPropertiesListResponse>(\n \"/api/hubspot/contacts/properties\",\n {\n object,\n },\n { read: true },\n );\n const { properties } = response.data;\n const operators = Object.entries(HUBSPOT_OPERATORS)\n .map(([kind, list]) => `${kind}: ${list.map((operator) => operator.value).join(\", \")}`)\n .join(\" · \");\n const objectFlag = object === \"contact\" ? \"\" : ` --object ${object}`;\n const hints =\n properties.length === 0\n ? [`This account has no visible ${object} property, so there is nothing an event could watch.`]\n : [\n `Pick the property and the condition that mean the outcome, then \\`baker analytics sources --create-hubspot${objectFlag} --property <name> [--operator <op>] --value <value>…\\` (\\`--value\\` repeats for a list). Operators by kind — ${operators}. Counting starts from creation: a ${object} already satisfying it is not counted until it leaves and comes back.`,\n ];\n writeJson({ ok: true, ...rowsAsData(response.data, \"properties\"), hints });\n } catch (err) {\n failNotConnected(err);\n }\n },\n });\n}\n\nconst contactsPropertiesCommand = propertiesCommand(\"contact\");\n\nconst contactsSummaryCommand = defineCommand({\n meta: {\n name: \"summary\",\n description: \"Whether recent leads are being worked, as counts. Example: baker hubspot contacts summary --days 30\",\n },\n args: {\n days: { type: \"string\", description: \"Window in days (default 30)\", required: false },\n },\n run: async ({ args }) => {\n try {\n const days = args.days === undefined ? 30 : Number(args.days);\n if (!Number.isInteger(days) || days < 1 || days > 365) {\n throw new ApiError(\"VALIDATION_ERROR\", \"--days must be a whole number between 1 and 365.\");\n }\n\n const response = await apiPost<HubspotContactsSummaryResponse>(\n \"/api/hubspot/contacts/summary\",\n { days },\n { read: true },\n );\n const { total, withOwner, withoutOwner, byStage, truncated } = response.data;\n\n const hints: string[] = [];\n if (total === 0) {\n hints.push(`No contacts were created in the last ${days} days — nothing reached the CRM in that window.`);\n } else if (withOwner === 0) {\n hints.push(\n `None of these ${total} contacts has anyone assigned. That is the strongest available signal that the leads are arriving and nobody is picking them up — worth raising with the user.`,\n );\n } else if (withoutOwner > withOwner) {\n hints.push(`${withoutOwner} of ${total} contacts have nobody assigned — more unworked than worked.`);\n }\n const unset = byStage.find((entry) => entry.stage === \"unset\");\n if (unset && unset.count > 0) {\n hints.push(\n `${unset.count} contact(s) have no lifecycle stage set at all, so they were created and never staged.`,\n );\n }\n if (truncated) {\n hints.push(\"Stopped before reading every contact in the window, so these counts are floors, not totals.\");\n }\n\n writeJson({ ...response, meta: { count: total }, ...(hints.length > 0 ? { hints } : {}) });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\n/**\n * What the agent should take from one contact lookup.\n *\n * An empty `deals` or a null `company` means two different things depending on\n * whether the connection could read them at all, and the wrong reading — \"this\n * lead was never worked\" — is the one conclusion the command exists to settle.\n * So each is paired with its readability flag rather than reported bare.\n */\nexport function contactLookupHints(\n data: HubspotContactLookupResponse[\"data\"],\n askedProperties: readonly string[] = [],\n): string[] {\n const { found, contact, deals, dealsReadable, company, companyReadable } = data;\n if (!found) {\n return [\n \"No contact with that email. The lead never reached the CRM — check the form's submissions before assuming the CRM lost it.\",\n ];\n }\n\n const hints: string[] = [];\n if (contact?.ownerId === null) {\n hints.push(\"Nobody is assigned to this contact.\");\n }\n const undefinedProperties = askedProperties.filter((name) => !Object.hasOwn(contact?.properties ?? {}, name));\n if (undefinedProperties.length > 0) {\n hints.push(\n `No contact property named ${undefinedProperties.join(\", \")} on this account, so there is nothing to read — this is not an empty value. \\`baker hubspot contacts fields\\` lists the names this account uses.`,\n );\n }\n if (!dealsReadable) {\n hints.push(\n \"Deals were not read: this HubSpot connection does not cover them. Do not report the lead as having no deal — you cannot tell. The user can enable it by reconnecting HubSpot.\",\n );\n } else if (deals.length === 0) {\n hints.push(\"No deal is associated, so this contact was never taken into the pipeline.\");\n }\n if (!companyReadable) {\n hints.push(\n \"Account details were not read: this HubSpot connection does not cover them. Do not report the lead as having no account — you cannot tell. The user can enable it by reconnecting HubSpot.\",\n );\n } else if (company === null) {\n hints.push(\n \"No account is associated either. Most B2B setups create one automatically when a contact arrives, so this usually means the lead was never processed at all — not that the account is missing.\",\n );\n }\n return hints;\n}\n\nfunction commaList(raw: string): string[] {\n return [\n ...new Set(\n raw\n .split(\",\")\n .map((item) => item.trim())\n .filter(Boolean),\n ),\n ];\n}\n\nconst contactsLookupCommand = defineCommand({\n meta: {\n name: \"lookup\",\n description:\n \"Find one contact by email and see whether it was worked; --properties reads named contact properties too. Example: baker hubspot contacts lookup a@b.com --properties utm_campaign,utm_source\",\n },\n args: {\n email: { type: \"positional\", description: \"The contact's email address\", required: true },\n properties: {\n type: \"string\",\n description:\n \"Comma-separated contact properties to read, by HubSpot's internal name: --properties utm_campaign,utm_source\",\n required: false,\n },\n },\n run: async ({ args }) => {\n try {\n const properties = typeof args.properties === \"string\" ? commaList(args.properties) : [];\n const response = await apiPost<HubspotContactLookupResponse>(\n \"/api/hubspot/contacts/lookup\",\n {\n email: args.email,\n ...(properties.length > 0 ? { properties } : {}),\n },\n { read: true },\n );\n const hints = contactLookupHints(response.data, properties);\n\n writeJson({\n ...response,\n meta: { count: response.data.found ? 1 : 0 },\n ...(hints.length > 0 ? { hints } : {}),\n });\n } catch (err) {\n failNotConnected(err);\n }\n },\n});\n\n/** `fields`, for contacts and for deals: what a HubSpot event's rows can read. */\nfunction fieldsCommand(object: HubspotObjectWord) {\n const words = OBJECT_WORDS[object];\n return defineCommand({\n meta: {\n name: \"fields\",\n description: `List every property a HubSpot event on a ${object} can read into its rows, with HubSpot's type${object === \"contact\" ? \"\" : ` — the ${object}'s own, and its contact's as contact.<name>`}. Example: ${words.command} fields`,\n },\n args: {},\n run: async () => {\n try {\n const response = await apiPost<HubspotContactFieldsListResponse>(\n \"/api/hubspot/contacts/fields\",\n { object },\n { read: true },\n );\n writeJson({\n ok: true,\n ...rowsAsData(response.data, \"fields\"),\n hints: [\n `A row of a HubSpot event is a template over these names: ${words.rows}. \\`baker analytics sources --preview${object === \"contact\" ? \"\" : ` --object ${object}`} --property <p> --value <v> --field <row>…\\` reads one real ${object} to check the rows against.`,\n ],\n });\n } catch (err) {\n failNotConnected(err);\n }\n },\n });\n}\n\nconst contactsFieldsCommand = fieldsCommand(\"contact\");\n\nconst dealsCommand = defineCommand({\n meta: {\n name: \"deals\",\n description:\n \"Deals on the connected HubSpot account: the deals themselves with amount and stage (`list`), one deal found by its name (`lookup`), and what a HubSpot event on a deal can watch (`properties`) and read (`fields`).\",\n },\n subCommands: {\n list: () => import(\"./crm.ts\").then((m) => m.dealsListCommand),\n lookup: () => import(\"./crm.ts\").then((m) => m.dealsLookupCommand),\n properties: propertiesCommand(\"deal\"),\n fields: fieldsCommand(\"deal\"),\n },\n});\n\nconst leadsCommand = defineCommand({\n meta: {\n name: \"leads\",\n description:\n \"Leads on the connected HubSpot account: what a HubSpot event on a lead can watch (`properties`) and read (`fields`). Start here for qualification and disqualification — a lead's stage is where HubSpot records both, and `hs_pipeline_stage` lists the account's own stages with their labels. Needs Sales Hub Professional or Enterprise; on any other plan the account has no leads to read.\",\n },\n subCommands: { properties: propertiesCommand(\"lead\"), fields: fieldsCommand(\"lead\") },\n});\n\nconst contactsCommand = defineCommand({\n meta: { name: \"contacts\", description: \"Contacts on the connected HubSpot account.\" },\n subCommands: {\n summary: contactsSummaryCommand,\n lookup: contactsLookupCommand,\n properties: contactsPropertiesCommand,\n fields: contactsFieldsCommand,\n },\n});\n\nconst companiesCommand = defineCommand({\n meta: { name: \"companies\", description: \"Companies (accounts) in the connected HubSpot CRM.\" },\n subCommands: {\n search: () => import(\"./crm.ts\").then((m) => m.companiesSearchCommand),\n contacts: () => import(\"./crm.ts\").then((m) => m.companiesContactsCommand),\n },\n});\n\nconst formsCommand = defineCommand({\n meta: { name: \"forms\", description: \"HubSpot forms on the connected account.\" },\n subCommands: { list: formsListCommand, view: formsViewCommand, submissions: formsSubmissionsCommand },\n});\n\nconst workflowsCommand = defineCommand({\n meta: { name: \"workflows\", description: \"HubSpot workflows on the connected account.\" },\n subCommands: { list: workflowsListCommand, view: workflowsViewCommand },\n});\n\nconst pipelinesCommand = defineCommand({\n meta: { name: \"pipelines\", description: \"HubSpot deal pipelines on the connected account.\" },\n subCommands: { list: pipelinesListCommand },\n});\n\nconst meetingsCommand = defineCommand({\n meta: { name: \"meetings\", description: \"HubSpot meeting links (calendars) on the connected account.\" },\n subCommands: { list: meetingsListCommand, view: meetingsViewCommand },\n});\n\nexport const hubspotCommand = defineCommand({\n meta: {\n name: \"hubspot\",\n description: `Read the connected HubSpot account — forms, the leads they received, workflows, deal pipelines, CRM\ncompanies and deals, and meeting links (calendars) — and get the blob to wire a form into a Form step yourself.\n\nExamples:\n baker hubspot forms list # every form: embed type + post-submit action\n baker hubspot forms list --redirecting-only # which forms redirect away on submit\n baker hubspot forms view <formId> # fields, consent mode, full configuration\n baker hubspot forms view <formId> --as-node # the form.external blob -> write into the step\n baker hubspot forms submissions <formId> # how many leads it got, and when\n baker hubspot workflows list --enabled-only # what runs after a lead is captured\n baker hubspot workflows view <workflowId> # its real branches, in order, and what each step writes\n baker hubspot pipelines list # where a lead lands, and the stages after it\n baker hubspot contacts summary --days 30 # are recent leads being worked? (counts only)\n baker hubspot contacts lookup a@b.com # was this one lead picked up? --properties utm_campaign,… reads those too\n baker hubspot companies search --domains acme.com,globex.io --with-deals # which are accounts, with deals\n baker hubspot deals list --modified-since 2026-01-01 # deals: amount, stage, closed won\n baker hubspot deals lookup --search \"Acme\" # is this sale in the CRM? (by deal name)\n baker hubspot deals properties # what a HubSpot event on a deal can watch (dealstage, amount…)\n baker hubspot deals fields # what its rows can read: the deal's own, its contact's as contact.<name>\n baker hubspot meetings list # every calendar + whether booking redirects\n baker hubspot meetings view <slug> --as-node # same, for a hubspotMeeting step\n\nAn account connected before one of these existed cannot serve it — you get HUBSPOT_RECONNECT_REQUIRED, which\nmeans HubSpot IS connected and the user has to reconnect it to widen what Baker may read. Report that and\ncarry on with the rest; never call it broken and never retry.\n\nNothing here is secret, so HubSpot steps do not need request_flow_input: take --as-node and edit the\nflow's _data.json. Use the approval form only when no account is connected or the right form is unclear.\nFull guide: __tooling__/docs/tools/baker/hubspot.md`,\n },\n subCommands: {\n forms: formsCommand,\n workflows: workflowsCommand,\n pipelines: pipelinesCommand,\n contacts: contactsCommand,\n companies: companiesCommand,\n deals: dealsCommand,\n leads: leadsCommand,\n meetings: meetingsCommand,\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,SAAS,qBAAqB;AAM9B,IAAM,cAAc,CAAC,UAAU,MAAM,SAAS;AAE9C,SAAS,gBAAgB,OAAqE;AAC5F,MAAI,UAAU,QAAW;AACvB,WAAO;AAAA,EACT;AACA,MAAI,CAAE,YAAkC,SAAS,KAAK,GAAG;AACvD,UAAM,IAAI,MAAM,gCAAgC,YAAY,KAAK,GAAG,CAAC,EAAE;AAAA,EACzE;AACA,SAAO;AACT;AAEA,eAAe;AAAA,EACb,SAAS;AAAA,EACT,QAAQ,CAAC,8BAA8B;AAAA,EACvC,QAAQ;AAAA,EACR,aACE;AAAA,EACF,MAAM;AAAA,IACJ,QAAQ,EAAE,MAAM,UAAU,aAAa,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;AA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iB,cAAc;AAAA,EAC1C,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6Bf;AAAA,EACA,aAAa;AAAA,IACX,OAAO;AAAA,IACP,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,WAAW;AAAA,IACX,OAAO;AAAA,IACP,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AACF,CAAC;","names":[]}
@@ -2,7 +2,7 @@ import {
2
2
  csvOrJson,
3
3
  handleLinkedinError,
4
4
  resolveAccountIdArg
5
- } from "./chunk-WVXJYBWA.js";
5
+ } from "./chunk-ZPLZHTWI.js";
6
6
  import {
7
7
  NO_CACHE_ARG
8
8
  } from "./chunk-VHKEKK2L.js";
@@ -134,4 +134,4 @@ the option chosen. Form ids are the ones \`baker ads linkedin lead-forms\` lists
134
134
  export {
135
135
  leadsCommand
136
136
  };
137
- //# sourceMappingURL=leads-ZRHPHJRE.js.map
137
+ //# sourceMappingURL=leads-QAMBOEX7.js.map
@@ -4,11 +4,11 @@ import {
4
4
  import {
5
5
  STAGE_FULL_ARG,
6
6
  TOTAL_BUDGET_HELP
7
- } from "./chunk-YXYUHTQM.js";
7
+ } from "./chunk-D2BRYEOF.js";
8
8
  import {
9
9
  normalizeLinkedinAccountId,
10
10
  statusesArgDescription
11
- } from "./chunk-WVXJYBWA.js";
11
+ } from "./chunk-ZPLZHTWI.js";
12
12
  import {
13
13
  AVAILABLE_ARG
14
14
  } from "./chunk-6AUTRWTB.js";
@@ -370,7 +370,16 @@ registerSchema({
370
370
  description: "Look up entity values for a facet \u2014 full list (q=adTargetingFacet) or typeahead search (q=typeahead, with --query).",
371
371
  args: {
372
372
  facet: { type: "string", description: "Facet name (industries) or URN", required: true },
373
- query: { type: "string", description: "Typeahead query (auto-switches finder)", required: false },
373
+ query: {
374
+ type: "string",
375
+ description: "Typeahead query (auto-switches finder), sent whole \u2014 a comma stays part of it",
376
+ required: false
377
+ },
378
+ queries: {
379
+ type: "string",
380
+ description: "CSV list of typeahead queries for several in one call (quote one with a comma); each match carries its query",
381
+ required: false
382
+ },
374
383
  finder: { type: "string", description: "adTargetingFacet|typeahead|similarEntities", required: false },
375
384
  locale: { type: "string", description: "Locale (default en_US)", required: false },
376
385
  "no-cache": NO_CACHE_ARG,
@@ -380,14 +389,19 @@ registerSchema({
380
389
  registerSchema({
381
390
  command: "ads.linkedin.audience-size",
382
391
  ...live("POST /api/ads/linkedin/audience-size"),
383
- description: "Estimate audience size for a targetingCriteria payload. Returns total + active + playbook \xA704 sweet-spot warnings.",
392
+ description: "Estimate audience size for a targetingCriteria payload. Returns total + active + playbook \xA704 sweet-spot warnings. --segments-file sizes a set of named segments in one call, one row each.",
384
393
  args: {
385
394
  "account-id": { type: "string", description: "Account ID", required: false },
386
395
  "account-urn": { type: "string", description: "Alias", required: false },
387
396
  targeting: { type: "string", description: "Inline JSON targetingCriteria", required: false },
388
397
  "targeting-file": { type: "string", description: "Path to JSON file", required: false },
398
+ "segments-file": {
399
+ type: "string",
400
+ description: 'Path to JSON {"<segment name>": targetingCriteria, \u2026} (up to 50) \u2014 one row per segment',
401
+ required: false
402
+ },
389
403
  "no-cache": NO_CACHE_ARG,
390
- output: { type: "string", description: "json", required: false, default: "json" }
404
+ output: { type: "string", description: "json|csv|jsonl|md", required: false, default: "json" }
391
405
  }
392
406
  });
393
407
  registerSchema({
@@ -1464,35 +1478,35 @@ Full guide: __tooling__/docs/tools/baker/ads-linkedin.md`
1464
1478
  normalize: normalizeLinkedinAccountId
1465
1479
  }),
1466
1480
  subCommands: {
1467
- accounts: () => import("./accounts-SUIMNTTA.js").then((m) => m.accountsCommand),
1468
- account: () => import("./account-Z62BVYAI.js").then((m) => m.accountCommand),
1469
- "account-users": () => import("./account-users-ZDZ7B4BX.js").then((m) => m.accountUsersCommand),
1470
- "campaign-groups": () => import("./campaign-groups-DKB3K7L4.js").then((m) => m.campaignGroupsCommand),
1471
- campaigns: () => import("./campaigns-6OYAQVIE.js").then((m) => m.campaignsCommand),
1472
- creatives: () => import("./creatives-42PW2C24.js").then((m) => m.creativesCommand),
1473
- preview: () => import("./preview-66BGLU5H.js").then((m) => m.previewCommand),
1474
- audiences: () => import("./write-commands-FUXBKDN7.js").then((m) => m.audiencesCommand),
1475
- "lead-forms": () => import("./write-commands-FUXBKDN7.js").then((m) => m.leadFormsCommand),
1476
- experiments: () => import("./experiments-C4R65GA6.js").then((m) => m.experimentsCommand),
1477
- draft: () => import("./draft-JGEZVDAS.js").then((m) => m.linkedinDraftCommand),
1478
- analytics: () => import("./analytics-WLFBQOO4.js").then((m) => m.analyticsCommand),
1479
- demographics: () => import("./demographics-K5WTHZCW.js").then((m) => m.demographicsCommand),
1480
- companies: () => import("./companies-ITNWR5Q4.js").then((m) => m.companiesCommand),
1481
- "top-companies": () => import("./top-companies-KEV55RME.js").then((m) => m.topCompaniesCommand),
1482
- resolve: () => import("./resolve-NVL3FTQU.js").then((m) => m.resolveCommand),
1483
- facets: () => import("./facets-GXBTQCAW.js").then((m) => m.facetsCommand),
1484
- "audience-size": () => import("./audience-size-ISJSPSRW.js").then((m) => m.audienceSizeCommand),
1485
- "bid-pricing": () => import("./bid-pricing-HFBQ23DD.js").then((m) => m.bidPricingCommand),
1486
- forecast: () => import("./forecast-NOQNCFTX.js").then((m) => m.forecastCommand),
1487
- leads: () => import("./leads-ZRHPHJRE.js").then((m) => m.leadsCommand),
1488
- revenue: () => import("./revenue-C24BDD5A.js").then((m) => m.revenueCommand),
1489
- conversions: () => import("./conversions-IMST22UQ.js").then((m) => m.conversionsCommand),
1490
- conversation: () => import("./conversation-SKZMGVA5.js").then((m) => m.conversationCommand),
1491
- audit: () => import("./audit-EHKSN2WS.js").then((m) => m.auditCommand),
1492
- "url-params": () => import("./url-params-CXUAYJBD.js").then((m) => m.urlParamsCommand)
1481
+ accounts: () => import("./accounts-3PEIYK7V.js").then((m) => m.accountsCommand),
1482
+ account: () => import("./account-PKCDR22I.js").then((m) => m.accountCommand),
1483
+ "account-users": () => import("./account-users-UO4OVX3W.js").then((m) => m.accountUsersCommand),
1484
+ "campaign-groups": () => import("./campaign-groups-YGIZAWMT.js").then((m) => m.campaignGroupsCommand),
1485
+ campaigns: () => import("./campaigns-FIU3FF7Q.js").then((m) => m.campaignsCommand),
1486
+ creatives: () => import("./creatives-FLL2NBH2.js").then((m) => m.creativesCommand),
1487
+ preview: () => import("./preview-TK4Q53KQ.js").then((m) => m.previewCommand),
1488
+ audiences: () => import("./write-commands-TDME3RU2.js").then((m) => m.audiencesCommand),
1489
+ "lead-forms": () => import("./write-commands-TDME3RU2.js").then((m) => m.leadFormsCommand),
1490
+ experiments: () => import("./experiments-BT3QLENT.js").then((m) => m.experimentsCommand),
1491
+ draft: () => import("./draft-XV3SNAT5.js").then((m) => m.linkedinDraftCommand),
1492
+ analytics: () => import("./analytics-DH7JTWW7.js").then((m) => m.analyticsCommand),
1493
+ demographics: () => import("./demographics-SR66Q3Q2.js").then((m) => m.demographicsCommand),
1494
+ companies: () => import("./companies-65CQH5NZ.js").then((m) => m.companiesCommand),
1495
+ "top-companies": () => import("./top-companies-XAZTHC44.js").then((m) => m.topCompaniesCommand),
1496
+ resolve: () => import("./resolve-JEEIJJOP.js").then((m) => m.resolveCommand),
1497
+ facets: () => import("./facets-RTH4UYOZ.js").then((m) => m.facetsCommand),
1498
+ "audience-size": () => import("./audience-size-NHQZQ7DR.js").then((m) => m.audienceSizeCommand),
1499
+ "bid-pricing": () => import("./bid-pricing-HVUVHS3F.js").then((m) => m.bidPricingCommand),
1500
+ forecast: () => import("./forecast-NH7BO45V.js").then((m) => m.forecastCommand),
1501
+ leads: () => import("./leads-QAMBOEX7.js").then((m) => m.leadsCommand),
1502
+ revenue: () => import("./revenue-J7YSHGB6.js").then((m) => m.revenueCommand),
1503
+ conversions: () => import("./conversions-JN2QSYKN.js").then((m) => m.conversionsCommand),
1504
+ conversation: () => import("./conversation-EUPDVCN5.js").then((m) => m.conversationCommand),
1505
+ audit: () => import("./audit-PEOYEN4A.js").then((m) => m.auditCommand),
1506
+ "url-params": () => import("./url-params-5FXKA6J2.js").then((m) => m.urlParamsCommand)
1493
1507
  }
1494
1508
  });
1495
1509
  export {
1496
1510
  linkedinCommand
1497
1511
  };
1498
- //# sourceMappingURL=linkedin-BD63QPGK.js.map
1512
+ //# sourceMappingURL=linkedin-DWWA5CGK.js.map