@wirecat/hubspot-cli 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/LICENSE +204 -0
  3. package/README.md +280 -2
  4. package/contracts/wirecat.json +3270 -0
  5. package/dist/bin/hubspot.d.ts +3 -0
  6. package/dist/bin/hubspot.d.ts.map +1 -0
  7. package/dist/bin/hubspot.js +40 -0
  8. package/dist/bin/hubspot.js.map +1 -0
  9. package/dist/bundle/all-profiles-64JAUYW4.js +279 -0
  10. package/dist/bundle/anthropic-VJOS4OUM.js +91 -0
  11. package/dist/bundle/app-server-GXV2OFML.js +245 -0
  12. package/dist/bundle/bun-M3J2QTR3.js +169 -0
  13. package/dist/bundle/bun-sqlite-IX3XYA5F.js +76 -0
  14. package/dist/bundle/chunk-24ERVFJP.js +73 -0
  15. package/dist/bundle/chunk-2QZK5BEP.js +392 -0
  16. package/dist/bundle/chunk-2UOJ7DLZ.js +46 -0
  17. package/dist/bundle/chunk-2VGD63G6.js +604 -0
  18. package/dist/bundle/chunk-2VGZRYEH.js +334 -0
  19. package/dist/bundle/chunk-36ITRDYY.js +63116 -0
  20. package/dist/bundle/chunk-3WLYWRGG.js +1395 -0
  21. package/dist/bundle/chunk-43EKCUBJ.js +72 -0
  22. package/dist/bundle/chunk-4W6BMH45.js +731 -0
  23. package/dist/bundle/chunk-5A6ZYNAQ.js +2003 -0
  24. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  25. package/dist/bundle/chunk-5GBUCHRU.js +274 -0
  26. package/dist/bundle/chunk-5K7QLJMM.js +4072 -0
  27. package/dist/bundle/chunk-65TWQ7BV.js +54 -0
  28. package/dist/bundle/chunk-7ELMWE3P.js +12066 -0
  29. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  30. package/dist/bundle/chunk-B3MANLNK.js +602 -0
  31. package/dist/bundle/chunk-C32AKHTY.js +2310 -0
  32. package/dist/bundle/chunk-CLAN3FES.js +1246 -0
  33. package/dist/bundle/chunk-CWXOXIWS.js +46 -0
  34. package/dist/bundle/chunk-D72URWJE.js +532 -0
  35. package/dist/bundle/chunk-DB2XKHI4.js +72 -0
  36. package/dist/bundle/chunk-DBEQI5YM.js +100 -0
  37. package/dist/bundle/chunk-DFCHHR5M.js +38 -0
  38. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  39. package/dist/bundle/chunk-DRWWJLI6.js +188 -0
  40. package/dist/bundle/chunk-DSP36YHQ.js +29 -0
  41. package/dist/bundle/chunk-E52JAS35.js +1028 -0
  42. package/dist/bundle/chunk-E5WLE7BM.js +78 -0
  43. package/dist/bundle/chunk-ECEZOLOD.js +230 -0
  44. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  45. package/dist/bundle/chunk-FBCCBCFH.js +288 -0
  46. package/dist/bundle/chunk-FKA7DOCK.js +53 -0
  47. package/dist/bundle/chunk-FOZYMDRL.js +259 -0
  48. package/dist/bundle/chunk-FPUGMDJV.js +7 -0
  49. package/dist/bundle/chunk-FTFV3HFW.js +721 -0
  50. package/dist/bundle/chunk-GPYCBYX5.js +218 -0
  51. package/dist/bundle/chunk-H3TNVEQX.js +782 -0
  52. package/dist/bundle/chunk-HC5ZWE5X.js +193 -0
  53. package/dist/bundle/chunk-HCAZV5NP.js +95 -0
  54. package/dist/bundle/chunk-HZRQLAHO.js +16 -0
  55. package/dist/bundle/chunk-IJADZW42.js +195 -0
  56. package/dist/bundle/chunk-IMJQRPLN.js +92 -0
  57. package/dist/bundle/chunk-JLDBMEKZ.js +106 -0
  58. package/dist/bundle/chunk-LOBVOGOE.js +66 -0
  59. package/dist/bundle/chunk-LXZ66MCH.js +1328 -0
  60. package/dist/bundle/chunk-MFNMKHML.js +26462 -0
  61. package/dist/bundle/chunk-MVA5HVKL.js +1392 -0
  62. package/dist/bundle/chunk-N2XADGL4.js +76 -0
  63. package/dist/bundle/chunk-NHHJHXMQ.js +58 -0
  64. package/dist/bundle/chunk-NUU4WZVL.js +52 -0
  65. package/dist/bundle/chunk-NWHEHV3K.js +133 -0
  66. package/dist/bundle/chunk-NXERIDPJ.js +319 -0
  67. package/dist/bundle/chunk-O3DYRCIT.js +23 -0
  68. package/dist/bundle/chunk-O55RWNSH.js +161 -0
  69. package/dist/bundle/chunk-P5BHKKBI.js +206 -0
  70. package/dist/bundle/chunk-PPHBRESD.js +82 -0
  71. package/dist/bundle/chunk-PVKF24ZW.js +364 -0
  72. package/dist/bundle/chunk-Q2OLOMHL.js +4045 -0
  73. package/dist/bundle/chunk-QGFX5MXL.js +460 -0
  74. package/dist/bundle/chunk-QJW35N5V.js +761 -0
  75. package/dist/bundle/chunk-QU25DA5N.js +360 -0
  76. package/dist/bundle/chunk-RMIYKDUL.js +1068 -0
  77. package/dist/bundle/chunk-RR5MX5TM.js +142 -0
  78. package/dist/bundle/chunk-SDQGB4KB.js +185 -0
  79. package/dist/bundle/chunk-TBJYLC5K.js +2788 -0
  80. package/dist/bundle/chunk-TI46WQXQ.js +1197 -0
  81. package/dist/bundle/chunk-TKVL2C3B.js +170 -0
  82. package/dist/bundle/chunk-TLKEPUAV.js +786 -0
  83. package/dist/bundle/chunk-TOSCB4SO.js +1227 -0
  84. package/dist/bundle/chunk-TP7GDWVF.js +6848 -0
  85. package/dist/bundle/chunk-URX6YDUL.js +9393 -0
  86. package/dist/bundle/chunk-UUMUL4L3.js +72 -0
  87. package/dist/bundle/chunk-VOH7S5M4.js +40963 -0
  88. package/dist/bundle/chunk-W53EJOFQ.js +63 -0
  89. package/dist/bundle/chunk-W7HM2VGO.js +24 -0
  90. package/dist/bundle/chunk-WE4UFASG.js +88 -0
  91. package/dist/bundle/chunk-X2M6NIQG.js +18 -0
  92. package/dist/bundle/chunk-XRREFEIW.js +372 -0
  93. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  94. package/dist/bundle/chunk-YMCY7VRE.js +1846 -0
  95. package/dist/bundle/chunk-Z73OL5HV.js +41 -0
  96. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  97. package/dist/bundle/command-contract-C6CBFXZF.js +40 -0
  98. package/dist/bundle/command-server-entry-DJKVVZCQ.js +169 -0
  99. package/dist/bundle/decode-FC65Y4IV.js +297 -0
  100. package/dist/bundle/definitions-MVPICAWV.js +2991 -0
  101. package/dist/bundle/dispatch-KOISQ5QJ.js +411 -0
  102. package/dist/bundle/dist-7TGU56B2.js +7577 -0
  103. package/dist/bundle/echarts-FVTUDXDU.js +42501 -0
  104. package/dist/bundle/embed-VNBZFPYH.js +38 -0
  105. package/dist/bundle/embedder-6U4NOFRO.js +111 -0
  106. package/dist/bundle/failure-FZ6VYKEQ.js +25 -0
  107. package/dist/bundle/first-run-UWAFSINQ.js +29 -0
  108. package/dist/bundle/first-screen-RTVMGHAE.js +40 -0
  109. package/dist/bundle/hubspot.js +198 -0
  110. package/dist/bundle/instructions-HET7BCYK.js +11 -0
  111. package/dist/bundle/mcp-RGNRW77S.js +167 -0
  112. package/dist/bundle/meeting-combined-L5AGBPYX.js +25 -0
  113. package/dist/bundle/meeting-model-NTB4RK3F.js +25 -0
  114. package/dist/bundle/meeting-semantic-JY3OGCBS.js +22 -0
  115. package/dist/bundle/node-CXZIFHZC.js +176 -0
  116. package/dist/bundle/node-P4E63KXA.js +2340 -0
  117. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  118. package/dist/bundle/node-sqlite-P3O7XN7Q.js +74 -0
  119. package/dist/bundle/oauth-HNCY4B2S.js +20 -0
  120. package/dist/bundle/open-F4P6YV54.js +23 -0
  121. package/dist/bundle/openai-4AICLIK3.js +238 -0
  122. package/dist/bundle/process-5RUXWGYS.js +91 -0
  123. package/dist/bundle/program-XA4C44Z4.js +9374 -0
  124. package/dist/bundle/prompt-NFMDVBZ4.js +17 -0
  125. package/dist/bundle/recognize-DKN3RY4V.js +26 -0
  126. package/dist/bundle/remote-6QHAGQWY.js +31 -0
  127. package/dist/bundle/rerank-M4KHEHUZ.js +52 -0
  128. package/dist/bundle/schemas-JRL3DLMP.js +952 -0
  129. package/dist/bundle/serve-DNU43ND6.js +199 -0
  130. package/dist/bundle/server-ATG5KY7K.js +207 -0
  131. package/dist/bundle/server-VNWVVH7A.js +77 -0
  132. package/dist/bundle/source-54HR4IWG.js +661 -0
  133. package/dist/bundle/sqlite-runtime-EMQAC63N.js +20 -0
  134. package/dist/bundle/state-T45CX7VY.js +36 -0
  135. package/dist/bundle/store-6LCEVBAZ.js +176 -0
  136. package/dist/bundle/store-6TZ2FCVA.js +295 -0
  137. package/dist/bundle/store-DXWYNVVB.js +32 -0
  138. package/dist/bundle/store-maintenance-command-J57HCJYY.js +68 -0
  139. package/dist/bundle/writer-NLLI5YRM.js +79 -0
  140. package/dist/commands/account.d.ts +3 -0
  141. package/dist/commands/account.d.ts.map +1 -0
  142. package/dist/commands/account.js +87 -0
  143. package/dist/commands/account.js.map +1 -0
  144. package/dist/commands/api.d.ts +9 -0
  145. package/dist/commands/api.d.ts.map +1 -0
  146. package/dist/commands/api.js +70 -0
  147. package/dist/commands/api.js.map +1 -0
  148. package/dist/commands/crm-shared.d.ts +8 -0
  149. package/dist/commands/crm-shared.d.ts.map +1 -0
  150. package/dist/commands/crm-shared.js +109 -0
  151. package/dist/commands/crm-shared.js.map +1 -0
  152. package/dist/commands/schedule.d.ts +3 -0
  153. package/dist/commands/schedule.d.ts.map +1 -0
  154. package/dist/commands/schedule.js +9 -0
  155. package/dist/commands/schedule.js.map +1 -0
  156. package/dist/commands/session.d.ts +14 -0
  157. package/dist/commands/session.d.ts.map +1 -0
  158. package/dist/commands/session.js +164 -0
  159. package/dist/commands/session.js.map +1 -0
  160. package/dist/config.d.ts +60 -0
  161. package/dist/config.d.ts.map +1 -0
  162. package/dist/config.js +153 -0
  163. package/dist/config.js.map +1 -0
  164. package/dist/context.d.ts +88 -0
  165. package/dist/context.d.ts.map +1 -0
  166. package/dist/context.js +137 -0
  167. package/dist/context.js.map +1 -0
  168. package/dist/crm/activities.d.ts +24 -0
  169. package/dist/crm/activities.d.ts.map +1 -0
  170. package/dist/crm/activities.js +214 -0
  171. package/dist/crm/activities.js.map +1 -0
  172. package/dist/crm/associations.d.ts +20 -0
  173. package/dist/crm/associations.d.ts.map +1 -0
  174. package/dist/crm/associations.js +47 -0
  175. package/dist/crm/associations.js.map +1 -0
  176. package/dist/crm/records.d.ts +63 -0
  177. package/dist/crm/records.d.ts.map +1 -0
  178. package/dist/crm/records.js +333 -0
  179. package/dist/crm/records.js.map +1 -0
  180. package/dist/crm/search.d.ts +57 -0
  181. package/dist/crm/search.d.ts.map +1 -0
  182. package/dist/crm/search.js +47 -0
  183. package/dist/crm/search.js.map +1 -0
  184. package/dist/crm/source.d.ts +37 -0
  185. package/dist/crm/source.d.ts.map +1 -0
  186. package/dist/crm/source.js +366 -0
  187. package/dist/crm/source.js.map +1 -0
  188. package/dist/crm/writer.d.ts +15 -0
  189. package/dist/crm/writer.d.ts.map +1 -0
  190. package/dist/crm/writer.js +199 -0
  191. package/dist/crm/writer.js.map +1 -0
  192. package/dist/generated/definitions.d.ts +3 -0
  193. package/dist/generated/definitions.d.ts.map +1 -0
  194. package/dist/generated/definitions.js +2987 -0
  195. package/dist/generated/definitions.js.map +1 -0
  196. package/dist/generated/manifest.d.ts +6 -0
  197. package/dist/generated/manifest.d.ts.map +1 -0
  198. package/dist/generated/manifest.js +6504 -0
  199. package/dist/generated/manifest.js.map +1 -0
  200. package/dist/generated/schemas.d.ts +205 -0
  201. package/dist/generated/schemas.d.ts.map +1 -0
  202. package/dist/generated/schemas.js +810 -0
  203. package/dist/generated/schemas.js.map +1 -0
  204. package/dist/generated/types.d.ts +1114 -0
  205. package/dist/generated/types.d.ts.map +1 -0
  206. package/dist/generated/types.js +5 -0
  207. package/dist/generated/types.js.map +1 -0
  208. package/dist/hubspot/account.d.ts +12 -0
  209. package/dist/hubspot/account.d.ts.map +1 -0
  210. package/dist/hubspot/account.js +23 -0
  211. package/dist/hubspot/account.js.map +1 -0
  212. package/dist/hubspot/transport.d.ts +81 -0
  213. package/dist/hubspot/transport.d.ts.map +1 -0
  214. package/dist/hubspot/transport.js +354 -0
  215. package/dist/hubspot/transport.js.map +1 -0
  216. package/dist/identity.d.ts +7 -0
  217. package/dist/identity.d.ts.map +1 -0
  218. package/dist/identity.js +32 -0
  219. package/dist/identity.js.map +1 -0
  220. package/dist/index.d.ts +3 -0
  221. package/dist/index.d.ts.map +1 -0
  222. package/dist/index.js +3 -0
  223. package/dist/index.js.map +1 -0
  224. package/dist/program.d.ts +6 -0
  225. package/dist/program.d.ts.map +1 -0
  226. package/dist/program.js +78 -0
  227. package/dist/program.js.map +1 -0
  228. package/dist/reasons.d.ts +10 -0
  229. package/dist/reasons.d.ts.map +1 -0
  230. package/dist/reasons.js +33 -0
  231. package/dist/reasons.js.map +1 -0
  232. package/dist/setup/flow.d.ts +2 -0
  233. package/dist/setup/flow.d.ts.map +1 -0
  234. package/dist/setup/flow.js +97 -0
  235. package/dist/setup/flow.js.map +1 -0
  236. package/dist/setup/texts.en.json +19 -0
  237. package/dist/setup/texts.es.json +19 -0
  238. package/dist/setup/texts.ru.json +19 -0
  239. package/dist/store.d.ts +16 -0
  240. package/dist/store.d.ts.map +1 -0
  241. package/dist/store.js +34 -0
  242. package/dist/store.js.map +1 -0
  243. package/dist/version.d.ts +2 -0
  244. package/dist/version.d.ts.map +1 -0
  245. package/dist/version.js +2 -0
  246. package/dist/version.js.map +1 -0
  247. package/dist/wcat.d.ts +3 -0
  248. package/dist/wcat.d.ts.map +1 -0
  249. package/dist/wcat.js +4 -0
  250. package/dist/wcat.js.map +1 -0
  251. package/dist/whoami.d.ts +19 -0
  252. package/dist/whoami.d.ts.map +1 -0
  253. package/dist/whoami.js +15 -0
  254. package/dist/whoami.js.map +1 -0
  255. package/package.json +98 -4
  256. package/skills/hubspot-cli/SKILL.md +102 -0
  257. package/skills/hubspot-cli/references/api/api-advanced.md +51 -0
  258. package/skills/hubspot-cli/references/api/api-basic.md +1064 -0
  259. package/skills/hubspot-cli/references/api/api-batch.md +724 -0
  260. package/skills/hubspot-cli/references/api/api-search.md +147 -0
  261. package/skills/hubspot-cli/references/api.md +16 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/crm/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAY,SAAS,EAAE,MAAM,cAAc,CAAA;AAE9E,oHAAoH;AACpH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA;AAC9B,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAA;AAChC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAoBtC;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,IAAU,EAAE,IAAY,EAAE,OAAsB,EAAE,EAAE;IAC/E,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,qBAAqB;QAChD,MAAM,IAAI,QAAQ,CAChB,kBAAkB,EAClB,GAAG,OAAO,yBAAyB,qBAAqB,iCAAiC,EACzF,EAAE,MAAM,EAAE,0BAA0B,EAAE,CACvC,CAAA;IACH,IAAI,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,UAAU;QAC7C,MAAM,IAAI,QAAQ,CAChB,kBAAkB,EAClB,GAAG,OAAO,kCAAkC,UAAU,4BAA4B,EAClF,EAAE,MAAM,EAAE,oBAAoB,EAAE,CACjC,CAAA;IACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,wBAAwB,IAAI,SAAS,EAAE;QAC7D,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAA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,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAA;AACzE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAE,IAAU,EAAE,KAAa,EAAE,UAA6B,EAAE,EAAE,CAC1G,CAAC;IACC,OAAO,EAAE,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAChF,IAAI,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE;IACxD,UAAU;IACV,KAAK;IACL,MAAM,EAAE,IAAI,CAAC,MAAM;CACpB,CAAyB,CAAA"}
