langchain 0.2.18 → 0.3.0-rc.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 (338) hide show
  1. package/dist/agents/openai_functions/index.cjs +2 -2
  2. package/dist/agents/openai_functions/index.js +2 -2
  3. package/dist/chains/combine_documents/stuff.cjs +2 -2
  4. package/dist/chains/combine_documents/stuff.js +2 -2
  5. package/dist/chains/openai_functions/openapi.cjs +3 -1
  6. package/dist/chains/openai_functions/openapi.js +3 -1
  7. package/dist/load/import_constants.cjs +2 -39
  8. package/dist/load/import_constants.js +2 -39
  9. package/dist/load/import_map.cjs +2 -3
  10. package/dist/load/import_map.d.ts +0 -1
  11. package/dist/load/import_map.js +0 -1
  12. package/dist/smith/config.d.ts +1 -5
  13. package/package.json +31 -854
  14. package/dist/document_loaders/fs/chatgpt.cjs +0 -90
  15. package/dist/document_loaders/fs/chatgpt.d.ts +0 -8
  16. package/dist/document_loaders/fs/chatgpt.js +0 -86
  17. package/dist/document_loaders/fs/csv.cjs +0 -73
  18. package/dist/document_loaders/fs/csv.d.ts +0 -65
  19. package/dist/document_loaders/fs/csv.js +0 -69
  20. package/dist/document_loaders/fs/docx.cjs +0 -58
  21. package/dist/document_loaders/fs/docx.d.ts +0 -25
  22. package/dist/document_loaders/fs/docx.js +0 -54
  23. package/dist/document_loaders/fs/epub.cjs +0 -103
  24. package/dist/document_loaders/fs/epub.d.ts +0 -33
  25. package/dist/document_loaders/fs/epub.js +0 -99
  26. package/dist/document_loaders/fs/notion.cjs +0 -26
  27. package/dist/document_loaders/fs/notion.d.ts +0 -12
  28. package/dist/document_loaders/fs/notion.js +0 -22
  29. package/dist/document_loaders/fs/obsidian.cjs +0 -247
  30. package/dist/document_loaders/fs/obsidian.d.ts +0 -28
  31. package/dist/document_loaders/fs/obsidian.js +0 -240
  32. package/dist/document_loaders/fs/openai_whisper_audio.cjs +0 -49
  33. package/dist/document_loaders/fs/openai_whisper_audio.d.ts +0 -23
  34. package/dist/document_loaders/fs/openai_whisper_audio.js +0 -45
  35. package/dist/document_loaders/fs/pdf.cjs +0 -148
  36. package/dist/document_loaders/fs/pdf.d.ts +0 -49
  37. package/dist/document_loaders/fs/pdf.js +0 -144
  38. package/dist/document_loaders/fs/pptx.cjs +0 -46
  39. package/dist/document_loaders/fs/pptx.d.ts +0 -25
  40. package/dist/document_loaders/fs/pptx.js +0 -42
  41. package/dist/document_loaders/fs/srt.cjs +0 -57
  42. package/dist/document_loaders/fs/srt.d.ts +0 -32
  43. package/dist/document_loaders/fs/srt.js +0 -50
  44. package/dist/document_loaders/fs/unstructured.cjs +0 -338
  45. package/dist/document_loaders/fs/unstructured.d.ts +0 -125
  46. package/dist/document_loaders/fs/unstructured.js +0 -333
  47. package/dist/document_loaders/web/apify_dataset.cjs +0 -130
  48. package/dist/document_loaders/web/apify_dataset.d.ts +0 -85
  49. package/dist/document_loaders/web/apify_dataset.js +0 -126
  50. package/dist/document_loaders/web/assemblyai.cjs +0 -200
  51. package/dist/document_loaders/web/assemblyai.d.ts +0 -95
  52. package/dist/document_loaders/web/assemblyai.js +0 -193
  53. package/dist/document_loaders/web/azure_blob_storage_container.cjs +0 -73
  54. package/dist/document_loaders/web/azure_blob_storage_container.d.ts +0 -46
  55. package/dist/document_loaders/web/azure_blob_storage_container.js +0 -69
  56. package/dist/document_loaders/web/azure_blob_storage_file.cjs +0 -124
  57. package/dist/document_loaders/web/azure_blob_storage_file.d.ts +0 -53
  58. package/dist/document_loaders/web/azure_blob_storage_file.js +0 -97
  59. package/dist/document_loaders/web/browserbase.cjs +0 -93
  60. package/dist/document_loaders/web/browserbase.d.ts +0 -48
  61. package/dist/document_loaders/web/browserbase.js +0 -86
  62. package/dist/document_loaders/web/cheerio.cjs +0 -118
  63. package/dist/document_loaders/web/cheerio.d.ts +0 -77
  64. package/dist/document_loaders/web/cheerio.js +0 -114
  65. package/dist/document_loaders/web/college_confidential.cjs +0 -41
  66. package/dist/document_loaders/web/college_confidential.d.ts +0 -25
  67. package/dist/document_loaders/web/college_confidential.js +0 -37
  68. package/dist/document_loaders/web/confluence.cjs +0 -190
  69. package/dist/document_loaders/web/confluence.d.ts +0 -114
  70. package/dist/document_loaders/web/confluence.js +0 -186
  71. package/dist/document_loaders/web/couchbase.cjs +0 -95
  72. package/dist/document_loaders/web/couchbase.d.ts +0 -32
  73. package/dist/document_loaders/web/couchbase.js +0 -91
  74. package/dist/document_loaders/web/figma.cjs +0 -102
  75. package/dist/document_loaders/web/figma.d.ts +0 -82
  76. package/dist/document_loaders/web/figma.js +0 -98
  77. package/dist/document_loaders/web/firecrawl.cjs +0 -95
  78. package/dist/document_loaders/web/firecrawl.d.ts +0 -50
  79. package/dist/document_loaders/web/firecrawl.js +0 -88
  80. package/dist/document_loaders/web/gitbook.cjs +0 -110
  81. package/dist/document_loaders/web/gitbook.d.ts +0 -55
  82. package/dist/document_loaders/web/gitbook.js +0 -106
  83. package/dist/document_loaders/web/github.cjs +0 -615
  84. package/dist/document_loaders/web/github.d.ts +0 -203
  85. package/dist/document_loaders/web/github.js +0 -608
  86. package/dist/document_loaders/web/hn.cjs +0 -90
  87. package/dist/document_loaders/web/hn.d.ts +0 -42
  88. package/dist/document_loaders/web/hn.js +0 -86
  89. package/dist/document_loaders/web/imsdb.cjs +0 -44
  90. package/dist/document_loaders/web/imsdb.d.ts +0 -23
  91. package/dist/document_loaders/web/imsdb.js +0 -40
  92. package/dist/document_loaders/web/notionapi.cjs +0 -404
  93. package/dist/document_loaders/web/notionapi.d.ts +0 -133
  94. package/dist/document_loaders/web/notionapi.js +0 -392
  95. package/dist/document_loaders/web/notiondb.cjs +0 -199
  96. package/dist/document_loaders/web/notiondb.d.ts +0 -56
  97. package/dist/document_loaders/web/notiondb.js +0 -195
  98. package/dist/document_loaders/web/pdf.cjs +0 -140
  99. package/dist/document_loaders/web/pdf.d.ts +0 -35
  100. package/dist/document_loaders/web/pdf.js +0 -136
  101. package/dist/document_loaders/web/playwright.cjs +0 -89
  102. package/dist/document_loaders/web/playwright.d.ts +0 -58
  103. package/dist/document_loaders/web/playwright.js +0 -85
  104. package/dist/document_loaders/web/puppeteer.cjs +0 -139
  105. package/dist/document_loaders/web/puppeteer.d.ts +0 -82
  106. package/dist/document_loaders/web/puppeteer.js +0 -135
  107. package/dist/document_loaders/web/recursive_url.cjs +0 -198
  108. package/dist/document_loaders/web/recursive_url.d.ts +0 -33
  109. package/dist/document_loaders/web/recursive_url.js +0 -194
  110. package/dist/document_loaders/web/s3.cjs +0 -164
  111. package/dist/document_loaders/web/s3.d.ts +0 -78
  112. package/dist/document_loaders/web/s3.js +0 -137
  113. package/dist/document_loaders/web/searchapi.cjs +0 -150
  114. package/dist/document_loaders/web/searchapi.d.ts +0 -76
  115. package/dist/document_loaders/web/searchapi.js +0 -146
  116. package/dist/document_loaders/web/serpapi.cjs +0 -127
  117. package/dist/document_loaders/web/serpapi.d.ts +0 -62
  118. package/dist/document_loaders/web/serpapi.js +0 -123
  119. package/dist/document_loaders/web/sitemap.cjs +0 -118
  120. package/dist/document_loaders/web/sitemap.d.ts +0 -41
  121. package/dist/document_loaders/web/sitemap.js +0 -114
  122. package/dist/document_loaders/web/sonix_audio.cjs +0 -68
  123. package/dist/document_loaders/web/sonix_audio.d.ts +0 -36
  124. package/dist/document_loaders/web/sonix_audio.js +0 -64
  125. package/dist/document_loaders/web/sort_xyz_blockchain.cjs +0 -157
  126. package/dist/document_loaders/web/sort_xyz_blockchain.d.ts +0 -78
  127. package/dist/document_loaders/web/sort_xyz_blockchain.js +0 -153
  128. package/dist/document_loaders/web/youtube.cjs +0 -116
  129. package/dist/document_loaders/web/youtube.d.ts +0 -55
  130. package/dist/document_loaders/web/youtube.js +0 -112
  131. package/dist/experimental/tools/pyinterpreter.cjs +0 -248
  132. package/dist/experimental/tools/pyinterpreter.d.ts +0 -18
  133. package/dist/experimental/tools/pyinterpreter.js +0 -244
  134. package/dist/retrievers/self_query/chroma.cjs +0 -48
  135. package/dist/retrievers/self_query/chroma.d.ts +0 -26
  136. package/dist/retrievers/self_query/chroma.js +0 -44
  137. package/dist/retrievers/self_query/pinecone.cjs +0 -47
  138. package/dist/retrievers/self_query/pinecone.d.ts +0 -26
  139. package/dist/retrievers/self_query/pinecone.js +0 -43
  140. package/dist/retrievers/self_query/supabase.cjs +0 -278
  141. package/dist/retrievers/self_query/supabase.d.ts +0 -109
  142. package/dist/retrievers/self_query/supabase.js +0 -274
  143. package/dist/retrievers/self_query/supabase_utils.cjs +0 -264
  144. package/dist/retrievers/self_query/supabase_utils.d.ts +0 -101
  145. package/dist/retrievers/self_query/supabase_utils.js +0 -259
  146. package/dist/retrievers/self_query/vectara.cjs +0 -143
  147. package/dist/retrievers/self_query/vectara.d.ts +0 -42
  148. package/dist/retrievers/self_query/vectara.js +0 -139
  149. package/dist/retrievers/self_query/weaviate.cjs +0 -201
  150. package/dist/retrievers/self_query/weaviate.d.ts +0 -99
  151. package/dist/retrievers/self_query/weaviate.js +0 -197
  152. package/dist/types/assemblyai-types.cjs +0 -2
  153. package/dist/types/assemblyai-types.d.ts +0 -4
  154. package/dist/types/assemblyai-types.js +0 -1
  155. package/document_loaders/fs/chatgpt.cjs +0 -1
  156. package/document_loaders/fs/chatgpt.d.cts +0 -1
  157. package/document_loaders/fs/chatgpt.d.ts +0 -1
  158. package/document_loaders/fs/chatgpt.js +0 -1
  159. package/document_loaders/fs/csv.cjs +0 -1
  160. package/document_loaders/fs/csv.d.cts +0 -1
  161. package/document_loaders/fs/csv.d.ts +0 -1
  162. package/document_loaders/fs/csv.js +0 -1
  163. package/document_loaders/fs/docx.cjs +0 -1
  164. package/document_loaders/fs/docx.d.cts +0 -1
  165. package/document_loaders/fs/docx.d.ts +0 -1
  166. package/document_loaders/fs/docx.js +0 -1
  167. package/document_loaders/fs/epub.cjs +0 -1
  168. package/document_loaders/fs/epub.d.cts +0 -1
  169. package/document_loaders/fs/epub.d.ts +0 -1
  170. package/document_loaders/fs/epub.js +0 -1
  171. package/document_loaders/fs/notion.cjs +0 -1
  172. package/document_loaders/fs/notion.d.cts +0 -1
  173. package/document_loaders/fs/notion.d.ts +0 -1
  174. package/document_loaders/fs/notion.js +0 -1
  175. package/document_loaders/fs/obsidian.cjs +0 -1
  176. package/document_loaders/fs/obsidian.d.cts +0 -1
  177. package/document_loaders/fs/obsidian.d.ts +0 -1
  178. package/document_loaders/fs/obsidian.js +0 -1
  179. package/document_loaders/fs/openai_whisper_audio.cjs +0 -1
  180. package/document_loaders/fs/openai_whisper_audio.d.cts +0 -1
  181. package/document_loaders/fs/openai_whisper_audio.d.ts +0 -1
  182. package/document_loaders/fs/openai_whisper_audio.js +0 -1
  183. package/document_loaders/fs/pdf.cjs +0 -1
  184. package/document_loaders/fs/pdf.d.cts +0 -1
  185. package/document_loaders/fs/pdf.d.ts +0 -1
  186. package/document_loaders/fs/pdf.js +0 -1
  187. package/document_loaders/fs/pptx.cjs +0 -1
  188. package/document_loaders/fs/pptx.d.cts +0 -1
  189. package/document_loaders/fs/pptx.d.ts +0 -1
  190. package/document_loaders/fs/pptx.js +0 -1
  191. package/document_loaders/fs/srt.cjs +0 -1
  192. package/document_loaders/fs/srt.d.cts +0 -1
  193. package/document_loaders/fs/srt.d.ts +0 -1
  194. package/document_loaders/fs/srt.js +0 -1
  195. package/document_loaders/fs/unstructured.cjs +0 -1
  196. package/document_loaders/fs/unstructured.d.cts +0 -1
  197. package/document_loaders/fs/unstructured.d.ts +0 -1
  198. package/document_loaders/fs/unstructured.js +0 -1
  199. package/document_loaders/web/apify_dataset.cjs +0 -1
  200. package/document_loaders/web/apify_dataset.d.cts +0 -1
  201. package/document_loaders/web/apify_dataset.d.ts +0 -1
  202. package/document_loaders/web/apify_dataset.js +0 -1
  203. package/document_loaders/web/assemblyai.cjs +0 -1
  204. package/document_loaders/web/assemblyai.d.cts +0 -1
  205. package/document_loaders/web/assemblyai.d.ts +0 -1
  206. package/document_loaders/web/assemblyai.js +0 -1
  207. package/document_loaders/web/azure_blob_storage_container.cjs +0 -1
  208. package/document_loaders/web/azure_blob_storage_container.d.cts +0 -1
  209. package/document_loaders/web/azure_blob_storage_container.d.ts +0 -1
  210. package/document_loaders/web/azure_blob_storage_container.js +0 -1
  211. package/document_loaders/web/azure_blob_storage_file.cjs +0 -1
  212. package/document_loaders/web/azure_blob_storage_file.d.cts +0 -1
  213. package/document_loaders/web/azure_blob_storage_file.d.ts +0 -1
  214. package/document_loaders/web/azure_blob_storage_file.js +0 -1
  215. package/document_loaders/web/browserbase.cjs +0 -1
  216. package/document_loaders/web/browserbase.d.cts +0 -1
  217. package/document_loaders/web/browserbase.d.ts +0 -1
  218. package/document_loaders/web/browserbase.js +0 -1
  219. package/document_loaders/web/cheerio.cjs +0 -1
  220. package/document_loaders/web/cheerio.d.cts +0 -1
  221. package/document_loaders/web/cheerio.d.ts +0 -1
  222. package/document_loaders/web/cheerio.js +0 -1
  223. package/document_loaders/web/college_confidential.cjs +0 -1
  224. package/document_loaders/web/college_confidential.d.cts +0 -1
  225. package/document_loaders/web/college_confidential.d.ts +0 -1
  226. package/document_loaders/web/college_confidential.js +0 -1
  227. package/document_loaders/web/confluence.cjs +0 -1
  228. package/document_loaders/web/confluence.d.cts +0 -1
  229. package/document_loaders/web/confluence.d.ts +0 -1
  230. package/document_loaders/web/confluence.js +0 -1
  231. package/document_loaders/web/couchbase.cjs +0 -1
  232. package/document_loaders/web/couchbase.d.cts +0 -1
  233. package/document_loaders/web/couchbase.d.ts +0 -1
  234. package/document_loaders/web/couchbase.js +0 -1
  235. package/document_loaders/web/figma.cjs +0 -1
  236. package/document_loaders/web/figma.d.cts +0 -1
  237. package/document_loaders/web/figma.d.ts +0 -1
  238. package/document_loaders/web/figma.js +0 -1
  239. package/document_loaders/web/firecrawl.cjs +0 -1
  240. package/document_loaders/web/firecrawl.d.cts +0 -1
  241. package/document_loaders/web/firecrawl.d.ts +0 -1
  242. package/document_loaders/web/firecrawl.js +0 -1
  243. package/document_loaders/web/gitbook.cjs +0 -1
  244. package/document_loaders/web/gitbook.d.cts +0 -1
  245. package/document_loaders/web/gitbook.d.ts +0 -1
  246. package/document_loaders/web/gitbook.js +0 -1
  247. package/document_loaders/web/github.cjs +0 -1
  248. package/document_loaders/web/github.d.cts +0 -1
  249. package/document_loaders/web/github.d.ts +0 -1
  250. package/document_loaders/web/github.js +0 -1
  251. package/document_loaders/web/hn.cjs +0 -1
  252. package/document_loaders/web/hn.d.cts +0 -1
  253. package/document_loaders/web/hn.d.ts +0 -1
  254. package/document_loaders/web/hn.js +0 -1
  255. package/document_loaders/web/imsdb.cjs +0 -1
  256. package/document_loaders/web/imsdb.d.cts +0 -1
  257. package/document_loaders/web/imsdb.d.ts +0 -1
  258. package/document_loaders/web/imsdb.js +0 -1
  259. package/document_loaders/web/notionapi.cjs +0 -1
  260. package/document_loaders/web/notionapi.d.cts +0 -1
  261. package/document_loaders/web/notionapi.d.ts +0 -1
  262. package/document_loaders/web/notionapi.js +0 -1
  263. package/document_loaders/web/notiondb.cjs +0 -1
  264. package/document_loaders/web/notiondb.d.cts +0 -1
  265. package/document_loaders/web/notiondb.d.ts +0 -1
  266. package/document_loaders/web/notiondb.js +0 -1
  267. package/document_loaders/web/pdf.cjs +0 -1
  268. package/document_loaders/web/pdf.d.cts +0 -1
  269. package/document_loaders/web/pdf.d.ts +0 -1
  270. package/document_loaders/web/pdf.js +0 -1
  271. package/document_loaders/web/playwright.cjs +0 -1
  272. package/document_loaders/web/playwright.d.cts +0 -1
  273. package/document_loaders/web/playwright.d.ts +0 -1
  274. package/document_loaders/web/playwright.js +0 -1
  275. package/document_loaders/web/puppeteer.cjs +0 -1
  276. package/document_loaders/web/puppeteer.d.cts +0 -1
  277. package/document_loaders/web/puppeteer.d.ts +0 -1
  278. package/document_loaders/web/puppeteer.js +0 -1
  279. package/document_loaders/web/recursive_url.cjs +0 -1
  280. package/document_loaders/web/recursive_url.d.cts +0 -1
  281. package/document_loaders/web/recursive_url.d.ts +0 -1
  282. package/document_loaders/web/recursive_url.js +0 -1
  283. package/document_loaders/web/s3.cjs +0 -1
  284. package/document_loaders/web/s3.d.cts +0 -1
  285. package/document_loaders/web/s3.d.ts +0 -1
  286. package/document_loaders/web/s3.js +0 -1
  287. package/document_loaders/web/searchapi.cjs +0 -1
  288. package/document_loaders/web/searchapi.d.cts +0 -1
  289. package/document_loaders/web/searchapi.d.ts +0 -1
  290. package/document_loaders/web/searchapi.js +0 -1
  291. package/document_loaders/web/serpapi.cjs +0 -1
  292. package/document_loaders/web/serpapi.d.cts +0 -1
  293. package/document_loaders/web/serpapi.d.ts +0 -1
  294. package/document_loaders/web/serpapi.js +0 -1
  295. package/document_loaders/web/sitemap.cjs +0 -1
  296. package/document_loaders/web/sitemap.d.cts +0 -1
  297. package/document_loaders/web/sitemap.d.ts +0 -1
  298. package/document_loaders/web/sitemap.js +0 -1
  299. package/document_loaders/web/sonix_audio.cjs +0 -1
  300. package/document_loaders/web/sonix_audio.d.cts +0 -1
  301. package/document_loaders/web/sonix_audio.d.ts +0 -1
  302. package/document_loaders/web/sonix_audio.js +0 -1
  303. package/document_loaders/web/sort_xyz_blockchain.cjs +0 -1
  304. package/document_loaders/web/sort_xyz_blockchain.d.cts +0 -1
  305. package/document_loaders/web/sort_xyz_blockchain.d.ts +0 -1
  306. package/document_loaders/web/sort_xyz_blockchain.js +0 -1
  307. package/document_loaders/web/youtube.cjs +0 -1
  308. package/document_loaders/web/youtube.d.cts +0 -1
  309. package/document_loaders/web/youtube.d.ts +0 -1
  310. package/document_loaders/web/youtube.js +0 -1
  311. package/experimental/tools/pyinterpreter.cjs +0 -1
  312. package/experimental/tools/pyinterpreter.d.cts +0 -1
  313. package/experimental/tools/pyinterpreter.d.ts +0 -1
  314. package/experimental/tools/pyinterpreter.js +0 -1
  315. package/memory/index.cjs +0 -1
  316. package/memory/index.d.cts +0 -1
  317. package/memory/index.d.ts +0 -1
  318. package/memory/index.js +0 -1
  319. package/retrievers/self_query/chroma.cjs +0 -1
  320. package/retrievers/self_query/chroma.d.cts +0 -1
  321. package/retrievers/self_query/chroma.d.ts +0 -1
  322. package/retrievers/self_query/chroma.js +0 -1
  323. package/retrievers/self_query/pinecone.cjs +0 -1
  324. package/retrievers/self_query/pinecone.d.cts +0 -1
  325. package/retrievers/self_query/pinecone.d.ts +0 -1
  326. package/retrievers/self_query/pinecone.js +0 -1
  327. package/retrievers/self_query/supabase.cjs +0 -1
  328. package/retrievers/self_query/supabase.d.cts +0 -1
  329. package/retrievers/self_query/supabase.d.ts +0 -1
  330. package/retrievers/self_query/supabase.js +0 -1
  331. package/retrievers/self_query/vectara.cjs +0 -1
  332. package/retrievers/self_query/vectara.d.cts +0 -1
  333. package/retrievers/self_query/vectara.d.ts +0 -1
  334. package/retrievers/self_query/vectara.js +0 -1
  335. package/retrievers/self_query/weaviate.cjs +0 -1
  336. package/retrievers/self_query/weaviate.d.cts +0 -1
  337. package/retrievers/self_query/weaviate.d.ts +0 -1
  338. package/retrievers/self_query/weaviate.js +0 -1
