@koda-sl/baker-cli 0.449.0-dev.bd86e5817 → 0.450.0-dev.b454c3dd2

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 (443) hide show
  1. package/README.md +11 -6
  2. package/dist/{account-AL2ZDSR7.js → account-XQXC7BR6.js} +5 -4
  3. package/dist/{account-AL2ZDSR7.js.map → account-XQXC7BR6.js.map} +1 -1
  4. package/dist/{accounts-HAFCLSR5.js → accounts-722UY53A.js} +4 -3
  5. package/dist/{accounts-HAFCLSR5.js.map → accounts-722UY53A.js.map} +1 -1
  6. package/dist/{accounts-O5MFO3QQ.js → accounts-E67BMK7T.js} +6 -5
  7. package/dist/{accounts-O5MFO3QQ.js.map → accounts-E67BMK7T.js.map} +1 -1
  8. package/dist/{actions-P35MEMGN.js → actions-6TQMSVWD.js} +18 -18
  9. package/dist/{add-5GAN6CVO.js → add-2BEGRHUX.js} +28 -5
  10. package/dist/add-2BEGRHUX.js.map +1 -0
  11. package/dist/{add-6DTC6X5G.js → add-LEMKEOPO.js} +3 -2
  12. package/dist/{add-6DTC6X5G.js.map → add-LEMKEOPO.js.map} +1 -1
  13. package/dist/{ads-73PGA4YC.js → ads-AGYCVD62.js} +4 -4
  14. package/dist/{advertisers-AE75CGVE.js → advertisers-2VQKAYKG.js} +4 -3
  15. package/dist/{advertisers-AE75CGVE.js.map → advertisers-2VQKAYKG.js.map} +1 -1
  16. package/dist/{analytics-FKCXIMPO.js → analytics-IFELDWLL.js} +24 -20
  17. package/dist/analytics-IFELDWLL.js.map +1 -0
  18. package/dist/{analytics-FPWQQGRM.js → analytics-OH5QEH7F.js} +4 -3
  19. package/dist/{analytics-FPWQQGRM.js.map → analytics-OH5QEH7F.js.map} +1 -1
  20. package/dist/{assign-ABN2AQ4J.js → assign-PTUJUCEL.js} +4 -3
  21. package/dist/{assign-ABN2AQ4J.js.map → assign-PTUJUCEL.js.map} +1 -1
  22. package/dist/{audience-size-GNBJY35X.js → audience-size-LRI6GJRT.js} +4 -3
  23. package/dist/{audience-size-GNBJY35X.js.map → audience-size-LRI6GJRT.js.map} +1 -1
  24. package/dist/{audit-3VS63TBW.js → audit-HWP7OPB7.js} +4 -3
  25. package/dist/{audit-3VS63TBW.js.map → audit-HWP7OPB7.js.map} +1 -1
  26. package/dist/{autocomplete-VS3XG3B7.js → autocomplete-J6DHU6MR.js} +4 -3
  27. package/dist/{autocomplete-VS3XG3B7.js.map → autocomplete-J6DHU6MR.js.map} +1 -1
  28. package/dist/{avatars-EKCKHCC3.js → avatars-467OSBD6.js} +4 -4
  29. package/dist/{bid-pricing-Q72B65AY.js → bid-pricing-EO5WLHGV.js} +4 -3
  30. package/dist/{bid-pricing-Q72B65AY.js.map → bid-pricing-EO5WLHGV.js.map} +1 -1
  31. package/dist/{brand-C6PFGGQN.js → brand-YRTEPGBK.js} +2 -2
  32. package/dist/{brief-YFJHQ5VQ.js → brief-OSFJ2V7F.js} +8 -7
  33. package/dist/{brief-YFJHQ5VQ.js.map → brief-OSFJ2V7F.js.map} +1 -1
  34. package/dist/{campaign-groups-KFFYQPU3.js → campaign-groups-PQ6KSQJR.js} +9 -8
  35. package/dist/{campaign-groups-KFFYQPU3.js.map → campaign-groups-PQ6KSQJR.js.map} +1 -1
  36. package/dist/{campaign-writes-FHOS5XZY.js → campaign-writes-5OVLUD5E.js} +4 -3
  37. package/dist/{campaign-writes-FHOS5XZY.js.map → campaign-writes-5OVLUD5E.js.map} +1 -1
  38. package/dist/{campaigns-2NHWBF5C.js → campaigns-6T3NSUT2.js} +12 -11
  39. package/dist/{campaigns-2NHWBF5C.js.map → campaigns-6T3NSUT2.js.map} +1 -1
  40. package/dist/{campaigns-KZYZTXDS.js → campaigns-OYMXDGWX.js} +5 -5
  41. package/dist/{canvas-UJNSHD3B.js → canvas-YQFG52IG.js} +13 -13
  42. package/dist/{capabilities-DJFTRJKS.js → capabilities-PXBKUN2G.js} +4 -3
  43. package/dist/{capabilities-DJFTRJKS.js.map → capabilities-PXBKUN2G.js.map} +1 -1
  44. package/dist/{catalog-ZQX6BGXS.js → catalog-XLXIM7IW.js} +4 -4
  45. package/dist/{chats-D2CSDX5Q.js → chats-UK47UE7C.js} +4 -3
  46. package/dist/{chats-D2CSDX5Q.js.map → chats-UK47UE7C.js.map} +1 -1
  47. package/dist/{chunk-7YCRFMXF.js → chunk-24EB7EDR.js} +3 -3
  48. package/dist/{chunk-5ZDLTE5T.js → chunk-2AOE2MZQ.js} +3 -3
  49. package/dist/{chunk-4SG4RW2P.js → chunk-2VPBIT65.js} +8 -8
  50. package/dist/chunk-4PDHHHUJ.js +537 -0
  51. package/dist/chunk-4PDHHHUJ.js.map +1 -0
  52. package/dist/{chunk-NPY4QUMQ.js → chunk-54C6YDGJ.js} +2 -2
  53. package/dist/{chunk-LZ73CZGP.js → chunk-5WCSKQ7Z.js} +6 -6
  54. package/dist/{chunk-3G3ZDLMI.js → chunk-5ZNTADVR.js} +2 -2
  55. package/dist/{chunk-AEOSAVVL.js → chunk-6F7DVPOS.js} +3 -3
  56. package/dist/{chunk-CJCVIEJ5.js → chunk-6NY2GPR4.js} +3 -3
  57. package/dist/{chunk-CXWFX2AM.js → chunk-6Y7ZBENQ.js} +6 -6
  58. package/dist/{chunk-M242LHLX.js → chunk-7CTMH5AK.js} +3 -3
  59. package/dist/{chunk-XF4JUKVF.js → chunk-7EPXVICM.js} +38 -5
  60. package/dist/chunk-7EPXVICM.js.map +1 -0
  61. package/dist/{chunk-T2PC5AVH.js → chunk-ASI4P6X2.js} +6 -6
  62. package/dist/chunk-ASI4P6X2.js.map +1 -0
  63. package/dist/{chunk-QD7ESRLN.js → chunk-C46GUI2S.js} +2 -2
  64. package/dist/{chunk-6N6WKAJM.js → chunk-CWYAELVG.js} +2 -2
  65. package/dist/{chunk-MXYBTMKB.js → chunk-DCRPXOJJ.js} +2 -2
  66. package/dist/{chunk-GKZ2WU75.js → chunk-FPOGPFAG.js} +3 -14
  67. package/dist/chunk-FPOGPFAG.js.map +1 -0
  68. package/dist/{chunk-JQJDXPCO.js → chunk-FUHN4MFY.js} +2 -2
  69. package/dist/{chunk-S77PZVYM.js → chunk-FYGR3I2A.js} +3 -3
  70. package/dist/{chunk-OZRUJVIQ.js → chunk-H3427GPU.js} +2 -2
  71. package/dist/{chunk-RPUSTYHL.js → chunk-HDLYPC6K.js} +5 -3
  72. package/dist/{chunk-RPUSTYHL.js.map → chunk-HDLYPC6K.js.map} +1 -1
  73. package/dist/{chunk-SSJK7FEV.js → chunk-HR6IWNKE.js} +1196 -1140
  74. package/dist/chunk-HR6IWNKE.js.map +1 -0
  75. package/dist/{chunk-YRQYA2LR.js → chunk-HROZYQ5H.js} +63 -5
  76. package/dist/chunk-HROZYQ5H.js.map +1 -0
  77. package/dist/{chunk-IR6D7K4H.js → chunk-I3ZR655O.js} +2 -2
  78. package/dist/{chunk-YK32GUBN.js → chunk-KMKEYI37.js} +3 -3
  79. package/dist/{chunk-W3ZHJJVT.js → chunk-KS2QY6MK.js} +4 -4
  80. package/dist/{chunk-WNRV4QH7.js → chunk-LYQJ4PZW.js} +5 -5
  81. package/dist/{chunk-B5SCU7MJ.js → chunk-MACCF4JZ.js} +16 -22
  82. package/dist/{chunk-B5SCU7MJ.js.map → chunk-MACCF4JZ.js.map} +1 -1
  83. package/dist/{chunk-CSYSX4D2.js → chunk-N4LAYIIN.js} +2 -2
  84. package/dist/{chunk-4AUMTNVB.js → chunk-NA63BH7V.js} +3 -3
  85. package/dist/{chunk-4BQXAE7Z.js → chunk-NDEE6G2J.js} +2 -2
  86. package/dist/{chunk-EDLZGTGN.js → chunk-NYIGXDUG.js} +1 -39
  87. package/dist/chunk-NYIGXDUG.js.map +1 -0
  88. package/dist/{chunk-DWHIOO7E.js → chunk-QE7W555R.js} +163 -12
  89. package/dist/chunk-QE7W555R.js.map +1 -0
  90. package/dist/{chunk-MELOSESI.js → chunk-R25YLW6H.js} +2 -2
  91. package/dist/{chunk-Y6O7EWYY.js → chunk-RL5CP7N6.js} +5 -5
  92. package/dist/{chunk-DGUNI37S.js → chunk-RX2DKU3W.js} +2 -2
  93. package/dist/{chunk-3HJLHTWP.js → chunk-SJYEY5MV.js} +12 -3
  94. package/dist/{chunk-3HJLHTWP.js.map → chunk-SJYEY5MV.js.map} +1 -1
  95. package/dist/{chunk-VTDMKARH.js → chunk-ULG4QRTV.js} +2 -2
  96. package/dist/{chunk-QRP3PXWN.js → chunk-VL43TNIP.js} +2 -2
  97. package/dist/{chunk-SHL7LOC3.js → chunk-VLMBTPXU.js} +3 -3
  98. package/dist/{chunk-KHRXPQID.js → chunk-VYQ3QJ3C.js} +2 -2
  99. package/dist/{chunk-A4LOJ2VD.js → chunk-WGUQHAJY.js} +2 -2
  100. package/dist/{chunk-ZEYEWPK6.js → chunk-WKQG6TER.js} +2 -2
  101. package/dist/{chunk-3IBYKLXR.js → chunk-ZDMTXQ2Q.js} +2 -2
  102. package/dist/{claim-FZ5OQLMU.js → claim-W6G6VEG5.js} +4 -3
  103. package/dist/{claim-FZ5OQLMU.js.map → claim-W6G6VEG5.js.map} +1 -1
  104. package/dist/cli.js +30 -30
  105. package/dist/{companies-DNI634RC.js → companies-TS6KBATJ.js} +4 -3
  106. package/dist/{companies-DNI634RC.js.map → companies-TS6KBATJ.js.map} +1 -1
  107. package/dist/{complete-2FZMGJV5.js → complete-LYR2HMQU.js} +4 -3
  108. package/dist/{complete-2FZMGJV5.js.map → complete-LYR2HMQU.js.map} +1 -1
  109. package/dist/{connect-QCOGEPP4.js → connect-FCXNVTXG.js} +13 -6
  110. package/dist/{conversation-6IOGV7B7.js → conversation-6ZJGPCXM.js} +4 -3
  111. package/dist/{conversation-6IOGV7B7.js.map → conversation-6ZJGPCXM.js.map} +1 -1
  112. package/dist/{conversions-4SRZPBBX.js → conversions-UHB55MMQ.js} +8 -7
  113. package/dist/{conversions-4SRZPBBX.js.map → conversions-UHB55MMQ.js.map} +1 -1
  114. package/dist/{create-BJNMO6HT.js → create-EX6OWLNM.js} +3 -2
  115. package/dist/{create-BJNMO6HT.js.map → create-EX6OWLNM.js.map} +1 -1
  116. package/dist/{create-RM7HV77Y.js → create-JCA7JPLP.js} +4 -3
  117. package/dist/{create-RM7HV77Y.js.map → create-JCA7JPLP.js.map} +1 -1
  118. package/dist/{create-FX4OJ2XF.js → create-JFSK4BOP.js} +4 -3
  119. package/dist/{create-FX4OJ2XF.js.map → create-JFSK4BOP.js.map} +1 -1
  120. package/dist/{create-VXM34ZWH.js → create-WU22YYU2.js} +4 -3
  121. package/dist/{create-VXM34ZWH.js.map → create-WU22YYU2.js.map} +1 -1
  122. package/dist/{creatives-NJF2U763.js → creatives-FXUQ5WSD.js} +10 -10
  123. package/dist/{creatives-JSWBFQ5R.js → creatives-KGXUOYPE.js} +9 -8
  124. package/dist/{creatives-JSWBFQ5R.js.map → creatives-KGXUOYPE.js.map} +1 -1
  125. package/dist/{credentials-C33K6XCJ.js → credentials-MJC7PGKR.js} +4 -3
  126. package/dist/{credentials-C33K6XCJ.js.map → credentials-MJC7PGKR.js.map} +1 -1
  127. package/dist/{critique-YDKPYZLD.js → critique-GS5VV5ZC.js} +7 -6
  128. package/dist/{critique-YDKPYZLD.js.map → critique-GS5VV5ZC.js.map} +1 -1
  129. package/dist/{critique-ZS4ON3SU.js → critique-TPHR27KH.js} +4 -3
  130. package/dist/{critique-ZS4ON3SU.js.map → critique-TPHR27KH.js.map} +1 -1
  131. package/dist/{crm-R5IXIFIV.js → crm-AVCM5D4G.js} +5 -4
  132. package/dist/{crm-R5IXIFIV.js.map → crm-AVCM5D4G.js.map} +1 -1
  133. package/dist/{crm-52ROSWH5.js → crm-VK44O3ED.js} +5 -4
  134. package/dist/{crm-52ROSWH5.js.map → crm-VK44O3ED.js.map} +1 -1
  135. package/dist/{customers-A36LOZOB.js → customers-XH2DMTFH.js} +6 -5
  136. package/dist/{delete-M2GDLPYN.js → delete-E3R3TKIL.js} +3 -2
  137. package/dist/{delete-M2GDLPYN.js.map → delete-E3R3TKIL.js.map} +1 -1
  138. package/dist/{delete-HGHXY24R.js → delete-KRH2YMSZ.js} +4 -3
  139. package/dist/{delete-HGHXY24R.js.map → delete-KRH2YMSZ.js.map} +1 -1
  140. package/dist/{delete-AIGE4Y4H.js → delete-WI5E3DR3.js} +4 -3
  141. package/dist/{delete-AIGE4Y4H.js.map → delete-WI5E3DR3.js.map} +1 -1
  142. package/dist/{demographics-NTWB2IMG.js → demographics-XV5PBA77.js} +4 -3
  143. package/dist/{demographics-NTWB2IMG.js.map → demographics-XV5PBA77.js.map} +1 -1
  144. package/dist/{discard-2WWQG6OU.js → discard-HTQUUHJR.js} +4 -3
  145. package/dist/{discard-2WWQG6OU.js.map → discard-HTQUUHJR.js.map} +1 -1
  146. package/dist/{domain-Y2LT6JLT.js → domain-RECGZXJB.js} +4 -3
  147. package/dist/{domain-Y2LT6JLT.js.map → domain-RECGZXJB.js.map} +1 -1
  148. package/dist/{draft-SLHAKJ2A.js → draft-2IBSJEKC.js} +4 -3
  149. package/dist/{draft-SLHAKJ2A.js.map → draft-2IBSJEKC.js.map} +1 -1
  150. package/dist/{draft-FJ7WHIXW.js → draft-PVTX6QT6.js} +4 -3
  151. package/dist/{draft-FJ7WHIXW.js.map → draft-PVTX6QT6.js.map} +1 -1
  152. package/dist/{draft-EJXNNJ3Y.js → draft-Q546QPPU.js} +5 -4
  153. package/dist/{draft-EJXNNJ3Y.js.map → draft-Q546QPPU.js.map} +1 -1
  154. package/dist/engine/index.js +3 -3
  155. package/dist/{facets-U7AQC4H6.js → facets-7EVPJMKS.js} +4 -3
  156. package/dist/{facets-U7AQC4H6.js.map → facets-7EVPJMKS.js.map} +1 -1
  157. package/dist/{feedback-PPQMOQ46.js → feedback-EIZKS4JU.js} +2 -2
  158. package/dist/{feedback-record-V66HWVRR.js → feedback-record-TKO54BOE.js} +9 -8
  159. package/dist/{feedback-record-V66HWVRR.js.map → feedback-record-TKO54BOE.js.map} +1 -1
  160. package/dist/{fetch-W7NULDEO.js → fetch-4BY6HYUM.js} +4 -3
  161. package/dist/{fetch-W7NULDEO.js.map → fetch-4BY6HYUM.js.map} +1 -1
  162. package/dist/{find-OTDIX6V4.js → find-FRRHAPWX.js} +4 -4
  163. package/dist/{flows-KABCBS3S.js → flows-KTFAML22.js} +21 -17
  164. package/dist/flows-KTFAML22.js.map +1 -0
  165. package/dist/{fonts-EMMX3KII.js → fonts-MXR3ZKDX.js} +6 -5
  166. package/dist/{forecast-GNODEIIC.js → forecast-3QTJYVND.js} +4 -3
  167. package/dist/{forecast-GNODEIIC.js.map → forecast-3QTJYVND.js.map} +1 -1
  168. package/dist/{funnel-AAX27NH4.js → funnel-I6XIAEHG.js} +11 -455
  169. package/dist/funnel-I6XIAEHG.js.map +1 -0
  170. package/dist/{ga4-UDQ2HA2J.js → ga4-DV2AXCSL.js} +1 -1
  171. package/dist/{get-QEYJRLV3.js → get-5PKNKJ5S.js} +7 -4
  172. package/dist/get-5PKNKJ5S.js.map +1 -0
  173. package/dist/{get-RTVUZM6E.js → get-72YPHJGV.js} +4 -3
  174. package/dist/{get-RTVUZM6E.js.map → get-72YPHJGV.js.map} +1 -1
  175. package/dist/{google-M7KEXVK5.js → google-6OGZX47I.js} +2 -2
  176. package/dist/{google-KTO3PLEU.js → google-QYYYSSXI.js} +5 -5
  177. package/dist/{google-ads-OK6IG3UV.js → google-ads-QGMQKZQD.js} +4 -3
  178. package/dist/{google-ads-OK6IG3UV.js.map → google-ads-QGMQKZQD.js.map} +1 -1
  179. package/dist/{gsc-P3QYGDV2.js → gsc-TAKOF7J5.js} +1 -1
  180. package/dist/{history-PQUJKK26.js → history-6AVQX2OQ.js} +4 -3
  181. package/dist/{history-PQUJKK26.js.map → history-6AVQX2OQ.js.map} +1 -1
  182. package/dist/{hubspot-Y77VLY6Y.js → hubspot-SVEMFK5S.js} +9 -8
  183. package/dist/{hubspot-Y77VLY6Y.js.map → hubspot-SVEMFK5S.js.map} +1 -1
  184. package/dist/{icon-I43F77FV.js → icon-L4RSS6PZ.js} +4 -4
  185. package/dist/{ideas-MIDU7YOA.js → ideas-NFOW3HKJ.js} +3 -2
  186. package/dist/{images-S254MS6O.js → images-2EFFUNNV.js} +9 -9
  187. package/dist/{ingest-YV2NLDBE.js → ingest-2EIKN4QC.js} +4 -3
  188. package/dist/{ingest-J4I3HKM3.js → ingest-2SO62RRI.js} +3 -2
  189. package/dist/{ingest-J4I3HKM3.js.map → ingest-2SO62RRI.js.map} +1 -1
  190. package/dist/{inspect-Q5NHBBHX.js → inspect-4OOS4APT.js} +4 -3
  191. package/dist/{inspect-Q5NHBBHX.js.map → inspect-4OOS4APT.js.map} +1 -1
  192. package/dist/{inspiration-P265QJ2H.js → inspiration-S3DU4CMQ.js} +1 -1
  193. package/dist/{keyword-metrics-PDY4ZXSP.js → keyword-metrics-SF4CSNZ2.js} +4 -3
  194. package/dist/{keyword-metrics-PDY4ZXSP.js.map → keyword-metrics-SF4CSNZ2.js.map} +1 -1
  195. package/dist/{keywords-for-site-GALSCV77.js → keywords-for-site-WDAOPNKC.js} +4 -3
  196. package/dist/{keywords-for-site-GALSCV77.js.map → keywords-for-site-WDAOPNKC.js.map} +1 -1
  197. package/dist/{landing-CJYGWCK4.js → landing-2ZB46LXH.js} +3 -3
  198. package/dist/{leads-PHKG6CP3.js → leads-A4W5KTWB.js} +4 -3
  199. package/dist/{leads-PHKG6CP3.js.map → leads-A4W5KTWB.js.map} +1 -1
  200. package/dist/{learn-FUQSY7DN.js → learn-IPULBCOD.js} +5 -4
  201. package/dist/{learn-FUQSY7DN.js.map → learn-IPULBCOD.js.map} +1 -1
  202. package/dist/{line-item-writes-E6MZPIZZ.js → line-item-writes-EMYSOJKM.js} +4 -3
  203. package/dist/{line-item-writes-E6MZPIZZ.js.map → line-item-writes-EMYSOJKM.js.map} +1 -1
  204. package/dist/{line-items-7ZGIKEF2.js → line-items-5NECXUZT.js} +5 -5
  205. package/dist/{link-QYAW6A2W.js → link-CI45HWFN.js} +4 -3
  206. package/dist/{link-QYAW6A2W.js.map → link-CI45HWFN.js.map} +1 -1
  207. package/dist/{linkedin-FFSDSGGS.js → linkedin-B7SYR75X.js} +27 -26
  208. package/dist/{linkedin-FFSDSGGS.js.map → linkedin-B7SYR75X.js.map} +1 -1
  209. package/dist/{list-NVQC5SNY.js → list-2BARXOT5.js} +3 -2
  210. package/dist/{list-NVQC5SNY.js.map → list-2BARXOT5.js.map} +1 -1
  211. package/dist/{list-SAV3LQHY.js → list-BIEVLEHS.js} +4 -3
  212. package/dist/{list-SAV3LQHY.js.map → list-BIEVLEHS.js.map} +1 -1
  213. package/dist/{list-5IC6KIKO.js → list-ZBT3EBVZ.js} +4 -3
  214. package/dist/{list-5IC6KIKO.js.map → list-ZBT3EBVZ.js.map} +1 -1
  215. package/dist/{log-XZPVOALD.js → log-C23OOAJZ.js} +4 -3
  216. package/dist/{log-XZPVOALD.js.map → log-C23OOAJZ.js.map} +1 -1
  217. package/dist/{logo-2IP663QO.js → logo-Q5D7PZY6.js} +3 -3
  218. package/dist/{lookup-XK45W2SH.js → lookup-ETWY47F7.js} +6 -5
  219. package/dist/{make-J3WBO62B.js → make-TPKKJXGL.js} +18 -17
  220. package/dist/{make-J3WBO62B.js.map → make-TPKKJXGL.js.map} +1 -1
  221. package/dist/{map-4J5WIWIG.js → map-SYZMPHLL.js} +5 -4
  222. package/dist/{map-4J5WIWIG.js.map → map-SYZMPHLL.js.map} +1 -1
  223. package/dist/{mcp-XXD7ZQCP.js → mcp-6FQBVJ6F.js} +3 -2
  224. package/dist/{mcp-XXD7ZQCP.js.map → mcp-6FQBVJ6F.js.map} +1 -1
  225. package/dist/{media-sources-O6ZRUA3N.js → media-sources-ZXHEEP6T.js} +2 -2
  226. package/dist/{members-D5ZYLS4Y.js → members-UDY4OOJW.js} +4 -3
  227. package/dist/{members-D5ZYLS4Y.js.map → members-UDY4OOJW.js.map} +1 -1
  228. package/dist/{normalize-PCNC6E2N.js → normalize-DAKHYS3V.js} +7 -3
  229. package/dist/{normalize-PCNC6E2N.js.map → normalize-DAKHYS3V.js.map} +1 -1
  230. package/dist/{options-MQ65VEVD.js → options-QL3ULED5.js} +7 -6
  231. package/dist/{options-MQ65VEVD.js.map → options-QL3ULED5.js.map} +1 -1
  232. package/dist/{performance-6QW2KEEQ.js → performance-UF5VTY2U.js} +5 -4
  233. package/dist/plan-FT632COT.js +51 -0
  234. package/dist/plan-FT632COT.js.map +1 -0
  235. package/dist/{promoted-tweet-writes-JPLHY3GM.js → promoted-tweet-writes-7HGESJ46.js} +4 -3
  236. package/dist/{promoted-tweet-writes-JPLHY3GM.js.map → promoted-tweet-writes-7HGESJ46.js.map} +1 -1
  237. package/dist/{promoted-tweets-SURKMHFI.js → promoted-tweets-LZKS5JIF.js} +3 -3
  238. package/dist/{publish-HCQ6MXLB.js → publish-NPD3SMZL.js} +4 -3
  239. package/dist/{publish-HCQ6MXLB.js.map → publish-NPD3SMZL.js.map} +1 -1
  240. package/dist/questionnaire-JNGYJTAY.js +37 -0
  241. package/dist/questionnaire-JNGYJTAY.js.map +1 -0
  242. package/dist/{reddit-GIP3ADMS.js → reddit-NU2N3LZD.js} +5 -4
  243. package/dist/{refresh-UXQSLCR3.js → refresh-EBVJ2C6L.js} +3 -2
  244. package/dist/{refresh-UXQSLCR3.js.map → refresh-EBVJ2C6L.js.map} +1 -1
  245. package/dist/{release-5KVLXNP6.js → release-V43YB2PY.js} +4 -3
  246. package/dist/{release-5KVLXNP6.js.map → release-V43YB2PY.js.map} +1 -1
  247. package/dist/{remove-6FIVKCJI.js → remove-QPSWLFI4.js} +3 -2
  248. package/dist/{remove-6FIVKCJI.js.map → remove-QPSWLFI4.js.map} +1 -1
  249. package/dist/{reopen-YM5LNOLB.js → reopen-GQ66NMWF.js} +4 -3
  250. package/dist/{reopen-YM5LNOLB.js.map → reopen-GQ66NMWF.js.map} +1 -1
  251. package/dist/{rerun-WYDRHIUJ.js → rerun-PZK275DY.js} +18 -17
  252. package/dist/{rerun-WYDRHIUJ.js.map → rerun-PZK275DY.js.map} +1 -1
  253. package/dist/{research-2BLEISBG.js → research-FMM6AWZC.js} +10 -10
  254. package/dist/{research-YOGE7GT2.js → research-GEOCUBXB.js} +3 -2
  255. package/dist/{research-YOGE7GT2.js.map → research-GEOCUBXB.js.map} +1 -1
  256. package/dist/{reset-C4UHQ3EU.js → reset-REXJ6AUK.js} +3 -2
  257. package/dist/{reset-C4UHQ3EU.js.map → reset-REXJ6AUK.js.map} +1 -1
  258. package/dist/{reset-OLVB6AE6.js → reset-Y72IVESB.js} +3 -2
  259. package/dist/{reset-OLVB6AE6.js.map → reset-Y72IVESB.js.map} +1 -1
  260. package/dist/{resolve-XYH2GDAE.js → resolve-OGX7C4TV.js} +4 -3
  261. package/dist/{resolve-XYH2GDAE.js.map → resolve-OGX7C4TV.js.map} +1 -1
  262. package/dist/{retry-7EELDEQP.js → retry-CD6JAQ3F.js} +3 -2
  263. package/dist/{retry-7EELDEQP.js.map → retry-CD6JAQ3F.js.map} +1 -1
  264. package/dist/{retry-726GKI6V.js → retry-TCUBBFR5.js} +3 -2
  265. package/dist/{retry-726GKI6V.js.map → retry-TCUBBFR5.js.map} +1 -1
  266. package/dist/{run-P4KR2MXC.js → run-A5ZDXTOI.js} +4 -3
  267. package/dist/{run-P4KR2MXC.js.map → run-A5ZDXTOI.js.map} +1 -1
  268. package/dist/{run-MODGUNGT.js → run-EUO34T2J.js} +18 -17
  269. package/dist/{scaffold-ad-5ZE7KE62.js → scaffold-ad-SW2HEWM3.js} +13 -12
  270. package/dist/{scaffold-ad-5ZE7KE62.js.map → scaffold-ad-SW2HEWM3.js.map} +1 -1
  271. package/dist/{scaffold-static-ad-HJY5HFDL.js → scaffold-static-ad-ECTJL54Y.js} +37 -36
  272. package/dist/scaffold-static-ad-ECTJL54Y.js.map +1 -0
  273. package/dist/{scaffold-video-P2PYPWG2.js → scaffold-video-EI7U7RBK.js} +12 -11
  274. package/dist/{scaffold-video-P2PYPWG2.js.map → scaffold-video-EI7U7RBK.js.map} +1 -1
  275. package/dist/{schedule-RDK4GEPI.js → schedule-S5YZJZ5U.js} +3 -2
  276. package/dist/{schedule-RDK4GEPI.js.map → schedule-S5YZJZ5U.js.map} +1 -1
  277. package/dist/{scheduled-agents-6U44QE76.js → scheduled-agents-N4LJRM4C.js} +11 -11
  278. package/dist/{schema-CHJDC7GQ.js → schema-R7JWWOF4.js} +8 -4
  279. package/dist/{schema-CHJDC7GQ.js.map → schema-R7JWWOF4.js.map} +1 -1
  280. package/dist/{search-PMJRU3C4.js → search-KHMQH3AT.js} +3 -2
  281. package/dist/{search-PMJRU3C4.js.map → search-KHMQH3AT.js.map} +1 -1
  282. package/dist/{select-AB2L4GAA.js → select-O2FN2JEQ.js} +9 -8
  283. package/dist/{select-AB2L4GAA.js.map → select-O2FN2JEQ.js.map} +1 -1
  284. package/dist/{sends-WGJVQUMF.js → sends-BQZM5PLS.js} +5 -4
  285. package/dist/{sends-WGJVQUMF.js.map → sends-BQZM5PLS.js.map} +1 -1
  286. package/dist/{set-prompt-DU2G2WTB.js → set-prompt-2HASHGWC.js} +9 -8
  287. package/dist/{set-prompt-DU2G2WTB.js.map → set-prompt-2HASHGWC.js.map} +1 -1
  288. package/dist/{setup-links-REPREN3C.js → setup-links-GYSE56GX.js} +4 -3
  289. package/dist/{setup-links-REPREN3C.js.map → setup-links-GYSE56GX.js.map} +1 -1
  290. package/dist/{site-WFSWIA3S.js → site-4SKM7RKG.js} +5 -4
  291. package/dist/{site-WFSWIA3S.js.map → site-4SKM7RKG.js.map} +1 -1
  292. package/dist/{sources-YBQ6KPFM.js → sources-FQ2UZTHL.js} +6 -6
  293. package/dist/{sources-AMI2AWKZ.js → sources-R2NKNC6J.js} +10 -9
  294. package/dist/{sources-AMI2AWKZ.js.map → sources-R2NKNC6J.js.map} +1 -1
  295. package/dist/{stale-6MJHVEG4.js → stale-W756ACKC.js} +8 -7
  296. package/dist/{stale-6MJHVEG4.js.map → stale-W756ACKC.js.map} +1 -1
  297. package/dist/{status-7F2KHFGA.js → status-SE2VZJJB.js} +4 -3
  298. package/dist/{status-7F2KHFGA.js.map → status-SE2VZJJB.js.map} +1 -1
  299. package/dist/{stock-2YCDN3N6.js → stock-KXJ26BY4.js} +5 -5
  300. package/dist/{studio-RA7QQH4O.js → studio-SYKOSNDB.js} +1 -1
  301. package/dist/{sync-GWTLKZTU.js → sync-LJGSODK3.js} +3 -2
  302. package/dist/{sync-GWTLKZTU.js.map → sync-LJGSODK3.js.map} +1 -1
  303. package/dist/{sync-definition-IPUFS5XS.js → sync-definition-QR2N233R.js} +12 -11
  304. package/dist/{tags-KFYLZLB3.js → tags-4BAVFH4S.js} +3 -2
  305. package/dist/{tags-KFYLZLB3.js.map → tags-4BAVFH4S.js.map} +1 -1
  306. package/dist/{tags-ABHSX6M5.js → tags-5SBMRC2A.js} +4 -3
  307. package/dist/{tags-ABHSX6M5.js.map → tags-5SBMRC2A.js.map} +1 -1
  308. package/dist/{tags-3WPW6PTV.js → tags-PYWFSBTR.js} +4 -4
  309. package/dist/{tags-6342FQEB.js → tags-QQU3OKMZ.js} +4 -3
  310. package/dist/{tags-6342FQEB.js.map → tags-QQU3OKMZ.js.map} +1 -1
  311. package/dist/{tags-FJIBBBRG.js → tags-YYLNF3PK.js} +4 -3
  312. package/dist/{tags-FJIBBBRG.js.map → tags-YYLNF3PK.js.map} +1 -1
  313. package/dist/{targeting-criteria-NR47AF5C.js → targeting-criteria-RJFLFICN.js} +3 -3
  314. package/dist/{targets-L56KOVQE.js → targets-S2MT2PNB.js} +4 -3
  315. package/dist/{targets-L56KOVQE.js.map → targets-S2MT2PNB.js.map} +1 -1
  316. package/dist/{templates-B6XGDYUF.js → templates-ZE5TOGRT.js} +4 -3
  317. package/dist/{templates-B6XGDYUF.js.map → templates-ZE5TOGRT.js.map} +1 -1
  318. package/dist/{testimonials-CVC4YIXO.js → testimonials-DII5DYLR.js} +6 -6
  319. package/dist/{top-companies-45X3DT7Z.js → top-companies-PGIAEHDF.js} +4 -3
  320. package/dist/{top-companies-45X3DT7Z.js.map → top-companies-PGIAEHDF.js.map} +1 -1
  321. package/dist/{translate-Z66FDB4K.js → translate-GXTS633J.js} +12 -11
  322. package/dist/{translate-Z66FDB4K.js.map → translate-GXTS633J.js.map} +1 -1
  323. package/dist/{triggers-22EMIVFD.js → triggers-2PTONXRU.js} +4 -3
  324. package/dist/{triggers-22EMIVFD.js.map → triggers-2PTONXRU.js.map} +1 -1
  325. package/dist/{unlink-65KUN6ID.js → unlink-XRMYJ6DB.js} +4 -3
  326. package/dist/{unlink-65KUN6ID.js.map → unlink-XRMYJ6DB.js.map} +1 -1
  327. package/dist/{unstage-2E3I5SWF.js → unstage-FY7A3YFF.js} +4 -3
  328. package/dist/{unstage-2E3I5SWF.js.map → unstage-FY7A3YFF.js.map} +1 -1
  329. package/dist/{unstage-4ZEULXEQ.js → unstage-RM2RLXKD.js} +5 -4
  330. package/dist/{unstage-4ZEULXEQ.js.map → unstage-RM2RLXKD.js.map} +1 -1
  331. package/dist/{update-KREBPGBH.js → update-E5SRBXQR.js} +4 -3
  332. package/dist/{update-KREBPGBH.js.map → update-E5SRBXQR.js.map} +1 -1
  333. package/dist/{update-D6DJC6T7.js → update-PJ67D2OG.js} +3 -2
  334. package/dist/{update-D6DJC6T7.js.map → update-PJ67D2OG.js.map} +1 -1
  335. package/dist/{update-2S7CSEAW.js → update-S4562V3O.js} +4 -3
  336. package/dist/{update-2S7CSEAW.js.map → update-S4562V3O.js.map} +1 -1
  337. package/dist/{update-7NCOTAQZ.js → update-V6YVEUI2.js} +4 -3
  338. package/dist/{update-7NCOTAQZ.js.map → update-V6YVEUI2.js.map} +1 -1
  339. package/dist/{upload-O6NHRPS7.js → upload-R6CQVLKF.js} +4 -3
  340. package/dist/{upload-O6NHRPS7.js.map → upload-R6CQVLKF.js.map} +1 -1
  341. package/dist/{url-options-GGXAL3J4.js → url-options-JOKU46F2.js} +4 -3
  342. package/dist/{url-options-GGXAL3J4.js.map → url-options-JOKU46F2.js.map} +1 -1
  343. package/dist/{url-params-3EFGVTZZ.js → url-params-7U2XMOWF.js} +4 -3
  344. package/dist/{url-params-3EFGVTZZ.js.map → url-params-7U2XMOWF.js.map} +1 -1
  345. package/dist/{validate-UMHHNTVU.js → validate-7YPOUKPB.js} +10 -9
  346. package/dist/{validate-UMHHNTVU.js.map → validate-7YPOUKPB.js.map} +1 -1
  347. package/dist/{videos-YSXYGTBM.js → videos-LICG6ACJ.js} +5 -5
  348. package/dist/{web-IGIGVEKS.js → web-BA2PGTWU.js} +4 -3
  349. package/dist/{web-IGIGVEKS.js.map → web-BA2PGTWU.js.map} +1 -1
  350. package/dist/{winning-ads-2WS7FI4E.js → winning-ads-C6S2C5VP.js} +2 -2
  351. package/dist/{write-commands-5C7FUOVN.js → write-commands-7SJ3BOW5.js} +5 -4
  352. package/dist/{write-commands-5C7FUOVN.js.map → write-commands-7SJ3BOW5.js.map} +1 -1
  353. package/dist/{x-BFSKFCZD.js → x-CZHRC6U7.js} +6 -6
  354. package/package.json +1 -1
  355. package/dist/add-5GAN6CVO.js.map +0 -1
  356. package/dist/analytics-FKCXIMPO.js.map +0 -1
  357. package/dist/chunk-DWHIOO7E.js.map +0 -1
  358. package/dist/chunk-EDLZGTGN.js.map +0 -1
  359. package/dist/chunk-GKZ2WU75.js.map +0 -1
  360. package/dist/chunk-SSJK7FEV.js.map +0 -1
  361. package/dist/chunk-T2PC5AVH.js.map +0 -1
  362. package/dist/chunk-XF4JUKVF.js.map +0 -1
  363. package/dist/chunk-YRQYA2LR.js.map +0 -1
  364. package/dist/flows-KABCBS3S.js.map +0 -1
  365. package/dist/funnel-AAX27NH4.js.map +0 -1
  366. package/dist/get-QEYJRLV3.js.map +0 -1
  367. package/dist/scaffold-static-ad-HJY5HFDL.js.map +0 -1
  368. /package/dist/{actions-P35MEMGN.js.map → actions-6TQMSVWD.js.map} +0 -0
  369. /package/dist/{ads-73PGA4YC.js.map → ads-AGYCVD62.js.map} +0 -0
  370. /package/dist/{avatars-EKCKHCC3.js.map → avatars-467OSBD6.js.map} +0 -0
  371. /package/dist/{brand-C6PFGGQN.js.map → brand-YRTEPGBK.js.map} +0 -0
  372. /package/dist/{campaigns-KZYZTXDS.js.map → campaigns-OYMXDGWX.js.map} +0 -0
  373. /package/dist/{canvas-UJNSHD3B.js.map → canvas-YQFG52IG.js.map} +0 -0
  374. /package/dist/{catalog-ZQX6BGXS.js.map → catalog-XLXIM7IW.js.map} +0 -0
  375. /package/dist/{chunk-7YCRFMXF.js.map → chunk-24EB7EDR.js.map} +0 -0
  376. /package/dist/{chunk-5ZDLTE5T.js.map → chunk-2AOE2MZQ.js.map} +0 -0
  377. /package/dist/{chunk-4SG4RW2P.js.map → chunk-2VPBIT65.js.map} +0 -0
  378. /package/dist/{chunk-NPY4QUMQ.js.map → chunk-54C6YDGJ.js.map} +0 -0
  379. /package/dist/{chunk-LZ73CZGP.js.map → chunk-5WCSKQ7Z.js.map} +0 -0
  380. /package/dist/{chunk-3G3ZDLMI.js.map → chunk-5ZNTADVR.js.map} +0 -0
  381. /package/dist/{chunk-AEOSAVVL.js.map → chunk-6F7DVPOS.js.map} +0 -0
  382. /package/dist/{chunk-CJCVIEJ5.js.map → chunk-6NY2GPR4.js.map} +0 -0
  383. /package/dist/{chunk-CXWFX2AM.js.map → chunk-6Y7ZBENQ.js.map} +0 -0
  384. /package/dist/{chunk-M242LHLX.js.map → chunk-7CTMH5AK.js.map} +0 -0
  385. /package/dist/{chunk-QD7ESRLN.js.map → chunk-C46GUI2S.js.map} +0 -0
  386. /package/dist/{chunk-6N6WKAJM.js.map → chunk-CWYAELVG.js.map} +0 -0
  387. /package/dist/{chunk-MXYBTMKB.js.map → chunk-DCRPXOJJ.js.map} +0 -0
  388. /package/dist/{chunk-JQJDXPCO.js.map → chunk-FUHN4MFY.js.map} +0 -0
  389. /package/dist/{chunk-S77PZVYM.js.map → chunk-FYGR3I2A.js.map} +0 -0
  390. /package/dist/{chunk-OZRUJVIQ.js.map → chunk-H3427GPU.js.map} +0 -0
  391. /package/dist/{chunk-IR6D7K4H.js.map → chunk-I3ZR655O.js.map} +0 -0
  392. /package/dist/{chunk-YK32GUBN.js.map → chunk-KMKEYI37.js.map} +0 -0
  393. /package/dist/{chunk-W3ZHJJVT.js.map → chunk-KS2QY6MK.js.map} +0 -0
  394. /package/dist/{chunk-WNRV4QH7.js.map → chunk-LYQJ4PZW.js.map} +0 -0
  395. /package/dist/{chunk-CSYSX4D2.js.map → chunk-N4LAYIIN.js.map} +0 -0
  396. /package/dist/{chunk-4AUMTNVB.js.map → chunk-NA63BH7V.js.map} +0 -0
  397. /package/dist/{chunk-4BQXAE7Z.js.map → chunk-NDEE6G2J.js.map} +0 -0
  398. /package/dist/{chunk-MELOSESI.js.map → chunk-R25YLW6H.js.map} +0 -0
  399. /package/dist/{chunk-Y6O7EWYY.js.map → chunk-RL5CP7N6.js.map} +0 -0
  400. /package/dist/{chunk-DGUNI37S.js.map → chunk-RX2DKU3W.js.map} +0 -0
  401. /package/dist/{chunk-VTDMKARH.js.map → chunk-ULG4QRTV.js.map} +0 -0
  402. /package/dist/{chunk-QRP3PXWN.js.map → chunk-VL43TNIP.js.map} +0 -0
  403. /package/dist/{chunk-SHL7LOC3.js.map → chunk-VLMBTPXU.js.map} +0 -0
  404. /package/dist/{chunk-KHRXPQID.js.map → chunk-VYQ3QJ3C.js.map} +0 -0
  405. /package/dist/{chunk-A4LOJ2VD.js.map → chunk-WGUQHAJY.js.map} +0 -0
  406. /package/dist/{chunk-ZEYEWPK6.js.map → chunk-WKQG6TER.js.map} +0 -0
  407. /package/dist/{chunk-3IBYKLXR.js.map → chunk-ZDMTXQ2Q.js.map} +0 -0
  408. /package/dist/{connect-QCOGEPP4.js.map → connect-FCXNVTXG.js.map} +0 -0
  409. /package/dist/{creatives-NJF2U763.js.map → creatives-FXUQ5WSD.js.map} +0 -0
  410. /package/dist/{customers-A36LOZOB.js.map → customers-XH2DMTFH.js.map} +0 -0
  411. /package/dist/{feedback-PPQMOQ46.js.map → feedback-EIZKS4JU.js.map} +0 -0
  412. /package/dist/{find-OTDIX6V4.js.map → find-FRRHAPWX.js.map} +0 -0
  413. /package/dist/{fonts-EMMX3KII.js.map → fonts-MXR3ZKDX.js.map} +0 -0
  414. /package/dist/{ga4-UDQ2HA2J.js.map → ga4-DV2AXCSL.js.map} +0 -0
  415. /package/dist/{google-M7KEXVK5.js.map → google-6OGZX47I.js.map} +0 -0
  416. /package/dist/{google-KTO3PLEU.js.map → google-QYYYSSXI.js.map} +0 -0
  417. /package/dist/{gsc-P3QYGDV2.js.map → gsc-TAKOF7J5.js.map} +0 -0
  418. /package/dist/{icon-I43F77FV.js.map → icon-L4RSS6PZ.js.map} +0 -0
  419. /package/dist/{ideas-MIDU7YOA.js.map → ideas-NFOW3HKJ.js.map} +0 -0
  420. /package/dist/{images-S254MS6O.js.map → images-2EFFUNNV.js.map} +0 -0
  421. /package/dist/{ingest-YV2NLDBE.js.map → ingest-2EIKN4QC.js.map} +0 -0
  422. /package/dist/{inspiration-P265QJ2H.js.map → inspiration-S3DU4CMQ.js.map} +0 -0
  423. /package/dist/{landing-CJYGWCK4.js.map → landing-2ZB46LXH.js.map} +0 -0
  424. /package/dist/{line-items-7ZGIKEF2.js.map → line-items-5NECXUZT.js.map} +0 -0
  425. /package/dist/{logo-2IP663QO.js.map → logo-Q5D7PZY6.js.map} +0 -0
  426. /package/dist/{lookup-XK45W2SH.js.map → lookup-ETWY47F7.js.map} +0 -0
  427. /package/dist/{media-sources-O6ZRUA3N.js.map → media-sources-ZXHEEP6T.js.map} +0 -0
  428. /package/dist/{performance-6QW2KEEQ.js.map → performance-UF5VTY2U.js.map} +0 -0
  429. /package/dist/{promoted-tweets-SURKMHFI.js.map → promoted-tweets-LZKS5JIF.js.map} +0 -0
  430. /package/dist/{reddit-GIP3ADMS.js.map → reddit-NU2N3LZD.js.map} +0 -0
  431. /package/dist/{research-2BLEISBG.js.map → research-FMM6AWZC.js.map} +0 -0
  432. /package/dist/{run-MODGUNGT.js.map → run-EUO34T2J.js.map} +0 -0
  433. /package/dist/{scheduled-agents-6U44QE76.js.map → scheduled-agents-N4LJRM4C.js.map} +0 -0
  434. /package/dist/{sources-YBQ6KPFM.js.map → sources-FQ2UZTHL.js.map} +0 -0
  435. /package/dist/{stock-2YCDN3N6.js.map → stock-KXJ26BY4.js.map} +0 -0
  436. /package/dist/{studio-RA7QQH4O.js.map → studio-SYKOSNDB.js.map} +0 -0
  437. /package/dist/{sync-definition-IPUFS5XS.js.map → sync-definition-QR2N233R.js.map} +0 -0
  438. /package/dist/{tags-3WPW6PTV.js.map → tags-PYWFSBTR.js.map} +0 -0
  439. /package/dist/{targeting-criteria-NR47AF5C.js.map → targeting-criteria-RJFLFICN.js.map} +0 -0
  440. /package/dist/{testimonials-CVC4YIXO.js.map → testimonials-DII5DYLR.js.map} +0 -0
  441. /package/dist/{videos-YSXYGTBM.js.map → videos-LICG6ACJ.js.map} +0 -0
  442. /package/dist/{winning-ads-2WS7FI4E.js.map → winning-ads-C6S2C5VP.js.map} +0 -0
  443. /package/dist/{x-BFSKFCZD.js.map → x-CZHRC6U7.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/flows/connect.ts"],"sourcesContent":["/**\n * `connect`: fill a Form's step or destination yourself once you know which\n * resource is meant, instead of parking the turn on the chat's picker card.\n *\n * Three sources, one write:\n * - `--hubspot-form <id>` — a HubSpot form as a `hubspotForm` destination.\n * - `--resource <id>` / `--new-sheet <title>` / nothing — Calendly, SavvyCal\n * and GoHighLevel steps; Google Sheets, Pipedrive and GoHighLevel\n * destinations. The backend reads the resource through the company's\n * connected account and answers with exactly what the card would write,\n * sealed under the flow key where it is a destination — so this command\n * writes ciphertext it cannot read.\n * - `--same-as <slug>:<id>` — the destination or step another Form already\n * has, copied as-is. No platform is asked anything.\n *\n * `request_flow_input` stays the path when nothing is connected, when a\n * spreadsheet has never been chosen, or when the agent cannot tell which\n * resource is meant.\n */\n\nimport {\n FLOW_AGENT_DESTINATION_KINDS,\n FLOW_PROVIDER_TYPE,\n type FlowAgentDestinationKind,\n type FlowsResolveResponse,\n type HubspotFormsDestinationResponse,\n} from \"@baker/api\";\nimport { defineCommand } from \"citty\";\nimport { ApiError, apiPost } from \"../../client.ts\";\nimport { writeJson } from \"../../output.ts\";\nimport { registerSchema } from \"../../schemas.ts\";\nimport { failApi } from \"../actions/shared.ts\";\nimport { hubspotRefusal } from \"../hubspot/refusal.ts\";\nimport { collectSideEffects, readFlowTree, walkNodes, writeFlowTree } from \"./shared.ts\";\n\ntype AnyRecord = Record<string, unknown>;\n\ntype Sealed = { oauthProviderId: string; encryptedConfig: string };\n\ntype Attached = { ok: true; nodeId: string; sideEffectId: string } | { ok: false; message: string; fix: string };\n\ntype Stepped = { ok: true; nodeId: string; type: string } | { ok: false; message: string; fix: string };\n\nconst STEP_KINDS = new Set([\"calendly\", \"savvycal\", \"highlevel\", \"highlevelForm\", \"hubspot\", \"hubspotMeeting\"]);\nconst OAUTH_SIDE_EFFECTS = new Set([\"hubspotForm\", \"googleSpreadsheet\", \"pipedrive\", \"goHighlevelContact\"]);\n\n/**\n * Put the sealed destination on the side effect `named` picks — or, with no\n * name, on the form's only one of `type`. Mutates `tree`; the caller writes it.\n */\nexport function attachDestination(\n tree: AnyRecord,\n named: string | undefined,\n sealed: Sealed,\n type = \"hubspotForm\",\n): Attached {\n const ofType = collectSideEffects(tree).filter((entry) => entry.sideEffect.type === type);\n const inventory = ofType.map((entry) => String(entry.sideEffect.id)).join(\", \") || \"none\";\n const chosen = named\n ? collectSideEffects(tree).find((entry) => entry.sideEffect.id === named)\n : ofType.length === 1\n ? ofType[0]\n : undefined;\n if (!chosen) {\n return {\n ok: false,\n message: named\n ? `No side effect with id \"${named}\" in this form.`\n : `This form has ${ofType.length} ${type} side effects — name one with --side-effect <id>.`,\n fix:\n ofType.length === 0\n ? `Add one first: baker flows add-side-effect <slug> --node <stepId> --type ${type}`\n : `${type} side effects in this form: ${inventory}`,\n };\n }\n if (chosen.sideEffect.type !== type) {\n return {\n ok: false,\n message: `Side effect \"${named}\" is a ${String(chosen.sideEffect.type)}, not a ${type}.`,\n fix: `${type} side effects in this form: ${inventory}`,\n };\n }\n chosen.sideEffect.oauthProviderId = sealed.oauthProviderId;\n chosen.sideEffect.encryptedConfig = sealed.encryptedConfig;\n return { ok: true, nodeId: String(chosen.node.id), sideEffectId: String(chosen.sideEffect.id) };\n}\n\nfunction isSet(value: unknown): boolean {\n return typeof value === \"string\" && value.length > 0;\n}\n\n/**\n * Every side effect of `type` that still lacks its account or its config — what\n * `--all` wires. One already wired is left alone, so re-running after a partial\n * setup never repoints a destination someone chose.\n */\nexport function unwiredSideEffects(tree: AnyRecord, type: string): string[] {\n return collectSideEffects(tree)\n .filter(({ sideEffect }) => sideEffect.type === type)\n .filter(({ sideEffect }) => !isSet(sideEffect.oauthProviderId) || !isSet(sideEffect.encryptedConfig))\n .map(({ sideEffect }) => String(sideEffect.id));\n}\n\nexport function unwiredHubspotForms(tree: AnyRecord): string[] {\n return unwiredSideEffects(tree, \"hubspotForm\");\n}\n\nfunction stepType(node: AnyRecord | undefined): string | undefined {\n const type = (node?.nodeData as AnyRecord | undefined)?.type;\n return typeof type === \"string\" ? type : undefined;\n}\n\nfunction findStep(tree: AnyRecord, nodeId: string): AnyRecord | undefined {\n return walkNodes(tree).find((node) => node.id === nodeId);\n}\n\n/** Write a picked resource into a step's `form.external`, keeping what the step autofills. */\nexport function attachStep(tree: AnyRecord, nodeId: string, external: AnyRecord): Stepped {\n const node = findStep(tree, nodeId);\n const type = stepType(node);\n if (!node || !type) {\n return {\n ok: false,\n message: `No step with id \"${nodeId}\" in this form.`,\n fix: \"Step ids: baker flows show <slug>\",\n };\n }\n if (!STEP_KINDS.has(type)) {\n return {\n ok: false,\n message: `Step \"${nodeId}\" is a ${type}, which embeds nothing from another platform.`,\n fix: \"Only calendly, savvycal, highlevel, highlevelForm, hubspot and hubspotMeeting steps take a resource.\",\n };\n }\n const nodeData = node.nodeData as AnyRecord;\n const form = (nodeData.form as AnyRecord | undefined) ?? {};\n nodeData.form = { autofilledFields: {}, ...form, external };\n return { ok: true, nodeId, type };\n}\n\n/** Steps of `type` with nothing picked yet — what `--all` fills for a step kind. */\nexport function unpickedSteps(tree: AnyRecord, type: string): string[] {\n return walkNodes(tree)\n .filter((node) => stepType(node) === type)\n .filter((node) => ((node.nodeData as AnyRecord).form as AnyRecord | undefined)?.external == null)\n .map((node) => String(node.id));\n}\n\n/**\n * Give `targetId` exactly the destination (or picked resource) `sourceId`\n * already has in another Form. Only between the same type: a sheet's sealed\n * config means nothing to Pipedrive.\n */\nexport function copyDestination(source: AnyRecord, sourceId: string, target: AnyRecord, targetId: string): Stepped {\n const from = collectSideEffects(source).find((entry) => entry.sideEffect.id === sourceId);\n if (from) {\n const type = String(from.sideEffect.type);\n if (!isSet(from.sideEffect.oauthProviderId) || !isSet(from.sideEffect.encryptedConfig)) {\n return {\n ok: false,\n message: `\"${sourceId}\" is not wired itself — nothing to copy.`,\n fix: \"Copy from one that is.\",\n };\n }\n const attached = attachDestination(\n target,\n targetId,\n {\n oauthProviderId: String(from.sideEffect.oauthProviderId),\n encryptedConfig: String(from.sideEffect.encryptedConfig),\n },\n type,\n );\n return attached.ok ? { ok: true, nodeId: attached.nodeId, type } : attached;\n }\n const step = findStep(source, sourceId);\n const external = ((step?.nodeData as AnyRecord | undefined)?.form as AnyRecord | undefined)?.external;\n if (!step || external == null || typeof external !== \"object\") {\n return {\n ok: false,\n message: `No wired side effect or picked step \"${sourceId}\" in the source form.`,\n fix: \"Ids: baker flows show <slug>\",\n };\n }\n const targetType = stepType(findStep(target, targetId));\n if (targetType !== stepType(step)) {\n return {\n ok: false,\n message: `\"${sourceId}\" is a ${String(stepType(step))} and \"${targetId}\" a ${String(targetType)} — copy only between the same type.`,\n fix: \"Pick a source of the same type.\",\n };\n }\n return attachStep(target, targetId, structuredClone(external as AnyRecord));\n}\n\nfunction refuse(\n message: string,\n fix: string | { action: string; explanation: string },\n code = \"VALIDATION_ERROR\",\n): never {\n writeJson({ ok: false, error: { code, message, fix } });\n process.exit(1);\n}\n\ntype Target = { kind: string; on: \"node\" | \"sideEffect\"; ids: string[] };\n\nfunction allTargets(tree: AnyRecord, kind: string | undefined): Target {\n if (!kind) refuse(\"--all needs --type <kind> to know what to wire.\", \"e.g. --all --type googleSpreadsheet\");\n const on = STEP_KINDS.has(kind) ? \"node\" : \"sideEffect\";\n const ids = on === \"node\" ? unpickedSteps(tree, kind) : unwiredSideEffects(tree, kind);\n if (ids.length === 0) {\n refuse(\n `Every ${kind} in this Form is already wired.`,\n \"Repoint one by naming it with --node / --side-effect instead of --all.\",\n );\n }\n return { kind, on, ids };\n}\n\nfunction onlyOfType(tree: AnyRecord, type: string): string {\n const probe = attachDestination(tree, undefined, { oauthProviderId: \"\", encryptedConfig: \"\" }, type);\n if (!probe.ok) refuse(probe.message, probe.fix);\n return probe.sideEffectId;\n}\n\nfunction stepTarget(tree: AnyRecord, node: string): Target {\n const type = stepType(findStep(tree, node));\n if (!type) refuse(`No step with id \"${node}\" in this form.`, \"Step ids: baker flows show <slug>\");\n return { kind: type, on: \"node\", ids: [node] };\n}\n\nfunction sideEffectTarget(tree: AnyRecord, named: string): Target {\n const found = collectSideEffects(tree).find((entry) => entry.sideEffect.id === named);\n if (!found) refuse(`No side effect with id \"${named}\" in this form.`, \"Side-effect ids: baker flows show <slug>\");\n return { kind: String(found.sideEffect.type), on: \"sideEffect\", ids: [named] };\n}\n\n/** Which steps or side effects this call fills, resolved before any platform is asked anything. */\nexport function targetsFor(tree: AnyRecord, args: AnyRecord): Target {\n const node = typeof args.node === \"string\" ? args.node : undefined;\n const named = typeof args[\"side-effect\"] === \"string\" ? args[\"side-effect\"] : undefined;\n if ([node, named, args.all === true ? \"all\" : undefined].filter(Boolean).length > 1) {\n refuse(\"Pass one of --node, --side-effect or --all.\", \"One target per call; --all for every unwired one.\");\n }\n if (args.all === true) {\n const kind = typeof args.type === \"string\" ? args.type : args[\"hubspot-form\"] ? \"hubspotForm\" : undefined;\n return allTargets(tree, kind);\n }\n if (node) return stepTarget(tree, node);\n if (named) return sideEffectTarget(tree, named);\n if (args[\"hubspot-form\"]) return { kind: \"hubspotForm\", on: \"sideEffect\", ids: [onlyOfType(tree, \"hubspotForm\")] };\n return refuse(\n \"Name what to fill: --node <stepId>, --side-effect <id>, or --all --type <kind>.\",\n \"Ids: baker flows show <slug>\",\n );\n}\n\nasync function sealHubspotForm(formId: string): Promise<HubspotFormsDestinationResponse[\"data\"]> {\n try {\n return (await apiPost<HubspotFormsDestinationResponse>(\"/api/hubspot/forms/destination\", { formId })).data;\n } catch (err) {\n const refusal = err instanceof ApiError ? hubspotRefusal(err.code, err.message) : null;\n if (err instanceof ApiError && refusal !== null) refuse(err.message, refusal.fix, refusal.code);\n failApi(err);\n }\n}\n\nfunction isAgentKind(kind: string): kind is FlowAgentDestinationKind {\n return (FLOW_AGENT_DESTINATION_KINDS as readonly string[]).includes(kind);\n}\n\n/**\n * The refusals only the user can clear, as the call that clears them: nothing\n * connected is the connect card; two accounts is a question only when the\n * agent cannot tell which one the user means.\n */\nexport function destinationRefusal(\n kind: FlowAgentDestinationKind,\n err: ApiError,\n): { code: string; fix: string } | null {\n if (err.code === \"NOT_FOUND\" && err.message.includes(\"is connected to this company\")) {\n return {\n code: \"NOT_CONNECTED\",\n fix: `AGENT INSTRUCTION: only the user can connect it. Call request_connection with { platform: \"${FLOW_PROVIDER_TYPE[kind]}\", reason } — reason in their words — then run this again. Keep going with the rest of the task meanwhile.`,\n };\n }\n if (err.code === \"CONFLICT\" && err.message.includes(\"--account\")) {\n return {\n code: \"SEVERAL_ACCOUNTS\",\n fix: \"Pass --account <id> when the user or the brief makes clear which one; otherwise ask them which (AskUserQuestion), naming the accounts above.\",\n };\n }\n return null;\n}\n\nfunction resolveBody(kind: FlowAgentDestinationKind, args: AnyRecord): AnyRecord {\n const columns =\n typeof args.columns === \"string\"\n ? args.columns\n .split(\",\")\n .map((column) => column.trim())\n .filter(Boolean)\n : undefined;\n return {\n kind,\n ...(typeof args.account === \"string\" ? { account: args.account } : {}),\n ...(typeof args.resource === \"string\" ? { resourceId: args.resource } : {}),\n ...(typeof args.tab === \"string\" ? { tab: args.tab } : {}),\n ...(typeof args[\"new-sheet\"] === \"string\" ? { newSheet: { title: args[\"new-sheet\"], columns } } : {}),\n };\n}\n\nasync function resolveDestination(\n kind: FlowAgentDestinationKind,\n args: AnyRecord,\n): Promise<FlowsResolveResponse[\"data\"]> {\n try {\n return (await apiPost<FlowsResolveResponse>(\"/api/flows/destinations/resolve\", resolveBody(kind, args))).data;\n } catch (err) {\n const refusal = err instanceof ApiError ? destinationRefusal(kind, err) : null;\n if (err instanceof ApiError && refusal !== null) refuse(err.message, refusal.fix, refusal.code);\n failApi(err);\n }\n}\n\ntype Wired = { wired: { nodeId: string; sideEffectId?: string }[]; destination: unknown; hints: string[] };\n\nfunction applyAll(target: Target, apply: (id: string) => Stepped | Attached): Wired[\"wired\"] {\n return target.ids.map((id) => {\n const done = apply(id);\n if (!done.ok) refuse(done.message, done.fix);\n return \"sideEffectId\" in done ? { nodeId: done.nodeId, sideEffectId: done.sideEffectId } : { nodeId: done.nodeId };\n });\n}\n\nfunction sameAs(tree: AnyRecord, target: Target, ref: string): Wired {\n const [slug, id] = ref.split(\":\");\n if (!slug || !id) refuse(`--same-as takes <slug>:<id>, got \"${ref}\".`, \"e.g. --same-as madrid:se-gsheet-1\");\n const source = readFlowTree(slug);\n const wired = applyAll(target, (targetId) => copyDestination(source, id, tree, targetId));\n return { wired, destination: { sameAs: ref }, hints: [] };\n}\n\nasync function fromHubspot(tree: AnyRecord, target: Target, formId: string, slug: string): Promise<Wired> {\n if (target.kind !== \"hubspotForm\") {\n refuse(\n `--hubspot-form wires a hubspotForm side effect, not a ${target.kind}.`,\n \"A HubSpot step takes `baker hubspot forms view <id> --as-node` (or `meetings view <slug> --as-node`).\",\n );\n }\n const sealed = await sealHubspotForm(formId);\n const wired = applyAll(target, (id) => attachDestination(tree, id, sealed));\n return {\n wired,\n destination: { formGuid: sealed.formGuid, formName: sealed.formName, portalId: sealed.portalId },\n hints: [\n `Now map each step's answers onto it: baker flows map ${slug} --side-effect <id> --hubspot-form ${sealed.formGuid} --map email=<value> … --write. Field names come from \\`baker hubspot forms view ${sealed.formGuid}\\`.`,\n ],\n };\n}\n\nfunction sheetHints(slug: string, data: Extract<FlowsResolveResponse[\"data\"], { target: \"sideEffect\" }>): string[] {\n const sheet = data.destination;\n if (!sheet)\n return [`Now map the fields: baker flows map ${slug} --side-effect <id> --map <fieldKey>=<value> … --write.`];\n const columns = sheet.columns.map((column) => `${column.letter}=${column.header}`).join(\", \");\n return [\n ...(sheet.created\n ? [\n `Created \"${sheet.name}\" in the connected Google account${sheet.url ? ` (${sheet.url})` : \"\"} — tell the user where their leads will land.`,\n ]\n : []),\n columns\n ? `Columns: ${columns}. Map by letter: baker flows map ${slug} --side-effect <id> --map A=<value> … --write.`\n : `The \"${sheet.tab}\" tab has no header row. Map by letter anyway, and say which column holds what.`,\n ];\n}\n\nasync function fromPlatform(tree: AnyRecord, target: Target, args: AnyRecord, slug: string): Promise<Wired> {\n const kind = target.kind;\n if (!isAgentKind(kind)) {\n const hubspotStep = kind === \"hubspot\" || kind === \"hubspotMeeting\";\n refuse(\n `A ${kind} ${target.on === \"node\" ? \"step\" : \"side effect\"} is not something this command can fill from a platform.`,\n hubspotStep\n ? \"Write the blob from `baker hubspot forms view <id> --as-node` (or `meetings view <slug> --as-node`) into the step's form.external.\"\n : OAUTH_SIDE_EFFECTS.has(kind)\n ? \"Pass --hubspot-form <formId>.\"\n : \"It takes typed credentials only the user has: request_flow_input.\",\n );\n }\n const data = await resolveDestination(kind, args);\n if (data.target === \"node\") {\n const wired = applyAll(target, (id) => attachStep(tree, id, data.external));\n return {\n wired,\n destination: { name: data.name, account: data.account },\n hints: [`Picked \"${data.name}\". Autofill its fields from earlier answers in the step's form.autofilledFields.`],\n };\n }\n const sealed = { oauthProviderId: data.oauthProviderId, encryptedConfig: data.encryptedConfig };\n const wired = applyAll(target, (id) => attachDestination(tree, id, sealed, kind));\n return {\n wired,\n destination: data.destination ? { ...data.destination, account: data.account } : { account: data.account },\n hints: sheetHints(slug, data),\n };\n}\n\nregisterSchema({\n command: \"flows.connect\",\n description:\n \"Fill a Form's step or destination yourself — no card for the user. Steps: Calendly, SavvyCal, GoHighLevel calendar/form (`--node <id> --resource <id>`). Destinations: HubSpot form (`--hubspot-form <id>`), Google Sheets (`--resource <spreadsheetId>` or `--new-sheet <title> --columns …`), Pipedrive and GoHighLevel contact (no resource: the connected account is the destination). `--same-as <slug>:<id>` copies what another Form already has. `--all --type <kind>` fills every unwired one of that kind at once. Ids come from `baker flows options <kind>`. Fall back to request_flow_input only when nothing is connected, the sheet was never chosen, or several resources plausibly match.\",\n args: {\n slug: { type: \"positional\", description: \"Form slug\", required: true },\n node: {\n type: \"string\",\n description: \"Step id to fill (calendly, savvycal, highlevel, highlevelForm)\",\n required: false,\n },\n \"side-effect\": { type: \"string\", description: \"Side-effect id to wire\", required: false },\n all: { type: \"boolean\", description: \"Every unwired one of --type in this Form\", required: false, default: false },\n type: { type: \"string\", description: \"The kind --all wires (e.g. googleSpreadsheet, calendly)\", required: false },\n resource: { type: \"string\", description: \"Option id from `baker flows options <kind>`\", required: false },\n \"hubspot-form\": {\n type: \"string\",\n description: \"HubSpot form id (from `baker hubspot forms list`)\",\n required: false,\n },\n \"new-sheet\": {\n type: \"string\",\n description: \"Create a Google spreadsheet with this title and wire it\",\n required: false,\n },\n columns: {\n type: \"string\",\n description: \"With --new-sheet: header row, comma-separated, from column A\",\n required: false,\n },\n tab: { type: \"string\", description: \"Google Sheets tab to append to (default: the first)\", required: false },\n \"same-as\": {\n type: \"string\",\n description: \"<slug>:<id> — copy another Form's wired destination or picked step\",\n required: false,\n },\n account: {\n type: \"string\",\n description: \"Connection id, when more than one account of the platform is connected\",\n required: false,\n },\n },\n});\n\nexport const connectCommand = defineCommand({\n meta: {\n name: \"connect\",\n description:\n 'Fill a step or destination yourself. Start here: baker flows options calendly, then baker flows connect contact --node book --resource <id>. Sheets: --side-effect se-gsheet-1 --new-sheet \"Leads\" --columns \"Name,Email\". Same as another Form: --same-as madrid:se-gsheet-1',\n },\n args: {\n slug: { type: \"positional\", description: \"Form slug\", required: true },\n node: { type: \"string\", description: \"Step id to fill\" },\n \"side-effect\": { type: \"string\", description: \"Side-effect id to wire\" },\n all: { type: \"boolean\", description: \"Every unwired one of --type\" },\n type: { type: \"string\", description: \"The kind --all wires\" },\n resource: { type: \"string\", description: \"Option id from baker flows options <kind>\" },\n \"hubspot-form\": { type: \"string\", description: \"HubSpot form id (from baker hubspot forms list)\" },\n \"new-sheet\": { type: \"string\", description: \"Create a spreadsheet with this title\" },\n columns: { type: \"string\", description: \"Header row for --new-sheet, comma-separated\" },\n tab: { type: \"string\", description: \"Sheet tab (default: the first)\" },\n \"same-as\": { type: \"string\", description: \"<slug>:<id> to copy\" },\n account: { type: \"string\", description: \"Connection id when several are connected\" },\n },\n run: async ({ args }) => {\n const slug = String(args.slug);\n const target = targetsFor(readFlowTree(slug), args);\n\n const tree = readFlowTree(slug);\n const result =\n typeof args[\"same-as\"] === \"string\"\n ? sameAs(tree, target, args[\"same-as\"])\n : typeof args[\"hubspot-form\"] === \"string\"\n ? await fromHubspot(tree, target, args[\"hubspot-form\"], slug)\n : await fromPlatform(tree, target, args, slug);\n writeFlowTree(slug, tree);\n\n writeJson({\n ok: true,\n data: {\n slug,\n kind: target.kind,\n [target.on === \"node\" ? \"steps\" : \"sideEffects\"]: result.wired,\n destination: result.destination,\n connected: true,\n },\n hints: [...result.hints, \"Staged like any other edit in this chat: it goes live when the chat is published.\"],\n });\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,qBAAqB;AAgB9B,IAAM,aAAa,oBAAI,IAAI,CAAC,YAAY,YAAY,aAAa,iBAAiB,WAAW,gBAAgB,CAAC;AAC9G,IAAM,qBAAqB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SAAS,EAAE,MAAM,UAAU,aAAa,8CAA8C;AAAA,IACtF,KAAK,EAAE,MAAM,UAAU,aAAa,iCAAiC;AAAA,IACrE,WAAW,EAAE,MAAM,UAAU,aAAa,sBAAsB;AAAA,IAChE,SAAS,EAAE,MAAM,UAAU,aAAa,2CAA2C;AAAA,EACrF;AAAA,EACA,KAAK,OAAO,EAAE,KAAK,MAAM;AACvB,UAAM,OAAO,OAAO,KAAK,IAAI;AAC7B,UAAM,SAAS,WAAW,aAAa,IAAI,GAAG,IAAI;AAElD,UAAM,OAAO,aAAa,IAAI;AAC9B,UAAM,SACJ,OAAO,KAAK,SAAS,MAAM,WACvB,OAAO,MAAM,QAAQ,KAAK,SAAS,CAAC,IACpC,OAAO,KAAK,cAAc,MAAM,WAC9B,MAAM,YAAY,MAAM,QAAQ,KAAK,cAAc,GAAG,IAAI,IAC1D,MAAM,aAAa,MAAM,QAAQ,MAAM,IAAI;AACnD,kBAAc,MAAM,IAAI;AAExB,cAAU;AAAA,MACR,IAAI;AAAA,MACJ,MAAM;AAAA,QACJ;AAAA,QACA,MAAM,OAAO;AAAA,QACb,CAAC,OAAO,OAAO,SAAS,UAAU,aAAa,GAAG,OAAO;AAAA,QACzD,aAAa,OAAO;AAAA,QACpB,WAAW;AAAA,MACb;AAAA,MACA,OAAO,CAAC,GAAG,OAAO,OAAO,mFAAmF;AAAA,IAC9G,CAAC;AAAA,EACH;AACF,CAAC;","names":["wired"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../api/src/identity/digest.ts","../../api/src/identity/email.ts","../../api/src/identity/phone.ts","../../api/src/identity/index.ts","../../api/src/event-ingest/matching.ts","../../api/src/event-ingest/vocabulary.ts","../../api/src/event-sources/fields.ts","../../api/src/event-sources/template.ts"],"sourcesContent":["/**\n * The one hash, and the one way to recognise one.\n *\n * Web Crypto, so the same code runs in the Convex runtime, a Worker, Node and a\n * browser — an identity digest that differs by runtime is a digest that matches\n * nothing, and nothing about that failure is visible from either end.\n */\n\n/** SHA-256 in lowercase hex. The form every ad platform documents. */\nexport async function sha256Hex(value: string): Promise<string> {\n const digest = await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(value));\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nconst SHA256_HEX = /^[0-9a-fA-F]{64}$/;\n\n/**\n * Whether a value is already a SHA-256 digest — the check that decides whether\n * a field holds plain text to normalize and hash, or a digest someone else\n * computed. Hashing a hash produces a key that matches nothing, forever, with\n * no way to tell afterwards.\n */\nexport function isSha256Hex(value: string): boolean {\n return SHA256_HEX.test(value);\n}\n\n/** The storable form of a supplied digest, or `null` if it is not one. */\nexport function normalizeSha256Hex(value: string): string | null {\n const trimmed = value.trim();\n return SHA256_HEX.test(trimmed) ? trimmed.toLowerCase() : null;\n}\n\n/**\n * The canonical form of a site's own id for a person, before it is hashed.\n *\n * Trim and lowercase, and deliberately nothing else. An `external_id` is an\n * opaque key in somebody else's system — a customer number, a CRM contact id, a\n * membership code — so there is no shape to check and no punctuation that means\n * anything. What matters is only that **both ends canonicalise it the same\n * way**: the browser hashing `Cust-4821` and the CRM hashing `cust-4821` would\n * produce two people out of one, with nothing anywhere to report it.\n *\n * Not part of the versioned normalizer beside it, on purpose. Those versions\n * exist because an address has a *correct* form that we learned late; this has\n * never had one and never will.\n */\nexport function normalizeExternalId(raw: string): string | null {\n const trimmed = raw.trim().toLowerCase();\n return trimmed === \"\" ? null : trimmed;\n}\n\n/** The digest a site's own id joins on, or `null` when there is nothing to hash. */\nexport async function externalIdDigest(raw: string): Promise<string | null> {\n const canonical = normalizeExternalId(raw);\n return canonical === null ? null : await sha256Hex(canonical);\n}\n","/**\n * Email normalization, one rule per version.\n *\n * A version is not a preference: a digest computed under v1 and stored a year\n * ago can never be recomputed, because the address that produced it was dropped\n * on purpose. So v1 is frozen at whatever the browser did on the day it ran, and\n * a better rule arrives as v2 alongside it rather than in place of it.\n */\n\n/**\n * **v1 — frozen.** Trim and lowercase, exactly what\n * the beacon's own rule (now `src/lib/tracking/identity-normalize.ts`) has always done. No shape check:\n * whatever the visitor typed was hashed, and every historical digest was\n * produced this way.\n *\n * `null` only for an empty result, which is the one case the beacon also\n * declines to report.\n */\nexport function normalizeEmailV1(raw: string): string | null {\n const trimmed = raw.trim().toLowerCase();\n return trimmed === \"\" ? null : trimmed;\n}\n\n/** No dots-as-separators, no length games: one `@`, a local part, a dotted domain. */\nconst EMAIL = /^[^\\s@]+@[^\\s@.]+(?:\\.[^\\s@.]+)+$/;\n\n/**\n * **v2.** v1 plus a shape check, so an unusable value is declined instead of\n * hashed into a key that can never match.\n */\nexport function normalizeEmailV2(raw: string): string | null {\n const trimmed = raw.trim().toLowerCase();\n return EMAIL.test(trimmed) ? trimmed : null;\n}\n\n/**\n * Google's own email canonicalization, applied on top of a normalized address:\n * for `gmail.com` and `googlemail.com`, drop the dots and any `+tag` from the\n * local part.\n *\n * `null` when there is no address left to send — a local part that was nothing\n * but a `+tag`. Google is the only platform that asks for this; Meta and\n * LinkedIn hash the address as written, which is why this is a provider step\n * and not part of the version.\n */\nexport function googleEmail(normalizedEmail: string): string | null {\n const [localPart, domain, ...extraParts] = normalizedEmail.split(\"@\");\n if (!localPart || !domain || extraParts.length > 0) return normalizedEmail;\n if (domain !== \"gmail.com\" && domain !== \"googlemail.com\") return normalizedEmail;\n const canonicalLocalPart = localPart.split(\"+\", 1)[0]?.replace(/\\./g, \"\") ?? \"\";\n return canonicalLocalPart ? `${canonicalLocalPart}@${domain}` : null;\n}\n","/**\n * Phone normalization, one rule per version, plus the shape each platform\n * hashes.\n *\n * Three copies of this used to exist — the beacon's, the funnel contract's and\n * `lib/capi.ts` — and they disagreed on the `+`. A digest of `34600111222` and a\n * digest of `+34600111222` are two unrelated keys for one person, and neither\n * end reports anything when they fail to meet.\n */\n\n/**\n * **v1 — frozen.** Digits only, with a `+` in front, exactly what\n * the beacon's own rule (now `src/lib/tracking/identity-normalize.ts`) has always done. It guesses no\n * country code and validates nothing: a national number becomes `+600111222`,\n * and that is the digest sitting in the store for every visitor who identified\n * before v2 existed.\n */\nexport function normalizePhoneV1(raw: string): string | null {\n const digits = raw\n .trim()\n .toLowerCase()\n .replace(/[^0-9]/g, \"\");\n return digits === \"\" ? null : `+${digits}`;\n}\n\n/** What a CRM writes around the digits and what E.164 does not keep. */\nconst PHONE_PUNCTUATION = /[\\s()./-]/g;\n/** E.164: `+`, a country code that cannot start at 0, up to 15 digits total. */\nconst E164 = /^\\+[1-9]\\d{7,14}$/;\n\n/**\n * **v2 — strict E.164.**\n *\n * A number with no international prefix is refused rather than guessed at. The\n * country code cannot be inferred from the value, and inventing one produces a\n * hash that silently matches nothing — worse than declining the key, because\n * the event still resolves by some other rung and nobody learns the phone was\n * lost. Both `+34…` and the access prefix `0034…` are accepted; a bare\n * `600111222` is not.\n */\nexport function normalizePhoneV2(raw: string): string | null {\n const compact = raw.replace(PHONE_PUNCTUATION, \"\");\n const e164 = compact.startsWith(\"00\") ? `+${compact.slice(2)}` : compact;\n return E164.test(e164) ? e164 : null;\n}\n\n/**\n * E.164 without the `+` — what Meta, LinkedIn and Twitter hash.\n *\n * Google hashes the same number *with* the `+`, and that single character is\n * the whole reason this function has a name.\n */\nexport function phoneWithoutPlus(normalizedPhone: string): string {\n return normalizedPhone.startsWith(\"+\") ? normalizedPhone.slice(1) : normalizedPhone;\n}\n","/**\n * Versioned identity normalization — one rule set, in one place, for the whole\n * platform.\n *\n * Several copies of \"normalize an email or a phone and hash it\" exist: the\n * browser beacon's, the one every Conversions API dispatcher shares\n * (`convex/lib/capi.ts`), and Google Ads' own on top of it\n * (`convex/sideEffects/googleAdsCapi/utils.ts`). They disagree about the `+` on\n * a phone, about whether a malformed address should be declined, and about\n * Gmail. Each disagreement is the same failure: two digests for one person, no\n * error anywhere, and an attribution that quietly matches nobody.\n *\n * **This module has taken over exactly one of them so far — the beacon's.** The\n * CAPI dispatchers still hold their own, because they sit on live conversion\n * uploads where a changed digest is money mis-attributed, so they move in their\n * own change with their own evidence. What is done instead, and now, is to make\n * the drift *detectable*: `capi.parity.test.ts` in `packages/backend` runs those\n * copies over the same table as these and fails when they stop agreeing. That is\n * the whole problem — the copies are identical today and nothing was watching.\n * One of them, Google Ads' phone rule, is genuinely a third rule and cannot be\n * pinned to either version; the test says so in place of pretending otherwise.\n *\n * Two ideas make that fixable rather than merely fixed:\n *\n * - **The version is data.** A digest cannot be recomputed — the plaintext was\n * dropped on purpose, which is the point of holding a digest at all. So the\n * rule that produced it is frozen as v1 and kept, and a better rule ships\n * beside it as v2. Anything holding plaintext produces both and looks up\n * both, which is why a normalization change cannot orphan the history.\n * - **The provider form is not the version.** Meta hashes E.164 without the\n * `+`, Google hashes it with the `+` and canonicalizes Gmail addresses. Those\n * are three digests of one canonical value, not three normalizations.\n */\n\nimport { sha256Hex } from \"./digest\";\nimport { normalizeEmailV1, normalizeEmailV2 } from \"./email\";\nimport { normalizePhoneV1, normalizePhoneV2 } from \"./phone\";\nimport { providerPlain } from \"./providers\";\nimport type { CanonicalIdentity, IdentityInput, NormalizationVersion } from \"./types\";\n\nexport { externalIdDigest, isSha256Hex, normalizeExternalId, normalizeSha256Hex, sha256Hex } from \"./digest\";\nexport { googleEmail, normalizeEmailV1, normalizeEmailV2 } from \"./email\";\nexport { normalizePhoneV1, normalizePhoneV2, phoneWithoutPlus } from \"./phone\";\nexport { type ProviderPlain, providerPlain } from \"./providers\";\nexport {\n type CanonicalIdentity,\n type IdentityInput,\n type IdentityKind,\n NORMALIZATION_VERSIONS,\n type NormalizationVersion,\n} from \"./types\";\nexport { extractDomain, isPublicEmailDomain, workEmailDomain } from \"./workDomain\";\n\n/**\n * Apply one version's rule to plain text, or decline it.\n *\n * `null` means this version has no usable form of this value — not that the\n * person has no phone. Under v2 that happens to any national number, on\n * purpose: see {@link normalizePhoneV2}.\n */\nexport function normalizeIdentity(raw: IdentityInput, version: NormalizationVersion): CanonicalIdentity | null {\n const value =\n raw.kind === \"email\"\n ? version === 1\n ? normalizeEmailV1(raw.value)\n : normalizeEmailV2(raw.value)\n : version === 1\n ? normalizePhoneV1(raw.value)\n : normalizePhoneV2(raw.value);\n return value === null ? null : { kind: raw.kind, value, normalizationVersion: version };\n}\n\n/**\n * The digests one canonical value produces, keyed by who asks for them.\n *\n * Snake case because this is a wire shape: it is what the browser sends, what\n * the ingest stores, and what an activation payload reads. `google_sha256` is\n * `null` when Google has no usable form of the value — a Gmail address whose\n * local part was only a `+tag`.\n */\nexport type IdentityDigests = {\n canonical_sha256: string;\n meta_sha256: string;\n google_sha256: string | null;\n normalization_version: NormalizationVersion;\n};\n\nexport async function providerDigests(canonical: CanonicalIdentity): Promise<IdentityDigests> {\n const plain = providerPlain(canonical);\n const [canonicalSha, metaSha, googleSha] = await Promise.all([\n sha256Hex(plain.canonical),\n sha256Hex(plain.meta),\n plain.google === null ? Promise.resolve(null) : sha256Hex(plain.google),\n ]);\n return {\n canonical_sha256: canonicalSha,\n meta_sha256: metaSha,\n google_sha256: googleSha,\n normalization_version: canonical.normalizationVersion,\n };\n}\n\n/**\n * The compact set a page sends and an ingest reads: one entry per version, plus\n * the two provider digests, for one plaintext value.\n *\n * `meta` and `google` are computed from the best version that produced a value\n * — v2 when it accepted the value, v1 otherwise — because a platform wants one\n * digest, not a history. `v1` and `v2` are both present when both rules\n * accepted the value, and they are equal when the two rules agreed.\n *\n * `null` when no version has a usable form: there is nothing to report, and\n * reporting an empty digest would be reporting the hash of the empty string.\n */\nexport type IdentityDigestSet = {\n v1?: string;\n v2?: string;\n meta: string;\n google?: string;\n};\n\nexport async function identityDigestSet(raw: IdentityInput): Promise<IdentityDigestSet | null> {\n const v1 = normalizeIdentity(raw, 1);\n const v2 = normalizeIdentity(raw, 2);\n const best = v2 ?? v1;\n if (best === null) return null;\n const digests = await providerDigests(best);\n return {\n ...(v1 === null ? {} : { v1: v1.value === best.value ? digests.canonical_sha256 : await sha256Hex(v1.value) }),\n ...(v2 === null ? {} : { v2: digests.canonical_sha256 }),\n meta: digests.meta_sha256,\n ...(digests.google_sha256 === null ? {} : { google: digests.google_sha256 }),\n };\n}\n","/**\n * The customer-matching block: one vocabulary for everything Meta calls\n * *advanced matching* and Google calls *enhanced conversions*.\n *\n * ## Why these fields are here at all\n *\n * A server event is worth what it can be joined to. An email is the join that\n * works, and everything in this file is the second-best set for when the join\n * has to happen *outward* instead — Meta and Google both accept an event with\n * no email at all if it carries enough of a person: a name and a postcode, a\n * click id, a browser cookie. They disagree about spelling and about what has\n * to be hashed, and they do not disagree about the set.\n *\n * Two things follow, and they are the whole design:\n *\n * - **One block, one spelling.** A sender maps their CRM once, here, rather\n * than once per destination. `MATCH_FIELD_FORWARDING` is the table that says\n * what each field is called on the other side, so the mapping is published\n * rather than folklore.\n * - **Kept in the form every destination can still be derived from.** That rule\n * decides, per field, whether it is stored hashed or in the clear, and it is\n * the only rule here worth remembering: **a digest can be computed later and\n * never undone.** A city hashed on arrival can never be sent to Google, which\n * wants `address_info.city` in plain text; a city kept in the clear can be\n * hashed for Meta at the moment of sending, for free.\n *\n * So: hashed here are the fields **both** destinations want hashed and which\n * identify a person on their own — email, phone, the two names, the date of\n * birth, and the sender's own id. Kept in the clear are the coarse ones that\n * identify nobody by themselves and that Google wants unhashed: city, region,\n * postal code, country, and the gender letter. Hashing that second set would\n * buy no privacy — the digest of `es` is not a secret — and would cost the\n * ability to send them anywhere.\n *\n * ## A value that arrives already hashed\n *\n * Accepted for every field, and detected rather than declared. There is no\n * `email_sha256` beside `email` any more, because two fields for one idea is a\n * choice a sender should never have had to make: a 64-character hex string is\n * unambiguously a digest — no address, phone number, city or name can be one —\n * so the field can hold either and we can tell. What we cannot do is *unhash*,\n * so a digest arriving for a field this module would otherwise keep in the\n * clear is stored under `<field>_sha256`: the key says what is inside it, and a\n * forward that needs the plain value knows it does not have one.\n *\n * ## Normalization is Meta's, and the divergence is stated\n *\n * The hashed fields are normalized under the rule Meta publishes (lower case,\n * trimmed, punctuation and spacing removed) because a digest can only be\n * computed under one rule and Meta's is the stricter of the two. Google's rule\n * for a name is lower-case-and-trim only, so the two agree on every name\n * without punctuation in it and differ on `O'Brien`. Email and phone do not\n * have this problem: they go through `../identity`, which is the platform's one\n * versioned rule and the same one the browser beacon writes with — which is\n * what makes a server event and a Form submission land on one person.\n */\n\nimport { isSha256Hex, sha256Hex } from \"../identity\";\n\n/**\n * A field of `user_data` that describes the person rather than naming a click.\n *\n * `email` and `phone` are deliberately not here: they are resolved by\n * `./identity` into the row's own `identity_hash`, under the platform's\n * versioned rule, and this module reads that result rather than hashing them a\n * second time under a different one.\n */\nexport const MATCH_FIELDS = [\n \"first_name\",\n \"last_name\",\n \"date_of_birth\",\n \"gender\",\n \"city\",\n \"region\",\n \"postal_code\",\n \"country\",\n] as const;\nexport type MatchField = (typeof MATCH_FIELDS)[number];\n\n/**\n * The browser cookies Meta's pixel sets, which name a browser rather than a\n * person.\n *\n * `fbp` is the pixel's own first-party cookie and `fbc` is the one it derives\n * from a click. Both are sent to Meta **unhashed and verbatim** — they are\n * opaque strings of Meta's own making, and hashing one destroys it — so they\n * are stored exactly as they arrived.\n *\n * They are not in {@link MATCH_FIELDS} and not in the click-id list either.\n * They are not click ids: a `gclid` is stamped on a URL by the ad platform and\n * has a column of its own here because reports filter on it, while `fbp` is a\n * cookie a script wrote and nothing reports on. But they *do* name somebody,\n * which is why `namesSomebody` counts them — an event carrying only an `fbp` is\n * still an event Meta can attribute, and refusing it would lose exactly the\n * conversions this block exists to make sendable.\n */\nexport const MATCH_COOKIES = [\"fbp\", \"fbc\"] as const;\nexport type MatchCookie = (typeof MATCH_COOKIES)[number];\n\n/** How a field is stored, once it has been normalized. */\ntype Keeping = \"hashed\" | \"plain\";\n\ntype MatchSpec = {\n keep: Keeping;\n /** The canonical form, or `null` when the value says nothing usable. */\n normalize: (value: string) => string | null;\n /** What Meta and Google call this field, for the published mapping. */\n meta: string;\n google: string | null;\n};\n\n/** Lower-cased, trimmed, and stripped of everything that is not a letter or a digit. Meta's rule. */\nfunction tightened(value: string): string | null {\n const stripped = value.toLowerCase().replace(/[^\\p{L}\\p{N}]/gu, \"\");\n return stripped === \"\" ? null : stripped;\n}\n\n/** Lower-cased and trimmed, with runs of whitespace collapsed. Nothing else is removed. */\nfunction loosened(value: string): string | null {\n const collapsed = value.trim().toLowerCase().replace(/\\s+/g, \" \");\n return collapsed === \"\" ? null : collapsed;\n}\n\n/**\n * `1985-04-09`, `1985/04/09`, `19850409` — eight digits in year-month-day\n * order, however they are punctuated.\n *\n * The order is not guessed. `09/04/1985` is refused rather than read as the\n * ninth of April or the fourth of September: nothing in the value says which,\n * and a birth date hashed under the wrong reading is a digest that matches\n * nobody at Meta, with no error anywhere to say so. A refusal costs one field\n * on one event and is visible in the arrival log; a wrong guess costs the match\n * and is not.\n */\nfunction birthDate(value: string): string | null {\n const digits = value.replace(/\\D/g, \"\");\n if (!/^\\d{8}$/.test(digits)) return null;\n const month = Number(digits.slice(4, 6));\n const day = Number(digits.slice(6, 8));\n if (month < 1 || month > 12 || day < 1 || day > 31) return null;\n return digits;\n}\n\n/** `f` or `m`, from whatever word or letter the sender's system stores. */\nfunction genderLetter(value: string): string | null {\n const first = value.trim().toLowerCase().charAt(0);\n return first === \"f\" || first === \"m\" ? first : null;\n}\n\n/** ISO-3166 alpha-2, lower-cased. A country name is refused rather than guessed at. */\nfunction countryCode(value: string): string | null {\n const code = value.trim().toLowerCase();\n return /^[a-z]{2}$/.test(code) ? code : null;\n}\n\nexport const MATCH_SPECS: Readonly<Record<MatchField, MatchSpec>> = {\n first_name: { keep: \"hashed\", normalize: tightened, meta: \"fn\", google: \"hashed_first_name\" },\n last_name: { keep: \"hashed\", normalize: tightened, meta: \"ln\", google: \"hashed_last_name\" },\n // Meta only. Google's enhanced conversions have no date of birth, so there is\n // no destination wanting it in the clear and every reason not to keep one.\n date_of_birth: { keep: \"hashed\", normalize: birthDate, meta: \"db\", google: null },\n gender: { keep: \"plain\", normalize: genderLetter, meta: \"ge\", google: null },\n city: { keep: \"plain\", normalize: loosened, meta: \"ct\", google: \"city\" },\n region: { keep: \"plain\", normalize: loosened, meta: \"st\", google: \"state\" },\n postal_code: { keep: \"plain\", normalize: loosened, meta: \"zp\", google: \"postal_code\" },\n country: { keep: \"plain\", normalize: countryCode, meta: \"country\", google: \"country_code\" },\n};\n\n/** One row of the published mapping: our name, Meta's, Google's, and whether we hold it hashed. */\nexport type MatchFieldForwarding = {\n field: string;\n meta: string;\n google: string | null;\n hashed: boolean;\n};\n\n/**\n * What each field of the matching block is called at the destinations that\n * accept it — the table the dialog and the docs both read.\n *\n * Published rather than described, because \"it maps onto Meta's user_data\" is\n * a promise a sender cannot check and this is the same promise they can.\n */\nexport const MATCH_FIELD_FORWARDING: readonly MatchFieldForwarding[] = [\n { field: \"email\", meta: \"em\", google: \"hashed_email\", hashed: true },\n { field: \"phone\", meta: \"ph\", google: \"hashed_phone_number\", hashed: true },\n // Kept in the clear — see `resolveOwnId`. The digest is still computed and\n // still stored beside it, so a Meta forward has one; what changed is that the\n // sender's own key is now readable, which is the entire reason they sent it.\n { field: \"external_id\", meta: \"external_id\", google: null, hashed: false },\n ...MATCH_FIELDS.map((field) => ({\n field,\n meta: MATCH_SPECS[field].meta,\n google: MATCH_SPECS[field].google,\n hashed: MATCH_SPECS[field].keep === \"hashed\",\n })),\n { field: \"fbp\", meta: \"fbp\", google: null, hashed: false },\n { field: \"fbc\", meta: \"fbc\", google: null, hashed: false },\n];\n\n/** The longest a stored match value may be, matching the width the map's values are held at. */\nconst MAX_MATCH_VALUE = 255;\n\n/**\n * One field, resolved to the key it is stored under and the value stored there.\n *\n * `null` when the field said nothing usable — `gender: \"unknown\"`, a country\n * spelled out in full, a postcode of whitespace. A field that is present and\n * unusable contributes nothing rather than storing something that matches\n * nobody, which is the same rule the identity resolution follows.\n */\nexport async function resolveMatchField(\n field: MatchField,\n raw: string,\n): Promise<{ key: string; value: string } | null> {\n const value = raw.trim();\n if (value === \"\") return null;\n const spec = MATCH_SPECS[field];\n // Already a digest, whatever this field would otherwise keep. Taken at face\n // value — hashing a hash matches nothing, forever — and keyed so that the\n // name says what is inside, because a plain-text destination cannot use it.\n if (isSha256Hex(value)) return { key: `${field}_sha256`, value: value.toLowerCase() };\n const normalized = spec.normalize(value);\n if (normalized === null) return null;\n if (spec.keep === \"plain\") return { key: field, value: normalized.slice(0, MAX_MATCH_VALUE) };\n return { key: `${field}_sha256`, value: await sha256Hex(normalized) };\n}\n\n/**\n * The two ids that are not facts about a person but *names the sender chose*,\n * kept exactly as they were sent.\n *\n * `external_id` is the client's own key — a HubSpot contact id, a Salesforce\n * record id — and `baker_id` is a cookie value one of our own pages minted.\n * Neither describes anybody: they are pointers, and a pointer is worth only\n * what it can be followed with.\n *\n * ## Why these are the exception to \"identifying fields are hashed\"\n *\n * `external_id` used to be hashed here and nothing else, on the reasoning that\n * it is sometimes an email or a document number in disguise. That reasoning\n * held and the consequence did not: it made the field **useless to the person\n * who sent it**. An integrator posting `external_id: \"hs:contact:12345\"` opened\n * the event and read *Provided, stored hashed* — no way to check we had read\n * the right record, no way to paste the id back into their CRM, and no way to\n * tell a working integration from one silently keyed on the wrong column. The\n * whole point of the field is to be recognised on the way back out.\n *\n * The privacy this bought was also smaller than it looked. The digest is still\n * computed, still what `identity_hash` stores and still what the identity graph\n * joins on — see `./identity` — so nothing about the joining changed. What is\n * new is a second copy in the clear, under the key that says so.\n *\n * A value that arrives *already* a digest still keeps `<field>_sha256`, for the\n * rule that governs every field here: a digest cannot be undone, so the key has\n * to say what is inside it.\n */\nexport function resolveOwnId(field: \"external_id\" | \"baker_id\", raw: string): { key: string; value: string } | null {\n const value = raw.trim();\n if (value === \"\") return null;\n if (isSha256Hex(value)) return { key: `${field}_sha256`, value: value.toLowerCase() };\n return { key: field, value: value.slice(0, MAX_MATCH_VALUE) };\n}\n\n/** A cookie value, as Meta minted it: bounded, and otherwise untouched. */\nexport function resolveMatchCookie(raw: string): string | null {\n const value = raw.trim();\n return value === \"\" ? null : value.slice(0, MAX_MATCH_VALUE);\n}\n\n/**\n * The `fbclid` hiding inside an `fbc`, or `null`.\n *\n * `fbc` is `fb.<subdomain index>.<timestamp>.<fbclid>` — Meta's own encoding of\n * a click id it already saw. A sender whose system stored the cookie has the\n * click id and does not know it, so reading it out costs one split and gives\n * the event the same paid-attribution column a landing page would have written\n * from the URL. Nothing is invented: the value was there.\n */\nexport function fbclidFromFbc(fbc: string): string | null {\n const parts = fbc.split(\".\");\n if (parts.length < 4 || parts[0] !== \"fb\") return null;\n const id = parts.slice(3).join(\".\");\n return id === \"\" ? null : id;\n}\n","/**\n * The click ids a sender may hand over, named the way their own system stored\n * them.\n *\n * The wire uses the **URL parameter** spelling (`li_fat_id`) rather than the\n * analytics row's field spelling (`liFatId`), because a client's CRM captured\n * these off a landing URL and that is the name it wrote them down under.\n * {@link clickIdsFromWire} is the one place the two vocabularies meet.\n *\n * Mirrored from `CLICK_ID_FIELDS` in `../analytics/normalize.ts`, which is the\n * source of truth for which click ids the store has columns for.\n * `vocabulary.parity.test.ts` reads that file and fails if the two drift — a\n * missing entry here is an attribution a client sent and we dropped.\n */\n\nimport type { ClickIdFields } from \"../analytics/normalize\";\n\nexport const INGEST_CLICK_ID_PARAMS = [\n \"gclid\",\n \"wbraid\",\n \"gbraid\",\n \"dclid\",\n \"fbclid\",\n \"ttclid\",\n \"twclid\",\n \"li_fat_id\",\n \"msclkid\",\n \"rdt_cid\",\n \"epik\",\n \"sccid\",\n \"oppref\",\n] as const;\nexport type IngestClickIdParam = (typeof INGEST_CLICK_ID_PARAMS)[number];\n\nconst FIELD_FOR_PARAM: Readonly<Record<IngestClickIdParam, keyof ClickIdFields>> = {\n gclid: \"gclid\",\n wbraid: \"wbraid\",\n gbraid: \"gbraid\",\n dclid: \"dclid\",\n fbclid: \"fbclid\",\n ttclid: \"ttclid\",\n twclid: \"twclid\",\n li_fat_id: \"liFatId\",\n msclkid: \"msclkid\",\n rdt_cid: \"rdtCid\",\n epik: \"epik\",\n sccid: \"sccid\",\n oppref: \"oppref\",\n};\n\n/** The wire's click block as the analytics row builder names its fields. Empty values are dropped. */\nexport function clickIdsFromWire(click: Partial<Record<IngestClickIdParam, string | null>> | null | undefined): {\n clickIds: ClickIdFields;\n kinds: IngestClickIdParam[];\n} {\n const clickIds: ClickIdFields = {};\n const kinds: IngestClickIdParam[] = [];\n for (const param of INGEST_CLICK_ID_PARAMS) {\n const value = click?.[param];\n if (typeof value !== \"string\" || value === \"\") continue;\n clickIds[FIELD_FOR_PARAM[param]] = value;\n kinds.push(param);\n }\n return { clickIds, kinds };\n}\n","/**\n * What a source can be read into: the fields of an event, named the way\n * `POST /v1/events` already names them.\n *\n * Assembled from the ingest vocabulary rather than spelled a fourth time. A\n * mapping is `SourceField → dotted path`, and the field half of that pair has\n * to be a name the wire already accepts, because the whole of what a source\n * does is build an `IngestEventInput` and hand it to the same door the\n * client's own server would have used. A field that existed only here would be\n * a field the event could not carry.\n */\n\nimport { MATCH_FIELDS, type MatchField } from \"../event-ingest/matching\";\nimport type { IngestClickIdParam } from \"../event-ingest/vocabulary\";\nimport { INGEST_CLICK_ID_PARAMS } from \"../event-ingest/vocabulary\";\n\n/** Where a field sits on the sheet: one row per group, in this order. */\nexport type SourceFieldGroup = \"event\" | \"person\" | \"money\" | \"click\";\n\nexport type SourceField =\n | \"event_name\"\n | \"event_time\"\n | \"event_id\"\n | \"email\"\n | \"phone\"\n | \"external_id\"\n | MatchField\n | \"value\"\n | \"currency\"\n | IngestClickIdParam;\n\nexport interface SourceFieldSpec {\n field: SourceField;\n /** The product word for it — what the sheet and the CLI show. */\n label: string;\n group: SourceFieldGroup;\n}\n\nconst MATCH_LABELS: Readonly<Record<MatchField, string>> = {\n first_name: \"First name\",\n last_name: \"Last name\",\n date_of_birth: \"Date of birth\",\n gender: \"Gender\",\n city: \"City\",\n region: \"Region\",\n postal_code: \"Postcode\",\n country: \"Country\",\n};\n\nconst CLICK_LABELS: Readonly<Record<IngestClickIdParam, string>> = {\n gclid: \"Google click id\",\n wbraid: \"Google click id (iOS, web to app)\",\n gbraid: \"Google click id (iOS, app)\",\n dclid: \"Google click id (Display & Video)\",\n fbclid: \"Meta click id\",\n ttclid: \"TikTok click id\",\n twclid: \"X click id\",\n li_fat_id: \"LinkedIn click id\",\n msclkid: \"Microsoft click id\",\n rdt_cid: \"Reddit click id\",\n epik: \"Pinterest click id\",\n sccid: \"Snapchat click id\",\n oppref: \"ChatGPT Ads click id\",\n};\n\nexport const SOURCE_FIELDS: readonly SourceFieldSpec[] = [\n { field: \"event_name\", label: \"What happened\", group: \"event\" },\n { field: \"event_time\", label: \"When it happened\", group: \"event\" },\n { field: \"event_id\", label: \"Its id\", group: \"event\" },\n { field: \"email\", label: \"Email\", group: \"person\" },\n { field: \"phone\", label: \"Phone\", group: \"person\" },\n { field: \"external_id\", label: \"Your own id for the person\", group: \"person\" },\n ...MATCH_FIELDS.map((field) => ({ field, label: MATCH_LABELS[field], group: \"person\" as const })),\n { field: \"value\", label: \"Amount\", group: \"money\" },\n { field: \"currency\", label: \"Currency\", group: \"money\" },\n ...INGEST_CLICK_ID_PARAMS.map((field) => ({ field, label: CLICK_LABELS[field], group: \"click\" as const })),\n];\n\nexport const SOURCE_FIELD_NAMES: readonly SourceField[] = SOURCE_FIELDS.map((spec) => spec.field);\n\nconst FIELD_SET: ReadonlySet<string> = new Set(SOURCE_FIELD_NAMES);\n\nexport function isSourceField(value: string): value is SourceField {\n return FIELD_SET.has(value);\n}\n\nexport const SOURCE_FIELD_GROUPS: readonly { group: SourceFieldGroup; label: string; detail: string }[] = [\n { group: \"event\", label: \"The event\", detail: \"What it is called, when it happened, and its own id.\" },\n {\n group: \"person\",\n label: \"Who it is about\",\n detail: \"How the platforms find the person. Email or phone is the one that matters.\",\n },\n {\n group: \"money\",\n label: \"What it was worth\",\n detail: \"The amount and its currency, for revenue and for the platforms.\",\n },\n {\n group: \"click\",\n label: \"The ad click that brought them\",\n detail: \"When the source keeps the click id, the campaign gets the credit.\",\n },\n];\n\n/**\n * A row that is not a field of the event but one of its own **properties** —\n * the flat `properties` object every event carries, which Measure → Events\n * breaks an event down by and which a send can forward to a platform as an\n * extra parameter (Meta's `custom_data`, a GA4 event parameter).\n *\n * Spelled `properties.<key>` in the mapping so the row shares the table with\n * the fields and the CLI's `--field` takes it unchanged, while an unknown bare\n * key is still refused: the namespace is what tells a deliberate extra\n * property from a typo that would otherwise silently map nothing.\n */\nexport const PROPERTY_ROW_PREFIX = \"properties.\";\n\n/** The longest a property's key may be. Keys are a shared dictionary in the store, so they are kept short and plain. */\nexport const PROPERTY_KEY_MAX = 64;\n\n/** Letters, digits, underscore, dash and dot — what a property key of `POST /v1/events` may be, and what a platform parameter name may be. */\nconst PROPERTY_KEY = /^[A-Za-z0-9_][A-Za-z0-9_.-]*$/;\n\n/** Keys a source writes itself; a row naming one would be overwritten in silence. */\nexport const RESERVED_PROPERTY_KEYS: readonly string[] = [\"baker_source\", \"hubspot_property\", \"hubspot_value\"];\n\n/** Whether a mapping row names a property rather than a field. */\nexport function isPropertyRow(row: string): boolean {\n return row.startsWith(PROPERTY_ROW_PREFIX);\n}\n\n/** The property's own key, for a `properties.<key>` row; null for anything else. */\nexport function propertyKeyOf(row: string): string | null {\n return isPropertyRow(row) ? row.slice(PROPERTY_ROW_PREFIX.length) : null;\n}\n\n/** The mapping row for a property key. */\nexport function propertyRow(key: string): string {\n return `${PROPERTY_ROW_PREFIX}${key}`;\n}\n\n/**\n * Why a property key cannot be used, in one sentence, or null when it can.\n * The same rule for a source's extra properties and for a send's parameters.\n */\nexport function propertyKeyProblem(key: string): string | null {\n const trimmed = key.trim();\n if (trimmed === \"\") return \"A property needs a name.\";\n if (trimmed.length > PROPERTY_KEY_MAX) return `A property name is at most ${PROPERTY_KEY_MAX} characters.`;\n if (!PROPERTY_KEY.test(trimmed)) {\n return `\"${trimmed}\" is not a property name: letters, digits, underscore, dash and dot only, starting with a letter or digit.`;\n }\n if (RESERVED_PROPERTY_KEYS.includes(trimmed)) return `\"${trimmed}\" is written by Baker itself; pick another name.`;\n return null;\n}\n\n/**\n * Whether a mapping row is one a source can hold: a field of the event, or a\n * well-named property. The reason when it is not.\n */\nexport function mappingRowProblem(row: string): string | null {\n if (isSourceField(row)) return null;\n const key = propertyKeyOf(row);\n if (key === null) {\n return `\"${row}\" is not a field an event can carry. A field is one of ${SOURCE_FIELD_NAMES.join(\", \")}; an extra property is spelled properties.<name>.`;\n }\n return propertyKeyProblem(key);\n}\n\n/** The property rows of a mapping, as `key → template`, in the order stored. */\nexport function propertyRows(mapping: Readonly<Record<string, string>>): { key: string; template: string }[] {\n return Object.entries(mapping).flatMap(([row, template]) => {\n const key = propertyKeyOf(row);\n return key === null ? [] : [{ key, template }];\n });\n}\n","/**\n * A mapping row is a template: literal text with `{{mentions}}` in it.\n *\n * ## Why a template and not a path\n *\n * A row used to hold one dotted path, and one path answers one question —\n * \"which field of the payload is the email\". It cannot answer the next three:\n * a currency the tool never sends but the company knows (`EUR`), a name split\n * over two fields (`{{firstname}} {{lastname}}`), or an amount a HubSpot\n * contact carries under a property nobody would guess. A template answers all\n * of them with one rule the Forms builder already teaches: type text, insert\n * a variable. The same spelling is what the CLI takes, so an agent and a\n * person write the same thing.\n *\n * ## What a mention points at\n *\n * Whatever the source can read. For an address it is a dotted path into the\n * payload (`contact.email`, `deal.contacts.0.email`); for a HubSpot read it\n * is a contact property's internal name (`hs_google_click_id`), plus `id` for\n * the contact's own id. The template does not know which — the lookup passed\n * to `renderTemplate` does.\n *\n * A mention names exactly one thing. There was a `{{phone|mobilephone}}`\n * spelling for \"the first that holds anything\"; it is gone, because it was a\n * rule the Forms builder's variables do not have, and a row that reads\n * differently from every other variable field in the product is a row nobody\n * can predict. A person who wants the mobile picks the mobile.\n */\n\nconst MENTION = /\\{\\{\\s*([^{}]+?)\\s*\\}\\}/g;\n\n/** The path a mention names, with the braces on. */\nexport function mentionOf(path: string): string {\n return `{{${path}}}`;\n}\n\n/** Every path a template reads, in order, once each. */\nexport function templateMentions(template: string): string[] {\n const seen: string[] = [];\n for (const match of template.matchAll(MENTION)) {\n const path = (match[1] ?? \"\").trim();\n if (path !== \"\" && !seen.includes(path)) seen.push(path);\n }\n return seen;\n}\n\n/**\n * The template with every mention replaced by what it points at, trimmed —\n * or nothing, when what is left is empty. An empty mention reads as empty\n * text rather than as its own spelling, so a template made only of mentions\n * the payload did not fill is \"not sent\", not the literal `{{phone}}`.\n */\nexport function renderTemplate(template: string, lookup: (path: string) => string | undefined): string | undefined {\n const rendered = template.replace(MENTION, (_whole, path: string) => lookup(path.trim()) ?? \"\").trim();\n return rendered === \"\" ? undefined : rendered;\n}\n\n/** The one path a template is, when it is exactly one mention and nothing else. */\nexport function isBareMention(template: string): string | null {\n const match = /^\\{\\{\\s*([^{}]+?)\\s*\\}\\}$/.exec(template.trim());\n return match === null ? null : (match[1] ?? null);\n}\n"],"mappings":";AAcA,IAAM,aAAa;AAQZ,SAAS,YAAY,OAAwB;AAClD,SAAO,WAAW,KAAK,KAAK;AAC9B;;;ACNO,SAAS,iBAAiB,KAA4B;AAC3D,QAAM,UAAU,IAAI,KAAK,EAAE,YAAY;AACvC,SAAO,YAAY,KAAK,OAAO;AACjC;AAGA,IAAM,QAAQ;AAMP,SAAS,iBAAiB,KAA4B;AAC3D,QAAM,UAAU,IAAI,KAAK,EAAE,YAAY;AACvC,SAAO,MAAM,KAAK,OAAO,IAAI,UAAU;AACzC;;;AChBO,SAAS,iBAAiB,KAA4B;AAC3D,QAAM,SAAS,IACZ,KAAK,EACL,YAAY,EACZ,QAAQ,WAAW,EAAE;AACxB,SAAO,WAAW,KAAK,OAAO,IAAI,MAAM;AAC1C;AAGA,IAAM,oBAAoB;AAE1B,IAAM,OAAO;AAYN,SAAS,iBAAiB,KAA4B;AAC3D,QAAM,UAAU,IAAI,QAAQ,mBAAmB,EAAE;AACjD,QAAM,OAAO,QAAQ,WAAW,IAAI,IAAI,IAAI,QAAQ,MAAM,CAAC,CAAC,KAAK;AACjE,SAAO,KAAK,KAAK,IAAI,IAA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