@koda-sl/baker-cli 0.384.0-dev.4699b7308 → 0.384.0-dev.557795bef

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 (964) hide show
  1. package/README.md +1098 -217
  2. package/canvas/tiktok-captions-composition/index.html +5 -6
  3. package/canvas/tiktok-captions-composition/meta.json +5 -0
  4. package/dist/account-4UEZAY5T.js +49 -0
  5. package/dist/account-4UEZAY5T.js.map +1 -0
  6. package/dist/account-OINZG6UP.js +80 -0
  7. package/dist/account-OINZG6UP.js.map +1 -0
  8. package/dist/account-QMDCUUSG.js +79 -0
  9. package/dist/account-QMDCUUSG.js.map +1 -0
  10. package/dist/account-reads-ZKKDYHK5.js +218 -0
  11. package/dist/account-reads-ZKKDYHK5.js.map +1 -0
  12. package/dist/account-writes-N4JDIDRB.js +66 -0
  13. package/dist/account-writes-N4JDIDRB.js.map +1 -0
  14. package/dist/accounts-AEBQFCNH.js +114 -0
  15. package/dist/accounts-AEBQFCNH.js.map +1 -0
  16. package/dist/accounts-EBGJ2YO7.js +611 -0
  17. package/dist/accounts-EBGJ2YO7.js.map +1 -0
  18. package/dist/accounts-HP4BLKK5.js +75 -0
  19. package/dist/accounts-HP4BLKK5.js.map +1 -0
  20. package/dist/accounts-YE2SQ3UQ.js +77 -0
  21. package/dist/accounts-YE2SQ3UQ.js.map +1 -0
  22. package/dist/accounts-Z4CLGQXJ.js +115 -0
  23. package/dist/accounts-Z4CLGQXJ.js.map +1 -0
  24. package/dist/actions-ADRIEQZX.js +55 -0
  25. package/dist/actions-ADRIEQZX.js.map +1 -0
  26. package/dist/active-entities-YB46ADQN.js +103 -0
  27. package/dist/active-entities-YB46ADQN.js.map +1 -0
  28. package/dist/activities-DUAIQJLN.js +74 -0
  29. package/dist/activities-DUAIQJLN.js.map +1 -0
  30. package/dist/ad-group-writes-HL3EZ3BT.js +170 -0
  31. package/dist/ad-group-writes-HL3EZ3BT.js.map +1 -0
  32. package/dist/ad-groups-FGS5JJGN.js +68 -0
  33. package/dist/ad-groups-FGS5JJGN.js.map +1 -0
  34. package/dist/ad-writes-LX4ACUHB.js +174 -0
  35. package/dist/ad-writes-LX4ACUHB.js.map +1 -0
  36. package/dist/add-5CUXNOUM.js +97 -0
  37. package/dist/add-5CUXNOUM.js.map +1 -0
  38. package/dist/add-6OXOQNET.js +302 -0
  39. package/dist/add-6OXOQNET.js.map +1 -0
  40. package/dist/add-E66HBIZV.js +105 -0
  41. package/dist/add-E66HBIZV.js.map +1 -0
  42. package/dist/add-ROK3ETQC.js +104 -0
  43. package/dist/add-ROK3ETQC.js.map +1 -0
  44. package/dist/add-accounts-YME5SCXD.js +91 -0
  45. package/dist/add-accounts-YME5SCXD.js.map +1 -0
  46. package/dist/ads-65R3WMDU.js +128 -0
  47. package/dist/ads-65R3WMDU.js.map +1 -0
  48. package/dist/ads-O63J7BDF.js +113 -0
  49. package/dist/ads-O63J7BDF.js.map +1 -0
  50. package/dist/ads-TFZ5PXKS.js +77 -0
  51. package/dist/ads-TFZ5PXKS.js.map +1 -0
  52. package/dist/ads-XSVRH45E.js +40 -0
  53. package/dist/ads-XSVRH45E.js.map +1 -0
  54. package/dist/adsets-Y62JOOTV.js +176 -0
  55. package/dist/adsets-Y62JOOTV.js.map +1 -0
  56. package/dist/advertisers-AIC4QPEK.js +120 -0
  57. package/dist/advertisers-AIC4QPEK.js.map +1 -0
  58. package/dist/advertisers-LJ2HKJ4W.js +125 -0
  59. package/dist/advertisers-LJ2HKJ4W.js.map +1 -0
  60. package/dist/analytics-N4PGXXEQ.js +1976 -0
  61. package/dist/analytics-N4PGXXEQ.js.map +1 -0
  62. package/dist/analytics-X3DR3UVG.js +433 -0
  63. package/dist/analytics-X3DR3UVG.js.map +1 -0
  64. package/dist/animate-E3SKQ6SI.js +480 -0
  65. package/dist/animate-E3SKQ6SI.js.map +1 -0
  66. package/dist/assign-Y7HGSQVJ.js +77 -0
  67. package/dist/assign-Y7HGSQVJ.js.map +1 -0
  68. package/dist/audience-size-SWX5YJQF.js +94 -0
  69. package/dist/audience-size-SWX5YJQF.js.map +1 -0
  70. package/dist/audiences-5A6BCWSA.js +268 -0
  71. package/dist/audiences-5A6BCWSA.js.map +1 -0
  72. package/dist/audiences-6QOCASVV.js +78 -0
  73. package/dist/audiences-6QOCASVV.js.map +1 -0
  74. package/dist/audiences-O67NGIP5.js +85 -0
  75. package/dist/audiences-O67NGIP5.js.map +1 -0
  76. package/dist/audit-2KVLWSAI.js +151 -0
  77. package/dist/audit-2KVLWSAI.js.map +1 -0
  78. package/dist/audit-HWK24VXI.js +88 -0
  79. package/dist/audit-HWK24VXI.js.map +1 -0
  80. package/dist/autocomplete-JJSGC5WU.js +111 -0
  81. package/dist/autocomplete-JJSGC5WU.js.map +1 -0
  82. package/dist/avatars-XIEKQ77J.js +38 -0
  83. package/dist/avatars-XIEKQ77J.js.map +1 -0
  84. package/dist/bid-pricing-D2HGRWZL.js +99 -0
  85. package/dist/bid-pricing-D2HGRWZL.js.map +1 -0
  86. package/dist/brand-AYYWRGIE.js +22 -0
  87. package/dist/brand-AYYWRGIE.js.map +1 -0
  88. package/dist/brief-3HUIDK5F.js +490 -0
  89. package/dist/brief-3HUIDK5F.js.map +1 -0
  90. package/dist/businesses-65EWTK5E.js +53 -0
  91. package/dist/businesses-65EWTK5E.js.map +1 -0
  92. package/dist/campaign-groups-6HCYR2JX.js +95 -0
  93. package/dist/campaign-groups-6HCYR2JX.js.map +1 -0
  94. package/dist/campaign-writes-M6JLF5AC.js +170 -0
  95. package/dist/campaign-writes-M6JLF5AC.js.map +1 -0
  96. package/dist/campaign-writes-Y6QPRQ4E.js +165 -0
  97. package/dist/campaign-writes-Y6QPRQ4E.js.map +1 -0
  98. package/dist/campaigns-6SM2ZSIH.js +76 -0
  99. package/dist/campaigns-6SM2ZSIH.js.map +1 -0
  100. package/dist/campaigns-7RKJZRY2.js +107 -0
  101. package/dist/campaigns-7RKJZRY2.js.map +1 -0
  102. package/dist/campaigns-KRI25JDZ.js +109 -0
  103. package/dist/campaigns-KRI25JDZ.js.map +1 -0
  104. package/dist/campaigns-TD7ZB5DG.js +110 -0
  105. package/dist/campaigns-TD7ZB5DG.js.map +1 -0
  106. package/dist/canvas-DMYY2DWI.js +46 -0
  107. package/dist/canvas-DMYY2DWI.js.map +1 -0
  108. package/dist/capabilities-3WJTXS2O.js +144 -0
  109. package/dist/capabilities-3WJTXS2O.js.map +1 -0
  110. package/dist/cards-7HRC4UQQ.js +85 -0
  111. package/dist/cards-7HRC4UQQ.js.map +1 -0
  112. package/dist/catalog-N6MDMIVL.js +64 -0
  113. package/dist/catalog-N6MDMIVL.js.map +1 -0
  114. package/dist/catalogs-PB46L7FH.js +128 -0
  115. package/dist/catalogs-PB46L7FH.js.map +1 -0
  116. package/dist/changes-SASUQK62.js +135 -0
  117. package/dist/changes-SASUQK62.js.map +1 -0
  118. package/dist/chatgpt-JKBSAG25.js +47 -0
  119. package/dist/chatgpt-JKBSAG25.js.map +1 -0
  120. package/dist/chats-WRVSQQB2.js +262 -0
  121. package/dist/chats-WRVSQQB2.js.map +1 -0
  122. package/dist/chunk-2FGKJY63.js +455 -0
  123. package/dist/chunk-2FGKJY63.js.map +1 -0
  124. package/dist/chunk-2GVXNKAE.js +42 -0
  125. package/dist/chunk-2GVXNKAE.js.map +1 -0
  126. package/dist/chunk-2J3PTIQB.js +479 -0
  127. package/dist/chunk-2J3PTIQB.js.map +1 -0
  128. package/dist/chunk-2J7XC2NO.js +346 -0
  129. package/dist/chunk-2J7XC2NO.js.map +1 -0
  130. package/dist/{chunk-VLUGGVJL.js → chunk-2UFRHW3T.js} +12 -4
  131. package/dist/chunk-2UFRHW3T.js.map +1 -0
  132. package/dist/chunk-2Y5V23PU.js +29 -0
  133. package/dist/chunk-2Y5V23PU.js.map +1 -0
  134. package/dist/chunk-3ACMDRSE.js +39 -0
  135. package/dist/chunk-3ACMDRSE.js.map +1 -0
  136. package/dist/chunk-3EWF7VII.js +1079 -0
  137. package/dist/chunk-3EWF7VII.js.map +1 -0
  138. package/dist/chunk-3LYMIKKN.js +625 -0
  139. package/dist/chunk-3LYMIKKN.js.map +1 -0
  140. package/dist/chunk-3M6RNCDD.js +26 -0
  141. package/dist/chunk-3M6RNCDD.js.map +1 -0
  142. package/dist/chunk-3MDO4RR2.js +310 -0
  143. package/dist/chunk-3MDO4RR2.js.map +1 -0
  144. package/dist/chunk-3NPOIHSX.js +6667 -0
  145. package/dist/chunk-3NPOIHSX.js.map +1 -0
  146. package/dist/chunk-3SK7TWGP.js +103 -0
  147. package/dist/chunk-3SK7TWGP.js.map +1 -0
  148. package/dist/chunk-3VXQYDJN.js +1743 -0
  149. package/dist/chunk-3VXQYDJN.js.map +1 -0
  150. package/dist/chunk-44VXKO65.js +106 -0
  151. package/dist/chunk-44VXKO65.js.map +1 -0
  152. package/dist/chunk-4NZ47VXO.js +137 -0
  153. package/dist/chunk-4NZ47VXO.js.map +1 -0
  154. package/dist/chunk-4X3UR372.js +225 -0
  155. package/dist/chunk-4X3UR372.js.map +1 -0
  156. package/dist/chunk-553XSIFW.js +304 -0
  157. package/dist/chunk-553XSIFW.js.map +1 -0
  158. package/dist/chunk-5FEBUCJU.js +25 -0
  159. package/dist/chunk-5FEBUCJU.js.map +1 -0
  160. package/dist/chunk-5HYSKH77.js +315 -0
  161. package/dist/chunk-5HYSKH77.js.map +1 -0
  162. package/dist/chunk-5MBPIONY.js +29 -0
  163. package/dist/chunk-5MBPIONY.js.map +1 -0
  164. package/dist/chunk-5UCP4EEQ.js +111 -0
  165. package/dist/chunk-5UCP4EEQ.js.map +1 -0
  166. package/dist/chunk-5VPJNNJL.js +494 -0
  167. package/dist/chunk-5VPJNNJL.js.map +1 -0
  168. package/dist/{chunk-VZEDAFAR.js → chunk-6YYSUISH.js} +47 -8
  169. package/dist/chunk-6YYSUISH.js.map +1 -0
  170. package/dist/chunk-7OHWEF3I.js +98 -0
  171. package/dist/chunk-7OHWEF3I.js.map +1 -0
  172. package/dist/chunk-A636XRD7.js +159 -0
  173. package/dist/chunk-A636XRD7.js.map +1 -0
  174. package/dist/chunk-A76FRBSF.js +297 -0
  175. package/dist/chunk-A76FRBSF.js.map +1 -0
  176. package/dist/chunk-AADVCEL4.js +817 -0
  177. package/dist/chunk-AADVCEL4.js.map +1 -0
  178. package/dist/chunk-AG62YO7C.js +96 -0
  179. package/dist/chunk-AG62YO7C.js.map +1 -0
  180. package/dist/chunk-AIRIT4GF.js +75 -0
  181. package/dist/chunk-AIRIT4GF.js.map +1 -0
  182. package/dist/chunk-AMCY5YCB.js +206 -0
  183. package/dist/chunk-AMCY5YCB.js.map +1 -0
  184. package/dist/chunk-AP3TP6VG.js +139 -0
  185. package/dist/chunk-AP3TP6VG.js.map +1 -0
  186. package/dist/chunk-APP475IQ.js +474 -0
  187. package/dist/chunk-APP475IQ.js.map +1 -0
  188. package/dist/chunk-AR7PU7BB.js +76 -0
  189. package/dist/chunk-AR7PU7BB.js.map +1 -0
  190. package/dist/chunk-B4S72KSS.js +172 -0
  191. package/dist/chunk-B4S72KSS.js.map +1 -0
  192. package/dist/chunk-BIPIL4QA.js +486 -0
  193. package/dist/chunk-BIPIL4QA.js.map +1 -0
  194. package/dist/chunk-BPUSL5Y2.js +58 -0
  195. package/dist/chunk-BPUSL5Y2.js.map +1 -0
  196. package/dist/chunk-BR32GHYD.js +65 -0
  197. package/dist/chunk-BR32GHYD.js.map +1 -0
  198. package/dist/chunk-CAMX6OHF.js +3182 -0
  199. package/dist/chunk-CAMX6OHF.js.map +1 -0
  200. package/dist/{chunk-MF7YA62W.js → chunk-CUL3VB4L.js} +10 -5
  201. package/dist/chunk-CUL3VB4L.js.map +1 -0
  202. package/dist/chunk-CVEY353K.js +66 -0
  203. package/dist/chunk-CVEY353K.js.map +1 -0
  204. package/dist/chunk-CWXADUKL.js +1599 -0
  205. package/dist/chunk-CWXADUKL.js.map +1 -0
  206. package/dist/chunk-D5FY4FAK.js +24 -0
  207. package/dist/chunk-D5FY4FAK.js.map +1 -0
  208. package/dist/chunk-DGCUPJZD.js +39 -0
  209. package/dist/chunk-DGCUPJZD.js.map +1 -0
  210. package/dist/chunk-DNCLWSHO.js +41 -0
  211. package/dist/chunk-DNCLWSHO.js.map +1 -0
  212. package/dist/chunk-DUPURL26.js +97 -0
  213. package/dist/chunk-DUPURL26.js.map +1 -0
  214. package/dist/chunk-E2ZOSNF5.js +96 -0
  215. package/dist/chunk-E2ZOSNF5.js.map +1 -0
  216. package/dist/chunk-E3HYHT7C.js +274 -0
  217. package/dist/chunk-E3HYHT7C.js.map +1 -0
  218. package/dist/chunk-EDLZGTGN.js +216 -0
  219. package/dist/chunk-EDLZGTGN.js.map +1 -0
  220. package/dist/chunk-EI5QN4UO.js +363 -0
  221. package/dist/chunk-EI5QN4UO.js.map +1 -0
  222. package/dist/{chunk-XHC4LMK4.js → chunk-EIGXX6KI.js} +16 -8
  223. package/dist/chunk-EIGXX6KI.js.map +1 -0
  224. package/dist/chunk-EPDE7ZRU.js +174 -0
  225. package/dist/chunk-EPDE7ZRU.js.map +1 -0
  226. package/dist/chunk-ERSX3MKH.js +34 -0
  227. package/dist/chunk-ERSX3MKH.js.map +1 -0
  228. package/dist/chunk-EVDRF4CI.js +509 -0
  229. package/dist/chunk-EVDRF4CI.js.map +1 -0
  230. package/dist/chunk-F4IEILTR.js +382 -0
  231. package/dist/chunk-F4IEILTR.js.map +1 -0
  232. package/dist/chunk-F7HRLPR5.js +67 -0
  233. package/dist/chunk-F7HRLPR5.js.map +1 -0
  234. package/dist/chunk-FEG6MN4H.js +84 -0
  235. package/dist/chunk-FEG6MN4H.js.map +1 -0
  236. package/dist/chunk-FKOECEVC.js +126 -0
  237. package/dist/chunk-FKOECEVC.js.map +1 -0
  238. package/dist/chunk-FMGW2NZI.js +106 -0
  239. package/dist/chunk-FMGW2NZI.js.map +1 -0
  240. package/dist/chunk-FPZKKNDK.js +98 -0
  241. package/dist/chunk-FPZKKNDK.js.map +1 -0
  242. package/dist/chunk-FUVCY63N.js +169 -0
  243. package/dist/chunk-FUVCY63N.js.map +1 -0
  244. package/dist/chunk-GBNJQNDS.js +19 -0
  245. package/dist/chunk-GBNJQNDS.js.map +1 -0
  246. package/dist/chunk-GIWHHCD6.js +145 -0
  247. package/dist/chunk-GIWHHCD6.js.map +1 -0
  248. package/dist/chunk-GOJXKIFQ.js +1605 -0
  249. package/dist/chunk-GOJXKIFQ.js.map +1 -0
  250. package/dist/chunk-GRQ2AXDX.js +9 -0
  251. package/dist/chunk-GRQ2AXDX.js.map +1 -0
  252. package/dist/chunk-GXDLWBOY.js +73 -0
  253. package/dist/chunk-GXDLWBOY.js.map +1 -0
  254. package/dist/chunk-HAE4WWFQ.js +455 -0
  255. package/dist/chunk-HAE4WWFQ.js.map +1 -0
  256. package/dist/chunk-I2DNBEV6.js +4227 -0
  257. package/dist/chunk-I2DNBEV6.js.map +1 -0
  258. package/dist/chunk-I4FTS5EE.js +455 -0
  259. package/dist/chunk-I4FTS5EE.js.map +1 -0
  260. package/dist/chunk-IELPT4K2.js +74 -0
  261. package/dist/chunk-IELPT4K2.js.map +1 -0
  262. package/dist/chunk-IJMWEO4P.js +57 -0
  263. package/dist/chunk-IJMWEO4P.js.map +1 -0
  264. package/dist/chunk-IREMSVKW.js +175 -0
  265. package/dist/chunk-IREMSVKW.js.map +1 -0
  266. package/dist/chunk-IVIJJXXT.js +62 -0
  267. package/dist/chunk-IVIJJXXT.js.map +1 -0
  268. package/dist/chunk-JD3W3ON7.js +188 -0
  269. package/dist/chunk-JD3W3ON7.js.map +1 -0
  270. package/dist/chunk-JLWBK3VC.js +5187 -0
  271. package/dist/chunk-JLWBK3VC.js.map +1 -0
  272. package/dist/chunk-JPK34QPS.js +134 -0
  273. package/dist/chunk-JPK34QPS.js.map +1 -0
  274. package/dist/chunk-JUY47NZ2.js +183 -0
  275. package/dist/chunk-JUY47NZ2.js.map +1 -0
  276. package/dist/chunk-JXMZEOHV.js +333 -0
  277. package/dist/chunk-JXMZEOHV.js.map +1 -0
  278. package/dist/chunk-K37K447U.js +51 -0
  279. package/dist/chunk-K37K447U.js.map +1 -0
  280. package/dist/chunk-K6TDB2KV.js +1442 -0
  281. package/dist/chunk-K6TDB2KV.js.map +1 -0
  282. package/dist/chunk-KIGGMKAE.js +66 -0
  283. package/dist/chunk-KIGGMKAE.js.map +1 -0
  284. package/dist/chunk-KKJ4KJCW.js +29 -0
  285. package/dist/chunk-KKJ4KJCW.js.map +1 -0
  286. package/dist/chunk-KONA5PSR.js +55 -0
  287. package/dist/chunk-KONA5PSR.js.map +1 -0
  288. package/dist/chunk-KVHRW7KO.js +60 -0
  289. package/dist/chunk-KVHRW7KO.js.map +1 -0
  290. package/dist/chunk-LA6PPSNA.js +65 -0
  291. package/dist/chunk-LA6PPSNA.js.map +1 -0
  292. package/dist/chunk-LKPJADL2.js +74 -0
  293. package/dist/chunk-LKPJADL2.js.map +1 -0
  294. package/dist/chunk-LWAEHLKV.js +74 -0
  295. package/dist/chunk-LWAEHLKV.js.map +1 -0
  296. package/dist/chunk-M6UNISGO.js +66 -0
  297. package/dist/chunk-M6UNISGO.js.map +1 -0
  298. package/dist/chunk-MIJAGBEP.js +23992 -0
  299. package/dist/chunk-MIJAGBEP.js.map +1 -0
  300. package/dist/chunk-MP4EXZ45.js +3151 -0
  301. package/dist/chunk-MP4EXZ45.js.map +1 -0
  302. package/dist/chunk-MYTDK3AL.js +2102 -0
  303. package/dist/chunk-MYTDK3AL.js.map +1 -0
  304. package/dist/chunk-MZQ5DX6S.js +125 -0
  305. package/dist/chunk-MZQ5DX6S.js.map +1 -0
  306. package/dist/chunk-NFSLRRIE.js +77 -0
  307. package/dist/chunk-NFSLRRIE.js.map +1 -0
  308. package/dist/chunk-NOK7MSVJ.js +533 -0
  309. package/dist/chunk-NOK7MSVJ.js.map +1 -0
  310. package/dist/chunk-NR5RZDAW.js +592 -0
  311. package/dist/chunk-NR5RZDAW.js.map +1 -0
  312. package/dist/chunk-O2EVJALZ.js +133 -0
  313. package/dist/chunk-O2EVJALZ.js.map +1 -0
  314. package/dist/chunk-O6UM5WWH.js +275 -0
  315. package/dist/chunk-O6UM5WWH.js.map +1 -0
  316. package/dist/chunk-O6XZIQXZ.js +6212 -0
  317. package/dist/chunk-O6XZIQXZ.js.map +1 -0
  318. package/dist/chunk-OIL6PU5W.js +35 -0
  319. package/dist/chunk-OIL6PU5W.js.map +1 -0
  320. package/dist/chunk-P4NSJS54.js +20 -0
  321. package/dist/chunk-P4NSJS54.js.map +1 -0
  322. package/dist/chunk-P5T7OZKV.js +26 -0
  323. package/dist/chunk-P5T7OZKV.js.map +1 -0
  324. package/dist/chunk-PFBQERWX.js +10 -0
  325. package/dist/chunk-PFBQERWX.js.map +1 -0
  326. package/dist/chunk-PSWVSLJU.js +56 -0
  327. package/dist/chunk-PSWVSLJU.js.map +1 -0
  328. package/dist/chunk-PY2NJ6XZ.js +191 -0
  329. package/dist/chunk-PY2NJ6XZ.js.map +1 -0
  330. package/dist/chunk-PZ4OM2LK.js +45 -0
  331. package/dist/chunk-PZ4OM2LK.js.map +1 -0
  332. package/dist/chunk-PZNOJ76W.js +541 -0
  333. package/dist/chunk-PZNOJ76W.js.map +1 -0
  334. package/dist/chunk-Q6ULQMWG.js +41 -0
  335. package/dist/chunk-Q6ULQMWG.js.map +1 -0
  336. package/dist/chunk-QKFD6PPX.js +57 -0
  337. package/dist/chunk-QKFD6PPX.js.map +1 -0
  338. package/dist/chunk-QMLGJ5OW.js +2891 -0
  339. package/dist/chunk-QMLGJ5OW.js.map +1 -0
  340. package/dist/chunk-R4TPDVBD.js +207 -0
  341. package/dist/chunk-R4TPDVBD.js.map +1 -0
  342. package/dist/chunk-R7QV5N2S.js +846 -0
  343. package/dist/chunk-R7QV5N2S.js.map +1 -0
  344. package/dist/chunk-RR3KT2E7.js +665 -0
  345. package/dist/chunk-RR3KT2E7.js.map +1 -0
  346. package/dist/chunk-SEPPFM5S.js +228 -0
  347. package/dist/chunk-SEPPFM5S.js.map +1 -0
  348. package/dist/chunk-SQ7DRYCC.js +150 -0
  349. package/dist/chunk-SQ7DRYCC.js.map +1 -0
  350. package/dist/chunk-SYULM665.js +610 -0
  351. package/dist/chunk-SYULM665.js.map +1 -0
  352. package/dist/chunk-TKT3OHZ6.js +170 -0
  353. package/dist/chunk-TKT3OHZ6.js.map +1 -0
  354. package/dist/chunk-TNOSX3PJ.js +136 -0
  355. package/dist/chunk-TNOSX3PJ.js.map +1 -0
  356. package/dist/chunk-TTVKI54A.js +160 -0
  357. package/dist/chunk-TTVKI54A.js.map +1 -0
  358. package/dist/chunk-U7ZVXFS3.js +23 -0
  359. package/dist/chunk-U7ZVXFS3.js.map +1 -0
  360. package/dist/chunk-UI6BKYQD.js +225 -0
  361. package/dist/chunk-UI6BKYQD.js.map +1 -0
  362. package/dist/chunk-UKLDW4UW.js +46 -0
  363. package/dist/chunk-UKLDW4UW.js.map +1 -0
  364. package/dist/chunk-V6XXXEXZ.js +76 -0
  365. package/dist/chunk-V6XXXEXZ.js.map +1 -0
  366. package/dist/chunk-V7BW2CIQ.js +92 -0
  367. package/dist/chunk-V7BW2CIQ.js.map +1 -0
  368. package/dist/chunk-VSU5R34H.js +76 -0
  369. package/dist/chunk-VSU5R34H.js.map +1 -0
  370. package/dist/chunk-W4SA4CMR.js +296 -0
  371. package/dist/chunk-W4SA4CMR.js.map +1 -0
  372. package/dist/chunk-WFUMNDCE.js +111 -0
  373. package/dist/chunk-WFUMNDCE.js.map +1 -0
  374. package/dist/chunk-WHWNXLTD.js +166 -0
  375. package/dist/chunk-WHWNXLTD.js.map +1 -0
  376. package/dist/chunk-WN4KX7GE.js +25 -0
  377. package/dist/chunk-WN4KX7GE.js.map +1 -0
  378. package/dist/chunk-XIY7P54H.js +84 -0
  379. package/dist/chunk-XIY7P54H.js.map +1 -0
  380. package/dist/chunk-YFPLNMPZ.js +337 -0
  381. package/dist/chunk-YFPLNMPZ.js.map +1 -0
  382. package/dist/chunk-YMBB4JBD.js +1830 -0
  383. package/dist/chunk-YMBB4JBD.js.map +1 -0
  384. package/dist/chunk-YQFM2P5W.js +197 -0
  385. package/dist/chunk-YQFM2P5W.js.map +1 -0
  386. package/dist/chunk-YQSBHWOI.js +41 -0
  387. package/dist/chunk-YTF3IVMF.js +149 -0
  388. package/dist/chunk-YTF3IVMF.js.map +1 -0
  389. package/dist/chunk-Z3ENMCFE.js +94 -0
  390. package/dist/chunk-Z3ENMCFE.js.map +1 -0
  391. package/dist/chunk-Z7MWSXLG.js +94 -0
  392. package/dist/chunk-Z7MWSXLG.js.map +1 -0
  393. package/dist/chunk-ZIXHS6AM.js +42 -0
  394. package/dist/chunk-ZIXHS6AM.js.map +1 -0
  395. package/dist/chunk-ZJ7TQUCU.js +4410 -0
  396. package/dist/chunk-ZJ7TQUCU.js.map +1 -0
  397. package/dist/chunk-ZNQRDLSS.js +52 -0
  398. package/dist/chunk-ZNQRDLSS.js.map +1 -0
  399. package/dist/claim-ROWH6JVB.js +197 -0
  400. package/dist/claim-ROWH6JVB.js.map +1 -0
  401. package/dist/cli.js +104 -69986
  402. package/dist/cli.js.map +1 -1
  403. package/dist/client-EURRWXPW.js +19 -0
  404. package/dist/code-FKQW7V7N.js +76 -0
  405. package/dist/code-FKQW7V7N.js.map +1 -0
  406. package/dist/companies-MD2MZKU6.js +195 -0
  407. package/dist/companies-MD2MZKU6.js.map +1 -0
  408. package/dist/complete-FCAJM6Z4.js +81 -0
  409. package/dist/complete-FCAJM6Z4.js.map +1 -0
  410. package/dist/config-OZOHIAOJ.js +88 -0
  411. package/dist/config-OZOHIAOJ.js.map +1 -0
  412. package/dist/connect-4YXFMXYX.js +42 -0
  413. package/dist/content-PCGSX2QU.js +85 -0
  414. package/dist/content-PCGSX2QU.js.map +1 -0
  415. package/dist/conversation-UX5NZ3IO.js +93 -0
  416. package/dist/conversation-UX5NZ3IO.js.map +1 -0
  417. package/dist/conversion-report-7QSWB2FY.js +125 -0
  418. package/dist/conversion-report-7QSWB2FY.js.map +1 -0
  419. package/dist/conversion-upload-command-XESIAQPU.js +438 -0
  420. package/dist/conversion-upload-command-XESIAQPU.js.map +1 -0
  421. package/dist/conversion-writes-BGOVLBS5.js +120 -0
  422. package/dist/conversion-writes-BGOVLBS5.js.map +1 -0
  423. package/dist/conversions-IYIWW4O7.js +76 -0
  424. package/dist/conversions-IYIWW4O7.js.map +1 -0
  425. package/dist/conversions-RLIJAE7E.js +135 -0
  426. package/dist/conversions-RLIJAE7E.js.map +1 -0
  427. package/dist/countries-5OBUVLLD.js +82 -0
  428. package/dist/countries-5OBUVLLD.js.map +1 -0
  429. package/dist/create-CUJLJUAQ.js +138 -0
  430. package/dist/create-CUJLJUAQ.js.map +1 -0
  431. package/dist/create-FENOT6DX.js +236 -0
  432. package/dist/create-FENOT6DX.js.map +1 -0
  433. package/dist/create-OFZQMOWO.js +59 -0
  434. package/dist/create-OFZQMOWO.js.map +1 -0
  435. package/dist/create-Z5SS2AWB.js +207 -0
  436. package/dist/create-Z5SS2AWB.js.map +1 -0
  437. package/dist/creatives-UJW2QBLH.js +182 -0
  438. package/dist/creatives-UJW2QBLH.js.map +1 -0
  439. package/dist/creatives-XI2DGQUZ.js +87 -0
  440. package/dist/creatives-XI2DGQUZ.js.map +1 -0
  441. package/dist/creatives-YLXQSROD.js +51 -0
  442. package/dist/creatives-YLXQSROD.js.map +1 -0
  443. package/dist/credentials-CH73QMD2.js +287 -0
  444. package/dist/credentials-CH73QMD2.js.map +1 -0
  445. package/dist/critique-C4WRQ4AJ.js +1449 -0
  446. package/dist/critique-C4WRQ4AJ.js.map +1 -0
  447. package/dist/critique-ZBNJ6MQ3.js +213 -0
  448. package/dist/critique-ZBNJ6MQ3.js.map +1 -0
  449. package/dist/crm-MJTT6GOJ.js +224 -0
  450. package/dist/crm-MJTT6GOJ.js.map +1 -0
  451. package/dist/crm-ZXHSEFYI.js +318 -0
  452. package/dist/crm-ZXHSEFYI.js.map +1 -0
  453. package/dist/crop-B52KIQ4O.js +113 -0
  454. package/dist/crop-B52KIQ4O.js.map +1 -0
  455. package/dist/currency-GGWF5DMU.js +88 -0
  456. package/dist/currency-GGWF5DMU.js.map +1 -0
  457. package/dist/custom-conversions-7WDBTC4X.js +125 -0
  458. package/dist/custom-conversions-7WDBTC4X.js.map +1 -0
  459. package/dist/customers-7E4HBSEY.js +56 -0
  460. package/dist/decide-PK7WNSQ2.js +199 -0
  461. package/dist/decide-PK7WNSQ2.js.map +1 -0
  462. package/dist/delete-56LKNEGA.js +71 -0
  463. package/dist/delete-56LKNEGA.js.map +1 -0
  464. package/dist/delete-DQY4ZSFN.js +54 -0
  465. package/dist/delete-DQY4ZSFN.js.map +1 -0
  466. package/dist/delete-EZ7HHOOD.js +69 -0
  467. package/dist/delete-EZ7HHOOD.js.map +1 -0
  468. package/dist/delete-JV4KAA6Y.js +66 -0
  469. package/dist/delete-JV4KAA6Y.js.map +1 -0
  470. package/dist/delete-YONJW4UZ.js +63 -0
  471. package/dist/delete-YONJW4UZ.js.map +1 -0
  472. package/dist/delete-YSYVFL6W.js +71 -0
  473. package/dist/delete-YSYVFL6W.js.map +1 -0
  474. package/dist/demographics-6N3TTYWC.js +138 -0
  475. package/dist/demographics-6N3TTYWC.js.map +1 -0
  476. package/dist/describe-AAVYIFE3.js +97 -0
  477. package/dist/describe-AAVYIFE3.js.map +1 -0
  478. package/dist/describe-UQFLWVFR.js +97 -0
  479. package/dist/describe-UQFLWVFR.js.map +1 -0
  480. package/dist/dimensions-QDXBG2XC.js +101 -0
  481. package/dist/dimensions-QDXBG2XC.js.map +1 -0
  482. package/dist/discard-S3NGGUSK.js +66 -0
  483. package/dist/discard-S3NGGUSK.js.map +1 -0
  484. package/dist/discover-6TEBPVNC.js +93 -0
  485. package/dist/discover-6TEBPVNC.js.map +1 -0
  486. package/dist/discover-SBZPB7T2.js +172 -0
  487. package/dist/discover-SBZPB7T2.js.map +1 -0
  488. package/dist/domain-AMAR76PB.js +98 -0
  489. package/dist/domain-AMAR76PB.js.map +1 -0
  490. package/dist/download-LV3GPOWV.js +299 -0
  491. package/dist/download-LV3GPOWV.js.map +1 -0
  492. package/dist/draft-6QZ7WMWM.js +217 -0
  493. package/dist/draft-6QZ7WMWM.js.map +1 -0
  494. package/dist/draft-DDFFTZ43.js +233 -0
  495. package/dist/draft-DDFFTZ43.js.map +1 -0
  496. package/dist/draft-FIKJXNIQ.js +281 -0
  497. package/dist/draft-FIKJXNIQ.js.map +1 -0
  498. package/dist/draft-GYGWTMBU.js +307 -0
  499. package/dist/draft-GYGWTMBU.js.map +1 -0
  500. package/dist/draft-KXL62WFS.js +328 -0
  501. package/dist/draft-KXL62WFS.js.map +1 -0
  502. package/dist/draft-N4LFPKTA.js +100 -0
  503. package/dist/draft-N4LFPKTA.js.map +1 -0
  504. package/dist/draft-POSLJCWG.js +306 -0
  505. package/dist/draft-POSLJCWG.js.map +1 -0
  506. package/dist/draft-XPO5RWST.js +103 -0
  507. package/dist/draft-XPO5RWST.js.map +1 -0
  508. package/dist/engine/index.d.ts +213 -127
  509. package/dist/engine/index.js +18 -4
  510. package/dist/{env-4P5HOGNA.js → env-TQ2XS2KY.js} +12 -2
  511. package/dist/env-TQ2XS2KY.js.map +1 -0
  512. package/dist/experiment-FQNKMORZ.js +1397 -0
  513. package/dist/experiment-FQNKMORZ.js.map +1 -0
  514. package/dist/export-4IZQZAPF.js +168 -0
  515. package/dist/export-4IZQZAPF.js.map +1 -0
  516. package/dist/extract-DZMGVQ7D.js +113 -0
  517. package/dist/extract-DZMGVQ7D.js.map +1 -0
  518. package/dist/facets-223V5P47.js +114 -0
  519. package/dist/facets-223V5P47.js.map +1 -0
  520. package/dist/favorites-DD2LNSTG.js +178 -0
  521. package/dist/favorites-DD2LNSTG.js.map +1 -0
  522. package/dist/feed-TUVFNX2U.js +177 -0
  523. package/dist/feed-TUVFNX2U.js.map +1 -0
  524. package/dist/feedback-MIW23MI2.js +66 -0
  525. package/dist/feedback-MIW23MI2.js.map +1 -0
  526. package/dist/feedback-record-RGKRKPGZ.js +175 -0
  527. package/dist/feedback-record-RGKRKPGZ.js.map +1 -0
  528. package/dist/fetch-O6UHNXWB.js +139 -0
  529. package/dist/fetch-O6UHNXWB.js.map +1 -0
  530. package/dist/fetch-TZ4UCMJK.js +176 -0
  531. package/dist/fetch-TZ4UCMJK.js.map +1 -0
  532. package/dist/find-4XKIBF4D.js +134 -0
  533. package/dist/find-4XKIBF4D.js.map +1 -0
  534. package/dist/fit-ODVVXV2Q.js +45 -0
  535. package/dist/fit-ODVVXV2Q.js.map +1 -0
  536. package/dist/flows-HVWBFZ7T.js +247 -0
  537. package/dist/flows-HVWBFZ7T.js.map +1 -0
  538. package/dist/follow-RCOXTZGY.js +94 -0
  539. package/dist/follow-RCOXTZGY.js.map +1 -0
  540. package/dist/follow-competitors-SQ5XBFTK.js +112 -0
  541. package/dist/follow-competitors-SQ5XBFTK.js.map +1 -0
  542. package/dist/following-VDU3BHC4.js +113 -0
  543. package/dist/following-VDU3BHC4.js.map +1 -0
  544. package/dist/fonts-NBIQAVQN.js +34 -0
  545. package/dist/fonts-NBIQAVQN.js.map +1 -0
  546. package/dist/forecast-2GJKBNBM.js +168 -0
  547. package/dist/forecast-2GJKBNBM.js.map +1 -0
  548. package/dist/forecast-76MUJBPO.js +104 -0
  549. package/dist/forecast-76MUJBPO.js.map +1 -0
  550. package/dist/funding-HTFVZLLG.js +85 -0
  551. package/dist/funding-HTFVZLLG.js.map +1 -0
  552. package/dist/funnel-FE2HIRVQ.js +394 -0
  553. package/dist/funnel-FE2HIRVQ.js.map +1 -0
  554. package/dist/ga4-2RC4EH7V.js +55 -0
  555. package/dist/ga4-2RC4EH7V.js.map +1 -0
  556. package/dist/generate-TPDOBCKQ.js +262 -0
  557. package/dist/generate-TPDOBCKQ.js.map +1 -0
  558. package/dist/get-6JNOVI27.js +56 -0
  559. package/dist/get-6JNOVI27.js.map +1 -0
  560. package/dist/get-FH2LIEYL.js +63 -0
  561. package/dist/get-FH2LIEYL.js.map +1 -0
  562. package/dist/get-GZLCDXXW.js +61 -0
  563. package/dist/get-GZLCDXXW.js.map +1 -0
  564. package/dist/get-KVAOPAQW.js +78 -0
  565. package/dist/get-KVAOPAQW.js.map +1 -0
  566. package/dist/get-TSPQYEKC.js +59 -0
  567. package/dist/get-TSPQYEKC.js.map +1 -0
  568. package/dist/get-TY3RXYNZ.js +63 -0
  569. package/dist/get-TY3RXYNZ.js.map +1 -0
  570. package/dist/get-VPW33XTN.js +92 -0
  571. package/dist/get-VPW33XTN.js.map +1 -0
  572. package/dist/gif-JFEYPFFI.js +94 -0
  573. package/dist/gif-JFEYPFFI.js.map +1 -0
  574. package/dist/google-R6RD4L6Z.js +136 -0
  575. package/dist/google-R6RD4L6Z.js.map +1 -0
  576. package/dist/google-VPQNRVIB.js +3190 -0
  577. package/dist/google-VPQNRVIB.js.map +1 -0
  578. package/dist/google-ads-JEQMNNMN.js +195 -0
  579. package/dist/google-ads-JEQMNNMN.js.map +1 -0
  580. package/dist/group-7AV6UL26.js +43 -0
  581. package/dist/group-7AV6UL26.js.map +1 -0
  582. package/dist/group-BVQZEZIC.js +43 -0
  583. package/dist/group-BVQZEZIC.js.map +1 -0
  584. package/dist/gsc-SQ42WAQE.js +30 -0
  585. package/dist/gsc-SQ42WAQE.js.map +1 -0
  586. package/dist/history-BNNHFURR.js +67 -0
  587. package/dist/history-BNNHFURR.js.map +1 -0
  588. package/dist/history-EHUQG4CE.js +133 -0
  589. package/dist/history-EHUQG4CE.js.map +1 -0
  590. package/dist/hubspot-JABE4USC.js +779 -0
  591. package/dist/hubspot-JABE4USC.js.map +1 -0
  592. package/dist/icon-OYTTSNSL.js +137 -0
  593. package/dist/icon-OYTTSNSL.js.map +1 -0
  594. package/dist/ideas-OD76WOQ3.js +32 -0
  595. package/dist/ideas-OD76WOQ3.js.map +1 -0
  596. package/dist/images-LY7AWWBK.js +90 -0
  597. package/dist/images-LY7AWWBK.js.map +1 -0
  598. package/dist/improve-W6GZNT2A.js +86 -0
  599. package/dist/improve-W6GZNT2A.js.map +1 -0
  600. package/dist/ingest-47WON6HT.js +23 -0
  601. package/dist/ingest-47WON6HT.js.map +1 -0
  602. package/dist/ingest-HDGGHBSJ.js +107 -0
  603. package/dist/ingest-HDGGHBSJ.js.map +1 -0
  604. package/dist/insights-IW7LGAWU.js +423 -0
  605. package/dist/insights-IW7LGAWU.js.map +1 -0
  606. package/dist/insights-QH54F56A.js +122 -0
  607. package/dist/insights-QH54F56A.js.map +1 -0
  608. package/dist/inspect-AJLG2HGL.js +189 -0
  609. package/dist/inspect-AJLG2HGL.js.map +1 -0
  610. package/dist/inspiration-RDQ3Y3N3.js +53 -0
  611. package/dist/inspiration-RDQ3Y3N3.js.map +1 -0
  612. package/dist/intent-5GSSCFZ2.js +95 -0
  613. package/dist/intent-5GSSCFZ2.js.map +1 -0
  614. package/dist/job-URVXJP75.js +202 -0
  615. package/dist/job-URVXJP75.js.map +1 -0
  616. package/dist/job-create-S4SECUVF.js +109 -0
  617. package/dist/job-create-S4SECUVF.js.map +1 -0
  618. package/dist/job-status-253SUCTJ.js +74 -0
  619. package/dist/job-status-253SUCTJ.js.map +1 -0
  620. package/dist/keep-GPSYDIGJ.js +78 -0
  621. package/dist/keep-GPSYDIGJ.js.map +1 -0
  622. package/dist/keyword-gap-NTFDX43B.js +130 -0
  623. package/dist/keyword-gap-NTFDX43B.js.map +1 -0
  624. package/dist/keyword-metrics-XSFLMBZX.js +197 -0
  625. package/dist/keyword-metrics-XSFLMBZX.js.map +1 -0
  626. package/dist/keywords-for-site-U4JLYXVE.js +128 -0
  627. package/dist/keywords-for-site-U4JLYXVE.js.map +1 -0
  628. package/dist/landing-AO72EGJ6.js +28 -0
  629. package/dist/landing-AO72EGJ6.js.map +1 -0
  630. package/dist/landings-NEF4PQL2.js +151 -0
  631. package/dist/landings-NEF4PQL2.js.map +1 -0
  632. package/dist/languages-3RDPPPTE.js +55 -0
  633. package/dist/languages-3RDPPPTE.js.map +1 -0
  634. package/dist/languages-CQX3YOIT.js +40 -0
  635. package/dist/languages-CQX3YOIT.js.map +1 -0
  636. package/dist/launches-GBHLJH5S.js +19 -0
  637. package/dist/launches-GBHLJH5S.js.map +1 -0
  638. package/dist/layerize-Q56C6LFG.js +190 -0
  639. package/dist/layerize-Q56C6LFG.js.map +1 -0
  640. package/dist/leads-JHUM6FYR.js +293 -0
  641. package/dist/leads-JHUM6FYR.js.map +1 -0
  642. package/dist/leads-UYZM2XQX.js +90 -0
  643. package/dist/leads-UYZM2XQX.js.map +1 -0
  644. package/dist/learn-D2KBGJHZ.js +203 -0
  645. package/dist/learn-D2KBGJHZ.js.map +1 -0
  646. package/dist/library-6VUFHTEK.js +109 -0
  647. package/dist/library-6VUFHTEK.js.map +1 -0
  648. package/dist/lighthouse-57U2GMPV.js +75 -0
  649. package/dist/lighthouse-57U2GMPV.js.map +1 -0
  650. package/dist/line-item-writes-R5GO6GTL.js +208 -0
  651. package/dist/line-item-writes-R5GO6GTL.js.map +1 -0
  652. package/dist/line-items-RBMH6YBZ.js +103 -0
  653. package/dist/line-items-RBMH6YBZ.js.map +1 -0
  654. package/dist/link-WS2RMCOP.js +64 -0
  655. package/dist/link-WS2RMCOP.js.map +1 -0
  656. package/dist/linkedin-FSIALZTS.js +1008 -0
  657. package/dist/linkedin-FSIALZTS.js.map +1 -0
  658. package/dist/list-2AE2Q4ZD.js +151 -0
  659. package/dist/list-2AE2Q4ZD.js.map +1 -0
  660. package/dist/list-E635Y6M4.js +303 -0
  661. package/dist/list-E635Y6M4.js.map +1 -0
  662. package/dist/list-G57ZO4PG.js +50 -0
  663. package/dist/list-G57ZO4PG.js.map +1 -0
  664. package/dist/list-JCSWZWDI.js +57 -0
  665. package/dist/list-JCSWZWDI.js.map +1 -0
  666. package/dist/list-KT6NXVLV.js +63 -0
  667. package/dist/list-KT6NXVLV.js.map +1 -0
  668. package/dist/list-RINCJOAC.js +76 -0
  669. package/dist/list-RINCJOAC.js.map +1 -0
  670. package/dist/list-SRNXHS6L.js +51 -0
  671. package/dist/list-SRNXHS6L.js.map +1 -0
  672. package/dist/list-YJSO4M5Q.js +65 -0
  673. package/dist/list-YJSO4M5Q.js.map +1 -0
  674. package/dist/locations-HW2Y5OJO.js +67 -0
  675. package/dist/locations-HW2Y5OJO.js.map +1 -0
  676. package/dist/locations-XOHI3VWI.js +40 -0
  677. package/dist/locations-XOHI3VWI.js.map +1 -0
  678. package/dist/log-3HX5BIO6.js +92 -0
  679. package/dist/log-3HX5BIO6.js.map +1 -0
  680. package/dist/logo-KXTGIYBI.js +18 -0
  681. package/dist/logo-KXTGIYBI.js.map +1 -0
  682. package/dist/lookup-X6O5UNJH.js +22 -0
  683. package/dist/lookup-X6O5UNJH.js.map +1 -0
  684. package/dist/make-QH77XOWM.js +633 -0
  685. package/dist/make-QH77XOWM.js.map +1 -0
  686. package/dist/map-QABBPYZM.js +404 -0
  687. package/dist/map-QABBPYZM.js.map +1 -0
  688. package/dist/mcp-HSD3W3OB.js +463 -0
  689. package/dist/mcp-HSD3W3OB.js.map +1 -0
  690. package/dist/media-MI4EE7L4.js +89 -0
  691. package/dist/media-MI4EE7L4.js.map +1 -0
  692. package/dist/media-QUTQOBA7.js +15 -0
  693. package/dist/media-QUTQOBA7.js.map +1 -0
  694. package/dist/media-sources-HO4DXRX5.js +32 -0
  695. package/dist/media-sources-HO4DXRX5.js.map +1 -0
  696. package/dist/members-YEYYJGY6.js +44 -0
  697. package/dist/members-YEYYJGY6.js.map +1 -0
  698. package/dist/meta-E3JOUOSS.js +69 -0
  699. package/dist/meta-E3JOUOSS.js.map +1 -0
  700. package/dist/metrics-HQ7XJAYQ.js +152 -0
  701. package/dist/metrics-HQ7XJAYQ.js.map +1 -0
  702. package/dist/models-PGX3FBHU.js +155 -0
  703. package/dist/models-PGX3FBHU.js.map +1 -0
  704. package/dist/normalize-FPJ6GSOY.js +806 -0
  705. package/dist/normalize-FPJ6GSOY.js.map +1 -0
  706. package/dist/normalize-GSQWN77S.js +141 -0
  707. package/dist/normalize-GSQWN77S.js.map +1 -0
  708. package/dist/options-F5XZMQLK.js +121 -0
  709. package/dist/options-F5XZMQLK.js.map +1 -0
  710. package/dist/output-GQFJ2T5B.js +24 -0
  711. package/dist/output-GQFJ2T5B.js.map +1 -0
  712. package/dist/page-VTTSBC6Y.js +105 -0
  713. package/dist/page-VTTSBC6Y.js.map +1 -0
  714. package/dist/pages-PMZVNVQM.js +66 -0
  715. package/dist/pages-PMZVNVQM.js.map +1 -0
  716. package/dist/performance-G67JQE5J.js +24 -0
  717. package/dist/performance-G67JQE5J.js.map +1 -0
  718. package/dist/pinterest-UDNGOWDM.js +96 -0
  719. package/dist/pinterest-UDNGOWDM.js.map +1 -0
  720. package/dist/pixels-OYZDGCH3.js +108 -0
  721. package/dist/pixels-OYZDGCH3.js.map +1 -0
  722. package/dist/pixels-XKGNTCFX.js +60 -0
  723. package/dist/pixels-XKGNTCFX.js.map +1 -0
  724. package/dist/plan-DZS3TVIJ.js +207 -0
  725. package/dist/plan-DZS3TVIJ.js.map +1 -0
  726. package/dist/preview-DR6MXOGI.js +169 -0
  727. package/dist/preview-DR6MXOGI.js.map +1 -0
  728. package/dist/profile-VOVZG44G.js +159 -0
  729. package/dist/profile-VOVZG44G.js.map +1 -0
  730. package/dist/promoted-tweet-writes-VCK2ADVJ.js +180 -0
  731. package/dist/promoted-tweet-writes-VCK2ADVJ.js.map +1 -0
  732. package/dist/promoted-tweets-4ACBP2RV.js +119 -0
  733. package/dist/promoted-tweets-4ACBP2RV.js.map +1 -0
  734. package/dist/properties-MKVF7MUK.js +101 -0
  735. package/dist/properties-MKVF7MUK.js.map +1 -0
  736. package/dist/publish-6XVA35T6.js +322 -0
  737. package/dist/publish-6XVA35T6.js.map +1 -0
  738. package/dist/query-CNWQ6STR.js +61 -0
  739. package/dist/query-CNWQ6STR.js.map +1 -0
  740. package/dist/query-DBSBZ73C.js +247 -0
  741. package/dist/query-DBSBZ73C.js.map +1 -0
  742. package/dist/query-QK4U4TEL.js +236 -0
  743. package/dist/query-QK4U4TEL.js.map +1 -0
  744. package/dist/questionnaire-OVJWNUVV.js +93 -0
  745. package/dist/questionnaire-OVJWNUVV.js.map +1 -0
  746. package/dist/read-L2QIVJTL.js +141 -0
  747. package/dist/read-L2QIVJTL.js.map +1 -0
  748. package/dist/reddit-SCEB2JQL.js +26 -0
  749. package/dist/reddit-SCEB2JQL.js.map +1 -0
  750. package/dist/refresh-TIH5Y3NP.js +94 -0
  751. package/dist/refresh-TIH5Y3NP.js.map +1 -0
  752. package/dist/release-LKMUKVXM.js +60 -0
  753. package/dist/release-LKMUKVXM.js.map +1 -0
  754. package/dist/relevant-pages-CRI2NLWG.js +99 -0
  755. package/dist/relevant-pages-CRI2NLWG.js.map +1 -0
  756. package/dist/remove-6ABOB7TZ.js +50 -0
  757. package/dist/remove-6ABOB7TZ.js.map +1 -0
  758. package/dist/remove-JKSCGKQG.js +48 -0
  759. package/dist/remove-JKSCGKQG.js.map +1 -0
  760. package/dist/reopen-27TDNXFP.js +63 -0
  761. package/dist/reopen-27TDNXFP.js.map +1 -0
  762. package/dist/rerun-XHECBJD5.js +84 -0
  763. package/dist/rerun-XHECBJD5.js.map +1 -0
  764. package/dist/research-4MOXIMDX.js +62 -0
  765. package/dist/research-4MOXIMDX.js.map +1 -0
  766. package/dist/research-XYXP7D4R.js +262 -0
  767. package/dist/research-XYXP7D4R.js.map +1 -0
  768. package/dist/reset-NLYEBPLX.js +54 -0
  769. package/dist/reset-NLYEBPLX.js.map +1 -0
  770. package/dist/reset-RDQOYBXX.js +54 -0
  771. package/dist/reset-RDQOYBXX.js.map +1 -0
  772. package/dist/resolve-VHKWC5KW.js +121 -0
  773. package/dist/resolve-VHKWC5KW.js.map +1 -0
  774. package/dist/retry-MTQSHXKH.js +60 -0
  775. package/dist/retry-MTQSHXKH.js.map +1 -0
  776. package/dist/retry-ZI5ECSFD.js +62 -0
  777. package/dist/retry-ZI5ECSFD.js.map +1 -0
  778. package/dist/retry-failed-2OYMCB55.js +45 -0
  779. package/dist/retry-failed-2OYMCB55.js.map +1 -0
  780. package/dist/run-BMJJRJL2.js +65 -0
  781. package/dist/run-BMJJRJL2.js.map +1 -0
  782. package/dist/run-IHXS6F5V.js +59 -0
  783. package/dist/run-IHXS6F5V.js.map +1 -0
  784. package/dist/scaffold-ad-QEADKYPL.js +1548 -0
  785. package/dist/scaffold-ad-QEADKYPL.js.map +1 -0
  786. package/dist/scaffold-static-ad-PTJ73ZNF.js +971 -0
  787. package/dist/scaffold-static-ad-PTJ73ZNF.js.map +1 -0
  788. package/dist/scaffold-video-ZQEZRVD6.js +872 -0
  789. package/dist/scaffold-video-ZQEZRVD6.js.map +1 -0
  790. package/dist/schedule-JD2EQJCT.js +61 -0
  791. package/dist/schedule-JD2EQJCT.js.map +1 -0
  792. package/dist/schedule-TLYT5UXM.js +66 -0
  793. package/dist/schedule-TLYT5UXM.js.map +1 -0
  794. package/dist/scheduled-agents-GIVKWTXX.js +49 -0
  795. package/dist/scheduled-agents-GIVKWTXX.js.map +1 -0
  796. package/dist/schema-MZTVCNP4.js +63 -0
  797. package/dist/schema-MZTVCNP4.js.map +1 -0
  798. package/dist/schema-RYTVKPLZ.js +132 -0
  799. package/dist/schema-RYTVKPLZ.js.map +1 -0
  800. package/dist/scrape-T3DA7ER7.js +2241 -0
  801. package/dist/scrape-T3DA7ER7.js.map +1 -0
  802. package/dist/screenshot-EIGC6SZB.js +102 -0
  803. package/dist/screenshot-EIGC6SZB.js.map +1 -0
  804. package/dist/search-2SVUDZIX.js +224 -0
  805. package/dist/search-2SVUDZIX.js.map +1 -0
  806. package/dist/search-34NFJ5F6.js +26 -0
  807. package/dist/search-34NFJ5F6.js.map +1 -0
  808. package/dist/search-AOFAN5NB.js +174 -0
  809. package/dist/search-AOFAN5NB.js.map +1 -0
  810. package/dist/search-BWE3OPOY.js +91 -0
  811. package/dist/search-BWE3OPOY.js.map +1 -0
  812. package/dist/search-EYYAOZND.js +92 -0
  813. package/dist/search-EYYAOZND.js.map +1 -0
  814. package/dist/search-copy-VKQ2OOBM.js +168 -0
  815. package/dist/search-copy-VKQ2OOBM.js.map +1 -0
  816. package/dist/seeds-HQYSVFIX.js +101 -0
  817. package/dist/seeds-HQYSVFIX.js.map +1 -0
  818. package/dist/select-HJMOAWAU.js +94 -0
  819. package/dist/select-HJMOAWAU.js.map +1 -0
  820. package/dist/sends-I7VQFE4S.js +309 -0
  821. package/dist/sends-I7VQFE4S.js.map +1 -0
  822. package/dist/sequences-JHSEJJGN.js +146 -0
  823. package/dist/sequences-JHSEJJGN.js.map +1 -0
  824. package/dist/set-prompt-TSS33JQZ.js +185 -0
  825. package/dist/set-prompt-TSS33JQZ.js.map +1 -0
  826. package/dist/setup-links-IW4BUANK.js +141 -0
  827. package/dist/setup-links-IW4BUANK.js.map +1 -0
  828. package/dist/{shared-J7DQZ2ED.js → shared-AT3FXPAG.js} +8 -6
  829. package/dist/shared-AT3FXPAG.js.map +1 -0
  830. package/dist/shopify-RQKO5TMR.js +3819 -0
  831. package/dist/shopify-RQKO5TMR.js.map +1 -0
  832. package/dist/site-3NU2BDAR.js +177 -0
  833. package/dist/site-3NU2BDAR.js.map +1 -0
  834. package/dist/sitemaps-FG37N5EB.js +87 -0
  835. package/dist/sitemaps-FG37N5EB.js.map +1 -0
  836. package/dist/sites-FIXK4Y3O.js +101 -0
  837. package/dist/sites-FIXK4Y3O.js.map +1 -0
  838. package/dist/skills-OKVCVQVD.js +47 -0
  839. package/dist/skills-OKVCVQVD.js.map +1 -0
  840. package/dist/sources-SEODRUIC.js +30 -0
  841. package/dist/sources-SEODRUIC.js.map +1 -0
  842. package/dist/sources-Z6BGTBGO.js +421 -0
  843. package/dist/sources-Z6BGTBGO.js.map +1 -0
  844. package/dist/stale-SWPDWXG7.js +63 -0
  845. package/dist/stale-SWPDWXG7.js.map +1 -0
  846. package/dist/stats-ZWZ7BAHV.js +34 -0
  847. package/dist/stats-ZWZ7BAHV.js.map +1 -0
  848. package/dist/status-7Y7UNSO6.js +62 -0
  849. package/dist/status-7Y7UNSO6.js.map +1 -0
  850. package/dist/sticker-FLRZM3BI.js +94 -0
  851. package/dist/sticker-FLRZM3BI.js.map +1 -0
  852. package/dist/stock-2CSMWRWV.js +179 -0
  853. package/dist/stock-2CSMWRWV.js.map +1 -0
  854. package/dist/studio-TTTR6N7D.js +49 -0
  855. package/dist/studio-TTTR6N7D.js.map +1 -0
  856. package/dist/sync-FH773IFH.js +54 -0
  857. package/dist/sync-FH773IFH.js.map +1 -0
  858. package/dist/sync-G5CS2RYV.js +54 -0
  859. package/dist/sync-G5CS2RYV.js.map +1 -0
  860. package/dist/sync-UADA6M33.js +265 -0
  861. package/dist/sync-UADA6M33.js.map +1 -0
  862. package/dist/sync-definition-77KLGPMA.js +52 -0
  863. package/dist/sync-definition-77KLGPMA.js.map +1 -0
  864. package/dist/tag-manager-NK3ZHSJB.js +43 -0
  865. package/dist/tag-manager-NK3ZHSJB.js.map +1 -0
  866. package/dist/tags-ANGHHLAC.js +20 -0
  867. package/dist/tags-ANGHHLAC.js.map +1 -0
  868. package/dist/tags-DKPUSQTJ.js +20 -0
  869. package/dist/tags-DKPUSQTJ.js.map +1 -0
  870. package/dist/tags-HSCV4ZAQ.js +20 -0
  871. package/dist/tags-HSCV4ZAQ.js.map +1 -0
  872. package/dist/tags-J3RMQEQM.js +26 -0
  873. package/dist/tags-J3RMQEQM.js.map +1 -0
  874. package/dist/tags-VZGTR3VJ.js +224 -0
  875. package/dist/tags-VZGTR3VJ.js.map +1 -0
  876. package/dist/targeting-constants-ZGBX3VWU.js +118 -0
  877. package/dist/targeting-constants-ZGBX3VWU.js.map +1 -0
  878. package/dist/targeting-criteria-BSG3CLHU.js +113 -0
  879. package/dist/targeting-criteria-BSG3CLHU.js.map +1 -0
  880. package/dist/targets-DVOAFYZQ.js +102 -0
  881. package/dist/targets-DVOAFYZQ.js.map +1 -0
  882. package/dist/templates-KJ5O44FF.js +178 -0
  883. package/dist/templates-KJ5O44FF.js.map +1 -0
  884. package/dist/testimonials-NB7V3DUO.js +32 -0
  885. package/dist/testimonials-NB7V3DUO.js.map +1 -0
  886. package/dist/themes-3RV3HNNE.js +94 -0
  887. package/dist/themes-3RV3HNNE.js.map +1 -0
  888. package/dist/top-companies-KRB3OZOT.js +108 -0
  889. package/dist/top-companies-KRB3OZOT.js.map +1 -0
  890. package/dist/translate-5FP32BIA.js +598 -0
  891. package/dist/translate-5FP32BIA.js.map +1 -0
  892. package/dist/triggers-EURHTCYC.js +141 -0
  893. package/dist/triggers-EURHTCYC.js.map +1 -0
  894. package/dist/tweets-X64YDEAA.js +123 -0
  895. package/dist/tweets-X64YDEAA.js.map +1 -0
  896. package/dist/unfollow-PIONCSBL.js +46 -0
  897. package/dist/unfollow-PIONCSBL.js.map +1 -0
  898. package/dist/unlink-HVVTZ3MB.js +67 -0
  899. package/dist/unlink-HVVTZ3MB.js.map +1 -0
  900. package/dist/unstage-BJJ5M7MK.js +95 -0
  901. package/dist/unstage-BJJ5M7MK.js.map +1 -0
  902. package/dist/unstage-Y7ZE3NUJ.js +84 -0
  903. package/dist/unstage-Y7ZE3NUJ.js.map +1 -0
  904. package/dist/update-3IP7FB6Y.js +98 -0
  905. package/dist/update-3IP7FB6Y.js.map +1 -0
  906. package/dist/update-CSDSK5NO.js +63 -0
  907. package/dist/update-CSDSK5NO.js.map +1 -0
  908. package/dist/update-FGJXVDB7.js +142 -0
  909. package/dist/update-FGJXVDB7.js.map +1 -0
  910. package/dist/update-MF7LY2OT.js +155 -0
  911. package/dist/update-MF7LY2OT.js.map +1 -0
  912. package/dist/upload-DDPI7KJV.js +126 -0
  913. package/dist/upload-DDPI7KJV.js.map +1 -0
  914. package/dist/upload-IWFYKD7A.js +150 -0
  915. package/dist/upload-IWFYKD7A.js.map +1 -0
  916. package/dist/upscale-EYCEYRWE.js +109 -0
  917. package/dist/upscale-EYCEYRWE.js.map +1 -0
  918. package/dist/url-options-RA3XISLN.js +130 -0
  919. package/dist/url-options-RA3XISLN.js.map +1 -0
  920. package/dist/url-params-SN4APXCK.js +98 -0
  921. package/dist/url-params-SN4APXCK.js.map +1 -0
  922. package/dist/use-E2TA2K6J.js +95 -0
  923. package/dist/use-E2TA2K6J.js.map +1 -0
  924. package/dist/validate-W52JOEXI.js +88 -0
  925. package/dist/validate-W52JOEXI.js.map +1 -0
  926. package/dist/variant-ETHB6XUM.js +338 -0
  927. package/dist/variant-ETHB6XUM.js.map +1 -0
  928. package/dist/videos-653WAFPG.js +39 -0
  929. package/dist/videos-653WAFPG.js.map +1 -0
  930. package/dist/view-BVEZRRV2.js +121 -0
  931. package/dist/view-BVEZRRV2.js.map +1 -0
  932. package/dist/viewer-check-W4ICSBHO.js +68 -0
  933. package/dist/viewer-check-W4ICSBHO.js.map +1 -0
  934. package/dist/web-JWIGFGIU.js +140 -0
  935. package/dist/web-JWIGFGIU.js.map +1 -0
  936. package/dist/winners-MJDKCGEZ.js +113 -0
  937. package/dist/winners-MJDKCGEZ.js.map +1 -0
  938. package/dist/winning-ads-O3IMUGGO.js +84 -0
  939. package/dist/winning-ads-O3IMUGGO.js.map +1 -0
  940. package/dist/write-commands-DA6FIFAO.js +737 -0
  941. package/dist/write-commands-DA6FIFAO.js.map +1 -0
  942. package/dist/write-commands-EMN2WENA.js +1015 -0
  943. package/dist/write-commands-EMN2WENA.js.map +1 -0
  944. package/dist/write-commands-KTPISQRE.js +206 -0
  945. package/dist/write-commands-KTPISQRE.js.map +1 -0
  946. package/dist/write-commands-QBGIWU27.js +713 -0
  947. package/dist/write-commands-QBGIWU27.js.map +1 -0
  948. package/dist/x-BT3SNCTU.js +47 -0
  949. package/dist/x-BT3SNCTU.js.map +1 -0
  950. package/package.json +9 -2
  951. package/dist/chunk-CHJOTJTZ.js +0 -9989
  952. package/dist/chunk-CHJOTJTZ.js.map +0 -1
  953. package/dist/chunk-HJEMOSPH.js +0 -1292
  954. package/dist/chunk-HJEMOSPH.js.map +0 -1
  955. package/dist/chunk-MF7YA62W.js.map +0 -1
  956. package/dist/chunk-VLUGGVJL.js.map +0 -1
  957. package/dist/chunk-VZEDAFAR.js.map +0 -1
  958. package/dist/chunk-XHC4LMK4.js.map +0 -1
  959. package/dist/client-GR6YL3YX.js +0 -17
  960. package/dist/output-NMQXZF3Z.js +0 -18
  961. /package/dist/{client-GR6YL3YX.js.map → chunk-YQSBHWOI.js.map} +0 -0
  962. /package/dist/{env-4P5HOGNA.js.map → client-EURRWXPW.js.map} +0 -0
  963. /package/dist/{output-NMQXZF3Z.js.map → connect-4YXFMXYX.js.map} +0 -0
  964. /package/dist/{shared-J7DQZ2ED.js.map → customers-7E4HBSEY.js.map} +0 -0