@@ -0,0 +1,37 @@
1
+ import type { CrmKind, CrmRecords } from "@wirecat/cli-core";
2
+ import { type CrmCallContext, type CrmSource } from "@wirecat/cli-core/crm";
3
+ import { type HubSpotTransport } from "../hubspot/transport.js";
4
+ /**
5
+ * Re-read before the last cursor: rows HubSpot saved while the round ran, rows its search index had not shown yet
6
+ * ("a few moments", search guide), and this computer's clock running ahead of HubSpot's. A row read twice is only
7
+ * saved twice.
8
+ */
9
+ export declare const OVERLAP_MS: number;
10
+ /**
11
+ * The longest `properties=` a GET sends. Servers commonly refuse request lines past 8 KB; HubSpot names no limit, so
12
+ * an account with hundreds of custom properties reads the ones that fit, and the call says which it left out.
13
+ */
14
+ export declare const MAX_PROPERTIES_CHARS = 6000;
15
+ /** HubSpot's own properties first, always; then the account's own while they fit. */
16
+ export declare const fitted: (own: readonly string[], custom: readonly string[]) => {
17
+ properties: string;
18
+ dropped: string[];
19
+ };
20
+ export interface HubSpotSourceOptions {
21
+ now?: () => number;
22
+ /** Rows a full list asks per page; a test pages over a small account with a smaller one. */
23
+ page?: number;
24
+ /** Rows a search asks per page. */
25
+ searchPage?: number;
26
+ }
27
+ /**
28
+ * The account's CRM for core's sync: lists in full by `after`, changes by search on the modified time, deletions by a
29
+ * pass over every id, since HubSpot gives a private app no change feed (webhooks need a public app). A service key has
30
+ * no user, so there is no `self()` and the copy is the whole account.
31
+ */
32
+ export type HubSpotCrmSource = CrmSource & {
33
+ /** One record of any kind by its id, with its associations; null when HubSpot has none or this key cannot see it. */
34
+ record<K extends CrmKind>(kind: K, externalId: string, context?: CrmCallContext): Promise<CrmRecords[K] | null>;
35
+ };
36
+ export declare const hubspotCrmSource: (hub: () => HubSpotTransport, options?: HubSpotSourceOptions) => HubSpotCrmSource;
37
+ //# sourceMappingURL=source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/crm/source.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAY,OAAO,EAAe,UAAU,EAAqB,MAAM,mBAAmB,CAAA;AACtG,OAAO,EACL,KAAK,cAAc,EAKnB,KAAK,SAAS,EAIf,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,KAAK,gBAAgB,EAAgC,MAAM,yBAAyB,CAAA;AAsB7F;;;;GAIG;AACH,eAAO,MAAM,UAAU,QAAc,CAAA;AAuDrC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,OAAQ,CAAA;AAEzC,qFAAqF;AACrF,eAAO,MAAM,MAAM,QAAS,SAAS,MAAM,EAAE,UAAU,SAAS,MAAM,EAAE;;;CAavE,CAAA;AAyBD,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;IAClB,4FAA4F;IAC5F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG;IACzC,qHAAqH;IACrH,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;CAChH,CAAA;AAED,eAAO,MAAM,gBAAgB,QAAS,MAAM,gBAAgB,YAAW,oBAAoB,KAAQ,gBAuSlG,CAAA"}
@@ -0,0 +1,366 @@
1
+ import { CliError, isCliError } from "@wirecat/cli-base";
2
+ import { crmValues, crmWindowOf, walk, } from "@wirecat/cli-core/crm";
3
+ import { accountDetails } from "../hubspot/account.js";
4
+ import { SERVICE, segment } from "../hubspot/transport.js";
5
+ import { readActivities } from "./activities.js";
6
+ import { associationsOf, withAssociations } from "./associations.js";
7
+ import { nextOf, OBJECTS, propertiesOf, resultsOf, toDeal, toField, toLead, toOrganization, toPerson, toPipeline, toUser, } from "./records.js";
8
+ import { modifiedSince, nextSpot, SEARCH_PAGE, search } from "./search.js";
9
+ const { id, text } = crmValues;
10
+ /**
11
+ * Re-read before the last cursor: rows HubSpot saved while the round ran, rows its search index had not shown yet
12
+ * ("a few moments", search guide), and this computer's clock running ahead of HubSpot's. A row read twice is only
13
+ * saved twice.
14
+ */
15
+ export const OVERLAP_MS = 10 * 60_000;
16
+ /** The largest page of a list (contacts guide) and of owners (owners guide). */
17
+ const LIST_PAGE = 100;
18
+ /** The pipelines API's object type for each kind with pipelines (pipelines guide). */
19
+ const PIPELINES = { deal: "deals", lead: "leads" };
20
+ /** A refusal for a missing scope names the scope core's gap shows, the one HubSpot named or the one the API needs. */
21
+ const scoped = (error, scope) => isCliError(error) && error.code === "permission_error" && typeof error.details.scope !== "string"
22
+ ? new CliError(error.code, error.message, { ...error.details, scope })
23
+ : error;
24
+ const refused = (error) => isCliError(error) && error.code === "permission_error";
25
+ /** A record this token may not open, or one HubSpot does not have: `get` answers null. */
26
+ const unseen = (error) => isCliError(error) && (error.code === "not_found" || refused(error));
27
+ /**
28
+ * `l<after>@<started>` lists in full; `s<from>.<offset>@<started>` reads changes from `from`. HubSpot's `after` is an
29
+ * opaque token, so the round's start is read after the last `@`, whatever the token holds.
30
+ */
31
+ const pageOf = (page, now) => {
32
+ const cut = (page ?? "").lastIndexOf("@");
33
+ const head = page?.slice(0, cut) ?? "";
34
+ const started = Number(page?.slice(cut + 1));
35
+ if (cut < 0 || !Number.isSafeInteger(started))
36
+ return { after: undefined, spot: undefined, started: now };
37
+ if (head.startsWith("l"))
38
+ return { after: head.slice(1) || undefined, spot: undefined, started };
39
+ const found = /^s(-?\d+)\.(\d+)$/.exec(head);
40
+ if (!found)
41
+ return { after: undefined, spot: undefined, started: now };
42
+ return { after: undefined, spot: { from: Number(found[1]), offset: Number(found[2]) }, started };
43
+ };
44
+ /**
45
+ * A list or a read by id leaves out an association type the record has none of; asked for, none is an empty list, so a
46
+ * link removed in HubSpot leaves the copy too.
47
+ */
48
+ const asked = (raw, types) => {
49
+ const held = typeof raw.associations === "object" && raw.associations !== null ? raw.associations : {};
50
+ return {
51
+ ...raw,
52
+ associations: { ...Object.fromEntries(types.map((type) => [type, { results: [] }])), ...held },
53
+ };
54
+ };
55
+ /** The shared names a live list filters by, as HubSpot's properties. */
56
+ const liveField = (kind, field) => ({
57
+ assigned_to: "hubspot_owner_id",
58
+ created_at: OBJECTS[kind].created,
59
+ updated_at: OBJECTS[kind].modified,
60
+ // A company's own `type` property (Prospect, Partner…), as b24 maps `type` to its company type.
61
+ ...(kind === "organization" ? { type: "type" } : {}),
62
+ })[field];
63
+ /**
64
+ * The longest `properties=` a GET sends. Servers commonly refuse request lines past 8 KB; HubSpot names no limit, so
65
+ * an account with hundreds of custom properties reads the ones that fit, and the call says which it left out.
66
+ */
67
+ export const MAX_PROPERTIES_CHARS = 6_000;
68
+ /** HubSpot's own properties first, always; then the account's own while they fit. */
69
+ export const fitted = (own, custom) => {
70
+ const kept = [...own];
71
+ let length = kept.join(",").length;
72
+ const dropped = [];
73
+ for (const name of custom) {
74
+ if (kept.includes(name))
75
+ continue;
76
+ if (length + name.length + 1 > MAX_PROPERTIES_CHARS)
77
+ dropped.push(name);
78
+ else {
79
+ kept.push(name);
80
+ length += name.length + 1;
81
+ }
82
+ }
83
+ return { properties: kept.join(","), dropped };
84
+ };
85
+ const OPERATORS = {
86
+ "=": "EQ",
87
+ "!=": "NEQ",
88
+ ">": "GT",
89
+ ">=": "GTE",
90
+ "<": "LT",
91
+ "<=": "LTE",
92
+ in: "IN",
93
+ };
94
+ /** core's conditions as one filter group: they are AND-ed, which a group is (search guide, filtering). */
95
+ const filtersOf = (kind, conditions, defined) => conditions.map(({ field, op, value }) => {
96
+ const propertyName = liveField(kind, field) ?? defined.find((one) => one.code === field)?.code;
97
+ if (!propertyName)
98
+ throw new CliError("validation_error", `${SERVICE} cannot filter ${OBJECTS[kind].name} by ${field}`, {
99
+ reason: "query.unsupported-field",
100
+ });
101
+ if (Array.isArray(value))
102
+ return { propertyName, operator: op === "!=" ? "NOT_IN" : "IN", values: value.map(String) };
103
+ return { propertyName, operator: OPERATORS[op], value: String(value) };
104
+ });
105
+ export const hubspotCrmSource = (hub, options = {}) => {
106
+ const now = options.now ?? Date.now;
107
+ const listPage = options.page ?? LIST_PAGE;
108
+ const searchPage = options.searchPage ?? SEARCH_PAGE;
109
+ /** core paid for a call's first request; each further one is spent from the run's budget. */
110
+ const metered = (context) => {
111
+ let paid = false;
112
+ const pay = () => {
113
+ if (paid)
114
+ context?.spend();
115
+ paid = true;
116
+ };
117
+ return {
118
+ get: (path, query) => {
119
+ pay();
120
+ return hub().get(path, query);
121
+ },
122
+ post: (path, body) => {
123
+ pay();
124
+ return hub().post(path, body);
125
+ },
126
+ };
127
+ };
128
+ const loaded = new Map();
129
+ /** Reading properties needs `crm.schemas.<type>.read`; without it records sync with no custom values. */
130
+ const fields = (kind, caller) => {
131
+ let found = loaded.get(kind);
132
+ if (!found) {
133
+ found = caller
134
+ .get(`/crm/properties/2026-03/${OBJECTS[kind].name}`)
135
+ .then((body) => resultsOf(body).flatMap((raw) => toField(raw) ?? []))
136
+ .catch((error) => {
137
+ if (refused(error))
138
+ return [];
139
+ loaded.delete(kind);
140
+ throw error;
141
+ });
142
+ loaded.set(kind, found);
143
+ }
144
+ return found;
145
+ };
146
+ let currency;
147
+ /** Asked only when a deal has an amount and no currency of its own. */
148
+ const currencyOf = (caller) => {
149
+ currency ??= accountDetails(caller).then((details) => details.companyCurrency ?? null, (error) => {
150
+ currency = undefined;
151
+ throw error;
152
+ });
153
+ return currency;
154
+ };
155
+ const mapped = async (kind, rows, defined, caller) => {
156
+ if (kind === "deal") {
157
+ const bare = rows.some((raw) => {
158
+ const properties = propertiesOf(raw);
159
+ return text(properties.amount) !== null && text(properties.deal_currency_code) === null;
160
+ });
161
+ const fallback = bare ? await currencyOf(caller) : null;
162
+ return rows.map((raw) => toDeal(raw, defined, fallback));
163
+ }
164
+ const map = { lead: toLead, person: toPerson, organization: toOrganization }[kind];
165
+ return rows.map((raw) => map(raw, defined));
166
+ };
167
+ /** The copy keeps no contact's custom values, as b24's does; a live read gives them. */
168
+ const synced = (kind, caller) => kind === "person" ? Promise.resolve([]) : fields(kind, caller);
169
+ const propertiesFor = (type, defined) => [
170
+ ...new Set([...type.properties, ...defined.map(({ code }) => code)]),
171
+ ];
172
+ /**
173
+ * One batch read per associated type (associations v4): a search answers no associations, and a list none of the
174
+ * type ids that mark the primary company.
175
+ */
176
+ const associate = async (type, rows, caller, types) => {
177
+ let linked = rows;
178
+ const ids = rows.flatMap((raw) => id(raw.id) ?? []);
179
+ for (const to of types)
180
+ linked = withAssociations(linked, to, await associationsOf(caller.post, type.name, to, ids));
181
+ return linked;
182
+ };
183
+ const everyLink = (type) => [...type.associations, ...type.linked];
184
+ /**
185
+ * The GET query's properties, the ones that do not fit named as a gap. Only a GET is capped: a change round's search
186
+ * sends them in a POST body and asks every one, so a property a full round left out still arrives with a change.
187
+ */
188
+ const getProperties = (kind, defined, context) => {
189
+ const { properties, dropped } = fitted(OBJECTS[kind].properties, defined.map(({ code }) => code));
190
+ if (dropped.length)
191
+ context?.gap({
192
+ kind,
193
+ message: `${dropped.length} of the account's own ${OBJECTS[kind].name} properties do not fit one request and were not read`,
194
+ });
195
+ return properties;
196
+ };
197
+ const readChanges = async (kind, cursor, page, caller, context) => {
198
+ const type = OBJECTS[kind];
199
+ const since = cursor === null ? null : Date.parse(cursor);
200
+ if (since !== null && Number.isNaN(since))
201
+ return { reset: true };
202
+ const { after, spot: saved, started } = pageOf(page, now());
203
+ const defined = await synced(kind, caller);
204
+ const properties = propertiesFor(type, defined);
205
+ const ended = { hasMore: false, cursor: new Date(started).toISOString() };
206
+ if (since === null) {
207
+ const query = {
208
+ limit: listPage,
209
+ properties: getProperties(kind, defined, context),
210
+ archived: false,
211
+ ...(type.associations.length ? { associations: type.associations.join(",") } : {}),
212
+ ...(after ? { after } : {}),
213
+ };
214
+ const body = await caller.get(`/crm/objects/2026-03/${type.path}`, query);
215
+ const rows = await associate(type, resultsOf(body).map((raw) => asked(raw, type.associations)), caller, type.linked);
216
+ const items = await mapped(kind, rows, defined, caller);
217
+ const next = nextOf(body);
218
+ return next ? { items, hasMore: true, nextCursor: `l${next}@${started}` } : { items, ...ended };
219
+ }
220
+ const spot = saved ?? { from: since - OVERLAP_MS, offset: 0 };
221
+ const { rows, more } = await search(caller.post, type.path, modifiedSince(type.modified, spot, searchPage, properties));
222
+ const items = await mapped(kind, await associate(type, rows, caller, everyLink(type)), defined, caller);
223
+ if (!more)
224
+ return { items, ...ended };
225
+ const next = nextSpot(spot, rows, type.modified, searchPage);
226
+ // More than the search cap changed at one moment (a mass import): only a full list reads them all.
227
+ if (next === null)
228
+ return { reset: true };
229
+ return { items, hasMore: true, nextCursor: `s${next.from}.${next.offset}@${started}` };
230
+ };
231
+ const known = async (kind, caller) => fields(kind, caller);
232
+ return {
233
+ provider: "hubspot",
234
+ traits: { kinds: ["organization", "person", "deal", "lead"], removedInChanges: false },
235
+ async pipelines(kind, context) {
236
+ try {
237
+ const body = await metered(context).get(`/crm/pipelines/2026-03/${PIPELINES[kind]}`);
238
+ return resultsOf(body).flatMap((raw) => {
239
+ const pipeline = toPipeline(raw, kind, (stage) => context?.gap({
240
+ kind,
241
+ message: `closed lead stage ${stage}: HubSpot gives no outcome; counted as lost`,
242
+ }));
243
+ return pipeline ? [pipeline] : [];
244
+ });
245
+ }
246
+ catch (error) {
247
+ if (kind === "lead" && refused(error)) {
248
+ context?.gap({ kind: "lead", scope: OBJECTS.lead.scope, message: leadsRefused });
249
+ return [];
250
+ }
251
+ throw scoped(error, OBJECTS[kind].scope);
252
+ }
253
+ },
254
+ async changes(kind, cursor, page, context) {
255
+ try {
256
+ return await readChanges(kind, cursor, page, metered(context), context);
257
+ }
258
+ catch (error) {
259
+ // Leads need Sales Hub Professional or Enterprise: an account without them still syncs everything else.
260
+ if (kind === "lead" && refused(error)) {
261
+ context?.gap({ kind: "lead", scope: OBJECTS.lead.scope, message: leadsRefused });
262
+ return { items: [], hasMore: false, cursor: null };
263
+ }
264
+ throw scoped(error, OBJECTS[kind].scope);
265
+ }
266
+ },
267
+ // Any other refusal fails the pass rather than answer no ids, which would mark every stored row deleted
268
+ // (WC-DATA-7). Leads are the exception: an account without Sales Hub Pro never has any, and core holds back a pass
269
+ // that would delete most of a kind until --rescan.
270
+ async ids(kind, page, context) {
271
+ const type = OBJECTS[kind];
272
+ try {
273
+ const body = await metered(context).get(`/crm/objects/2026-03/${type.path}`, {
274
+ limit: listPage,
275
+ properties: "hs_object_id",
276
+ archived: false,
277
+ ...(page ? { after: page } : {}),
278
+ });
279
+ const items = resultsOf(body).flatMap((raw) => id(raw.id) ?? []);
280
+ const next = nextOf(body);
281
+ return next ? { items, hasMore: true, nextCursor: next } : { items, hasMore: false };
282
+ }
283
+ catch (error) {
284
+ if (kind === "lead" && refused(error)) {
285
+ context?.gap({ kind: "lead", scope: type.scope, message: leadsRefused });
286
+ return { items: [], hasMore: false };
287
+ }
288
+ throw scoped(error, type.scope);
289
+ }
290
+ },
291
+ async fields(kind, context) {
292
+ return fields(kind, metered(context));
293
+ },
294
+ // Active owners, then the deactivated ones, which `archived=true` lists alone (owners guide).
295
+ async users(context) {
296
+ const caller = metered(context);
297
+ const users = [];
298
+ for (const archived of [false, true]) {
299
+ let after = null;
300
+ do {
301
+ const body = await caller
302
+ .get("/crm/owners/2026-03", { limit: LIST_PAGE, archived, ...(after ? { after } : {}) })
303
+ .catch((error) => {
304
+ throw scoped(error, "crm.objects.owners.read");
305
+ });
306
+ for (const raw of resultsOf(body)) {
307
+ const user = toUser(raw);
308
+ if (user)
309
+ users.push(user);
310
+ }
311
+ after = nextOf(body);
312
+ } while (after);
313
+ }
314
+ return [...new Map(users.map((user) => [user.externalId, user])).values()];
315
+ },
316
+ async list(kind, query, context) {
317
+ const caller = metered(context);
318
+ const type = OBJECTS[kind];
319
+ const defined = await known(kind, caller);
320
+ const filters = filtersOf(kind, query.conditions, defined);
321
+ const properties = propertiesFor(type, defined);
322
+ const page = await walk(crmWindowOf(query), SEARCH_PAGE, async (offset, limit) => {
323
+ const { rows, more } = await search(caller.post, type.path, {
324
+ filters,
325
+ sort: { propertyName: type.created, direction: "DESCENDING" },
326
+ properties,
327
+ limit,
328
+ offset,
329
+ ...(query.text ? { query: query.text } : {}),
330
+ });
331
+ return { rows: await associate(type, rows, caller, everyLink(type)), more };
332
+ });
333
+ return { items: await mapped(kind, page.items, defined, caller), hasMore: page.hasMore };
334
+ },
335
+ get: (kind, externalId, context) => record(kind, externalId, context),
336
+ record,
337
+ activities: (since, page, context) => readActivities(metered(context), since, page, context, now, { search: searchPage, list: listPage }),
338
+ };
339
+ async function record(kind, externalId, context) {
340
+ if (!/^\d{1,20}$/.test(externalId))
341
+ return null;
342
+ const caller = metered(context);
343
+ const type = OBJECTS[kind];
344
+ const defined = await fields(kind, caller);
345
+ let body;
346
+ try {
347
+ body = await caller.get(`/crm/objects/2026-03/${type.path}/${segment(externalId)}`, {
348
+ properties: getProperties(kind, defined, context),
349
+ ...(type.associations.length ? { associations: type.associations.join(",") } : {}),
350
+ });
351
+ }
352
+ catch (error) {
353
+ if (unseen(error))
354
+ return null;
355
+ throw error;
356
+ }
357
+ if (typeof body !== "object" || body === null)
358
+ return null;
359
+ const rows = await associate(type, [asked(body, type.associations)], caller, type.linked);
360
+ const [found] = await mapped(kind, rows, defined, caller);
361
+ return found ?? null;
362
+ }
363
+ };
364
+ const leadsRefused = "HubSpot refused the leads: they need Sales Hub Professional or Enterprise and the crm.objects.leads.read scope; " +
365
+ "deals, contacts and companies are copied without them";
366
+ //# sourceMappingURL=source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/crm/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAOL,SAAS,EACT,WAAW,EACX,IAAI,GACL,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAqC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,EACL,MAAM,EACN,OAAO,EAEP,YAAY,EAEZ,SAAS,EACT,MAAM,EACN,OAAO,EACP,MAAM,EACN,cAAc,EACd,QAAQ,EACR,UAAU,EACV,MAAM,GACP,MAAM,cAAc,CAAA;AACrB,OAAO,EAAe,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAa,MAAM,EAAE,MAAM,aAAa,CAAA;AAElG,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,SAAS,CAAA;AAE9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,GAAG,MAAM,CAAA;AACrC,gFAAgF;AAChF,MAAM,SAAS,GAAG,GAAG,CAAA;AAErB,sFAAsF;AACtF,MAAM,SAAS,GAA6B,EAAE,I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GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QAC1C,IAAI,IAAa,CAAA;QACjB,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,wBAAwB,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE;gBAClF,UAAU,EAAE,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC;gBACjD,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACnF,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,MAAM,CAAC,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAA;YAC9B,MAAM,KAAK,CAAA;QACb,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,IAAI,CAAA;QAC1D,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAW,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAChG,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;QACzD,OAAO,KAAK,IAAI,IAAI,CAAA;IACtB,CAAC;AACH,CAAC,CAAA;AAED,MAAM,YAAY,GAChB,kHAAkH;IAClH,uDAAuD,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { type CrmWriteCapabilities, type CrmWriter } from "@wirecat/cli-core/crm";
2
+ import { type HubSpotWriteTransport } from "../hubspot/transport.js";
3
+ import type { HubSpotCrmSource } from "./source.js";
4
+ /**
5
+ * Deals, contacts and companies; leads need Sales Hub Professional, which no account this was checked on has. HubSpot
6
+ * takes no idempotency key on a create (objects guide), so a repeated write makes a second record.
7
+ */
8
+ export declare const HUBSPOT_WRITES: CrmWriteCapabilities;
9
+ /**
10
+ * Core's write port over HubSpot's object APIs (https://developers.hubspot.com/docs/api-reference/latest/crm/using-object-apis):
11
+ * a POST to create, a PATCH of the properties given, a DELETE that archives. Each is sent once, then the record is read
12
+ * back whole with its associations, as core's store wants it.
13
+ */
14
+ export declare const hubspotCrmWriter: (hub: () => HubSpotWriteTransport, source: () => HubSpotCrmSource) => CrmWriter;
15
+ //# sourceMappingURL=writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/crm/writer.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,oBAAoB,EAEzB,KAAK,SAAS,EAGf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,KAAK,qBAAqB,EAAoB,MAAM,yBAAyB,CAAA;AAEtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,oBAI5B,CAAA;AAsHD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAS,MAAM,qBAAqB,UAAU,MAAM,gBAAgB,KAAG,SA0EnG,CAAA"}