@@ -1,264 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertObjectFilterToStructuredQuery = exports.ProxyParamsDuplicator = void 0;
4
- /* eslint-disable @typescript-eslint/no-explicit-any */
5
- const structured_query_1 = require("@langchain/core/structured_query");
6
- /**
7
- * Utility class used to duplicate parameters for a proxy object,
8
- * specifically designed to work with `SupabaseFilter` objects. It
9
- * contains methods to handle different types of operations such as "or",
10
- * "filter", "in", "contains", "textSearch", "match", "not", and default
11
- * operations.
12
- */
13
- class ProxyParamsDuplicator {
14
- constructor() {
15
- Object.defineProperty(this, "duplicationAllowedOps", {
16
- enumerable: true,
17
- configurable: true,
18
- writable: true,
19
- value: [
20
- "eq",
21
- "neq",
22
- "lt",
23
- "lte",
24
- "gt",
25
- "gte",
26
- "like",
27
- "ilike",
28
- "or",
29
- "in",
30
- "contains",
31
- "match",
32
- "not",
33
- "textSearch",
34
- "filter",
35
- ]
36
- });
37
- Object.defineProperty(this, "values", {
38
- enumerable: true,
39
- configurable: true,
40
- writable: true,
41
- value: []
42
- });
43
- }
44
- /**
45
- * Creates a proxy handler for a `SupabaseFilter` object. The handler
46
- * intercepts get operations and applies specific logic based on the
47
- * property being accessed.
48
- * @returns A proxy handler for a `SupabaseFilter` object.
49
- */
50
- buildProxyHandler() {
51
- const proxyHandler = {
52
- get: (target, prop, receiver) => {
53
- if (typeof target[prop] === "function") {
54
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
55
- return (...args) => {
56
- if (this.duplicationAllowedOps.includes(String(prop))) {
57
- switch (String(prop)) {
58
- case "or":
59
- // args[0]: filters, args[1]: { foreignTable }
60
- this.addOrClause(args[0], args[1]);
61
- break;
62
- case "filter":
63
- // args[0]: column, args[1]: operator, args[2]: value
64
- this.addFilterClause(args[0], args[1], args[2]);
65
- break;
66
- case "in":
67
- // args[0]: column, args[1]: values
68
- this.addInClause(args[0], args[1]);
69
- break;
70
- case "contains":
71
- // args[0]: column, args[1]: value
72
- this.addContainsClause(args[0], args[1]);
73
- break;
74
- case "textSearch":
75
- // args[0]: column, args[1]: query, args[2]: { config, type }
76
- this.addTextSearchClause(args[0], args[1], args[2]);
77
- break;
78
- case "match":
79
- // args[0]: query
80
- this.addMatchClause(args[0]);
81
- break;
82
- case "not":
83
- // args[0]: column, args[1]: operator, args[2]: value
84
- this.addNotClause(args[0], args[1], args[2]);
85
- break;
86
- default:
87
- // args[0]: column, args[1]: value
88
- this.addDefaultOpClause(prop, args[0], args[1]);
89
- }
90
- return new Proxy(target, proxyHandler);
91
- }
92
- else {
93
- throw new Error("Filter operation not supported for 'or' mergeFiltersOperator");
94
- }
95
- };
96
- }
97
- else {
98
- return Reflect.get(target, prop, receiver);
99
- }
100
- },
101
- };
102
- return proxyHandler;
103
- }
104
- /**
105
- * Removes type annotations from a value string.
106
- * @param value The value string to clean.
107
- * @returns The cleaned value string.
108
- */
109
- removeType(value) {
110
- let cleanedValue = value;
111
- if (cleanedValue.includes("::float")) {
112
- cleanedValue = cleanedValue.replace("::float", "");
113
- }
114
- if (cleanedValue.includes("::int")) {
115
- cleanedValue = cleanedValue.replace("::int", "");
116
- }
117
- return cleanedValue;
118
- }
119
- /**
120
- * Adds a default operation clause to the values array.
121
- * @param prop The operation property.
122
- * @param column The column to apply the operation to.
123
- * @param value The value for the operation.
124
- */
125
- addDefaultOpClause(prop, column, value) {
126
- this.values.push([this.removeType(column), `${String(prop)}.${value}`]);
127
- }
128
- /**
129
- * Adds an 'or' clause to the values array.
130
- * @param filters The filters for the 'or' clause.
131
- * @param foreignTable Optional foreign table for the 'or' clause.
132
- */
133
- addOrClause(filters, { foreignTable } = {}) {
134
- const key = foreignTable ? `${foreignTable}.or` : "or";
135
- this.values.push([this.removeType(key), `(${filters})`]);
136
- }
137
- /**
138
- * Adds a 'filter' clause to the values array.
139
- * @param column The column to apply the filter to.
140
- * @param operator The operator for the filter.
141
- * @param value The value for the filter.
142
- */
143
- addFilterClause(column, operator, value) {
144
- this.values.push([this.removeType(column), `${operator}.${value}`]);
145
- }
146
- /**
147
- * Adds an 'in' clause to the values array.
148
- * @param column The column to apply the 'in' clause to.
149
- * @param values The values for the 'in' clause.
150
- */
151
- addInClause(column, values) {
152
- const cleanedValues = values
153
- .map((s) => {
154
- if (typeof s === "string" && /[,()]/.test(s))
155
- return `"${s}"`;
156
- else
157
- return `${s}`;
158
- })
159
- .join(",");
160
- this.values.push([this.removeType(column), `in.(${cleanedValues})`]);
161
- }
162
- /**
163
- * Adds a 'contains' clause to the values array.
164
- * @param column The column to apply the 'contains' clause to.
165
- * @param value The value for the 'contains' clause.
166
- */
167
- addContainsClause(column, value) {
168
- if (typeof value === "string") {
169
- this.values.push([this.removeType(column), `cs.${value}`]);
170
- }
171
- else if (Array.isArray(value)) {
172
- this.values.push([this.removeType(column), `cs.{${value.join(",")}}`]);
173
- }
174
- else {
175
- this.values.push([
176
- this.removeType(column),
177
- `cs.${JSON.stringify(value)}`,
178
- ]);
179
- }
180
- }
181
- /**
182
- * Adds a 'textSearch' clause to the values array.
183
- * @param column The column to apply the 'textSearch' clause to.
184
- * @param query The query for the 'textSearch' clause.
185
- * @param config Optional configuration for the 'textSearch' clause.
186
- * @param type Optional type for the 'textSearch' clause.
187
- */
188
- addTextSearchClause(column, query, { config, type, } = {}) {
189
- let typePart = "";
190
- if (type === "plain") {
191
- typePart = "pl";
192
- }
193
- else if (type === "phrase") {
194
- typePart = "ph";
195
- }
196
- else if (type === "websearch") {
197
- typePart = "w";
198
- }
199
- const configPart = config === undefined ? "" : `(${config})`;
200
- this.values.push([
201
- this.removeType(column),
202
- `${typePart}fts${configPart}.${query}`,
203
- ]);
204
- }
205
- /**
206
- * Adds a 'not' clause to the values array.
207
- * @param column The column to apply the 'not' clause to.
208
- * @param operator The operator for the 'not' clause.
209
- * @param value The value for the 'not' clause.
210
- */
211
- addNotClause(column, operator, value) {
212
- this.values.push([column, `not.${operator}.${value}`]);
213
- }
214
- /**
215
- * Adds a 'match' clause to the values array.
216
- * @param query The query for the 'match' clause.
217
- */
218
- addMatchClause(query) {
219
- Object.entries(query).forEach(([column, value]) => {
220
- this.values.push([column, `eq.${value}`]);
221
- });
222
- }
223
- /**
224
- * Returns the flattened parameters as a string.
225
- * @returns The flattened parameters as a string.
226
- */
227
- flattenedParams() {
228
- const mapped = this.values.map(([k, v]) => `${k}.${v}`);
229
- if (mapped.length === 1)
230
- return mapped[0];
231
- return `and(${mapped.join(",")})`;
232
- }
233
- /**
234
- * Gets flattened parameters from a `SupabaseFilter` and a
235
- * `SupabaseFilterRPCCall`.
236
- * @param rpc The `SupabaseFilter` object.
237
- * @param filter The `SupabaseFilterRPCCall` object.
238
- * @returns The flattened parameters as a string.
239
- */
240
- static getFlattenedParams(
241
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
242
- rpc,
243
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
244
- filter) {
245
- const proxiedDuplicator = new ProxyParamsDuplicator();
246
- const proxiedRpc = new Proxy(rpc, proxiedDuplicator.buildProxyHandler());
247
- void filter(proxiedRpc);
248
- return proxiedDuplicator.flattenedParams();
249
- }
250
- }
251
- exports.ProxyParamsDuplicator = ProxyParamsDuplicator;
252
- /**
253
- * Converts a `SupabaseMetadata` object into a `StructuredQuery` object.
254
- * The function creates a new `StructuredQuery` object and uses the
255
- * `Operation` and `Comparison` classes to build the query.
256
- */
257
- function convertObjectFilterToStructuredQuery(
258
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
259
- objFilter) {
260
- return new structured_query_1.StructuredQuery("", new structured_query_1.Operation(structured_query_1.Operators.and, Object.entries(objFilter).map(
261
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
262
- ([column, value]) => new structured_query_1.Comparison(structured_query_1.Comparators.eq, column, value))));
263
- }
264
- exports.convertObjectFilterToStructuredQuery = convertObjectFilterToStructuredQuery;
@@ -1,101 +0,0 @@
1
- import { StructuredQuery } from "@langchain/core/structured_query";
2
- /**
3
- * Utility class used to duplicate parameters for a proxy object,
4
- * specifically designed to work with `SupabaseFilter` objects. It
5
- * contains methods to handle different types of operations such as "or",
6
- * "filter", "in", "contains", "textSearch", "match", "not", and default
7
- * operations.
8
- */
9
- export declare class ProxyParamsDuplicator {
10
- duplicationAllowedOps: string[];
11
- values: [string, string][];
12
- /**
13
- * Creates a proxy handler for a `SupabaseFilter` object. The handler
14
- * intercepts get operations and applies specific logic based on the
15
- * property being accessed.
16
- * @returns A proxy handler for a `SupabaseFilter` object.
17
- */
18
- buildProxyHandler(): ProxyHandler<any>;
19
- /**
20
- * Removes type annotations from a value string.
21
- * @param value The value string to clean.
22
- * @returns The cleaned value string.
23
- */
24
- removeType(value: string): string;
25
- /**
26
- * Adds a default operation clause to the values array.
27
- * @param prop The operation property.
28
- * @param column The column to apply the operation to.
29
- * @param value The value for the operation.
30
- */
31
- addDefaultOpClause(prop: string, column: string, value: unknown): void;
32
- /**
33
- * Adds an 'or' clause to the values array.
34
- * @param filters The filters for the 'or' clause.
35
- * @param foreignTable Optional foreign table for the 'or' clause.
36
- */
37
- addOrClause(filters: string, { foreignTable }?: {
38
- foreignTable?: string;
39
- }): void;
40
- /**
41
- * Adds a 'filter' clause to the values array.
42
- * @param column The column to apply the filter to.
43
- * @param operator The operator for the filter.
44
- * @param value The value for the filter.
45
- */
46
- addFilterClause(column: string, operator: string, value: unknown): void;
47
- /**
48
- * Adds an 'in' clause to the values array.
49
- * @param column The column to apply the 'in' clause to.
50
- * @param values The values for the 'in' clause.
51
- */
52
- addInClause(column: string, values: unknown[]): void;
53
- /**
54
- * Adds a 'contains' clause to the values array.
55
- * @param column The column to apply the 'contains' clause to.
56
- * @param value The value for the 'contains' clause.
57
- */
58
- addContainsClause(column: string, value: unknown): void;
59
- /**
60
- * Adds a 'textSearch' clause to the values array.
61
- * @param column The column to apply the 'textSearch' clause to.
62
- * @param query The query for the 'textSearch' clause.
63
- * @param config Optional configuration for the 'textSearch' clause.
64
- * @param type Optional type for the 'textSearch' clause.
65
- */
66
- addTextSearchClause(column: string, query: string[], { config, type, }?: {
67
- config?: string;
68
- type?: "plain" | "phrase" | "websearch";
69
- }): void;
70
- /**
71
- * Adds a 'not' clause to the values array.
72
- * @param column The column to apply the 'not' clause to.
73
- * @param operator The operator for the 'not' clause.
74
- * @param value The value for the 'not' clause.
75
- */
76
- addNotClause(column: string, operator: string, value: unknown): void;
77
- /**
78
- * Adds a 'match' clause to the values array.
79
- * @param query The query for the 'match' clause.
80
- */
81
- addMatchClause(query: Record<string, unknown>): void;
82
- /**
83
- * Returns the flattened parameters as a string.
84
- * @returns The flattened parameters as a string.
85
- */
86
- flattenedParams(): string;
87
- /**
88
- * Gets flattened parameters from a `SupabaseFilter` and a
89
- * `SupabaseFilterRPCCall`.
90
- * @param rpc The `SupabaseFilter` object.
91
- * @param filter The `SupabaseFilterRPCCall` object.
92
- * @returns The flattened parameters as a string.
93
- */
94
- static getFlattenedParams(rpc: any, filter: any): string;
95
- }
96
- /**
97
- * Converts a `SupabaseMetadata` object into a `StructuredQuery` object.
98
- * The function creates a new `StructuredQuery` object and uses the
99
- * `Operation` and `Comparison` classes to build the query.
100
- */
101
- export declare function convertObjectFilterToStructuredQuery(objFilter: any): StructuredQuery;
@@ -1,259 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { Comparators, Comparison, Operation, Operators, StructuredQuery, } from "@langchain/core/structured_query";
3
- /**
4
- * Utility class used to duplicate parameters for a proxy object,
5
- * specifically designed to work with `SupabaseFilter` objects. It
6
- * contains methods to handle different types of operations such as "or",
7
- * "filter", "in", "contains", "textSearch", "match", "not", and default
8
- * operations.
9
- */
10
- export class ProxyParamsDuplicator {
11
- constructor() {
12
- Object.defineProperty(this, "duplicationAllowedOps", {
13
- enumerable: true,
14
- configurable: true,
15
- writable: true,
16
- value: [
17
- "eq",
18
- "neq",
19
- "lt",
20
- "lte",
21
- "gt",
22
- "gte",
23
- "like",
24
- "ilike",
25
- "or",
26
- "in",
27
- "contains",
28
- "match",
29
- "not",
30
- "textSearch",
31
- "filter",
32
- ]
33
- });
34
- Object.defineProperty(this, "values", {
35
- enumerable: true,
36
- configurable: true,
37
- writable: true,
38
- value: []
39
- });
40
- }
41
- /**
42
- * Creates a proxy handler for a `SupabaseFilter` object. The handler
43
- * intercepts get operations and applies specific logic based on the
44
- * property being accessed.
45
- * @returns A proxy handler for a `SupabaseFilter` object.
46
- */
47
- buildProxyHandler() {
48
- const proxyHandler = {
49
- get: (target, prop, receiver) => {
50
- if (typeof target[prop] === "function") {
51
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
- return (...args) => {
53
- if (this.duplicationAllowedOps.includes(String(prop))) {
54
- switch (String(prop)) {
55
- case "or":
56
- // args[0]: filters, args[1]: { foreignTable }
57
- this.addOrClause(args[0], args[1]);
58
- break;
59
- case "filter":
60
- // args[0]: column, args[1]: operator, args[2]: value
61
- this.addFilterClause(args[0], args[1], args[2]);
62
- break;
63
- case "in":
64
- // args[0]: column, args[1]: values
65
- this.addInClause(args[0], args[1]);
66
- break;
67
- case "contains":
68
- // args[0]: column, args[1]: value
69
- this.addContainsClause(args[0], args[1]);
70
- break;
71
- case "textSearch":
72
- // args[0]: column, args[1]: query, args[2]: { config, type }
73
- this.addTextSearchClause(args[0], args[1], args[2]);
74
- break;
75
- case "match":
76
- // args[0]: query
77
- this.addMatchClause(args[0]);
78
- break;
79
- case "not":
80
- // args[0]: column, args[1]: operator, args[2]: value
81
- this.addNotClause(args[0], args[1], args[2]);
82
- break;
83
- default:
84
- // args[0]: column, args[1]: value
85
- this.addDefaultOpClause(prop, args[0], args[1]);
86
- }
87
- return new Proxy(target, proxyHandler);
88
- }
89
- else {
90
- throw new Error("Filter operation not supported for 'or' mergeFiltersOperator");
91
- }
92
- };
93
- }
94
- else {
95
- return Reflect.get(target, prop, receiver);
96
- }
97
- },
98
- };
99
- return proxyHandler;
100
- }
101
- /**
102
- * Removes type annotations from a value string.
103
- * @param value The value string to clean.
104
- * @returns The cleaned value string.
105
- */
106
- removeType(value) {
107
- let cleanedValue = value;
108
- if (cleanedValue.includes("::float")) {
109
- cleanedValue = cleanedValue.replace("::float", "");
110
- }
111
- if (cleanedValue.includes("::int")) {
112
- cleanedValue = cleanedValue.replace("::int", "");
113
- }
114
- return cleanedValue;
115
- }
116
- /**
117
- * Adds a default operation clause to the values array.
118
- * @param prop The operation property.
119
- * @param column The column to apply the operation to.
120
- * @param value The value for the operation.
121
- */
122
- addDefaultOpClause(prop, column, value) {
123
- this.values.push([this.removeType(column), `${String(prop)}.${value}`]);
124
- }
125
- /**
126
- * Adds an 'or' clause to the values array.
127
- * @param filters The filters for the 'or' clause.
128
- * @param foreignTable Optional foreign table for the 'or' clause.
129
- */
130
- addOrClause(filters, { foreignTable } = {}) {
131
- const key = foreignTable ? `${foreignTable}.or` : "or";
132
- this.values.push([this.removeType(key), `(${filters})`]);
133
- }
134
- /**
135
- * Adds a 'filter' clause to the values array.
136
- * @param column The column to apply the filter to.
137
- * @param operator The operator for the filter.
138
- * @param value The value for the filter.
139
- */
140
- addFilterClause(column, operator, value) {
141
- this.values.push([this.removeType(column), `${operator}.${value}`]);
142
- }
143
- /**
144
- * Adds an 'in' clause to the values array.
145
- * @param column The column to apply the 'in' clause to.
146
- * @param values The values for the 'in' clause.
147
- */
148
- addInClause(column, values) {
149
- const cleanedValues = values
150
- .map((s) => {
151
- if (typeof s === "string" && /[,()]/.test(s))
152
- return `"${s}"`;
153
- else
154
- return `${s}`;
155
- })
156
- .join(",");
157
- this.values.push([this.removeType(column), `in.(${cleanedValues})`]);
158
- }
159
- /**
160
- * Adds a 'contains' clause to the values array.
161
- * @param column The column to apply the 'contains' clause to.
162
- * @param value The value for the 'contains' clause.
163
- */
164
- addContainsClause(column, value) {
165
- if (typeof value === "string") {
166
- this.values.push([this.removeType(column), `cs.${value}`]);
167
- }
168
- else if (Array.isArray(value)) {
169
- this.values.push([this.removeType(column), `cs.{${value.join(",")}}`]);
170
- }
171
- else {
172
- this.values.push([
173
- this.removeType(column),
174
- `cs.${JSON.stringify(value)}`,
175
- ]);
176
- }
177
- }
178
- /**
179
- * Adds a 'textSearch' clause to the values array.
180
- * @param column The column to apply the 'textSearch' clause to.
181
- * @param query The query for the 'textSearch' clause.
182
- * @param config Optional configuration for the 'textSearch' clause.
183
- * @param type Optional type for the 'textSearch' clause.
184
- */
185
- addTextSearchClause(column, query, { config, type, } = {}) {
186
- let typePart = "";
187
- if (type === "plain") {
188
- typePart = "pl";
189
- }
190
- else if (type === "phrase") {
191
- typePart = "ph";
192
- }
193
- else if (type === "websearch") {
194
- typePart = "w";
195
- }
196
- const configPart = config === undefined ? "" : `(${config})`;
197
- this.values.push([
198
- this.removeType(column),
199
- `${typePart}fts${configPart}.${query}`,
200
- ]);
201
- }
202
- /**
203
- * Adds a 'not' clause to the values array.
204
- * @param column The column to apply the 'not' clause to.
205
- * @param operator The operator for the 'not' clause.
206
- * @param value The value for the 'not' clause.
207
- */
208
- addNotClause(column, operator, value) {
209
- this.values.push([column, `not.${operator}.${value}`]);
210
- }
211
- /**
212
- * Adds a 'match' clause to the values array.
213
- * @param query The query for the 'match' clause.
214
- */
215
- addMatchClause(query) {
216
- Object.entries(query).forEach(([column, value]) => {
217
- this.values.push([column, `eq.${value}`]);
218
- });
219
- }
220
- /**
221
- * Returns the flattened parameters as a string.
222
- * @returns The flattened parameters as a string.
223
- */
224
- flattenedParams() {
225
- const mapped = this.values.map(([k, v]) => `${k}.${v}`);
226
- if (mapped.length === 1)
227
- return mapped[0];
228
- return `and(${mapped.join(",")})`;
229
- }
230
- /**
231
- * Gets flattened parameters from a `SupabaseFilter` and a
232
- * `SupabaseFilterRPCCall`.
233
- * @param rpc The `SupabaseFilter` object.
234
- * @param filter The `SupabaseFilterRPCCall` object.
235
- * @returns The flattened parameters as a string.
236
- */
237
- static getFlattenedParams(
238
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
239
- rpc,
240
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
241
- filter) {
242
- const proxiedDuplicator = new ProxyParamsDuplicator();
243
- const proxiedRpc = new Proxy(rpc, proxiedDuplicator.buildProxyHandler());
244
- void filter(proxiedRpc);
245
- return proxiedDuplicator.flattenedParams();
246
- }
247
- }
248
- /**
249
- * Converts a `SupabaseMetadata` object into a `StructuredQuery` object.
250
- * The function creates a new `StructuredQuery` object and uses the
251
- * `Operation` and `Comparison` classes to build the query.
252
- */
253
- export function convertObjectFilterToStructuredQuery(
254
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
255
- objFilter) {
256
- return new StructuredQuery("", new Operation(Operators.and, Object.entries(objFilter).map(
257
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
258
- ([column, value]) => new Comparison(Comparators.eq, column, value))));
259
- }