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,142 @@
1
+ /**
2
+ * General filter utility functions
3
+ * Consolidates utilities from filter-utils.ts and filter-utils-additions.ts
4
+ */
5
+ import { ATTRIBUTES, FilterConditionType, } from './types.js';
6
+ import { resolveDateRange } from '../date-utils.js';
7
+ /**
8
+ * Creates a filter for records based on their creation date
9
+ *
10
+ * @param dateRange - Date range specification
11
+ * @returns Configured filter object
12
+ */
13
+ export function createCreatedDateFilter(dateRange) {
14
+ return createDateRangeFilter(ATTRIBUTES.CREATED_AT, dateRange);
15
+ }
16
+ /**
17
+ * Creates a filter for records based on their last modification date
18
+ *
19
+ * @param dateRange - Date range specification
20
+ * @returns Configured filter object
21
+ */
22
+ export function createModifiedDateFilter(dateRange) {
23
+ return createDateRangeFilter(ATTRIBUTES.UPDATED_AT, dateRange);
24
+ }
25
+ /**
26
+ * Creates a filter for B2B Segment (type_persona)
27
+ *
28
+ * @param value - B2B Segment value to filter by
29
+ * @returns Configured filter object
30
+ */
31
+ export function createB2BSegmentFilter(value) {
32
+ // Using a simple equals filter that will be transformed using the shorthand format
33
+ return {
34
+ filters: [
35
+ {
36
+ attribute: { slug: 'type_persona' },
37
+ condition: FilterConditionType.EQUALS, // This won't be used for type_persona due to shorthand format
38
+ value,
39
+ },
40
+ ],
41
+ matchAny: false,
42
+ };
43
+ }
44
+ /**
45
+ * Validates if a value falls within a numeric range
46
+ *
47
+ * @param value - The value to check
48
+ * @param range - The numeric range to validate against
49
+ * @returns True if value is within range
50
+ */
51
+ export function isInNumericRange(value, range) {
52
+ if (range.equals !== undefined) {
53
+ return value === range.equals;
54
+ }
55
+ if (range.min !== undefined && value < range.min) {
56
+ return false;
57
+ }
58
+ if (range.max !== undefined && value > range.max) {
59
+ return false;
60
+ }
61
+ return true;
62
+ }
63
+ /**
64
+ * Checks if a date string falls within a date range
65
+ *
66
+ * @param dateStr - ISO date string to check
67
+ * @param range - Date range to validate against
68
+ * @returns True if date is within range
69
+ */
70
+ export function isInDateRange(dateStr, range) {
71
+ const date = new Date(dateStr);
72
+ const resolvedRange = resolveDateRange(range);
73
+ if (resolvedRange.start) {
74
+ const startDate = new Date(resolvedRange.start);
75
+ if (date < startDate)
76
+ return false;
77
+ }
78
+ if (resolvedRange.end) {
79
+ const endDate = new Date(resolvedRange.end);
80
+ if (date > endDate)
81
+ return false;
82
+ }
83
+ return true;
84
+ }
85
+ /**
86
+ * Debug logging for filter operations
87
+ *
88
+ * @param operation - The operation being performed
89
+ * @param details - Additional details to log
90
+ */
91
+ export function debugFilterLog(operation, details) {
92
+ if (process.env.NODE_ENV === 'development') {
93
+ console.log(`[Filter ${operation}]`, details);
94
+ }
95
+ }
96
+ /**
97
+ * Determines if a filter attribute represents a date field
98
+ *
99
+ * @param attributeSlug - The attribute slug to check
100
+ * @returns True if the attribute is a date field
101
+ */
102
+ export function isDateAttribute(attributeSlug) {
103
+ const dateAttributes = [
104
+ ATTRIBUTES.CREATED_AT,
105
+ ATTRIBUTES.UPDATED_AT,
106
+ ATTRIBUTES.LAST_INTERACTION,
107
+ ];
108
+ return dateAttributes.includes(attributeSlug);
109
+ }
110
+ /**
111
+ * Determines if a filter attribute represents a numeric field
112
+ *
113
+ * @param attributeSlug - The attribute slug to check
114
+ * @returns True if the attribute is a numeric field
115
+ */
116
+ export function isNumericAttribute(attributeSlug) {
117
+ const numericAttributes = [ATTRIBUTES.REVENUE, ATTRIBUTES.EMPLOYEE_COUNT];
118
+ return numericAttributes.includes(attributeSlug);
119
+ }
120
+ /**
121
+ * Determines if a filter attribute represents a text field
122
+ *
123
+ * @param attributeSlug - The attribute slug to check
124
+ * @returns True if the attribute is a text field
125
+ */
126
+ export function isTextAttribute(attributeSlug) {
127
+ const textAttributes = [
128
+ ATTRIBUTES.NAME,
129
+ ATTRIBUTES.EMAIL,
130
+ ATTRIBUTES.WEBSITE,
131
+ ATTRIBUTES.NOTE_CONTENT,
132
+ ATTRIBUTES.INDUSTRY,
133
+ ];
134
+ return textAttributes.includes(attributeSlug);
135
+ }
136
+ /**
137
+ * Helper function to extract attribute mappings as needed
138
+ * Re-exports builder functions as utilities for backward compatibility
139
+ */
140
+ import { createDateRangeFilter, createEqualsFilter, createContainsFilter, } from './builders.js';
141
+ export { createDateRangeFilter, createEqualsFilter, createContainsFilter };
142
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/filters/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGL,UAAU,EACV,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,SAAoB;IAC1D,OAAO,qBAAqB,CAAC,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,SAAoB;IAC3D,OAAO,qBAAqB,CAAC,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,mFAAmF;IACnF,OAAO;QACL,OAAO,EAAE;YACP;gBACE,SAAS,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;gBACnC,SAAS,EAAE,mBAAmB,CAAC,MAAM,EAAE,8DAA8D;gBACrG,KAAK;aACN;SACF;QACD,QAAQ,EAAE,KAAK;KAChB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,KAAmB;IACjE,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,KAAK,KAAK,KAAK,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,IAAI,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;QACjD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,IAAI,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,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AAC,cAAc,CAAC,CAAC;IAE1E,OAAO,iBAAiB,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AACnD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,aAAqB;IACnD,MAAM,cAAc,GAAG;QACrB,UAAU,CAAC,IAAI;QACf,UAAU,CAAC,KAAK;QAChB,UAAU,CAAC,OAAO;QAClB,UAAU,CAAC,YAAY;QACvB,UAAU,CAAC,QAAQ;KACpB,CAAC;IAEF,OAAO,cAAc,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AAChD,CAAC;AAED;;;GAGG;AACH,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * @module validation-utils
3
+ *
4
+ * Centralized validation utilities for filter structures
5
+ * Provides consistent error message formatting and reusable validation functions
6
+ */
7
+ import { ListEntryFilter, ListEntryFilters } from './types.js';
8
+ import { ValidatedListEntryFilters } from '../../api/operations/types.js';
9
+ /**
10
+ * Error message templates for consistent error formatting
11
+ */
12
+ export declare const ERROR_MESSAGES: {
13
+ MISSING_FILTERS: string;
14
+ FILTERS_NOT_ARRAY: (type: string) => string;
15
+ MISSING_FILTERS_PROPERTY: string;
16
+ EMPTY_FILTERS_ARRAY: string;
17
+ INVALID_FILTER_STRUCTURE: (index: number, reason: string) => string;
18
+ MISSING_ATTRIBUTE: string;
19
+ MISSING_ATTRIBUTE_SLUG: string;
20
+ MISSING_CONDITION: string;
21
+ INVALID_CONDITION: (condition: string, validConditions: string[]) => string;
22
+ ALL_FILTERS_INVALID: string;
23
+ };
24
+ /**
25
+ * Standard example format for filter structures to include in error messages
26
+ */
27
+ export declare const FILTER_EXAMPLES: {
28
+ SIMPLE: string;
29
+ OR_LOGIC: string;
30
+ MULTIPLE_CONDITIONS: string;
31
+ };
32
+ /**
33
+ * Validates the basic filter structure ensuring filters object has required properties
34
+ *
35
+ * This function performs structural validation to ensure:
36
+ * - The filters parameter is not null/undefined
37
+ * - The filters object has a 'filters' property
38
+ * - The 'filters' property is an array
39
+ *
40
+ * @param filters - The filters object to validate (may be undefined/null from user input)
41
+ * @returns Validated filters object with guaranteed filters array
42
+ * @throws FilterValidationError with consistent error messages and appropriate categories
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const validated = validateFiltersObject({
47
+ * filters: [{ attribute: { slug: 'name' }, condition: 'equals', value: 'test' }]
48
+ * });
49
+ * // validated.filters is guaranteed to be an array
50
+ * ```
51
+ */
52
+ export declare function validateFiltersObject(filters: ListEntryFilters | undefined): ValidatedListEntryFilters;
53
+ /**
54
+ * Validates each individual filter in a filters array
55
+ * Returns list of invalid filters with reasons
56
+ *
57
+ * @param filters - Array of filter objects to validate
58
+ * @param validateConditions - Whether to validate condition values
59
+ * @returns Array of objects containing invalid filter index, reason and filter object
60
+ */
61
+ export declare function collectInvalidFilters(filters: ListEntryFilter[], validateConditions?: boolean): {
62
+ index: number;
63
+ reason: string;
64
+ filter: any;
65
+ }[];
66
+ /**
67
+ * Creates a consistently formatted error message for invalid filters
68
+ *
69
+ * @param invalidFilters - Array of invalid filter objects with reasons
70
+ * @returns Formatted error message with details
71
+ */
72
+ export declare function formatInvalidFiltersError(invalidFilters: {
73
+ index: number;
74
+ reason: string;
75
+ filter: any;
76
+ }[]): string;
77
+ /**
78
+ * Full validation of filters with detailed error messages and examples
79
+ *
80
+ * This is the primary entry point for filter validation. It performs:
81
+ * 1. Structural validation using validateFiltersObject()
82
+ * 2. Individual filter validation for each filter in the array
83
+ * 3. Condition validation if enabled
84
+ * 4. Comprehensive error reporting with examples
85
+ *
86
+ * @param filters - Filter object to validate (may have optional filters array)
87
+ * @param validateConditions - Whether to validate condition values against known operators
88
+ * @returns Validated filters with guaranteed filters array and valid structure
89
+ * @throws FilterValidationError with detailed messages, examples, and appropriate categories
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * // Valid usage
94
+ * const validated = validateFilters({
95
+ * filters: [
96
+ * { attribute: { slug: 'name' }, condition: 'equals', value: 'John' },
97
+ * { attribute: { slug: 'age' }, condition: 'greater_than', value: 18 }
98
+ * ],
99
+ * matchAny: false
100
+ * }, true);
101
+ *
102
+ * // validated.filters is guaranteed to exist and be valid
103
+ * ```
104
+ *
105
+ * @see validateFiltersObject For structural validation
106
+ * @see collectInvalidFilters For individual filter validation logic
107
+ */
108
+ export declare function validateFilters(filters: ListEntryFilters | undefined, validateConditions?: boolean): ValidatedListEntryFilters;
109
+ /**
110
+ * Helper function to get a descriptive reason for an invalid filter
111
+ *
112
+ * @param filter - The filter to analyze
113
+ * @returns A string describing what's wrong with the filter
114
+ */
115
+ export declare function getInvalidFilterReason(filter: any): string;
116
+ /**
117
+ * Generate examples for different filter scenarios
118
+ *
119
+ * @param filterType - The type of filter example to generate (simple, or, multiple)
120
+ * @returns A string with the example in JSON format
121
+ */
122
+ export declare function getFilterExample(filterType?: 'simple' | 'or' | 'multiple'): string;
123
+ //# sourceMappingURL=validation-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-utils.d.ts","sourceRoot":"","sources":["../../../src/utils/filters/validation-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAG1E;;GAEG;AACH,eAAO,MAAM,cAAc;;8BAEC,MAAM;;;sCAIE,MAAM,UAAU,MAAM;;;;mCAKzB,MAAM,mBAAmB,MAAM,EAAE;;CAMjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;;;;CAuC3B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,gBAAgB,GAAG,SAAS,GACpC,yBAAyB,CA2B3B;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,eAAe,EAAE,EAC1B,kBAAkB,GAAE,OAAc,GACjC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,EAAE,CAyDlD;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,cAAc,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,EAAE,GAC/D,MAAM,CAUR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,gBAAgB,GAAG,SAAS,EACrC,kBAAkB,GAAE,OAAc,GACjC,yBAAyB,CA4C3B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAsB1D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,GAAE,QAAQ,GAAG,IAAI,GAAG,UAAqB,GAClD,MAAM,CAUR"}
@@ -0,0 +1,282 @@
1
+ /**
2
+ * @module validation-utils
3
+ *
4
+ * Centralized validation utilities for filter structures
5
+ * Provides consistent error message formatting and reusable validation functions
6
+ */
7
+ import { FilterValidationError, FilterErrorCategory, } from '../../errors/api-errors.js';
8
+ import { isValidFilterCondition } from '../../types/attio.js';
9
+ /**
10
+ * Error message templates for consistent error formatting
11
+ */
12
+ export const ERROR_MESSAGES = {
13
+ MISSING_FILTERS: 'Filter object is required but was undefined or null',
14
+ FILTERS_NOT_ARRAY: (type) => `Invalid filter structure: 'filters' property must be an array but got ${type}`,
15
+ MISSING_FILTERS_PROPERTY: 'Filters must include a "filters" array property',
16
+ EMPTY_FILTERS_ARRAY: 'No filters provided in the filters array',
17
+ INVALID_FILTER_STRUCTURE: (index, reason) => `Invalid filter structure at index ${index}: ${reason}`,
18
+ MISSING_ATTRIBUTE: 'missing attribute object',
19
+ MISSING_ATTRIBUTE_SLUG: 'missing attribute.slug property',
20
+ MISSING_CONDITION: 'missing condition property',
21
+ INVALID_CONDITION: (condition, validConditions) => `Invalid filter condition '${condition}'. Valid conditions are: ${validConditions.join(', ')}`,
22
+ ALL_FILTERS_INVALID: 'All filters are invalid. Please provide at least one valid filter.',
23
+ };
24
+ /**
25
+ * Standard example format for filter structures to include in error messages
26
+ */
27
+ export const FILTER_EXAMPLES = {
28
+ SIMPLE: `{
29
+ "filters": [
30
+ {
31
+ "attribute": { "slug": "name" },
32
+ "condition": "contains",
33
+ "value": "Company Inc"
34
+ }
35
+ ]
36
+ }`,
37
+ OR_LOGIC: `{
38
+ "filters": [
39
+ {
40
+ "attribute": { "slug": "name" },
41
+ "condition": "contains",
42
+ "value": "Inc"
43
+ },
44
+ {
45
+ "attribute": { "slug": "industry" },
46
+ "condition": "equals",
47
+ "value": "Technology"
48
+ }
49
+ ],
50
+ "matchAny": true
51
+ }`,
52
+ MULTIPLE_CONDITIONS: `{
53
+ "filters": [
54
+ {
55
+ "attribute": { "slug": "name" },
56
+ "condition": "contains",
57
+ "value": "Inc"
58
+ },
59
+ {
60
+ "attribute": { "slug": "website" },
61
+ "condition": "contains",
62
+ "value": ".com"
63
+ }
64
+ ]
65
+ }`,
66
+ };
67
+ /**
68
+ * Validates the basic filter structure ensuring filters object has required properties
69
+ *
70
+ * This function performs structural validation to ensure:
71
+ * - The filters parameter is not null/undefined
72
+ * - The filters object has a 'filters' property
73
+ * - The 'filters' property is an array
74
+ *
75
+ * @param filters - The filters object to validate (may be undefined/null from user input)
76
+ * @returns Validated filters object with guaranteed filters array
77
+ * @throws FilterValidationError with consistent error messages and appropriate categories
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * const validated = validateFiltersObject({
82
+ * filters: [{ attribute: { slug: 'name' }, condition: 'equals', value: 'test' }]
83
+ * });
84
+ * // validated.filters is guaranteed to be an array
85
+ * ```
86
+ */
87
+ export function validateFiltersObject(filters) {
88
+ // Check if filters is undefined or null
89
+ if (!filters) {
90
+ throw new FilterValidationError(ERROR_MESSAGES.MISSING_FILTERS, FilterErrorCategory.STRUCTURE);
91
+ }
92
+ // Check if filters has a filters property
93
+ if (!('filters' in filters)) {
94
+ throw new FilterValidationError(ERROR_MESSAGES.MISSING_FILTERS_PROPERTY, FilterErrorCategory.STRUCTURE);
95
+ }
96
+ // Check if filters.filters is an array
97
+ if (!Array.isArray(filters.filters)) {
98
+ throw new FilterValidationError(ERROR_MESSAGES.FILTERS_NOT_ARRAY(typeof filters.filters), FilterErrorCategory.STRUCTURE);
99
+ }
100
+ // Return the validated filters with the correct type
101
+ return filters;
102
+ }
103
+ /**
104
+ * Validates each individual filter in a filters array
105
+ * Returns list of invalid filters with reasons
106
+ *
107
+ * @param filters - Array of filter objects to validate
108
+ * @param validateConditions - Whether to validate condition values
109
+ * @returns Array of objects containing invalid filter index, reason and filter object
110
+ */
111
+ export function collectInvalidFilters(filters, validateConditions = true) {
112
+ const invalidFilters = [];
113
+ // Check each filter in the array
114
+ filters.forEach((filter, index) => {
115
+ // Check if filter is a valid object
116
+ if (!filter || typeof filter !== 'object') {
117
+ invalidFilters.push({
118
+ index,
119
+ reason: `Filter at index ${index} is ${filter === null ? 'null' : typeof filter}`,
120
+ filter,
121
+ });
122
+ return;
123
+ }
124
+ // Check for required properties
125
+ if (!filter.attribute) {
126
+ invalidFilters.push({
127
+ index,
128
+ reason: ERROR_MESSAGES.MISSING_ATTRIBUTE,
129
+ filter,
130
+ });
131
+ return;
132
+ }
133
+ if (!filter.attribute.slug) {
134
+ invalidFilters.push({
135
+ index,
136
+ reason: ERROR_MESSAGES.MISSING_ATTRIBUTE_SLUG,
137
+ filter,
138
+ });
139
+ return;
140
+ }
141
+ if (!filter.condition) {
142
+ invalidFilters.push({
143
+ index,
144
+ reason: ERROR_MESSAGES.MISSING_CONDITION,
145
+ filter,
146
+ });
147
+ return;
148
+ }
149
+ // Validate condition if enabled
150
+ if (validateConditions && !isValidFilterCondition(filter.condition)) {
151
+ invalidFilters.push({
152
+ index,
153
+ reason: `Invalid condition '${filter.condition}'`,
154
+ filter,
155
+ });
156
+ return;
157
+ }
158
+ });
159
+ return invalidFilters;
160
+ }
161
+ /**
162
+ * Creates a consistently formatted error message for invalid filters
163
+ *
164
+ * @param invalidFilters - Array of invalid filter objects with reasons
165
+ * @returns Formatted error message with details
166
+ */
167
+ export function formatInvalidFiltersError(invalidFilters) {
168
+ if (invalidFilters.length === 0) {
169
+ return '';
170
+ }
171
+ const errorDetails = invalidFilters
172
+ .map((f) => `Filter [${f.index}]: ${f.reason}`)
173
+ .join('; ');
174
+ return errorDetails;
175
+ }
176
+ /**
177
+ * Full validation of filters with detailed error messages and examples
178
+ *
179
+ * This is the primary entry point for filter validation. It performs:
180
+ * 1. Structural validation using validateFiltersObject()
181
+ * 2. Individual filter validation for each filter in the array
182
+ * 3. Condition validation if enabled
183
+ * 4. Comprehensive error reporting with examples
184
+ *
185
+ * @param filters - Filter object to validate (may have optional filters array)
186
+ * @param validateConditions - Whether to validate condition values against known operators
187
+ * @returns Validated filters with guaranteed filters array and valid structure
188
+ * @throws FilterValidationError with detailed messages, examples, and appropriate categories
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * // Valid usage
193
+ * const validated = validateFilters({
194
+ * filters: [
195
+ * { attribute: { slug: 'name' }, condition: 'equals', value: 'John' },
196
+ * { attribute: { slug: 'age' }, condition: 'greater_than', value: 18 }
197
+ * ],
198
+ * matchAny: false
199
+ * }, true);
200
+ *
201
+ * // validated.filters is guaranteed to exist and be valid
202
+ * ```
203
+ *
204
+ * @see validateFiltersObject For structural validation
205
+ * @see collectInvalidFilters For individual filter validation logic
206
+ */
207
+ export function validateFilters(filters, validateConditions = true) {
208
+ // First validate basic structure
209
+ const validatedFilters = validateFiltersObject(filters);
210
+ // Handle empty or undefined filters array (valid but returns no results)
211
+ if (!validatedFilters.filters || validatedFilters.filters.length === 0) {
212
+ return validatedFilters;
213
+ }
214
+ // Collect invalid filters
215
+ const invalidFilters = collectInvalidFilters(validatedFilters.filters, validateConditions);
216
+ // If all filters are invalid, throw error with examples
217
+ if (invalidFilters.length === validatedFilters.filters.length) {
218
+ const errorDetails = formatInvalidFiltersError(invalidFilters);
219
+ let errorMessage = `${ERROR_MESSAGES.ALL_FILTERS_INVALID} ${errorDetails}`;
220
+ // Add examples to help the user fix their filters
221
+ errorMessage +=
222
+ '\n\nExample of valid filter structure: \n' + FILTER_EXAMPLES.SIMPLE;
223
+ // Determine most appropriate error category based on invalid filters
224
+ let category = FilterErrorCategory.STRUCTURE;
225
+ // If we have specific attribute issues
226
+ if (invalidFilters.some((f) => f.reason.includes('attribute'))) {
227
+ category = FilterErrorCategory.ATTRIBUTE;
228
+ }
229
+ // If we have specific condition issues
230
+ else if (invalidFilters.some((f) => f.reason.includes('condition'))) {
231
+ category = FilterErrorCategory.CONDITION;
232
+ }
233
+ // If we have specific value issues
234
+ else if (invalidFilters.some((f) => f.reason.includes('value'))) {
235
+ category = FilterErrorCategory.VALUE;
236
+ }
237
+ throw new FilterValidationError(errorMessage, category);
238
+ }
239
+ return validatedFilters;
240
+ }
241
+ /**
242
+ * Helper function to get a descriptive reason for an invalid filter
243
+ *
244
+ * @param filter - The filter to analyze
245
+ * @returns A string describing what's wrong with the filter
246
+ */
247
+ export function getInvalidFilterReason(filter) {
248
+ if (!filter || typeof filter !== 'object') {
249
+ return `filter is ${filter === null ? 'null' : typeof filter}`;
250
+ }
251
+ if (!filter.attribute) {
252
+ return ERROR_MESSAGES.MISSING_ATTRIBUTE;
253
+ }
254
+ if (!filter.attribute.slug) {
255
+ return ERROR_MESSAGES.MISSING_ATTRIBUTE_SLUG;
256
+ }
257
+ if (!filter.condition) {
258
+ return ERROR_MESSAGES.MISSING_CONDITION;
259
+ }
260
+ if (!isValidFilterCondition(filter.condition)) {
261
+ return `invalid condition '${filter.condition}'`;
262
+ }
263
+ return 'unknown issue';
264
+ }
265
+ /**
266
+ * Generate examples for different filter scenarios
267
+ *
268
+ * @param filterType - The type of filter example to generate (simple, or, multiple)
269
+ * @returns A string with the example in JSON format
270
+ */
271
+ export function getFilterExample(filterType = 'simple') {
272
+ switch (filterType) {
273
+ case 'or':
274
+ return FILTER_EXAMPLES.OR_LOGIC;
275
+ case 'multiple':
276
+ return FILTER_EXAMPLES.MULTIPLE_CONDITIONS;
277
+ case 'simple':
278
+ default:
279
+ return FILTER_EXAMPLES.SIMPLE;
280
+ }
281
+ }
282
+ //# sourceMappingURL=validation-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-utils.js","sourceRoot":"","sources":["../../../src/utils/filters/validation-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,eAAe,EAAE,qDAAqD;IACtE,iBAAiB,EAAE,CAAC,IAAY,EAAE,EAAE,CAClC,yEAAyE,IAAI,EAAE;IACjF,wBAAwB,EAAE,iDAAiD;IAC3E,mBAAmB,EAAE,0CAA0C;IAC/D,wBAAwB,EAAE,CAAC,KAAa,EAAE,MAAc,EAAE,EAAE,CAC1D,qCAAqC,KAAK,KAAK,MAAM,EAAE;IACzD,iBAAiB,EAAE,0BAA0B;IAC7C,sBAAsB,EAAE,iCAAiC;IACzD,iBAAiB,EAAE,4BAA4B;IAC/C,iBAAiB,EAAE,CAAC,SAAiB,EAAE,eAAyB,EAAE,EAAE,CAClE,6BAA6B,SAAS,4BAA4B,eAAe,CAAC,IAAI,CACpF,IAAI,CACL,EAAE;IACL,mBAAmB,EACjB,oEAAoE;CACvE,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B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QAClC,KAAK,UAAU;YACb,OAAO,eAAe,CAAC,mBAAmB,CAAC;QAC7C,KAAK,QAAQ,CAAC;QACd;YACE,OAAO,eAAe,CAAC,MAAM,CAAC;IAClC,CAAC;AACH,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @module validators
3
+ *
4
+ * Consolidated filter validation utilities
5
+ * Provides functions to validate and normalize filter parameters
6
+ *
7
+ * This module provides:
8
+ * - Structure validation for filter objects
9
+ * - Date range validation and normalization
10
+ * - Numeric range validation
11
+ * - Activity filter validation
12
+ * - Filter condition validation
13
+ * - Parameter type validation and conversion
14
+ */
15
+ import { DateRange, ActivityFilter, NumericRange, FilterConditionType, ListEntryFilter } from './types.js';
16
+ /**
17
+ * Validates a filter structure for basic required properties
18
+ *
19
+ * @param filter - The filter to validate
20
+ * @returns True if filter is valid, false otherwise
21
+ */
22
+ export declare function validateFilterStructure(filter: ListEntryFilter): boolean;
23
+ /**
24
+ * Validates a date range object
25
+ *
26
+ * @param dateRange - The date range to validate
27
+ * @returns Validated and normalized date range
28
+ * @throws FilterValidationError if validation fails
29
+ */
30
+ export declare function validateDateRange(dateRange: any): DateRange;
31
+ /**
32
+ * Validates an activity filter object
33
+ *
34
+ * @param activityFilter - The activity filter to validate
35
+ * @returns Validated and normalized activity filter
36
+ * @throws FilterValidationError if validation fails
37
+ */
38
+ export declare function validateActivityFilter(activityFilter: any): ActivityFilter;
39
+ /**
40
+ * Validates a numeric range object
41
+ *
42
+ * @param range - The numeric range to validate
43
+ * @returns Validated and normalized numeric range
44
+ * @throws FilterValidationError if validation fails
45
+ */
46
+ export declare function validateNumericRange(range: any): NumericRange;
47
+ /**
48
+ * Validates a filter condition string
49
+ *
50
+ * @param condition - The condition to validate
51
+ * @returns The validated condition
52
+ * @throws FilterValidationError if validation fails
53
+ */
54
+ export declare function validateFilterCondition(condition: string): FilterConditionType;
55
+ /**
56
+ * Ensures a value is a number, converting if necessary
57
+ *
58
+ * @param value - The value to validate and convert
59
+ * @param paramName - Name of the parameter (for error messages)
60
+ * @param defaultValue - Optional default value if undefined
61
+ * @returns The validated number
62
+ * @throws FilterValidationError if validation fails
63
+ */
64
+ export declare function validateNumericParam(value: any, paramName: string, defaultValue?: number): number;
65
+ /**
66
+ * Validates filter structure and conditions
67
+ *
68
+ * @param filter - The filter to validate
69
+ * @param validateConditions - Whether to validate condition types (default: true)
70
+ * @throws FilterValidationError if validation fails
71
+ */
72
+ export declare function validateFilterWithConditions(filter: ListEntryFilter, validateConditions?: boolean): void;
73
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/utils/filters/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,EACL,SAAS,EACT,cAAc,EAEd,YAAY,EACZ,mBAAmB,EACnB,eAAe,EAChB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAcxE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,CAoJ3D;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,GAAG,GAAG,cAAc,CA2D1E;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG,YAAY,CAgF7D;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,GAChB,mBAAmB,CAerB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,GAAG,EACV,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAcR;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,eAAe,EACvB,kBAAkB,GAAE,OAAc,GACjC,IAAI,CAgBN"}