attio-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (644) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/LICENSE +236 -0
  3. package/README.md +105 -0
  4. package/dist/api/attio-client.d.ts +25 -0
  5. package/dist/api/attio-client.d.ts.map +1 -0
  6. package/dist/api/attio-client.js +64 -0
  7. package/dist/api/attio-client.js.map +1 -0
  8. package/dist/api/attribute-types.d.ts +119 -0
  9. package/dist/api/attribute-types.d.ts.map +1 -0
  10. package/dist/api/attribute-types.js +320 -0
  11. package/dist/api/attribute-types.js.map +1 -0
  12. package/dist/api/client.d.ts +3 -0
  13. package/dist/api/client.d.ts.map +1 -0
  14. package/dist/api/client.js +61 -0
  15. package/dist/api/client.js.map +1 -0
  16. package/dist/api/operations/batch.d.ts +55 -0
  17. package/dist/api/operations/batch.d.ts.map +1 -0
  18. package/dist/api/operations/batch.js +176 -0
  19. package/dist/api/operations/batch.js.map +1 -0
  20. package/dist/api/operations/crud.d.ts +61 -0
  21. package/dist/api/operations/crud.d.ts.map +1 -0
  22. package/dist/api/operations/crud.js +192 -0
  23. package/dist/api/operations/crud.js.map +1 -0
  24. package/dist/api/operations/index.d.ts +14 -0
  25. package/dist/api/operations/index.d.ts.map +1 -0
  26. package/dist/api/operations/index.js +18 -0
  27. package/dist/api/operations/index.js.map +1 -0
  28. package/dist/api/operations/lists.d.ts +66 -0
  29. package/dist/api/operations/lists.d.ts.map +1 -0
  30. package/dist/api/operations/lists.js +300 -0
  31. package/dist/api/operations/lists.js.map +1 -0
  32. package/dist/api/operations/notes.d.ts +29 -0
  33. package/dist/api/operations/notes.d.ts.map +1 -0
  34. package/dist/api/operations/notes.js +63 -0
  35. package/dist/api/operations/notes.js.map +1 -0
  36. package/dist/api/operations/retry.d.ts +48 -0
  37. package/dist/api/operations/retry.d.ts.map +1 -0
  38. package/dist/api/operations/retry.js +98 -0
  39. package/dist/api/operations/retry.js.map +1 -0
  40. package/dist/api/operations/search.d.ts +37 -0
  41. package/dist/api/operations/search.d.ts.map +1 -0
  42. package/dist/api/operations/search.js +186 -0
  43. package/dist/api/operations/search.js.map +1 -0
  44. package/dist/api/operations/tasks.d.ts +20 -0
  45. package/dist/api/operations/tasks.d.ts.map +1 -0
  46. package/dist/api/operations/tasks.js +87 -0
  47. package/dist/api/operations/tasks.js.map +1 -0
  48. package/dist/api/operations/types.d.ts +61 -0
  49. package/dist/api/operations/types.d.ts.map +1 -0
  50. package/dist/api/operations/types.js +10 -0
  51. package/dist/api/operations/types.js.map +1 -0
  52. package/dist/cli/commands/attributes.d.ts +34 -0
  53. package/dist/cli/commands/attributes.d.ts.map +1 -0
  54. package/dist/cli/commands/attributes.js +171 -0
  55. package/dist/cli/commands/attributes.js.map +1 -0
  56. package/dist/cli/discover.d.ts +3 -0
  57. package/dist/cli/discover.d.ts.map +1 -0
  58. package/dist/cli/discover.js +72 -0
  59. package/dist/cli/discover.js.map +1 -0
  60. package/dist/errors/api-errors.d.ts +191 -0
  61. package/dist/errors/api-errors.d.ts.map +1 -0
  62. package/dist/errors/api-errors.js +305 -0
  63. package/dist/errors/api-errors.js.map +1 -0
  64. package/dist/errors/company-errors.d.ts +40 -0
  65. package/dist/errors/company-errors.d.ts.map +1 -0
  66. package/dist/errors/company-errors.js +62 -0
  67. package/dist/errors/company-errors.js.map +1 -0
  68. package/dist/errors/value-match-error.d.ts +15 -0
  69. package/dist/errors/value-match-error.d.ts.map +1 -0
  70. package/dist/errors/value-match-error.js +40 -0
  71. package/dist/errors/value-match-error.js.map +1 -0
  72. package/dist/handlers/error-interceptor.d.ts +6 -0
  73. package/dist/handlers/error-interceptor.d.ts.map +1 -0
  74. package/dist/handlers/error-interceptor.js +17 -0
  75. package/dist/handlers/error-interceptor.js.map +1 -0
  76. package/dist/handlers/rate-limited-handler.d.ts +17 -0
  77. package/dist/handlers/rate-limited-handler.d.ts.map +1 -0
  78. package/dist/handlers/rate-limited-handler.js +126 -0
  79. package/dist/handlers/rate-limited-handler.js.map +1 -0
  80. package/dist/handlers/resources.d.ts +11 -0
  81. package/dist/handlers/resources.d.ts.map +1 -0
  82. package/dist/handlers/resources.js +109 -0
  83. package/dist/handlers/resources.js.map +1 -0
  84. package/dist/handlers/tool-configs/companies/attributes.d.ts +85 -0
  85. package/dist/handlers/tool-configs/companies/attributes.d.ts.map +1 -0
  86. package/dist/handlers/tool-configs/companies/attributes.js +203 -0
  87. package/dist/handlers/tool-configs/companies/attributes.js.map +1 -0
  88. package/dist/handlers/tool-configs/companies/batch.d.ts +145 -0
  89. package/dist/handlers/tool-configs/companies/batch.d.ts.map +1 -0
  90. package/dist/handlers/tool-configs/companies/batch.js +249 -0
  91. package/dist/handlers/tool-configs/companies/batch.js.map +1 -0
  92. package/dist/handlers/tool-configs/companies/crud.d.ts +103 -0
  93. package/dist/handlers/tool-configs/companies/crud.d.ts.map +1 -0
  94. package/dist/handlers/tool-configs/companies/crud.js +157 -0
  95. package/dist/handlers/tool-configs/companies/crud.js.map +1 -0
  96. package/dist/handlers/tool-configs/companies/definitions.d.ts +5 -0
  97. package/dist/handlers/tool-configs/companies/definitions.d.ts.map +1 -0
  98. package/dist/handlers/tool-configs/companies/definitions.js +9 -0
  99. package/dist/handlers/tool-configs/companies/definitions.js.map +1 -0
  100. package/dist/handlers/tool-configs/companies/formatters.d.ts +42 -0
  101. package/dist/handlers/tool-configs/companies/formatters.d.ts.map +1 -0
  102. package/dist/handlers/tool-configs/companies/formatters.js +324 -0
  103. package/dist/handlers/tool-configs/companies/formatters.js.map +1 -0
  104. package/dist/handlers/tool-configs/companies/index.d.ts +642 -0
  105. package/dist/handlers/tool-configs/companies/index.d.ts.map +1 -0
  106. package/dist/handlers/tool-configs/companies/index.js +86 -0
  107. package/dist/handlers/tool-configs/companies/index.js.map +1 -0
  108. package/dist/handlers/tool-configs/companies/notes.d.ts +61 -0
  109. package/dist/handlers/tool-configs/companies/notes.d.ts.map +1 -0
  110. package/dist/handlers/tool-configs/companies/notes.js +109 -0
  111. package/dist/handlers/tool-configs/companies/notes.js.map +1 -0
  112. package/dist/handlers/tool-configs/companies/relationships.d.ts +137 -0
  113. package/dist/handlers/tool-configs/companies/relationships.d.ts.map +1 -0
  114. package/dist/handlers/tool-configs/companies/relationships.js +163 -0
  115. package/dist/handlers/tool-configs/companies/relationships.js.map +1 -0
  116. package/dist/handlers/tool-configs/companies/search.d.ts +101 -0
  117. package/dist/handlers/tool-configs/companies/search.d.ts.map +1 -0
  118. package/dist/handlers/tool-configs/companies/search.js +163 -0
  119. package/dist/handlers/tool-configs/companies/search.js.map +1 -0
  120. package/dist/handlers/tool-configs/companies/types.d.ts +6 -0
  121. package/dist/handlers/tool-configs/companies/types.d.ts.map +1 -0
  122. package/dist/handlers/tool-configs/companies/types.js +2 -0
  123. package/dist/handlers/tool-configs/companies/types.js.map +1 -0
  124. package/dist/handlers/tool-configs/index.d.ts +12 -0
  125. package/dist/handlers/tool-configs/index.d.ts.map +1 -0
  126. package/dist/handlers/tool-configs/index.js +12 -0
  127. package/dist/handlers/tool-configs/index.js.map +1 -0
  128. package/dist/handlers/tool-configs/lists.d.ts +459 -0
  129. package/dist/handlers/tool-configs/lists.d.ts.map +1 -0
  130. package/dist/handlers/tool-configs/lists.js +597 -0
  131. package/dist/handlers/tool-configs/lists.js.map +1 -0
  132. package/dist/handlers/tool-configs/paginated-people.d.ts +197 -0
  133. package/dist/handlers/tool-configs/paginated-people.d.ts.map +1 -0
  134. package/dist/handlers/tool-configs/paginated-people.js +256 -0
  135. package/dist/handlers/tool-configs/paginated-people.js.map +1 -0
  136. package/dist/handlers/tool-configs/people/activity-search.d.ts +98 -0
  137. package/dist/handlers/tool-configs/people/activity-search.d.ts.map +1 -0
  138. package/dist/handlers/tool-configs/people/activity-search.js +113 -0
  139. package/dist/handlers/tool-configs/people/activity-search.js.map +1 -0
  140. package/dist/handlers/tool-configs/people/advanced-search.d.ts +62 -0
  141. package/dist/handlers/tool-configs/people/advanced-search.d.ts.map +1 -0
  142. package/dist/handlers/tool-configs/people/advanced-search.js +74 -0
  143. package/dist/handlers/tool-configs/people/advanced-search.js.map +1 -0
  144. package/dist/handlers/tool-configs/people/crud.d.ts +63 -0
  145. package/dist/handlers/tool-configs/people/crud.d.ts.map +1 -0
  146. package/dist/handlers/tool-configs/people/crud.js +71 -0
  147. package/dist/handlers/tool-configs/people/crud.js.map +1 -0
  148. package/dist/handlers/tool-configs/people/date-search.d.ts +42 -0
  149. package/dist/handlers/tool-configs/people/date-search.d.ts.map +1 -0
  150. package/dist/handlers/tool-configs/people/date-search.js +93 -0
  151. package/dist/handlers/tool-configs/people/date-search.js.map +1 -0
  152. package/dist/handlers/tool-configs/people/formatters.d.ts +19 -0
  153. package/dist/handlers/tool-configs/people/formatters.d.ts.map +1 -0
  154. package/dist/handlers/tool-configs/people/formatters.js +98 -0
  155. package/dist/handlers/tool-configs/people/formatters.js.map +1 -0
  156. package/dist/handlers/tool-configs/people/index.d.ts +407 -0
  157. package/dist/handlers/tool-configs/people/index.d.ts.map +1 -0
  158. package/dist/handlers/tool-configs/people/index.js +30 -0
  159. package/dist/handlers/tool-configs/people/index.js.map +1 -0
  160. package/dist/handlers/tool-configs/people/notes.d.ts +38 -0
  161. package/dist/handlers/tool-configs/people/notes.d.ts.map +1 -0
  162. package/dist/handlers/tool-configs/people/notes.js +57 -0
  163. package/dist/handlers/tool-configs/people/notes.js.map +1 -0
  164. package/dist/handlers/tool-configs/people/relationships.d.ts +112 -0
  165. package/dist/handlers/tool-configs/people/relationships.d.ts.map +1 -0
  166. package/dist/handlers/tool-configs/people/relationships.js +173 -0
  167. package/dist/handlers/tool-configs/people/relationships.js.map +1 -0
  168. package/dist/handlers/tool-configs/people/search.d.ts +53 -0
  169. package/dist/handlers/tool-configs/people/search.d.ts.map +1 -0
  170. package/dist/handlers/tool-configs/people/search.js +61 -0
  171. package/dist/handlers/tool-configs/people/search.js.map +1 -0
  172. package/dist/handlers/tool-configs/people-fix-complete.d.ts +6 -0
  173. package/dist/handlers/tool-configs/people-fix-complete.d.ts.map +1 -0
  174. package/dist/handlers/tool-configs/people-fix-complete.js +76 -0
  175. package/dist/handlers/tool-configs/people-fix-complete.js.map +1 -0
  176. package/dist/handlers/tool-configs/people-fixed.d.ts +12 -0
  177. package/dist/handlers/tool-configs/people-fixed.d.ts.map +1 -0
  178. package/dist/handlers/tool-configs/people-fixed.js +58 -0
  179. package/dist/handlers/tool-configs/people-fixed.js.map +1 -0
  180. package/dist/handlers/tool-configs/people-types.d.ts +32 -0
  181. package/dist/handlers/tool-configs/people-types.d.ts.map +1 -0
  182. package/dist/handlers/tool-configs/people-types.js +5 -0
  183. package/dist/handlers/tool-configs/people-types.js.map +1 -0
  184. package/dist/handlers/tool-configs/people.d.ts +599 -0
  185. package/dist/handlers/tool-configs/people.d.ts.map +1 -0
  186. package/dist/handlers/tool-configs/people.js +817 -0
  187. package/dist/handlers/tool-configs/people.js.map +1 -0
  188. package/dist/handlers/tool-configs/prompts.d.ts +69 -0
  189. package/dist/handlers/tool-configs/prompts.d.ts.map +1 -0
  190. package/dist/handlers/tool-configs/prompts.js +90 -0
  191. package/dist/handlers/tool-configs/prompts.js.map +1 -0
  192. package/dist/handlers/tool-configs/rate-limited-people.d.ts +203 -0
  193. package/dist/handlers/tool-configs/rate-limited-people.d.ts.map +1 -0
  194. package/dist/handlers/tool-configs/rate-limited-people.js +44 -0
  195. package/dist/handlers/tool-configs/rate-limited-people.js.map +1 -0
  196. package/dist/handlers/tool-configs/records/index.d.ts +282 -0
  197. package/dist/handlers/tool-configs/records/index.d.ts.map +1 -0
  198. package/dist/handlers/tool-configs/records/index.js +277 -0
  199. package/dist/handlers/tool-configs/records/index.js.map +1 -0
  200. package/dist/handlers/tool-configs/records.d.ts +282 -0
  201. package/dist/handlers/tool-configs/records.d.ts.map +1 -0
  202. package/dist/handlers/tool-configs/records.js +277 -0
  203. package/dist/handlers/tool-configs/records.js.map +1 -0
  204. package/dist/handlers/tool-configs/resource-specific-tools.d.ts +15 -0
  205. package/dist/handlers/tool-configs/resource-specific-tools.d.ts.map +1 -0
  206. package/dist/handlers/tool-configs/resource-specific-tools.js +33 -0
  207. package/dist/handlers/tool-configs/resource-specific-tools.js.map +1 -0
  208. package/dist/handlers/tool-configs/tasks.d.ts +127 -0
  209. package/dist/handlers/tool-configs/tasks.d.ts.map +1 -0
  210. package/dist/handlers/tool-configs/tasks.js +95 -0
  211. package/dist/handlers/tool-configs/tasks.js.map +1 -0
  212. package/dist/handlers/tool-types.d.ts +47 -0
  213. package/dist/handlers/tool-types.d.ts.map +1 -0
  214. package/dist/handlers/tool-types.js +2 -0
  215. package/dist/handlers/tool-types.js.map +1 -0
  216. package/dist/handlers/tools/config-verifier.d.ts +27 -0
  217. package/dist/handlers/tools/config-verifier.d.ts.map +1 -0
  218. package/dist/handlers/tools/config-verifier.js +108 -0
  219. package/dist/handlers/tools/config-verifier.js.map +1 -0
  220. package/dist/handlers/tools/dispatcher/core.d.ts +12 -0
  221. package/dist/handlers/tools/dispatcher/core.d.ts.map +1 -0
  222. package/dist/handlers/tools/dispatcher/core.js +276 -0
  223. package/dist/handlers/tools/dispatcher/core.js.map +1 -0
  224. package/dist/handlers/tools/dispatcher/formatting.d.ts +17 -0
  225. package/dist/handlers/tools/dispatcher/formatting.d.ts.map +1 -0
  226. package/dist/handlers/tools/dispatcher/formatting.js +25 -0
  227. package/dist/handlers/tools/dispatcher/formatting.js.map +1 -0
  228. package/dist/handlers/tools/dispatcher/logging.d.ts +63 -0
  229. package/dist/handlers/tools/dispatcher/logging.d.ts.map +1 -0
  230. package/dist/handlers/tools/dispatcher/logging.js +108 -0
  231. package/dist/handlers/tools/dispatcher/logging.js.map +1 -0
  232. package/dist/handlers/tools/dispatcher/operations/batch.d.ts +29 -0
  233. package/dist/handlers/tools/dispatcher/operations/batch.d.ts.map +1 -0
  234. package/dist/handlers/tools/dispatcher/operations/batch.js +137 -0
  235. package/dist/handlers/tools/dispatcher/operations/batch.js.map +1 -0
  236. package/dist/handlers/tools/dispatcher/operations/crud.d.ts +25 -0
  237. package/dist/handlers/tools/dispatcher/operations/crud.d.ts.map +1 -0
  238. package/dist/handlers/tools/dispatcher/operations/crud.js +110 -0
  239. package/dist/handlers/tools/dispatcher/operations/crud.js.map +1 -0
  240. package/dist/handlers/tools/dispatcher/operations/details.d.ts +13 -0
  241. package/dist/handlers/tools/dispatcher/operations/details.d.ts.map +1 -0
  242. package/dist/handlers/tools/dispatcher/operations/details.js +52 -0
  243. package/dist/handlers/tools/dispatcher/operations/details.js.map +1 -0
  244. package/dist/handlers/tools/dispatcher/operations/info.d.ts +25 -0
  245. package/dist/handlers/tools/dispatcher/operations/info.d.ts.map +1 -0
  246. package/dist/handlers/tools/dispatcher/operations/info.js +82 -0
  247. package/dist/handlers/tools/dispatcher/operations/info.js.map +1 -0
  248. package/dist/handlers/tools/dispatcher/operations/lists.d.ts +62 -0
  249. package/dist/handlers/tools/dispatcher/operations/lists.d.ts.map +1 -0
  250. package/dist/handlers/tools/dispatcher/operations/lists.js +283 -0
  251. package/dist/handlers/tools/dispatcher/operations/lists.js.map +1 -0
  252. package/dist/handlers/tools/dispatcher/operations/notes.d.ts +17 -0
  253. package/dist/handlers/tools/dispatcher/operations/notes.d.ts.map +1 -0
  254. package/dist/handlers/tools/dispatcher/operations/notes.js +102 -0
  255. package/dist/handlers/tools/dispatcher/operations/notes.js.map +1 -0
  256. package/dist/handlers/tools/dispatcher/operations/search.d.ts +43 -0
  257. package/dist/handlers/tools/dispatcher/operations/search.d.ts.map +1 -0
  258. package/dist/handlers/tools/dispatcher/operations/search.js +190 -0
  259. package/dist/handlers/tools/dispatcher/operations/search.js.map +1 -0
  260. package/dist/handlers/tools/dispatcher/validation.d.ts +27 -0
  261. package/dist/handlers/tools/dispatcher/validation.d.ts.map +1 -0
  262. package/dist/handlers/tools/dispatcher/validation.js +47 -0
  263. package/dist/handlers/tools/dispatcher/validation.js.map +1 -0
  264. package/dist/handlers/tools/dispatcher.d.ts +11 -0
  265. package/dist/handlers/tools/dispatcher.d.ts.map +1 -0
  266. package/dist/handlers/tools/dispatcher.js +15 -0
  267. package/dist/handlers/tools/dispatcher.js.map +1 -0
  268. package/dist/handlers/tools/error-types.d.ts +33 -0
  269. package/dist/handlers/tools/error-types.d.ts.map +1 -0
  270. package/dist/handlers/tools/error-types.js +21 -0
  271. package/dist/handlers/tools/error-types.js.map +1 -0
  272. package/dist/handlers/tools/formatters.d.ts +43 -0
  273. package/dist/handlers/tools/formatters.d.ts.map +1 -0
  274. package/dist/handlers/tools/formatters.js +170 -0
  275. package/dist/handlers/tools/formatters.js.map +1 -0
  276. package/dist/handlers/tools/index.d.ts +15 -0
  277. package/dist/handlers/tools/index.d.ts.map +1 -0
  278. package/dist/handlers/tools/index.js +34 -0
  279. package/dist/handlers/tools/index.js.map +1 -0
  280. package/dist/handlers/tools/registry.d.ts +1874 -0
  281. package/dist/handlers/tools/registry.d.ts.map +1 -0
  282. package/dist/handlers/tools/registry.js +103 -0
  283. package/dist/handlers/tools/registry.js.map +1 -0
  284. package/dist/health/http-server.d.ts +24 -0
  285. package/dist/health/http-server.d.ts.map +1 -0
  286. package/dist/health/http-server.js +106 -0
  287. package/dist/health/http-server.js.map +1 -0
  288. package/dist/index.d.ts +3 -0
  289. package/dist/index.d.ts.map +1 -0
  290. package/dist/index.js +238 -0
  291. package/dist/index.js.map +1 -0
  292. package/dist/objects/base-operations.d.ts +41 -0
  293. package/dist/objects/base-operations.d.ts.map +1 -0
  294. package/dist/objects/base-operations.js +116 -0
  295. package/dist/objects/base-operations.js.map +1 -0
  296. package/dist/objects/batch-companies.d.ts +112 -0
  297. package/dist/objects/batch-companies.d.ts.map +1 -0
  298. package/dist/objects/batch-companies.js +347 -0
  299. package/dist/objects/batch-companies.js.map +1 -0
  300. package/dist/objects/companies/attributes.d.ts +83 -0
  301. package/dist/objects/companies/attributes.d.ts.map +1 -0
  302. package/dist/objects/companies/attributes.js +426 -0
  303. package/dist/objects/companies/attributes.js.map +1 -0
  304. package/dist/objects/companies/basic.d.ts +117 -0
  305. package/dist/objects/companies/basic.d.ts.map +1 -0
  306. package/dist/objects/companies/basic.js +367 -0
  307. package/dist/objects/companies/basic.js.map +1 -0
  308. package/dist/objects/companies/batch.d.ts +6 -0
  309. package/dist/objects/companies/batch.d.ts.map +1 -0
  310. package/dist/objects/companies/batch.js +6 -0
  311. package/dist/objects/companies/batch.js.map +1 -0
  312. package/dist/objects/companies/index.d.ts +13 -0
  313. package/dist/objects/companies/index.d.ts.map +1 -0
  314. package/dist/objects/companies/index.js +17 -0
  315. package/dist/objects/companies/index.js.map +1 -0
  316. package/dist/objects/companies/notes.d.ts +26 -0
  317. package/dist/objects/companies/notes.d.ts.map +1 -0
  318. package/dist/objects/companies/notes.js +199 -0
  319. package/dist/objects/companies/notes.js.map +1 -0
  320. package/dist/objects/companies/relationships.d.ts +41 -0
  321. package/dist/objects/companies/relationships.d.ts.map +1 -0
  322. package/dist/objects/companies/relationships.js +142 -0
  323. package/dist/objects/companies/relationships.js.map +1 -0
  324. package/dist/objects/companies/search.d.ts +158 -0
  325. package/dist/objects/companies/search.d.ts.map +1 -0
  326. package/dist/objects/companies/search.js +463 -0
  327. package/dist/objects/companies/search.js.map +1 -0
  328. package/dist/objects/companies/types.d.ts +27 -0
  329. package/dist/objects/companies/types.d.ts.map +1 -0
  330. package/dist/objects/companies/types.js +3 -0
  331. package/dist/objects/companies/types.js.map +1 -0
  332. package/dist/objects/lists.d.ts +148 -0
  333. package/dist/objects/lists.d.ts.map +1 -0
  334. package/dist/objects/lists.js +586 -0
  335. package/dist/objects/lists.js.map +1 -0
  336. package/dist/objects/paginated-people.d.ts +50 -0
  337. package/dist/objects/paginated-people.d.ts.map +1 -0
  338. package/dist/objects/paginated-people.js +171 -0
  339. package/dist/objects/paginated-people.js.map +1 -0
  340. package/dist/objects/people/basic.d.ts +90 -0
  341. package/dist/objects/people/basic.d.ts.map +1 -0
  342. package/dist/objects/people/basic.js +157 -0
  343. package/dist/objects/people/basic.js.map +1 -0
  344. package/dist/objects/people/batch.d.ts +24 -0
  345. package/dist/objects/people/batch.d.ts.map +1 -0
  346. package/dist/objects/people/batch.js +145 -0
  347. package/dist/objects/people/batch.js.map +1 -0
  348. package/dist/objects/people/index.d.ts +11 -0
  349. package/dist/objects/people/index.d.ts.map +1 -0
  350. package/dist/objects/people/index.js +17 -0
  351. package/dist/objects/people/index.js.map +1 -0
  352. package/dist/objects/people/notes.d.ts +20 -0
  353. package/dist/objects/people/notes.d.ts.map +1 -0
  354. package/dist/objects/people/notes.js +60 -0
  355. package/dist/objects/people/notes.js.map +1 -0
  356. package/dist/objects/people/relationships.d.ts +23 -0
  357. package/dist/objects/people/relationships.d.ts.map +1 -0
  358. package/dist/objects/people/relationships.js +116 -0
  359. package/dist/objects/people/relationships.js.map +1 -0
  360. package/dist/objects/people/search.d.ts +83 -0
  361. package/dist/objects/people/search.d.ts.map +1 -0
  362. package/dist/objects/people/search.js +286 -0
  363. package/dist/objects/people/search.js.map +1 -0
  364. package/dist/objects/people/types.d.ts +37 -0
  365. package/dist/objects/people/types.d.ts.map +1 -0
  366. package/dist/objects/people/types.js +71 -0
  367. package/dist/objects/people/types.js.map +1 -0
  368. package/dist/objects/people-write.d.ts +71 -0
  369. package/dist/objects/people-write.d.ts.map +1 -0
  370. package/dist/objects/people-write.js +261 -0
  371. package/dist/objects/people-write.js.map +1 -0
  372. package/dist/objects/records/formatters.d.ts +20 -0
  373. package/dist/objects/records/formatters.d.ts.map +1 -0
  374. package/dist/objects/records/formatters.js +47 -0
  375. package/dist/objects/records/formatters.js.map +1 -0
  376. package/dist/objects/records/index.d.ts +74 -0
  377. package/dist/objects/records/index.d.ts.map +1 -0
  378. package/dist/objects/records/index.js +374 -0
  379. package/dist/objects/records/index.js.map +1 -0
  380. package/dist/objects/records.d.ts +88 -0
  381. package/dist/objects/records.d.ts.map +1 -0
  382. package/dist/objects/records.js +432 -0
  383. package/dist/objects/records.js.map +1 -0
  384. package/dist/objects/tasks.d.ts +19 -0
  385. package/dist/objects/tasks.d.ts.map +1 -0
  386. package/dist/objects/tasks.js +23 -0
  387. package/dist/objects/tasks.js.map +1 -0
  388. package/dist/prompts/error-handler.d.ts +28 -0
  389. package/dist/prompts/error-handler.d.ts.map +1 -0
  390. package/dist/prompts/error-handler.js +47 -0
  391. package/dist/prompts/error-handler.js.map +1 -0
  392. package/dist/prompts/handlers.d.ts +49 -0
  393. package/dist/prompts/handlers.d.ts.map +1 -0
  394. package/dist/prompts/handlers.js +353 -0
  395. package/dist/prompts/handlers.js.map +1 -0
  396. package/dist/prompts/index.d.ts +11 -0
  397. package/dist/prompts/index.d.ts.map +1 -0
  398. package/dist/prompts/index.js +15 -0
  399. package/dist/prompts/index.js.map +1 -0
  400. package/dist/prompts/templates/companies.d.ts +10 -0
  401. package/dist/prompts/templates/companies.d.ts.map +1 -0
  402. package/dist/prompts/templates/companies.js +128 -0
  403. package/dist/prompts/templates/companies.js.map +1 -0
  404. package/dist/prompts/templates/index.d.ts +42 -0
  405. package/dist/prompts/templates/index.d.ts.map +1 -0
  406. package/dist/prompts/templates/index.js +58 -0
  407. package/dist/prompts/templates/index.js.map +1 -0
  408. package/dist/prompts/templates/lists.d.ts +10 -0
  409. package/dist/prompts/templates/lists.d.ts.map +1 -0
  410. package/dist/prompts/templates/lists.js +127 -0
  411. package/dist/prompts/templates/lists.js.map +1 -0
  412. package/dist/prompts/templates/notes.d.ts +10 -0
  413. package/dist/prompts/templates/notes.d.ts.map +1 -0
  414. package/dist/prompts/templates/notes.js +119 -0
  415. package/dist/prompts/templates/notes.js.map +1 -0
  416. package/dist/prompts/templates/people.d.ts +10 -0
  417. package/dist/prompts/templates/people.d.ts.map +1 -0
  418. package/dist/prompts/templates/people.js +127 -0
  419. package/dist/prompts/templates/people.js.map +1 -0
  420. package/dist/prompts/types.d.ts +52 -0
  421. package/dist/prompts/types.d.ts.map +1 -0
  422. package/dist/prompts/types.js +5 -0
  423. package/dist/prompts/types.js.map +1 -0
  424. package/dist/types/attio.d.ts +424 -0
  425. package/dist/types/attio.d.ts.map +1 -0
  426. package/dist/types/attio.js +116 -0
  427. package/dist/types/attio.js.map +1 -0
  428. package/dist/types/company-types.d.ts +52 -0
  429. package/dist/types/company-types.d.ts.map +1 -0
  430. package/dist/types/company-types.js +5 -0
  431. package/dist/types/company-types.js.map +1 -0
  432. package/dist/types/tool-types.d.ts +262 -0
  433. package/dist/types/tool-types.d.ts.map +1 -0
  434. package/dist/types/tool-types.js +6 -0
  435. package/dist/types/tool-types.js.map +1 -0
  436. package/dist/utils/api-fallback.d.ts +39 -0
  437. package/dist/utils/api-fallback.d.ts.map +1 -0
  438. package/dist/utils/api-fallback.js +94 -0
  439. package/dist/utils/api-fallback.js.map +1 -0
  440. package/dist/utils/attribute-mapping/attribute-mappers.d.ts +39 -0
  441. package/dist/utils/attribute-mapping/attribute-mappers.d.ts.map +1 -0
  442. package/dist/utils/attribute-mapping/attribute-mappers.js +394 -0
  443. package/dist/utils/attribute-mapping/attribute-mappers.js.map +1 -0
  444. package/dist/utils/attribute-mapping/filter-translator.d.ts +9 -0
  445. package/dist/utils/attribute-mapping/filter-translator.d.ts.map +1 -0
  446. package/dist/utils/attribute-mapping/filter-translator.js +104 -0
  447. package/dist/utils/attribute-mapping/filter-translator.js.map +1 -0
  448. package/dist/utils/attribute-mapping/index.d.ts +10 -0
  449. package/dist/utils/attribute-mapping/index.d.ts.map +1 -0
  450. package/dist/utils/attribute-mapping/index.js +12 -0
  451. package/dist/utils/attribute-mapping/index.js.map +1 -0
  452. package/dist/utils/attribute-mapping/legacy-maps.d.ts +11 -0
  453. package/dist/utils/attribute-mapping/legacy-maps.d.ts.map +1 -0
  454. package/dist/utils/attribute-mapping/legacy-maps.js +54 -0
  455. package/dist/utils/attribute-mapping/legacy-maps.js.map +1 -0
  456. package/dist/utils/attribute-mapping/mapping-utils.d.ts +90 -0
  457. package/dist/utils/attribute-mapping/mapping-utils.d.ts.map +1 -0
  458. package/dist/utils/attribute-mapping/mapping-utils.js +145 -0
  459. package/dist/utils/attribute-mapping/mapping-utils.js.map +1 -0
  460. package/dist/utils/auto-discovery.d.ts +22 -0
  461. package/dist/utils/auto-discovery.d.ts.map +1 -0
  462. package/dist/utils/auto-discovery.js +143 -0
  463. package/dist/utils/auto-discovery.js.map +1 -0
  464. package/dist/utils/cli-colors.d.ts +36 -0
  465. package/dist/utils/cli-colors.d.ts.map +1 -0
  466. package/dist/utils/cli-colors.js +35 -0
  467. package/dist/utils/cli-colors.js.map +1 -0
  468. package/dist/utils/config-loader.d.ts +41 -0
  469. package/dist/utils/config-loader.d.ts.map +1 -0
  470. package/dist/utils/config-loader.js +167 -0
  471. package/dist/utils/config-loader.js.map +1 -0
  472. package/dist/utils/config-migration.d.ts +140 -0
  473. package/dist/utils/config-migration.d.ts.map +1 -0
  474. package/dist/utils/config-migration.js +310 -0
  475. package/dist/utils/config-migration.js.map +1 -0
  476. package/dist/utils/date-utils.d.ts +63 -0
  477. package/dist/utils/date-utils.d.ts.map +1 -0
  478. package/dist/utils/date-utils.js +329 -0
  479. package/dist/utils/date-utils.js.map +1 -0
  480. package/dist/utils/debug-b2b-segment.d.ts +2 -0
  481. package/dist/utils/debug-b2b-segment.d.ts.map +1 -0
  482. package/dist/utils/debug-b2b-segment.js +67 -0
  483. package/dist/utils/debug-b2b-segment.js.map +1 -0
  484. package/dist/utils/domain-utils.d.ts +46 -0
  485. package/dist/utils/domain-utils.d.ts.map +1 -0
  486. package/dist/utils/domain-utils.js +143 -0
  487. package/dist/utils/domain-utils.js.map +1 -0
  488. package/dist/utils/dynamic-import.d.ts +33 -0
  489. package/dist/utils/dynamic-import.d.ts.map +1 -0
  490. package/dist/utils/dynamic-import.js +41 -0
  491. package/dist/utils/dynamic-import.js.map +1 -0
  492. package/dist/utils/error-enhancer.d.ts +23 -0
  493. package/dist/utils/error-enhancer.d.ts.map +1 -0
  494. package/dist/utils/error-enhancer.js +188 -0
  495. package/dist/utils/error-enhancer.js.map +1 -0
  496. package/dist/utils/error-handler.d.ts +89 -0
  497. package/dist/utils/error-handler.d.ts.map +1 -0
  498. package/dist/utils/error-handler.js +336 -0
  499. package/dist/utils/error-handler.js.map +1 -0
  500. package/dist/utils/filters/builders/activity.d.ts +13 -0
  501. package/dist/utils/filters/builders/activity.d.ts.map +1 -0
  502. package/dist/utils/filters/builders/activity.js +65 -0
  503. package/dist/utils/filters/builders/activity.js.map +1 -0
  504. package/dist/utils/filters/builders/basic.d.ts +13 -0
  505. package/dist/utils/filters/builders/basic.d.ts.map +1 -0
  506. package/dist/utils/filters/builders/basic.js +36 -0
  507. package/dist/utils/filters/builders/basic.js.map +1 -0
  508. package/dist/utils/filters/builders/complex.d.ts +31 -0
  509. package/dist/utils/filters/builders/complex.d.ts.map +1 -0
  510. package/dist/utils/filters/builders/complex.js +92 -0
  511. package/dist/utils/filters/builders/complex.js.map +1 -0
  512. package/dist/utils/filters/builders/date.d.ts +17 -0
  513. package/dist/utils/filters/builders/date.d.ts.map +1 -0
  514. package/dist/utils/filters/builders/date.js +51 -0
  515. package/dist/utils/filters/builders/date.js.map +1 -0
  516. package/dist/utils/filters/builders/index.d.ts +8 -0
  517. package/dist/utils/filters/builders/index.d.ts.map +1 -0
  518. package/dist/utils/filters/builders/index.js +8 -0
  519. package/dist/utils/filters/builders/index.js.map +1 -0
  520. package/dist/utils/filters/builders/numeric.d.ts +17 -0
  521. package/dist/utils/filters/builders/numeric.d.ts.map +1 -0
  522. package/dist/utils/filters/builders/numeric.js +61 -0
  523. package/dist/utils/filters/builders/numeric.js.map +1 -0
  524. package/dist/utils/filters/builders/text.d.ts +17 -0
  525. package/dist/utils/filters/builders/text.d.ts.map +1 -0
  526. package/dist/utils/filters/builders/text.js +47 -0
  527. package/dist/utils/filters/builders/text.js.map +1 -0
  528. package/dist/utils/filters/builders/types.d.ts +2 -0
  529. package/dist/utils/filters/builders/types.d.ts.map +1 -0
  530. package/dist/utils/filters/builders/types.js +2 -0
  531. package/dist/utils/filters/builders/types.js.map +1 -0
  532. package/dist/utils/filters/builders.d.ts +2 -0
  533. package/dist/utils/filters/builders.d.ts.map +1 -0
  534. package/dist/utils/filters/builders.js +2 -0
  535. package/dist/utils/filters/builders.js.map +1 -0
  536. package/dist/utils/filters/cache.d.ts +80 -0
  537. package/dist/utils/filters/cache.d.ts.map +1 -0
  538. package/dist/utils/filters/cache.js +212 -0
  539. package/dist/utils/filters/cache.js.map +1 -0
  540. package/dist/utils/filters/index.d.ts +51 -0
  541. package/dist/utils/filters/index.d.ts.map +1 -0
  542. package/dist/utils/filters/index.js +67 -0
  543. package/dist/utils/filters/index.js.map +1 -0
  544. package/dist/utils/filters/operators.d.ts +65 -0
  545. package/dist/utils/filters/operators.d.ts.map +1 -0
  546. package/dist/utils/filters/operators.js +214 -0
  547. package/dist/utils/filters/operators.js.map +1 -0
  548. package/dist/utils/filters/relationship.d.ts +81 -0
  549. package/dist/utils/filters/relationship.d.ts.map +1 -0
  550. package/dist/utils/filters/relationship.js +393 -0
  551. package/dist/utils/filters/relationship.js.map +1 -0
  552. package/dist/utils/filters/translators.d.ts +120 -0
  553. package/dist/utils/filters/translators.d.ts.map +1 -0
  554. package/dist/utils/filters/translators.js +397 -0
  555. package/dist/utils/filters/translators.js.map +1 -0
  556. package/dist/utils/filters/types.d.ts +77 -0
  557. package/dist/utils/filters/types.d.ts.map +1 -0
  558. package/dist/utils/filters/types.js +85 -0
  559. package/dist/utils/filters/types.js.map +1 -0
  560. package/dist/utils/filters/utils.d.ts +86 -0
  561. package/dist/utils/filters/utils.d.ts.map +1 -0
  562. package/dist/utils/filters/utils.js +142 -0
  563. package/dist/utils/filters/utils.js.map +1 -0
  564. package/dist/utils/filters/validation-utils.d.ts +123 -0
  565. package/dist/utils/filters/validation-utils.d.ts.map +1 -0
  566. package/dist/utils/filters/validation-utils.js +282 -0
  567. package/dist/utils/filters/validation-utils.js.map +1 -0
  568. package/dist/utils/filters/validators.d.ts +73 -0
  569. package/dist/utils/filters/validators.d.ts.map +1 -0
  570. package/dist/utils/filters/validators.js +311 -0
  571. package/dist/utils/filters/validators.js.map +1 -0
  572. package/dist/utils/json-serializer.d.ts +68 -0
  573. package/dist/utils/json-serializer.d.ts.map +1 -0
  574. package/dist/utils/json-serializer.js +235 -0
  575. package/dist/utils/json-serializer.js.map +1 -0
  576. package/dist/utils/logger.d.ts +226 -0
  577. package/dist/utils/logger.d.ts.map +1 -0
  578. package/dist/utils/logger.js +323 -0
  579. package/dist/utils/logger.js.map +1 -0
  580. package/dist/utils/numeric-utils.d.ts +27 -0
  581. package/dist/utils/numeric-utils.d.ts.map +1 -0
  582. package/dist/utils/numeric-utils.js +83 -0
  583. package/dist/utils/numeric-utils.js.map +1 -0
  584. package/dist/utils/pagination.d.ts +85 -0
  585. package/dist/utils/pagination.d.ts.map +1 -0
  586. package/dist/utils/pagination.js +169 -0
  587. package/dist/utils/pagination.js.map +1 -0
  588. package/dist/utils/person-lookup.d.ts +35 -0
  589. package/dist/utils/person-lookup.d.ts.map +1 -0
  590. package/dist/utils/person-lookup.js +67 -0
  591. package/dist/utils/person-lookup.js.map +1 -0
  592. package/dist/utils/rate-limiter.d.ts +82 -0
  593. package/dist/utils/rate-limiter.d.ts.map +1 -0
  594. package/dist/utils/rate-limiter.js +159 -0
  595. package/dist/utils/rate-limiter.js.map +1 -0
  596. package/dist/utils/record-utils.d.ts +74 -0
  597. package/dist/utils/record-utils.d.ts.map +1 -0
  598. package/dist/utils/record-utils.js +312 -0
  599. package/dist/utils/record-utils.js.map +1 -0
  600. package/dist/utils/relationship-utils.d.ts +61 -0
  601. package/dist/utils/relationship-utils.d.ts.map +1 -0
  602. package/dist/utils/relationship-utils.js +242 -0
  603. package/dist/utils/relationship-utils.js.map +1 -0
  604. package/dist/utils/response-formatter.d.ts +121 -0
  605. package/dist/utils/response-formatter.d.ts.map +1 -0
  606. package/dist/utils/response-formatter.js +188 -0
  607. package/dist/utils/response-formatter.js.map +1 -0
  608. package/dist/utils/uri-parser.d.ts +18 -0
  609. package/dist/utils/uri-parser.d.ts.map +1 -0
  610. package/dist/utils/uri-parser.js +31 -0
  611. package/dist/utils/uri-parser.js.map +1 -0
  612. package/dist/utils/validation.d.ts +59 -0
  613. package/dist/utils/validation.d.ts.map +1 -0
  614. package/dist/utils/validation.js +264 -0
  615. package/dist/utils/validation.js.map +1 -0
  616. package/dist/utils/value-matcher.d.ts +58 -0
  617. package/dist/utils/value-matcher.d.ts.map +1 -0
  618. package/dist/utils/value-matcher.js +131 -0
  619. package/dist/utils/value-matcher.js.map +1 -0
  620. package/dist/validators/attribute-validator.d.ts +59 -0
  621. package/dist/validators/attribute-validator.d.ts.map +1 -0
  622. package/dist/validators/attribute-validator.js +531 -0
  623. package/dist/validators/attribute-validator.js.map +1 -0
  624. package/dist/validators/company/field_detector.d.ts +5 -0
  625. package/dist/validators/company/field_detector.d.ts.map +1 -0
  626. package/dist/validators/company/field_detector.js +95 -0
  627. package/dist/validators/company/field_detector.js.map +1 -0
  628. package/dist/validators/company/index.d.ts +26 -0
  629. package/dist/validators/company/index.d.ts.map +1 -0
  630. package/dist/validators/company/index.js +433 -0
  631. package/dist/validators/company/index.js.map +1 -0
  632. package/dist/validators/company/type_cache.d.ts +14 -0
  633. package/dist/validators/company/type_cache.d.ts.map +1 -0
  634. package/dist/validators/company/type_cache.js +28 -0
  635. package/dist/validators/company/type_cache.js.map +1 -0
  636. package/dist/validators/company/types.d.ts +8 -0
  637. package/dist/validators/company/types.d.ts.map +1 -0
  638. package/dist/validators/company/types.js +2 -0
  639. package/dist/validators/company/types.js.map +1 -0
  640. package/dist/validators/company-validator.d.ts +2 -0
  641. package/dist/validators/company-validator.d.ts.map +1 -0
  642. package/dist/validators/company-validator.js +2 -0
  643. package/dist/validators/company-validator.js.map +1 -0
  644. package/package.json +167 -0
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Utility functions for domain extraction and validation
3
+ */
4
+ /**
5
+ * Extracts domain from various input formats
6
+ *
7
+ * @param input - Input string that may contain a domain, URL, or email
8
+ * @returns Extracted domain or null if no valid domain found
9
+ * @example
10
+ * ```typescript
11
+ * extractDomain("https://example.com/path") // Returns "example.com"
12
+ * extractDomain("john@example.com") // Returns "example.com"
13
+ * extractDomain("example.com") // Returns "example.com"
14
+ * extractDomain("company name") // Returns null
15
+ * ```
16
+ */
17
+ export function extractDomain(input) {
18
+ if (!input || typeof input !== 'string') {
19
+ return null;
20
+ }
21
+ // Clean up input
22
+ const cleanInput = input.trim().toLowerCase();
23
+ // Check for email format
24
+ const emailMatch = cleanInput.match(/^[^\s@]+@([^\s@]+\.[^\s@]+)$/);
25
+ if (emailMatch) {
26
+ return emailMatch[1];
27
+ }
28
+ // Check for URL format
29
+ try {
30
+ const url = new URL(cleanInput.startsWith('http') ? cleanInput : `https://${cleanInput}`);
31
+ const hostname = url.hostname;
32
+ // Validate that hostname looks like a domain
33
+ if (isValidDomain(hostname)) {
34
+ return normalizeDomain(hostname);
35
+ }
36
+ }
37
+ catch (error) {
38
+ // Not a valid URL, continue with other checks
39
+ }
40
+ // Check if input is already a domain
41
+ if (isValidDomain(cleanInput)) {
42
+ return normalizeDomain(cleanInput);
43
+ }
44
+ // Try to extract domain from text that might contain a domain
45
+ const domainPattern = /(?:https?:\/\/)?(?:www\.)?([a-zA-Z0-9-]+\.[a-zA-Z]{2,})/;
46
+ const match = cleanInput.match(domainPattern);
47
+ if (match && isValidDomain(match[1])) {
48
+ return normalizeDomain(match[1]);
49
+ }
50
+ return null;
51
+ }
52
+ /**
53
+ * Validates if a string is a valid domain format
54
+ *
55
+ * @param domain - Domain string to validate
56
+ * @returns True if domain appears valid
57
+ */
58
+ export function isValidDomain(domain) {
59
+ if (!domain || typeof domain !== 'string') {
60
+ return false;
61
+ }
62
+ // Basic domain validation
63
+ const domainRegex = /^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/;
64
+ return domainRegex.test(domain) && domain.length <= 253;
65
+ }
66
+ /**
67
+ * Normalizes domain for consistent matching
68
+ *
69
+ * @param domain - Domain to normalize
70
+ * @returns Normalized domain
71
+ */
72
+ export function normalizeDomain(domain) {
73
+ if (!domain) {
74
+ return '';
75
+ }
76
+ return domain
77
+ .trim()
78
+ .toLowerCase()
79
+ .replace(/^www\./, '');
80
+ }
81
+ /**
82
+ * Checks if a query likely contains a domain
83
+ *
84
+ * @param query - Search query to analyze
85
+ * @returns True if query appears to contain domain information
86
+ */
87
+ export function hasDomainIndicators(query) {
88
+ if (!query) {
89
+ return false;
90
+ }
91
+ const indicators = [
92
+ /\.(com|org|net|edu|gov|mil|io|co|ai|tech|app|dev|xyz)/i,
93
+ /@[a-zA-Z0-9-]+\./,
94
+ /https?:\/\//,
95
+ /www\./,
96
+ ];
97
+ return indicators.some((pattern) => pattern.test(query));
98
+ }
99
+ /**
100
+ * Extracts multiple potential domains from a query
101
+ *
102
+ * @param query - Query that may contain multiple domains
103
+ * @returns Array of extracted domains
104
+ */
105
+ export function extractAllDomains(query) {
106
+ if (!query) {
107
+ return [];
108
+ }
109
+ const domains = [];
110
+ // Extract email domains
111
+ const emailMatches = query.match(/[^\s@]+@([^\s@]+\.[^\s@]+)/g);
112
+ if (emailMatches) {
113
+ emailMatches.forEach((email) => {
114
+ const domain = extractDomain(email);
115
+ if (domain) {
116
+ domains.push(domain);
117
+ }
118
+ });
119
+ }
120
+ // Extract URL domains
121
+ const urlMatches = query.match(/https?:\/\/[^\s]+/g);
122
+ if (urlMatches) {
123
+ urlMatches.forEach((url) => {
124
+ const domain = extractDomain(url);
125
+ if (domain) {
126
+ domains.push(domain);
127
+ }
128
+ });
129
+ }
130
+ // Extract standalone domains (including subdomains)
131
+ const domainMatches = query.match(/(?:^|\s|,)([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*\.[a-zA-Z]{2,})(?=\s|,|$)/g);
132
+ if (domainMatches) {
133
+ domainMatches.forEach((match) => {
134
+ const domain = extractDomain(match.trim().replace(/^[,\s]+/, ''));
135
+ if (domain) {
136
+ domains.push(domain);
137
+ }
138
+ });
139
+ }
140
+ // Remove duplicates and normalize
141
+ return [...new Set(domains.map(normalizeDomain))];
142
+ }
143
+ //# sourceMappingURL=domain-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-utils.js","sourceRoot":"","sources":["../../src/utils/domain-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iBAAiB;IACjB,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAE9C,yBAAyB;IACzB,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACpE,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAED,uBAAuB;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,UAAU,EAAE,CACrE,CAAC;QACF,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QAE9B,6CAA6C;QAC7C,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,8CAA8C;IAChD,CAAC;IAED,qCAAqC;IACrC,IAAI,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,OAAO,eAAe,CAAC,UAAU,CAAC,CA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,kCAAkC;IAClC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Utility for dynamically importing ES modules
3
+ *
4
+ * This module provides a wrapper around the dynamic import() function to make it easier to
5
+ * work with ES modules in a Node.js environment that may be transitioning from CommonJS.
6
+ * It helps address common compatibility issues that arise when mixing module systems,
7
+ * such as "require is not defined in ES module scope" errors.
8
+ *
9
+ * Use cases:
10
+ * 1. Loading modules at runtime based on configuration
11
+ * 2. Conditional loading of modules to improve startup performance
12
+ * 3. Handling imports that may not be available in all environments
13
+ * 4. Supporting both CommonJS and ES module imports in the same codebase
14
+ */
15
+ /**
16
+ * Dynamically imports a module in an environment-agnostic way
17
+ *
18
+ * This function wraps the standard dynamic import() with error handling and logging.
19
+ * It can be used to load both ES modules and CommonJS modules in an ES module context.
20
+ *
21
+ * @param moduleName - Name of the module to import (e.g., 'handlebars', './config.js')
22
+ * @returns Promise resolving to the imported module
23
+ * @throws Error if the module cannot be imported
24
+ *
25
+ * @example
26
+ * // Load a module dynamically
27
+ * const handlebars = await dynamicImport('handlebars');
28
+ *
29
+ * // Use with destructuring
30
+ * const { compile, registerHelper } = await dynamicImport('handlebars');
31
+ */
32
+ export declare function dynamicImport(moduleName: string): Promise<any>;
33
+ //# sourceMappingURL=dynamic-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-import.d.ts","sourceRoot":"","sources":["../../src/utils/dynamic-import.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAWpE"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Utility for dynamically importing ES modules
3
+ *
4
+ * This module provides a wrapper around the dynamic import() function to make it easier to
5
+ * work with ES modules in a Node.js environment that may be transitioning from CommonJS.
6
+ * It helps address common compatibility issues that arise when mixing module systems,
7
+ * such as "require is not defined in ES module scope" errors.
8
+ *
9
+ * Use cases:
10
+ * 1. Loading modules at runtime based on configuration
11
+ * 2. Conditional loading of modules to improve startup performance
12
+ * 3. Handling imports that may not be available in all environments
13
+ * 4. Supporting both CommonJS and ES module imports in the same codebase
14
+ */
15
+ /**
16
+ * Dynamically imports a module in an environment-agnostic way
17
+ *
18
+ * This function wraps the standard dynamic import() with error handling and logging.
19
+ * It can be used to load both ES modules and CommonJS modules in an ES module context.
20
+ *
21
+ * @param moduleName - Name of the module to import (e.g., 'handlebars', './config.js')
22
+ * @returns Promise resolving to the imported module
23
+ * @throws Error if the module cannot be imported
24
+ *
25
+ * @example
26
+ * // Load a module dynamically
27
+ * const handlebars = await dynamicImport('handlebars');
28
+ *
29
+ * // Use with destructuring
30
+ * const { compile, registerHelper } = await dynamicImport('handlebars');
31
+ */
32
+ export async function dynamicImport(moduleName) {
33
+ try {
34
+ return await import(moduleName);
35
+ }
36
+ catch (error) {
37
+ console.error(`Error importing module ${moduleName}:`, error);
38
+ throw new Error(`Failed to import module "${moduleName}": ${error.message || 'Unknown error'}`);
39
+ }
40
+ }
41
+ //# sourceMappingURL=dynamic-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-import.js","sourceRoot":"","sources":["../../src/utils/dynamic-import.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,UAAkB;IACpD,IAAI,CAAC;QACH,OAAO,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,0BAA0B,UAAU,GAAG,EAAE,KAAK,CAAC,CAAC;QAC9D,MAAM,IAAI,KAAK,CACb,4BAA4B,UAAU,MACpC,KAAK,CAAC,OAAO,IAAI,eACnB,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Enhance an API error with value suggestions if applicable
3
+ */
4
+ export declare function enhanceApiError(error: any): Error;
5
+ /**
6
+ * Check if an error is a value mismatch that we can enhance
7
+ */
8
+ export declare function isValueMismatchError(error: any): {
9
+ isMismatch: boolean;
10
+ fieldSlug?: string;
11
+ searchValue?: string;
12
+ errorMessage?: string;
13
+ };
14
+ /**
15
+ * Get valid values for a field (if known)
16
+ */
17
+ export declare function getKnownFieldValues(fieldSlug: string): string[] | null;
18
+ /**
19
+ * Add or update known field values
20
+ * This could be populated from Attio API discovery
21
+ */
22
+ export declare function updateKnownFieldValues(fieldSlug: string, values: string[]): void;
23
+ //# sourceMappingURL=error-enhancer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-enhancer.d.ts","sourceRoot":"","sources":["../../src/utils/error-enhancer.ts"],"names":[],"mappings":"AAmLA;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,CAiEjD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG;IAChD,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAiCA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAEtE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EAAE,GACf,IAAI,CAEN"}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Enhances API errors with helpful suggestions for value mismatches
3
+ */
4
+ import { ValueMatchError } from '../errors/value-match-error.js';
5
+ import { findBestValueMatch, } from './value-matcher.js';
6
+ import axios from 'axios';
7
+ // Known valid values for select fields - this should ideally come from Attio API
8
+ const KNOWN_FIELD_VALUES = {
9
+ type_persona: [
10
+ 'Plastic Surgeon',
11
+ 'Medical Spa/Aesthetics',
12
+ 'Dermatologist',
13
+ 'Medical Practice',
14
+ 'Wellness Center',
15
+ 'Cosmetic Surgery',
16
+ 'Aesthetic Medicine',
17
+ 'Primary Care',
18
+ 'Specialist',
19
+ 'Hospital',
20
+ 'Clinic',
21
+ ],
22
+ industry: [
23
+ 'Healthcare',
24
+ 'Technology',
25
+ 'Finance',
26
+ 'Education',
27
+ 'Retail',
28
+ 'Manufacturing',
29
+ 'Hospitality',
30
+ 'Real Estate',
31
+ 'Professional Services',
32
+ ],
33
+ stage: [
34
+ 'Lead',
35
+ 'Prospect',
36
+ 'Opportunity',
37
+ 'Customer',
38
+ 'Churned',
39
+ 'Qualified',
40
+ 'Engaged',
41
+ 'Negotiation',
42
+ ],
43
+ };
44
+ /**
45
+ * Parse API error to extract context
46
+ */
47
+ function parseApiError(error) {
48
+ console.error(`[enhancer-parseApiError] --- ENTERING parseApiError ---`);
49
+ console.error(`[enhancer-parseApiError] error type: ${typeof error}, constructor: ${error
50
+ ?.constructor?.name}`);
51
+ if (error && typeof error === 'object') {
52
+ console.error(`[enhancer-parseApiError] error keys: ${JSON.stringify(Object.keys(error))}`);
53
+ console.error(`[enhancer-parseApiError] error.message from input: ${error.message}`);
54
+ }
55
+ const isAxios = axios.isAxiosError(error);
56
+ console.error(`[enhancer-parseApiError] Step 1: axios.isAxiosError(error) result: ${isAxios}`);
57
+ let responseExists = false;
58
+ let responseDataExists = false;
59
+ let responseDataContent = 'N/A';
60
+ if (isAxios && error.response) {
61
+ responseExists = true;
62
+ console.error(`[enhancer-parseApiError] Step 2: error.response exists. Keys: ${JSON.stringify(Object.keys(error.response))}`);
63
+ if (error.response.data) {
64
+ responseDataExists = true;
65
+ try {
66
+ responseDataContent = JSON.stringify(error.response.data);
67
+ }
68
+ catch (e) {
69
+ responseDataContent = 'Error stringifying response.data';
70
+ }
71
+ console.error(`[enhancer-parseApiError] Step 3: error.response.data exists. Type: ${typeof error
72
+ .response.data}, Content: ${responseDataContent}`);
73
+ }
74
+ else {
75
+ console.error(`[enhancer-parseApiError] Step 3: error.response.data is FALSY.`);
76
+ }
77
+ }
78
+ else {
79
+ console.error(`[enhancer-parseApiError] Step 2: error.response is FALSY or not an Axios error for this check.`);
80
+ console.error(`[enhancer-parseApiError] Step 3: error.response.data is FALSY (because error.response was not available).`);
81
+ }
82
+ console.error(`[enhancer-parseApiError] FINAL CHECK BEFORE CONDITION: isAxios=${isAxios}, responseExists=${responseExists}, responseDataExists=${responseDataExists}`);
83
+ if (isAxios &&
84
+ responseExists &&
85
+ responseDataExists &&
86
+ error.response &&
87
+ error.response.data) {
88
+ console.error(`[enhancer-parseApiError] --- CONDITION MET --- Processing error.response.data...`);
89
+ const data = error.response.data;
90
+ const message = typeof data.message === 'string' ? data.message : '';
91
+ const pathArray = Array.isArray(data.path) && data.path.length > 0 ? data.path : [];
92
+ const path = typeof pathArray[0] === 'string' ? pathArray[0] : undefined;
93
+ console.error(`[enhancer-parseApiError] Extracted from data: message='${message}', path='${path}'`);
94
+ if (message.includes('Unknown select option name') ||
95
+ message.includes('Unknown multi-select option names')) {
96
+ const valueMatch = message.match(/constraint: (.*)/);
97
+ const extractedValue = valueMatch && typeof valueMatch[1] === 'string'
98
+ ? valueMatch[1].split(',')[0].trim()
99
+ : undefined;
100
+ console.error(`[enhancer-parseApiError] --- RETURNING ValueMismatch context: field='${path}', value='${extractedValue}' ---`);
101
+ return {
102
+ fieldSlug: path,
103
+ searchValue: extractedValue,
104
+ errorMessage: message,
105
+ };
106
+ }
107
+ console.error(`[enhancer-parseApiError] --- RETURNING Non-ValueMismatch Axios context: field='${path}' ---`);
108
+ return { fieldSlug: path, errorMessage: message };
109
+ }
110
+ console.error(`[enhancer-parseApiError] --- CONDITION NOT MET ---`);
111
+ const genericErrorMessage = error && typeof error.message === 'string'
112
+ ? error.message
113
+ : 'Unknown error';
114
+ console.error(`[enhancer-parseApiError] Returning generic message: '${genericErrorMessage}'`);
115
+ return { errorMessage: genericErrorMessage };
116
+ }
117
+ /**
118
+ * Enhance an API error with value suggestions if applicable
119
+ */
120
+ export function enhanceApiError(error) {
121
+ console.error('[enhancer] Called with error type:', error?.constructor?.name, '. Is Axios Error:', error?.isAxiosError);
122
+ console.error('[enhancer] Attempting to enhance error. Message property:', error?.message, '. ResponseData property:', JSON.stringify(error?.response?.data));
123
+ const mismatchCheck = isValueMismatchError(error);
124
+ console.error('[enhancer] Mismatch check result:', JSON.stringify(mismatchCheck));
125
+ if (mismatchCheck.isMismatch &&
126
+ mismatchCheck.fieldSlug &&
127
+ mismatchCheck.searchValue) {
128
+ const fieldSlug = mismatchCheck.fieldSlug;
129
+ const searchValue = mismatchCheck.searchValue;
130
+ const knownValues = KNOWN_FIELD_VALUES[fieldSlug]; // Already checked in isValueMismatchError, but good for clarity
131
+ console.error(`[enhancer] Value mismatch confirmed for field: ${fieldSlug}, value: ${searchValue}.`);
132
+ if (knownValues) {
133
+ console.error(`[enhancer] Attempting to find best match for '${searchValue}' in known values for '${fieldSlug}'.`);
134
+ const matchResult = findBestValueMatch(searchValue, knownValues);
135
+ console.error('[enhancer] Match result from findBestValueMatch:', JSON.stringify(matchResult));
136
+ console.error('[enhancer] Returning NEW ValueMatchError');
137
+ return new ValueMatchError(fieldSlug, searchValue, matchResult, error // Pass original Axios error for reference
138
+ );
139
+ }
140
+ }
141
+ else {
142
+ console.error('[enhancer] No value mismatch, or field/value not actionable. Error message from mismatchCheck:', mismatchCheck.errorMessage);
143
+ }
144
+ console.error('[enhancer] No specific enhancement applied. Returning original error.');
145
+ return error; // Fallback: return original error if not enhanced
146
+ }
147
+ /**
148
+ * Check if an error is a value mismatch that we can enhance
149
+ */
150
+ export function isValueMismatchError(error) {
151
+ const context = parseApiError(error);
152
+ console.error('[enhancer-isValueMismatchError] Context from parseApiError:', JSON.stringify(context));
153
+ if (context.fieldSlug &&
154
+ context.searchValue &&
155
+ KNOWN_FIELD_VALUES[context.fieldSlug]) {
156
+ const knownValues = KNOWN_FIELD_VALUES[context.fieldSlug];
157
+ if (knownValues &&
158
+ !knownValues.some((v) => v.toLowerCase() === context.searchValue?.toLowerCase())) {
159
+ console.error(`[enhancer-isValueMismatchError] Mismatch found for field '${context.fieldSlug}', value '${context.searchValue}'.`);
160
+ return {
161
+ isMismatch: true,
162
+ fieldSlug: context.fieldSlug,
163
+ searchValue: context.searchValue,
164
+ errorMessage: context.errorMessage,
165
+ };
166
+ }
167
+ }
168
+ console.error('[enhancer-isValueMismatchError] No mismatch or field/value not in KNOWN_FIELD_VALUES.');
169
+ return { isMismatch: false, errorMessage: context.errorMessage };
170
+ }
171
+ /**
172
+ * Get valid values for a field (if known)
173
+ */
174
+ export function getKnownFieldValues(fieldSlug) {
175
+ return KNOWN_FIELD_VALUES[fieldSlug] || null;
176
+ }
177
+ /**
178
+ * Add or update known field values
179
+ * This could be populated from Attio API discovery
180
+ */
181
+ export function updateKnownFieldValues(fieldSlug, values) {
182
+ KNOWN_FIELD_VALUES[fieldSlug] = values;
183
+ }
184
+ // Remove locally defined ValueMatchResult and similarity functions if they were causing issues
185
+ // interface ValueMatchResult { ... }
186
+ // function similarity(...) { ... }
187
+ // function editDistance(...) { ... }
188
+ //# sourceMappingURL=error-enhancer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-enhancer.js","sourceRoot":"","sources":["../../src/utils/error-enhancer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,kBAAkB,GAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,iFAAiF;AACjF,MAAM,kBAAkB,GAA6B;IACnD,YAAY,EAAE;QACZ,iBAAiB;QACjB,wBAAwB;QACxB,e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CAAC,YAAY,EAAE,CAAC;AACnE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACnD,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,SAAiB,EACjB,MAAgB;IAEhB,kBAAkB,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;AACzC,CAAC;AAED,+FAA+F;AAC/F,qCAAqC;AACrC,mCAAmC;AACnC,qCAAqC"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Error handling utility for creating consistent error responses
3
+ */
4
+ import { AttioErrorResponse } from '../types/attio.js';
5
+ /**
6
+ * Enum for categorizing different types of errors
7
+ */
8
+ export declare enum ErrorType {
9
+ VALIDATION_ERROR = "validation_error",
10
+ API_ERROR = "api_error",
11
+ AUTHENTICATION_ERROR = "authentication_error",
12
+ RATE_LIMIT_ERROR = "rate_limit_error",
13
+ NETWORK_ERROR = "network_error",
14
+ NOT_FOUND_ERROR = "not_found_error",
15
+ SERVER_ERROR = "server_error",
16
+ PARAMETER_ERROR = "parameter_error",
17
+ SERIALIZATION_ERROR = "serialization_error",
18
+ FORMAT_ERROR = "format_error",
19
+ UNKNOWN_ERROR = "unknown_error"
20
+ }
21
+ /**
22
+ * Interface for error details with improved type safety
23
+ */
24
+ export interface ErrorDetails {
25
+ code: number;
26
+ message: string;
27
+ type: ErrorType;
28
+ details?: {
29
+ status?: number;
30
+ method?: string;
31
+ path?: string;
32
+ detail?: string;
33
+ responseData?: Record<string, any>;
34
+ originalError?: string;
35
+ [key: string]: any;
36
+ };
37
+ }
38
+ /**
39
+ * Custom error class for Attio API errors
40
+ */
41
+ export declare class AttioApiError extends Error {
42
+ status: number;
43
+ detail: string;
44
+ path: string;
45
+ method: string;
46
+ responseData: any;
47
+ type: ErrorType;
48
+ constructor(message: string, status: number, detail: string, path: string, method: string, type?: ErrorType, responseData?: any);
49
+ }
50
+ /**
51
+ * Creates a specific API error based on status code and context
52
+ *
53
+ * @param status - HTTP status code
54
+ * @param path - API path
55
+ * @param method - HTTP method
56
+ * @param responseData - Response data from API
57
+ * @returns Appropriate error instance
58
+ */
59
+ export declare function createAttioError(error: any): Error;
60
+ /**
61
+ * Creates a specific API error based on status code and context
62
+ *
63
+ * @param status - HTTP status code
64
+ * @param path - API path
65
+ * @param method - HTTP method
66
+ * @param responseData - Response data from API
67
+ * @returns Appropriate error instance
68
+ */
69
+ export declare function createApiError(status: number, path: string, method: string, responseData?: any): Error;
70
+ /**
71
+ * Format an error into a standardized response based on error type
72
+ *
73
+ * @param error - The error to format
74
+ * @param type - The error type
75
+ * @param details - Additional error details
76
+ * @returns Formatted error response
77
+ */
78
+ export declare function formatErrorResponse(error: Error, type?: ErrorType, details?: any): any;
79
+ /**
80
+ * Creates a detailed error response for API errors, suitable for returning to MCP clients
81
+ *
82
+ * @param error - The caught error
83
+ * @param url - The API URL that was called
84
+ * @param method - The HTTP method used
85
+ * @param responseData - Any response data received
86
+ * @returns Formatted error result
87
+ */
88
+ export declare function createErrorResult(error: Error | any, url: string, method: string, responseData?: AttioErrorResponse): any;
89
+ //# sourceMappingURL=error-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../src/utils/error-handler.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD;;GAEG;AACH,oBAAY,SAAS;IACnB,gBAAgB,qBAAqB;IACrC,SAAS,cAAc;IACvB,oBAAoB,yBAAyB;IAC7C,gBAAgB,qBAAqB;IACrC,aAAa,kBAAkB;IAC/B,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IA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