@@ -0,0 +1 @@
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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I,KAAK;AACzB,MAAI,YAAY,GAAI,QAAO;AAC3B,MAAI,QAAQ,SAAS,iBAAkB,QAAO,8BAA8B,gBAAgB;AAC5F,MAAI,CAAC,aAAa,KAAK,OAAO,GAAG;AAC/B,WAAO,IAAI,OAAO;AAAA,EACpB;AACA,MAAI,uBAAuB,SAAS,OAAO,EAAG,QAAO,IAAI,OAAO;AAChE,SAAO;AACT;AAMO,SAAS,kBAAkB,KAA4B;AAC5D,MAAI,cAAc,GAAG,EAAG,QAAO;AAC/B,QAAM,MAAM,cAAc,GAAG;AAC7B,MAAI,QAAQ,MAAM;AAChB,WAAO,IAAI,GAAG,0DAA0D,mBAAmB,KAAK,IAAI,CAAC;AAAA,EACvG;AACA,SAAO,mBAAmB,GAAG;AAC/B;;;AC3IA,IAAM,UAAU;AAGT,SAAS,UAAU,MAAsB;AAC9C,SAAO,KAAK,IAAI;AAClB;AAGO,SAAS,iBAAiB,UAA4B;AAC3D,QAAM,OAAiB,CAAC;AACxB,aAAW,SAAS,SAAS,SAAS,OAAO,GAAG;AAC9C,UAAM,QAAQ,MAAM,CAAC,KAAK,IAAI,KAAK;AACnC,QAAI,SAAS,MAAM,CAAC,KAAK,SAAS,IAAI,EAAG,MAAK,KAAK,IAAI;AAAA,EACzD;AACA,SAAO;AACT;","names":[]}
@@ -0,0 +1,363 @@
1
+ import {
2
+ MAX_VIDEO_INGEST_BYTES,
3
+ MAX_VIDEO_INGEST_SECONDS,
4
+ directDedupeKey,
5
+ downloadTimeoutMs,
6
+ isDirectMediaUrl,
7
+ isDrmProtected,
8
+ isRegionBlocked,
9
+ isToolingOrBlockFailure,
10
+ refuseByDuration,
11
+ resolveIngestSource,
12
+ worthDownloadingInstead
13
+ } from "./chunk-FKOECEVC.js";
14
+ import {
15
+ YtDlpError,
16
+ canonicalUrl,
17
+ durationSeconds,
18
+ isAudioOnly,
19
+ isVimeoAuthFailure,
20
+ probeYtDlp,
21
+ runYtDlp,
22
+ ytDlpBlockSignal
23
+ } from "./chunk-W4SA4CMR.js";
24
+ import {
25
+ videosIngestRequestSchema
26
+ } from "./chunk-O6XZIQXZ.js";
27
+ import {
28
+ ApiError,
29
+ apiPost
30
+ } from "./chunk-CUL3VB4L.js";
31
+ import {
32
+ captureVimeoCookie,
33
+ isProxyFailure
34
+ } from "./chunk-I4FTS5EE.js";
35
+ import {
36
+ registerSchema,
37
+ writeJson
38
+ } from "./chunk-MYTDK3AL.js";
39
+
40
+ // src/commands/videos/ingest.ts
41
+ import { mkdtemp, rm, stat } from "fs/promises";
42
+ import { tmpdir } from "os";
43
+ import path from "path";
44
+ import { defineCommand } from "citty";
45
+
46
+ // src/lib/streamUpload.ts
47
+ import { createHash } from "crypto";
48
+ import { createReadStream } from "fs";
49
+ import { Readable } from "stream";
50
+ import { pipeline } from "stream/promises";
51
+ async function hashFile(filePath) {
52
+ const hash = createHash("sha256");
53
+ await pipeline(createReadStream(filePath), hash);
54
+ return hash.digest("hex");
55
+ }
56
+ async function putFileStreamed(args) {
57
+ const body = Readable.toWeb(createReadStream(args.filePath));
58
+ return await fetch(args.putUrl, {
59
+ method: "PUT",
60
+ body,
61
+ headers: {
62
+ "Content-Type": args.contentType,
63
+ "Content-Length": String(args.sizeBytes)
64
+ },
65
+ duplex: "half"
66
+ });
67
+ }
68
+
69
+ // src/commands/videos/ingest.ts
70
+ registerSchema({
71
+ command: "videos.ingest",
72
+ description: "Add a video to the library from a URL \u2014 a direct file, or a YouTube/TikTok/Vimeo page.",
73
+ args: {
74
+ url: { type: "string", description: "Video URL (direct file or a watch/post page)", required: true },
75
+ source: { type: "string", description: "Provenance: url | youtube", required: false },
76
+ "external-id": { type: "string", description: "Provider asset id (deduped on)", required: false },
77
+ "external-url": { type: "string", description: "Canonical page URL", required: false },
78
+ download: {
79
+ type: "boolean",
80
+ description: "Force the download path instead of letting Baker fetch the URL directly",
81
+ required: false,
82
+ default: false
83
+ },
84
+ country: {
85
+ type: "string",
86
+ description: "Two-letter country to fetch from (e.g. US, DE, JP) \u2014 use when a video is blocked in your region",
87
+ required: false
88
+ },
89
+ context: {
90
+ type: "string",
91
+ description: "What you know that the video cannot show \u2014 the campaign, whether the person on camera is a real customer, what it is for. Highest-leverage flag here: it is what makes the clip findable later.",
92
+ required: false
93
+ },
94
+ "dry-run": { type: "boolean", description: "Preview the operation without executing", required: false }
95
+ }
96
+ });
97
+ var ingestCommand = defineCommand({
98
+ meta: {
99
+ name: "ingest",
100
+ description: "Add a video to the library from a URL. A direct file URL is handed straight to Baker, which fetches it. A page URL (YouTube, TikTok, Vimeo, Instagram) is downloaded here first, then uploaded \u2014 and a direct URL that Baker cannot fetch falls back to that same path automatically.\n\nExample: baker videos ingest https://www.youtube.com/watch?v=abc123"
101
+ },
102
+ args: {
103
+ url: { type: "positional", description: "Video URL", required: false },
104
+ source: { type: "string", description: "Provenance: url | youtube", required: false },
105
+ "external-id": { type: "string", description: "Provider asset id", required: false },
106
+ "external-url": { type: "string", description: "Canonical page URL", required: false },
107
+ download: { type: "boolean", description: "Force the download path", required: false, default: false },
108
+ country: { type: "string", description: "Two-letter country to fetch from, e.g. US", required: false },
109
+ context: {
110
+ type: "string",
111
+ description: "Context for the analysis \u2014 campaign, who is on camera, intended use",
112
+ required: false
113
+ },
114
+ "dry-run": { type: "boolean", description: "Preview without executing", required: false, default: false }
115
+ },
116
+ run: ({ args }) => runVideoIngest({
117
+ url: args.url,
118
+ source: args.source,
119
+ externalId: args["external-id"],
120
+ externalUrl: args["external-url"],
121
+ forceDownload: args.download === true,
122
+ country: args.country,
123
+ context: args.context,
124
+ dryRun: args["dry-run"] === true
125
+ })
126
+ });
127
+ async function runVideoIngest(opts) {
128
+ const url = opts.url;
129
+ if (!url) {
130
+ writeJson({ ok: false, error: { code: "VALIDATION_ERROR", message: "URL is required" } });
131
+ process.exit(1);
132
+ }
133
+ const direct = !opts.forceDownload && isDirectMediaUrl(url);
134
+ const country = opts.country?.trim() || void 0;
135
+ const args = {
136
+ url,
137
+ source: resolveIngestSource(opts.source, url),
138
+ externalId: opts.externalId,
139
+ // Deliberately NOT pre-filled with the pasted URL. Doing so shadowed the
140
+ // canonical URL the probe resolves (`?? canonicalUrl(...)` below could never
141
+ // run), so the same video filed under a different `externalUrl` depending on
142
+ // whether the link was copied from a share sheet, a shorts page or the
143
+ // address bar. `downloadThenIngest` falls back to `args.url` when the probe
144
+ // resolves nothing, which is the value this used to hard-code.
145
+ externalUrl: opts.externalUrl,
146
+ descriptionContext: opts.context?.trim() || void 0
147
+ };
148
+ const validation = videosIngestRequestSchema.safeParse({ ...args, url });
149
+ if (!validation.success) {
150
+ const problem = validation.error.issues[0];
151
+ writeJson({
152
+ ok: false,
153
+ error: {
154
+ code: "VALIDATION_ERROR",
155
+ message: problem ? `${problem.path.join(".") || "request"}: ${problem.message}` : "Invalid request"
156
+ }
157
+ });
158
+ process.exit(1);
159
+ }
160
+ if (opts.dryRun) {
161
+ reportDryRun(args, direct, country);
162
+ return;
163
+ }
164
+ try {
165
+ const data = await ingestByRoute(args, direct, country);
166
+ writeJson({ ok: true, data, hints: ingestHints(data) });
167
+ } catch (err) {
168
+ reportIngestFailure(err);
169
+ }
170
+ }
171
+ function ingestHints(data) {
172
+ if (data.reducedQuality !== true) return void 0;
173
+ return [
174
+ "Added, but at standard quality (360p): the site refused to release the full-quality file and this was the best it would hand over. Tell the user \u2014 the clip is in the library and usable, it is just not high-resolution. If they need the crisp version, ask them for the original file and use `baker videos upload <file>`."
175
+ ];
176
+ }
177
+ function reportDryRun(args, direct, country) {
178
+ writeJson({
179
+ ok: true,
180
+ dryRun: true,
181
+ operation: "videos.ingest",
182
+ params: {
183
+ url: args.url,
184
+ source: args.source,
185
+ // Known up front on the direct route, because it is derived from the URL
186
+ // alone. The download route's key comes from the probe, which a dry run
187
+ // does not perform, so there it stays null rather than becoming a guess.
188
+ externalId: args.externalId ?? (direct ? directDedupeKey(args.source, args.url) : null),
189
+ // A page URL's canonical form is only known after the probe, which a dry
190
+ // run does not perform — so this is null rather than a guess.
191
+ externalUrl: args.externalUrl ?? null,
192
+ direct,
193
+ country: country ?? null,
194
+ descriptionContext: args.descriptionContext ?? null
195
+ }
196
+ });
197
+ }
198
+ async function ingestByRoute(args, direct, country) {
199
+ if (!direct) {
200
+ return { ...await downloadThenIngest(args, country), via: "download" };
201
+ }
202
+ try {
203
+ const externalId = args.externalId ?? directDedupeKey(args.source, args.url);
204
+ return { ...await ingestUrl({ ...args, externalId }), via: "direct" };
205
+ } catch (err) {
206
+ if (!(err instanceof ApiError) || !worthDownloadingInstead(err.code)) throw err;
207
+ return { ...await downloadThenIngest(args, country), via: "download", fallbackFrom: err.message };
208
+ }
209
+ }
210
+ function reportYtDlpFailure(err) {
211
+ const detail = `${err.stderrTail} ${err.message}`;
212
+ if (isProxyFailure(ytDlpBlockSignal(detail))) {
213
+ fail(
214
+ "Couldn't download that video: our connection to the internet was refused.",
215
+ "This is Baker's egress proxy, not the link \u2014 its credentials look wrong or expired. The link is probably fine. Report it; retrying won't help until the proxy is fixed."
216
+ );
217
+ }
218
+ if (isDrmProtected(detail)) {
219
+ fail(
220
+ "That video is copy-protected, so it can't be added to the library.",
221
+ "The publisher encrypted this one against downloading. Nothing will change that \u2014 not retrying, not a different region. Ask whoever owns the video for the original file and add it with `baker videos upload <file>`."
222
+ );
223
+ }
224
+ if (isVimeoAuthFailure(detail)) {
225
+ fail(
226
+ "Vimeo wouldn't hand over that video \u2014 Baker isn't signed in to Vimeo.",
227
+ "Vimeo now refuses anonymous downloads entirely, so this needs a signed-in session and the one Baker holds has either expired or was never set. Nothing is wrong with the link. Report it so the Vimeo cookie can be refreshed; meanwhile download the file and use `baker videos upload <file>`."
228
+ );
229
+ }
230
+ if (isRegionBlocked(detail)) {
231
+ fail(
232
+ `That video isn't available in the region we're fetching from. ${err.stderrTail || err.message}`,
233
+ "Re-run with `--country <two-letter code>` for a country where the video plays \u2014 e.g. `--country US`. Pick the one the video belongs to (the uploader's country is the usual answer); each attempt costs a paid connection, so choose rather than work through the list."
234
+ );
235
+ }
236
+ fail(
237
+ `Couldn't download that video. ${err.stderrTail || err.message}`,
238
+ isToolingOrBlockFailure(detail) ? "The site wouldn't hand over the video \u2014 usually the downloader being out of date against a site that changed, or the request being blocked. Retrying won't help, and the link is probably fine. Report it so the tool can be updated; meanwhile download the file and use `baker videos upload <file>`." : "Check the link is public and playable. Private or age-restricted videos can't be downloaded \u2014 download the file yourself and use `baker videos upload <file>`."
239
+ );
240
+ }
241
+ function fail(message, fix, code = "INGEST_FAILED") {
242
+ writeJson({ ok: false, error: { code, message, fix } });
243
+ process.exit(1);
244
+ }
245
+ function reportIngestFailure(err) {
246
+ if (err instanceof ApiError) {
247
+ writeJson({ ok: false, error: { code: err.code, message: err.message } });
248
+ process.exit(1);
249
+ }
250
+ if (err instanceof YtDlpError) reportYtDlpFailure(err);
251
+ const detail = err instanceof Error ? err.message : String(err);
252
+ if (detail.includes("timed out after")) {
253
+ fail(
254
+ "That video took too long to download and was stopped part-way.",
255
+ "Long or slow-serving videos can outrun the download window. Try a shorter clip, or download this one yourself and use `baker videos upload <file>`.",
256
+ "INTERNAL_ERROR"
257
+ );
258
+ }
259
+ fail(
260
+ `Couldn't add that video. ${detail}`,
261
+ "This is a fault on Baker's side, not a problem with the link. Report it.",
262
+ "INTERNAL_ERROR"
263
+ );
264
+ }
265
+ function dedupeKey(args, info) {
266
+ const id = typeof info.id === "string" ? info.id : void 0;
267
+ if (!id) return void 0;
268
+ if (info.extractor === "generic") return `${args.source}:${canonicalUrl(info) ?? args.url}`;
269
+ return `${args.source}:${id}`;
270
+ }
271
+ function ingestUrl(args) {
272
+ const body = {
273
+ url: args.url,
274
+ source: args.source
275
+ };
276
+ if (args.externalId) body.externalId = args.externalId;
277
+ if (args.externalUrl) body.externalUrl = args.externalUrl;
278
+ if (args.descriptionContext) body.descriptionContext = args.descriptionContext;
279
+ return apiPost("/api/videos/ingest", body);
280
+ }
281
+ async function downloadThenIngest(args, country) {
282
+ const vimeoCookie = captureVimeoCookie();
283
+ const workDir = await mkdtemp(path.join(tmpdir(), "videos-ingest-"));
284
+ try {
285
+ const probe = await probeYtDlp({ url: args.url, country, vimeoCookie, cookieDir: workDir });
286
+ if (isAudioOnly(probe.info)) {
287
+ throw new ApiError(
288
+ "VALIDATION_ERROR",
289
+ "That link is audio, not video, so it can't go in the video library. Music and podcast links have no picture to store."
290
+ );
291
+ }
292
+ const tooLong = refuseByDuration(durationSeconds(probe.info), MAX_VIDEO_INGEST_SECONDS);
293
+ if (tooLong) {
294
+ throw new ApiError("VALIDATION_ERROR", tooLong);
295
+ }
296
+ const externalId = args.externalId ?? dedupeKey(args, probe.info);
297
+ const { filePath, tier, reducedQuality } = await runYtDlp({
298
+ url: args.url,
299
+ audioOnly: false,
300
+ workDir,
301
+ // Deliberately uncapped: take the best the site will release and let Mux
302
+ // decide what to serve. The 1080p ceiling this replaces was reasoning
303
+ // about the wrong cost — it saved download bytes by throwing away source
304
+ // pixels *before* the one system that can make renditions from them ever
305
+ // saw them, so a 4K master became a 1080p master permanently, for
306
+ // everything the library is ever asked to do with that clip afterwards.
307
+ // Downscaling is Mux's job and it is cheap; re-acquiring a master is not.
308
+ country,
309
+ vimeoCookie,
310
+ // Budgeted from the probed length, so the duration we accept and the time
311
+ // we allow to fetch it cannot drift apart.
312
+ timeoutMs: downloadTimeoutMs(durationSeconds(probe.info))
313
+ });
314
+ const stats = await stat(filePath);
315
+ if (stats.size > MAX_VIDEO_INGEST_BYTES) {
316
+ throw new ApiError(
317
+ "VALIDATION_ERROR",
318
+ `That video is ${(stats.size / 1024 ** 3).toFixed(1)} GB, over the ${Math.round(MAX_VIDEO_INGEST_BYTES / 1024 ** 3)} GB limit for this route.`
319
+ );
320
+ }
321
+ const publicUrl = await uploadToAssetStore(filePath, stats.size);
322
+ return {
323
+ ...await ingestUrl({
324
+ ...args,
325
+ url: publicUrl,
326
+ externalId,
327
+ externalUrl: args.externalUrl ?? canonicalUrl(probe.info) ?? args.url
328
+ }),
329
+ egress: tier,
330
+ // Named in the result for the same reason `egress` is: a geo-targeted exit
331
+ // is a deliberate, billable choice and must not be invisible afterwards.
332
+ ...country ? { country } : {},
333
+ // Third member of the same family. The site refused the good formats and
334
+ // the download quietly took the one it would release, which is the right
335
+ // call — but a clip that is 360p because of that must say so here, or the
336
+ // only way to find out is to watch it.
337
+ ...reducedQuality ? { reducedQuality: true } : {}
338
+ };
339
+ } finally {
340
+ await rm(workDir, { recursive: true, force: true }).catch(() => {
341
+ });
342
+ }
343
+ }
344
+ async function uploadToAssetStore(filePath, sizeBytes) {
345
+ const sha256 = await hashFile(filePath);
346
+ const { putUrl, publicUrl } = await apiPost("/api/canvas/assets/presign", {
347
+ sha256,
348
+ mime: "video/mp4",
349
+ purpose: "source"
350
+ });
351
+ const putRes = await putFileStreamed({ putUrl, filePath, contentType: "video/mp4", sizeBytes });
352
+ if (!putRes.ok) {
353
+ throw new ApiError("INTERNAL_ERROR", `Storing the downloaded video failed: HTTP ${putRes.status}`);
354
+ }
355
+ return publicUrl;
356
+ }
357
+
358
+ export {
359
+ ingestCommand,
360
+ runVideoIngest,
361
+ ingestHints
362
+ };
363
+ //# sourceMappingURL=chunk-EI5QN4UO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/videos/ingest.ts","../src/lib/streamUpload.ts"],"sourcesContent":["import { mkdtemp, rm, stat } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport path from \"node:path\";\nimport { type VideosIngestRequest, type VideosIngestResponse, videosIngestRequestSchema } from \"@baker/api\";\nimport { isProxyFailure } from \"@baker/proxy\";\nimport { defineCommand } from \"citty\";\nimport { ApiError, apiPost } from \"../../client.ts\";\nimport { captureVimeoCookie } from \"../../env.ts\";\nimport { hashFile, putFileStreamed } from \"../../lib/streamUpload.ts\";\nimport { isVimeoAuthFailure } from \"../../lib/vimeoCookie.ts\";\nimport {\n canonicalUrl,\n durationSeconds,\n isAudioOnly,\n probeYtDlp,\n runYtDlp,\n YtDlpError,\n type YtDlpInfo,\n} from \"../../lib/ytDlp.ts\";\nimport { ytDlpBlockSignal } from \"../../lib/ytDlpSignal.ts\";\nimport { writeJson } from \"../../output.ts\";\nimport { registerSchema } from \"../../schemas.ts\";\nimport {\n directDedupeKey,\n downloadTimeoutMs,\n isDirectMediaUrl,\n isDrmProtected,\n isRegionBlocked,\n isToolingOrBlockFailure,\n MAX_VIDEO_INGEST_BYTES,\n MAX_VIDEO_INGEST_SECONDS,\n refuseByDuration,\n resolveIngestSource,\n worthDownloadingInstead,\n} from \"./ingestUrl.ts\";\n\nregisterSchema({\n command: \"videos.ingest\",\n description: \"Add a video to the library from a URL — a direct file, or a YouTube/TikTok/Vimeo page.\",\n args: {\n url: { type: \"string\", description: \"Video URL (direct file or a watch/post page)\", required: true },\n source: { type: \"string\", description: \"Provenance: url | youtube\", required: false },\n \"external-id\": { type: \"string\", description: \"Provider asset id (deduped on)\", required: false },\n \"external-url\": { type: \"string\", description: \"Canonical page URL\", required: false },\n download: {\n type: \"boolean\",\n description: \"Force the download path instead of letting Baker fetch the URL directly\",\n required: false,\n default: false,\n },\n country: {\n type: \"string\",\n description: \"Two-letter country to fetch from (e.g. US, DE, JP) — use when a video is blocked in your region\",\n required: false,\n },\n context: {\n type: \"string\",\n description:\n \"What you know that the video cannot show — the campaign, whether the person on camera is a real customer, what it is for. Highest-leverage flag here: it is what makes the clip findable later.\",\n required: false,\n },\n \"dry-run\": { type: \"boolean\", description: \"Preview the operation without executing\", required: false },\n },\n});\n\nexport const ingestCommand = defineCommand({\n meta: {\n name: \"ingest\",\n description:\n \"Add a video to the library from a URL. A direct file URL is handed straight to Baker, which fetches it. A page URL (YouTube, TikTok, Vimeo, Instagram) is downloaded here first, then uploaded — and a direct URL that Baker cannot fetch falls back to that same path automatically.\\n\\nExample: baker videos ingest https://www.youtube.com/watch?v=abc123\",\n },\n args: {\n url: { type: \"positional\", description: \"Video URL\", required: false },\n source: { type: \"string\", description: \"Provenance: url | youtube\", required: false },\n \"external-id\": { type: \"string\", description: \"Provider asset id\", required: false },\n \"external-url\": { type: \"string\", description: \"Canonical page URL\", required: false },\n download: { type: \"boolean\", description: \"Force the download path\", required: false, default: false },\n country: { type: \"string\", description: \"Two-letter country to fetch from, e.g. US\", required: false },\n context: {\n type: \"string\",\n description: \"Context for the analysis — campaign, who is on camera, intended use\",\n required: false,\n },\n \"dry-run\": { type: \"boolean\", description: \"Preview without executing\", required: false, default: false },\n },\n run: ({ args }) =>\n runVideoIngest({\n url: args.url as string | undefined,\n source: args.source as string | undefined,\n externalId: args[\"external-id\"] as string | undefined,\n externalUrl: args[\"external-url\"] as string | undefined,\n forceDownload: args.download === true,\n country: args.country as string | undefined,\n context: args.context as string | undefined,\n dryRun: args[\"dry-run\"] === true,\n }),\n});\n\nexport type VideoIngestOptions = {\n url: string | undefined;\n source?: string;\n externalId?: string;\n externalUrl?: string;\n forceDownload?: boolean;\n country?: string;\n /** What the adder knew that the frames cannot show. Feeds the analysis. */\n context?: string;\n dryRun?: boolean;\n};\n\n/**\n * The ingest flow itself, callable from `videos ingest` and from the URL branch\n * of `videos upload` — one implementation, so the two verbs cannot drift.\n */\nexport async function runVideoIngest(opts: VideoIngestOptions): Promise<void> {\n const url = opts.url;\n if (!url) {\n writeJson({ ok: false, error: { code: \"VALIDATION_ERROR\", message: \"URL is required\" } });\n process.exit(1);\n }\n\n const direct = !opts.forceDownload && isDirectMediaUrl(url);\n const country = opts.country?.trim() || undefined;\n const args: IngestArgs = {\n url,\n source: resolveIngestSource(opts.source, url),\n externalId: opts.externalId,\n // Deliberately NOT pre-filled with the pasted URL. Doing so shadowed the\n // canonical URL the probe resolves (`?? canonicalUrl(...)` below could never\n // run), so the same video filed under a different `externalUrl` depending on\n // whether the link was copied from a share sheet, a shorts page or the\n // address bar. `downloadThenIngest` falls back to `args.url` when the probe\n // resolves nothing, which is the value this used to hard-code.\n externalUrl: opts.externalUrl,\n descriptionContext: opts.context?.trim() || undefined,\n };\n\n // Checked here as well as at the route, because the download path ends by\n // posting this same body: a bad `--source` caught only server-side would\n // otherwise be discovered twice, the second time after downloading the video.\n const validation = videosIngestRequestSchema.safeParse({ ...args, url });\n if (!validation.success) {\n const problem = validation.error.issues[0];\n writeJson({\n ok: false,\n error: {\n code: \"VALIDATION_ERROR\",\n message: problem ? `${problem.path.join(\".\") || \"request\"}: ${problem.message}` : \"Invalid request\",\n },\n });\n process.exit(1);\n }\n\n if (opts.dryRun) {\n reportDryRun(args, direct, country);\n return;\n }\n\n try {\n const data = await ingestByRoute(args, direct, country);\n writeJson({ ok: true, data, hints: ingestHints(data) });\n } catch (err) {\n reportIngestFailure(err);\n }\n}\n\n/**\n * The successful ingest as the caller receives it.\n *\n * Named rather than left as a `Record<string, unknown>` so the fields that only\n * *sometimes* appear are still a checked contract. `reducedQuality` is the one\n * that needs it: nothing else reads it, `ingestHints` is the only thing that\n * acts on it, and an untyped bag would let either side be renamed with the\n * tests still green and the hint silently never firing again.\n */\nexport type IngestReport = VideosIngestResponse & {\n via: \"direct\" | \"download\";\n egress?: string;\n country?: string;\n reducedQuality?: true;\n fallbackFrom?: string;\n};\n\n/**\n * What the caller has to be told about a download that already succeeded.\n *\n * The recovery itself is deliberately invisible — nobody asks for a retry, and\n * a video that arrives is a video that arrived. What must not be invisible is\n * the price the recovery paid, because it is the one thing looking at the\n * result cannot reveal: a 360p clip and a 1080p clip are the same successful\n * envelope. Written for whoever reads the JSON to repeat to a marketer, so it\n * says \"standard quality\", not which player answered.\n */\nexport function ingestHints(data: IngestReport): string[] | undefined {\n if (data.reducedQuality !== true) return undefined;\n return [\n \"Added, but at standard quality (360p): the site refused to release the full-quality file and this was the best it would hand over. Tell the user — the clip is in the library and usable, it is just not high-resolution. If they need the crisp version, ask them for the original file and use `baker videos upload <file>`.\",\n ];\n}\n\nfunction reportDryRun(args: IngestArgs, direct: boolean, country?: string): void {\n writeJson({\n ok: true,\n dryRun: true,\n operation: \"videos.ingest\",\n params: {\n url: args.url,\n source: args.source,\n // Known up front on the direct route, because it is derived from the URL\n // alone. The download route's key comes from the probe, which a dry run\n // does not perform, so there it stays null rather than becoming a guess.\n externalId: args.externalId ?? (direct ? directDedupeKey(args.source, args.url) : null),\n // A page URL's canonical form is only known after the probe, which a dry\n // run does not perform — so this is null rather than a guess.\n externalUrl: args.externalUrl ?? null,\n direct,\n country: country ?? null,\n descriptionContext: args.descriptionContext ?? null,\n },\n });\n}\n\n/**\n * A direct media URL is handed straight over: Baker asks Mux to pull it, so no\n * bytes cross this machine and there is no size ceiling to hit. Only when that\n * is refused do we pay to download and re-upload the file ourselves.\n */\nasync function ingestByRoute(args: IngestArgs, direct: boolean, country?: string): Promise<IngestReport> {\n if (!direct) {\n return { ...(await downloadThenIngest(args, country)), via: \"download\" };\n }\n try {\n // Defaulted here rather than on `args`, so that the fallback below still\n // derives its key from the probe: a URL that turns out to be a page carries\n // a real provider id, which dedupes better than the link it was pasted as.\n const externalId = args.externalId ?? directDedupeKey(args.source, args.url);\n return { ...(await ingestUrl({ ...args, externalId })), via: \"direct\" };\n } catch (err) {\n if (!(err instanceof ApiError) || !worthDownloadingInstead(err.code)) throw err;\n return { ...(await downloadThenIngest(args, country)), via: \"download\", fallbackFrom: err.message };\n }\n}\n\n/**\n * Turn a yt-dlp failure into the one sentence that names its actual cause.\n *\n * Split out from `reportIngestFailure` because the list of distinguishable\n * causes kept growing — proxy, DRM, Vimeo login, region, stale extractor — and\n * each one exists because the generic message sent the reader somewhere useless.\n * Order matters and is not alphabetical: DRM and region both also emit phrases\n * the stale-extractor branch would match, so the specific cases are asked first.\n */\nfunction reportYtDlpFailure(err: YtDlpError): never {\n const detail = `${err.stderrTail} ${err.message}`;\n\n // Our own egress failing is not the site's fault and not the link's. Saying\n // otherwise sends whoever reads this to check a video that was never the\n // problem, while the real cause — a rotated proxy credential — stays hidden.\n if (isProxyFailure(ytDlpBlockSignal(detail))) {\n fail(\n \"Couldn't download that video: our connection to the internet was refused.\",\n \"This is Baker's egress proxy, not the link — its credentials look wrong or expired. The link is probably fine. Report it; retrying won't help until the proxy is fixed.\",\n );\n }\n if (isDrmProtected(detail)) {\n fail(\n \"That video is copy-protected, so it can't be added to the library.\",\n \"The publisher encrypted this one against downloading. Nothing will change that — not retrying, not a different region. Ask whoever owns the video for the original file and add it with `baker videos upload <file>`.\",\n );\n }\n if (isVimeoAuthFailure(detail)) {\n fail(\n \"Vimeo wouldn't hand over that video — Baker isn't signed in to Vimeo.\",\n \"Vimeo now refuses anonymous downloads entirely, so this needs a signed-in session and the one Baker holds has either expired or was never set. Nothing is wrong with the link. Report it so the Vimeo cookie can be refreshed; meanwhile download the file and use `baker videos upload <file>`.\",\n );\n }\n if (isRegionBlocked(detail)) {\n fail(\n `That video isn't available in the region we're fetching from. ${err.stderrTail || err.message}`,\n \"Re-run with `--country <two-letter code>` for a country where the video plays — e.g. `--country US`. Pick the one the video belongs to (the uploader's country is the usual answer); each attempt costs a paid connection, so choose rather than work through the list.\",\n );\n }\n fail(\n `Couldn't download that video. ${err.stderrTail || err.message}`,\n isToolingOrBlockFailure(detail)\n ? \"The site wouldn't hand over the video — usually the downloader being out of date against a site that changed, or the request being blocked. Retrying won't help, and the link is probably fine. Report it so the tool can be updated; meanwhile download the file and use `baker videos upload <file>`.\"\n : \"Check the link is public and playable. Private or age-restricted videos can't be downloaded — download the file yourself and use `baker videos upload <file>`.\",\n );\n}\n\n/** Emit an ingest failure envelope and stop. */\nfunction fail(message: string, fix: string, code = \"INGEST_FAILED\"): never {\n writeJson({ ok: false, error: { code, message, fix } });\n process.exit(1);\n}\n\nfunction reportIngestFailure(err: unknown): never {\n if (err instanceof ApiError) {\n writeJson({ ok: false, error: { code: err.code, message: err.message } });\n process.exit(1);\n }\n if (err instanceof YtDlpError) reportYtDlpFailure(err);\n\n // Say what actually went wrong. \"Unexpected error\" was worse than unhelpful:\n // a download that outran its leash throws a plain `Error`, lands here, and had\n // its only diagnostic thrown away — so a predictable timeout on a long video\n // was indistinguishable from a genuine crash.\n const detail = err instanceof Error ? err.message : String(err);\n if (detail.includes(\"timed out after\")) {\n fail(\n \"That video took too long to download and was stopped part-way.\",\n \"Long or slow-serving videos can outrun the download window. Try a shorter clip, or download this one yourself and use `baker videos upload <file>`.\",\n \"INTERNAL_ERROR\",\n );\n }\n fail(\n `Couldn't add that video. ${detail}`,\n \"This is a fault on Baker's side, not a problem with the link. Report it.\",\n \"INTERNAL_ERROR\",\n );\n}\n\ntype IngestArgs = {\n url: string;\n source: string;\n externalId?: string;\n externalUrl?: string;\n descriptionContext?: string;\n};\n\n/**\n * A dedupe key that identifies this exact video and nothing else.\n *\n * yt-dlp's per-platform extractors return a real provider id, which is what we\n * want: the same YouTube clip pasted three ways dedupes to one row. Its\n * *generic* extractor does not — it returns the URL's basename, so two unrelated\n * files both named `demo.mp4` would produce `url:demo` and the second ingest\n * would \"succeed\" by handing back the first one's clip. A wrong hit is worse\n * than a missed one here: a duplicate costs a transcode, while a collision\n * silently returns the wrong video under a successful-looking response.\n *\n * So the generic case is keyed on the canonical URL, which is unique by\n * construction and still dedupes re-pastes of the same link exactly as intended.\n */\nfunction dedupeKey(args: IngestArgs, info: YtDlpInfo): string | undefined {\n const id = typeof info.id === \"string\" ? info.id : undefined;\n if (!id) return undefined;\n if (info.extractor === \"generic\") return `${args.source}:${canonicalUrl(info) ?? args.url}`;\n return `${args.source}:${id}`;\n}\n\nfunction ingestUrl(args: IngestArgs): Promise<VideosIngestResponse> {\n const body: VideosIngestRequest = {\n url: args.url,\n source: args.source as VideosIngestRequest[\"source\"],\n };\n if (args.externalId) body.externalId = args.externalId;\n if (args.externalUrl) body.externalUrl = args.externalUrl;\n if (args.descriptionContext) body.descriptionContext = args.descriptionContext;\n return apiPost<VideosIngestResponse>(\"/api/videos/ingest\", body);\n}\n\n/**\n * Download the media with yt-dlp, park it in R2, then ingest that URL.\n *\n * The extra hop is what makes a page URL work at all: Mux can only pull a media\n * file, and a watch page is not one. It is also the only route for a CDN that\n * serves us but refuses Mux — YouTube's file URLs, for instance, are bound to\n * the IP that requested them, so handing one to Mux would 403.\n */\nasync function downloadThenIngest(\n args: IngestArgs,\n country?: string,\n): Promise<VideosIngestResponse & { egress: string; country?: string; reducedQuality?: true }> {\n const vimeoCookie = captureVimeoCookie();\n // The work dir is created before the probe, not after, because the probe needs\n // somewhere to put the cookie jar — Vimeo refuses metadata anonymously too.\n const workDir = await mkdtemp(path.join(tmpdir(), \"videos-ingest-\"));\n\n try {\n // Metadata first, because both of the decisions it settles are decisions we\n // used to make only after paying for the download.\n const probe = await probeYtDlp({ url: args.url, country, vimeoCookie, cookieDir: workDir });\n\n if (isAudioOnly(probe.info)) {\n throw new ApiError(\n \"VALIDATION_ERROR\",\n \"That link is audio, not video, so it can't go in the video library. Music and podcast links have no picture to store.\",\n );\n }\n\n const tooLong = refuseByDuration(durationSeconds(probe.info), MAX_VIDEO_INGEST_SECONDS);\n if (tooLong) {\n throw new ApiError(\"VALIDATION_ERROR\", tooLong);\n }\n\n // Prefer yt-dlp's own id: re-pasting the same link then dedupes instead of\n // paying Mux to transcode and transcribe the same video twice. Read from the\n // probe rather than from the download's info.json only because the probe has\n // already run — the dedupe itself still happens at the route, after the file\n // has been fetched. Skipping the download on a known id needs a lookup the\n // API does not expose yet; `ingestFromUrlInternal` short-circuits on\n // `externalId` before calling Mux, so the hook for it exists.\n const externalId = args.externalId ?? dedupeKey(args, probe.info);\n\n const { filePath, tier, reducedQuality } = await runYtDlp({\n url: args.url,\n audioOnly: false,\n workDir,\n // Deliberately uncapped: take the best the site will release and let Mux\n // decide what to serve. The 1080p ceiling this replaces was reasoning\n // about the wrong cost — it saved download bytes by throwing away source\n // pixels *before* the one system that can make renditions from them ever\n // saw them, so a 4K master became a 1080p master permanently, for\n // everything the library is ever asked to do with that clip afterwards.\n // Downscaling is Mux's job and it is cheap; re-acquiring a master is not.\n country,\n vimeoCookie,\n // Budgeted from the probed length, so the duration we accept and the time\n // we allow to fetch it cannot drift apart.\n timeoutMs: downloadTimeoutMs(durationSeconds(probe.info)),\n });\n\n const stats = await stat(filePath);\n if (stats.size > MAX_VIDEO_INGEST_BYTES) {\n throw new ApiError(\n \"VALIDATION_ERROR\",\n `That video is ${(stats.size / 1024 ** 3).toFixed(1)} GB, over the ${Math.round(MAX_VIDEO_INGEST_BYTES / 1024 ** 3)} GB limit for this route.`,\n );\n }\n\n const publicUrl = await uploadToAssetStore(filePath, stats.size);\n\n // `url` becomes the stored copy, so the original has to survive as\n // `externalUrl` — otherwise a direct link that fell back to this route\n // leaves the library with no record of where the clip came from.\n // `egress` names the rung that produced the bytes. A paid exit costing real\n // money must never be spent invisibly — without this the only difference\n // between a free download and a residential one is the wall clock.\n return {\n ...(await ingestUrl({\n ...args,\n url: publicUrl,\n externalId,\n externalUrl: args.externalUrl ?? canonicalUrl(probe.info) ?? args.url,\n })),\n egress: tier,\n // Named in the result for the same reason `egress` is: a geo-targeted exit\n // is a deliberate, billable choice and must not be invisible afterwards.\n ...(country ? { country } : {}),\n // Third member of the same family. The site refused the good formats and\n // the download quietly took the one it would release, which is the right\n // call — but a clip that is 360p because of that must say so here, or the\n // only way to find out is to watch it.\n ...(reducedQuality ? { reducedQuality: true } : {}),\n };\n } finally {\n await rm(workDir, { recursive: true, force: true }).catch(() => {\n // best-effort cleanup — the sandbox is disposable\n });\n }\n}\n\n/**\n * Park a downloaded file in R2 via the canvas asset presign route and return the\n * public URL.\n *\n * Streamed from disk in both passes — hashing and uploading — so a long video\n * costs one buffer rather than twice its own length in RAM. It reads the file\n * twice because the presign needs the sha before the PUT can start, which is a\n * cheap trade against holding gigabytes in memory to avoid the second read.\n */\nasync function uploadToAssetStore(filePath: string, sizeBytes: number): Promise<string> {\n const sha256 = await hashFile(filePath);\n const { putUrl, publicUrl } = await apiPost<{ putUrl: string; publicUrl: string }>(\"/api/canvas/assets/presign\", {\n sha256,\n mime: \"video/mp4\",\n purpose: \"source\",\n });\n\n const putRes = await putFileStreamed({ putUrl, filePath, contentType: \"video/mp4\", sizeBytes });\n if (!putRes.ok) {\n throw new ApiError(\"INTERNAL_ERROR\", `Storing the downloaded video failed: HTTP ${putRes.status}`);\n }\n return publicUrl;\n}\n","import { createHash } from \"node:crypto\";\nimport { createReadStream } from \"node:fs\";\nimport { Readable } from \"node:stream\";\nimport { pipeline } from \"node:stream/promises\";\n\n/**\n * Move a file to object storage without ever holding it in memory.\n *\n * The reason this exists rather than `readFile` + `fetch`: a video is the one\n * asset whose size is set by someone else. Reading it into a Buffer costs its\n * full length in RAM, and handing that Buffer to `new Uint8Array(...)` copies it\n * again — measured, not assumed: `new Uint8Array(buf)` does not alias, so peak\n * usage was twice the file. On an 8 GB Runtime that puts the real ceiling near\n * 3-4 GB of *video*, well under the size a 4K master or a long recording\n * reaches, and the failure mode is an OOM kill with no error to report.\n *\n * Streaming makes peak memory a fixed chunk regardless of length, which is what\n * lets the size limit be a policy decision instead of a memory one.\n */\n\n/** sha256 of a file's contents, read in chunks. */\nexport async function hashFile(filePath: string): Promise<string> {\n const hash = createHash(\"sha256\");\n await pipeline(createReadStream(filePath), hash);\n return hash.digest(\"hex\");\n}\n\n/**\n * PUT a file to a presigned URL, streaming from disk.\n *\n * `content-length` is mandatory and comes from the caller's `stat`: a stream\n * body would otherwise be sent chunked, which S3-compatible presigned PUTs\n * reject. `duplex: \"half\"` is required by undici whenever the body is a stream.\n */\nexport async function putFileStreamed(args: {\n putUrl: string;\n filePath: string;\n contentType: string;\n sizeBytes: number;\n}): Promise<Response> {\n // `toWeb` rather than handing `fetch` the Node stream directly: undici accepts\n // both, but only the web stream is a `BodyInit`, so this stays type-safe\n // instead of needing a cast that would hide a real mistake later.\n const body = Readable.toWeb(createReadStream(args.filePath)) as ReadableStream<Uint8Array>;\n\n return await fetch(args.putUrl, {\n method: \"PUT\",\n body,\n headers: {\n \"Content-Type\": args.contentType,\n \"Content-Length\": String(args.sizeBytes),\n },\n duplex: \"half\",\n } as RequestInit & { duplex: \"half\" });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SA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iB,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAAA,IACnD;AAAA,EACF,UAAE;AACA,UAAM,GAAG,SAAS,EAAE,WAAW,MAAM,OAAO,KAAK,CAAC,EAAE,MAAM,MAAM;AAAA,IAEhE,CAAC;AAAA,EACH;AACF;AAWA,eAAe,mBAAmB,UAAkB,WAAoC;AACtF,QAAM,SAAS,MAAM,SAAS,QAAQ;AACtC,QAAM,EAAE,QAAQ,UAAU,IAAI,MAAM,QAA+C,8BAA8B;AAAA,IAC/G;AAAA,IACA,MAAM;AAAA,IACN,SAAS;AAAA,EACX,CAAC;AAED,QAAM,SAAS,MAAM,gBAAgB,EAAE,QAAQ,UAAU,aAAa,aAAa,UAAU,CAAC;AAC9F,MAAI,CAAC,OAAO,IAAI;AACd,UAAM,IAAI,SAAS,kBAAkB,6CAA6C,OAAO,MAAM,EAAE;AAAA,EACnG;AACA,SAAO;AACT;","names":[]}
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ApiError,
3
3
  apiGet
4
- } from "./chunk-MF7YA62W.js";
4
+ } from "./chunk-CUL3VB4L.js";
5
5
  import {
6
6
  getEnv
7
- } from "./chunk-HJEMOSPH.js";
7
+ } from "./chunk-I4FTS5EE.js";
8
8
 
9
9
  // src/error-handler.ts
10
10
  var REQUEST_CONNECTION_PLATFORM = {
@@ -153,6 +153,12 @@ function writeJsonEnvelope(envelope) {
153
153
  process.stdout.write(`${JSON.stringify(envelope, null, 2)}
154
154
  `);
155
155
  }
156
+ var TABLE_OUTPUT_FORMATS = ["json", "csv", "jsonl", "md"];
157
+ function outputFormatRefusal(format, supported) {
158
+ if (supported.includes(format)) return null;
159
+ const list = supported.length > 1 ? `${supported.slice(0, -1).join(", ")} or ${supported.at(-1)}` : supported.join("");
160
+ return `--output ${format} is not supported \u2014 use ${list}`;
161
+ }
156
162
  function toCsvRow(values) {
157
163
  return values.map((v) => {
158
164
  if (v.includes(",") || v.includes('"') || v.includes("\n")) {
@@ -288,14 +294,16 @@ export {
288
294
  getQueryTtl,
289
295
  buildQueryCacheKey,
290
296
  getManagerIdForCustomer,
291
- connectionFixExplanation,
292
- handleConnectionError,
293
- isNotConnectedError,
294
- needsConnectionFix,
295
297
  writeAdsJson,
296
298
  writeJsonEnvelope,
299
+ TABLE_OUTPUT_FORMATS,
300
+ outputFormatRefusal,
297
301
  toCsvRow,
298
302
  writeAdsOutput,
299
- resolveCustomerId
303
+ resolveCustomerId,
304
+ connectionFixExplanation,
305
+ handleConnectionError,
306
+ isNotConnectedError,
307
+ needsConnectionFix
300
308
  };
301
- //# sourceMappingURL=chunk-XHC4LMK4.js.map
309
+ //# sourceMappingURL=chunk-EIGXX6KI.js.map