@nshiab/simple-data-analysis-core 2.0.9 → 2.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 (453) hide show
  1. package/esm/class/SDAError.d.ts +6 -6
  2. package/esm/class/SDAError.js +6 -6
  3. package/esm/class/Simple.d.ts +9 -9
  4. package/esm/class/Simple.js +9 -9
  5. package/esm/class/SimpleDB.d.ts +80 -76
  6. package/esm/class/SimpleDB.d.ts.map +1 -1
  7. package/esm/class/SimpleDB.js +80 -76
  8. package/esm/class/SimpleTable.d.ts +2795 -1139
  9. package/esm/class/SimpleTable.d.ts.map +1 -1
  10. package/esm/class/SimpleTable.js +2781 -1149
  11. package/esm/helpers/buildApproximateMutualReachabilityMst.d.ts +45 -0
  12. package/esm/helpers/buildApproximateMutualReachabilityMst.d.ts.map +1 -0
  13. package/esm/helpers/buildApproximateMutualReachabilityMst.js +212 -0
  14. package/esm/helpers/buildChronologicalGraphComponentsSql.d.ts +14 -0
  15. package/esm/helpers/buildChronologicalGraphComponentsSql.d.ts.map +1 -0
  16. package/esm/helpers/buildChronologicalGraphComponentsSql.js +167 -0
  17. package/esm/helpers/buildExactMutualReachabilityMst.d.ts +28 -0
  18. package/esm/helpers/buildExactMutualReachabilityMst.d.ts.map +1 -0
  19. package/esm/helpers/buildExactMutualReachabilityMst.js +97 -0
  20. package/esm/helpers/buildGraphTemporalCostStateSql.d.ts +12 -0
  21. package/esm/helpers/buildGraphTemporalCostStateSql.d.ts.map +1 -0
  22. package/esm/helpers/buildGraphTemporalCostStateSql.js +86 -0
  23. package/esm/helpers/buildGraphTemporalReachabilitySql.d.ts +13 -0
  24. package/esm/helpers/buildGraphTemporalReachabilitySql.d.ts.map +1 -0
  25. package/esm/helpers/buildGraphTemporalReachabilitySql.js +70 -0
  26. package/esm/helpers/buildSparseMutualReachabilityMst.d.ts +10 -0
  27. package/esm/helpers/buildSparseMutualReachabilityMst.d.ts.map +1 -0
  28. package/esm/helpers/buildSparseMutualReachabilityMst.js +47 -0
  29. package/esm/helpers/buildUmapGraph.d.ts +2 -5
  30. package/esm/helpers/buildUmapGraph.d.ts.map +1 -1
  31. package/esm/helpers/buildUmapGraph.js +6 -100
  32. package/esm/helpers/buildVectorNeighbors.d.ts +45 -0
  33. package/esm/helpers/buildVectorNeighbors.d.ts.map +1 -0
  34. package/esm/helpers/buildVectorNeighbors.js +170 -0
  35. package/esm/helpers/buildWeakGraphComponentsSql.d.ts +3 -0
  36. package/esm/helpers/buildWeakGraphComponentsSql.d.ts.map +1 -0
  37. package/esm/helpers/buildWeakGraphComponentsSql.js +32 -0
  38. package/esm/helpers/camelCase.d.ts +7 -5
  39. package/esm/helpers/camelCase.d.ts.map +1 -1
  40. package/esm/helpers/camelCase.js +7 -5
  41. package/esm/helpers/capitalize.d.ts +6 -4
  42. package/esm/helpers/capitalize.d.ts.map +1 -1
  43. package/esm/helpers/capitalize.js +6 -4
  44. package/esm/helpers/clusterHdbscan.d.ts +18 -0
  45. package/esm/helpers/clusterHdbscan.d.ts.map +1 -0
  46. package/esm/helpers/clusterHdbscan.js +342 -0
  47. package/esm/helpers/computeCovariance.d.ts +16 -0
  48. package/esm/helpers/computeCovariance.d.ts.map +1 -0
  49. package/esm/helpers/computeCovariance.js +99 -0
  50. package/esm/helpers/computeMahalanobisDistances.d.ts +14 -0
  51. package/esm/helpers/computeMahalanobisDistances.d.ts.map +1 -0
  52. package/esm/helpers/computeMahalanobisDistances.js +87 -0
  53. package/esm/helpers/createDirectory.d.ts +4 -3
  54. package/esm/helpers/createDirectory.d.ts.map +1 -1
  55. package/esm/helpers/createDirectory.js +4 -3
  56. package/esm/helpers/dataToArrays.d.ts +6 -4
  57. package/esm/helpers/dataToArrays.d.ts.map +1 -1
  58. package/esm/helpers/dataToArrays.js +6 -4
  59. package/esm/helpers/extractTypes.d.ts +1 -1
  60. package/esm/helpers/extractTypes.js +4 -9
  61. package/esm/helpers/factorCovariance.d.ts +17 -0
  62. package/esm/helpers/factorCovariance.d.ts.map +1 -0
  63. package/esm/helpers/factorCovariance.js +189 -0
  64. package/esm/helpers/findGeoColumn.d.ts +6 -4
  65. package/esm/helpers/findGeoColumn.d.ts.map +1 -1
  66. package/esm/helpers/findGeoColumn.js +6 -4
  67. package/esm/helpers/findGeoColumnFromSchema.d.ts +8 -5
  68. package/esm/helpers/findGeoColumnFromSchema.d.ts.map +1 -1
  69. package/esm/helpers/findGeoColumnFromSchema.js +8 -5
  70. package/esm/helpers/formatDate.d.ts +12 -6
  71. package/esm/helpers/formatDate.d.ts.map +1 -1
  72. package/esm/helpers/formatDate.js +12 -6
  73. package/esm/helpers/formatMissingTables.d.ts +8 -5
  74. package/esm/helpers/formatMissingTables.d.ts.map +1 -1
  75. package/esm/helpers/formatMissingTables.js +8 -5
  76. package/esm/helpers/formatNumber.d.ts +19 -10
  77. package/esm/helpers/formatNumber.d.ts.map +1 -1
  78. package/esm/helpers/formatNumber.js +32 -17
  79. package/esm/helpers/getGraphEdgeIdColumn.d.ts +9 -0
  80. package/esm/helpers/getGraphEdgeIdColumn.d.ts.map +1 -0
  81. package/esm/helpers/getGraphEdgeIdColumn.js +25 -0
  82. package/esm/helpers/getGraphEndpointColumns.d.ts +11 -0
  83. package/esm/helpers/getGraphEndpointColumns.d.ts.map +1 -0
  84. package/esm/helpers/getGraphEndpointColumns.js +160 -0
  85. package/esm/helpers/getGraphWeightColumn.d.ts +10 -0
  86. package/esm/helpers/getGraphWeightColumn.d.ts.map +1 -0
  87. package/esm/helpers/getGraphWeightColumn.js +40 -0
  88. package/esm/helpers/graphRouteResultSchema.d.ts +4 -0
  89. package/esm/helpers/graphRouteResultSchema.d.ts.map +1 -0
  90. package/esm/helpers/graphRouteResultSchema.js +12 -0
  91. package/esm/helpers/graphRouteResultSelect.d.ts +4 -0
  92. package/esm/helpers/graphRouteResultSelect.d.ts.map +1 -0
  93. package/esm/helpers/graphRouteResultSelect.js +22 -0
  94. package/esm/helpers/hasGeometryColumn.d.ts +4 -3
  95. package/esm/helpers/hasGeometryColumn.d.ts.map +1 -1
  96. package/esm/helpers/hasGeometryColumn.js +4 -3
  97. package/esm/helpers/inspectGraphConnectivity.d.ts +10 -0
  98. package/esm/helpers/inspectGraphConnectivity.d.ts.map +1 -0
  99. package/esm/helpers/inspectGraphConnectivity.js +55 -0
  100. package/esm/helpers/mergeOptions.d.ts +24 -13
  101. package/esm/helpers/mergeOptions.d.ts.map +1 -1
  102. package/esm/helpers/mergeOptions.js +24 -13
  103. package/esm/helpers/parseValue.d.ts +6 -4
  104. package/esm/helpers/parseValue.d.ts.map +1 -1
  105. package/esm/helpers/parseValue.js +6 -4
  106. package/esm/helpers/prepareGraphRouteSql.d.ts +31 -0
  107. package/esm/helpers/prepareGraphRouteSql.d.ts.map +1 -0
  108. package/esm/helpers/prepareGraphRouteSql.js +86 -0
  109. package/esm/helpers/prepareGraphStarts.d.ts +9 -0
  110. package/esm/helpers/prepareGraphStarts.d.ts.map +1 -0
  111. package/esm/helpers/prepareGraphStarts.js +68 -0
  112. package/esm/helpers/prepareGraphTemporalSql.d.ts +28 -0
  113. package/esm/helpers/prepareGraphTemporalSql.d.ts.map +1 -0
  114. package/esm/helpers/prepareGraphTemporalSql.js +154 -0
  115. package/esm/helpers/prepareGraphTraversal.d.ts +19 -0
  116. package/esm/helpers/prepareGraphTraversal.d.ts.map +1 -0
  117. package/esm/helpers/prepareGraphTraversal.js +79 -0
  118. package/esm/helpers/prepareNumericFeatures.d.ts +41 -0
  119. package/esm/helpers/prepareNumericFeatures.d.ts.map +1 -0
  120. package/esm/helpers/prepareNumericFeatures.js +210 -0
  121. package/esm/helpers/prettyDuration.d.ts +14 -8
  122. package/esm/helpers/prettyDuration.d.ts.map +1 -1
  123. package/esm/helpers/prettyDuration.js +14 -8
  124. package/esm/helpers/printTable.d.ts +18 -13
  125. package/esm/helpers/printTable.d.ts.map +1 -1
  126. package/esm/helpers/printTable.js +18 -13
  127. package/esm/helpers/publishPreparedColumns.d.ts +37 -0
  128. package/esm/helpers/publishPreparedColumns.d.ts.map +1 -0
  129. package/esm/helpers/publishPreparedColumns.js +113 -0
  130. package/esm/helpers/queryDB.d.ts +24 -13
  131. package/esm/helpers/queryDB.d.ts.map +1 -1
  132. package/esm/helpers/queryDB.js +24 -13
  133. package/esm/helpers/queueAsyncBarrier.d.ts +12 -7
  134. package/esm/helpers/queueAsyncBarrier.d.ts.map +1 -1
  135. package/esm/helpers/queueAsyncBarrier.js +12 -7
  136. package/esm/helpers/queueGraphResult.d.ts +18 -0
  137. package/esm/helpers/queueGraphResult.d.ts.map +1 -0
  138. package/esm/helpers/queueGraphResult.js +39 -0
  139. package/esm/helpers/quoteIdentifier.d.ts +4 -3
  140. package/esm/helpers/quoteIdentifier.d.ts.map +1 -1
  141. package/esm/helpers/quoteIdentifier.js +4 -3
  142. package/esm/helpers/quoteQualifiedIdentifier.d.ts +6 -4
  143. package/esm/helpers/quoteQualifiedIdentifier.d.ts.map +1 -1
  144. package/esm/helpers/quoteQualifiedIdentifier.js +6 -4
  145. package/esm/helpers/runQuery.d.ts.map +1 -1
  146. package/esm/helpers/runQuery.js +17 -3
  147. package/esm/helpers/selectFuzzyReplacements.d.ts +11 -0
  148. package/esm/helpers/selectFuzzyReplacements.d.ts.map +1 -0
  149. package/esm/helpers/selectFuzzyReplacements.js +124 -0
  150. package/esm/helpers/stabilizeCosineVectors.d.ts +14 -0
  151. package/esm/helpers/stabilizeCosineVectors.d.ts.map +1 -0
  152. package/esm/helpers/stabilizeCosineVectors.js +34 -0
  153. package/esm/helpers/stringToArray.d.ts +4 -3
  154. package/esm/helpers/stringToArray.d.ts.map +1 -1
  155. package/esm/helpers/stringToArray.js +4 -3
  156. package/esm/helpers/updateColumnsWithJS.d.ts +12 -6
  157. package/esm/helpers/updateColumnsWithJS.d.ts.map +1 -1
  158. package/esm/helpers/updateColumnsWithJS.js +12 -6
  159. package/esm/helpers/validateGraphRouteResultSchema.d.ts +4 -0
  160. package/esm/helpers/validateGraphRouteResultSchema.d.ts.map +1 -0
  161. package/esm/helpers/validateGraphRouteResultSchema.js +13 -0
  162. package/esm/helpers/validateGraphTemporalEvents.d.ts +7 -0
  163. package/esm/helpers/validateGraphTemporalEvents.d.ts.map +1 -0
  164. package/esm/helpers/validateGraphTemporalEvents.js +47 -0
  165. package/esm/helpers/validateNumericalAnalysis.d.ts +10 -6
  166. package/esm/helpers/validateNumericalAnalysis.d.ts.map +1 -1
  167. package/esm/helpers/validateNumericalAnalysis.js +10 -6
  168. package/esm/helpers/validateVectorRowIds.d.ts +4 -0
  169. package/esm/helpers/validateVectorRowIds.d.ts.map +1 -0
  170. package/esm/helpers/validateVectorRowIds.js +16 -0
  171. package/esm/helpers/vectorDistanceExpression.d.ts +6 -0
  172. package/esm/helpers/vectorDistanceExpression.d.ts.map +1 -0
  173. package/esm/helpers/vectorDistanceExpression.js +11 -0
  174. package/esm/helpers/wrapString.d.ts +10 -7
  175. package/esm/helpers/wrapString.d.ts.map +1 -1
  176. package/esm/helpers/wrapString.js +10 -7
  177. package/esm/methods/addId.d.ts +5 -0
  178. package/esm/methods/addId.d.ts.map +1 -0
  179. package/esm/methods/addId.js +38 -0
  180. package/esm/methods/commonNeighbors.d.ts +10 -0
  181. package/esm/methods/commonNeighbors.d.ts.map +1 -0
  182. package/esm/methods/commonNeighbors.js +101 -0
  183. package/esm/methods/connectedComponents.d.ts +9 -0
  184. package/esm/methods/connectedComponents.d.ts.map +1 -0
  185. package/esm/methods/connectedComponents.js +147 -0
  186. package/esm/methods/degree.d.ts +9 -0
  187. package/esm/methods/degree.d.ts.map +1 -0
  188. package/esm/methods/degree.js +135 -0
  189. package/esm/methods/distances.d.ts +12 -0
  190. package/esm/methods/distances.d.ts.map +1 -0
  191. package/esm/methods/distances.js +164 -0
  192. package/esm/methods/findCycles.d.ts +12 -0
  193. package/esm/methods/findCycles.d.ts.map +1 -0
  194. package/esm/methods/findCycles.js +330 -0
  195. package/esm/methods/fuzzyClean.d.ts.map +1 -1
  196. package/esm/methods/fuzzyClean.js +17 -136
  197. package/esm/methods/fuzzyJoin.js +70 -16
  198. package/esm/methods/getTypes.d.ts +1 -1
  199. package/esm/methods/hdbscan.d.ts +5 -0
  200. package/esm/methods/hdbscan.d.ts.map +1 -0
  201. package/esm/methods/hdbscan.js +208 -0
  202. package/esm/methods/mahalanobis.d.ts +5 -0
  203. package/esm/methods/mahalanobis.d.ts.map +1 -0
  204. package/esm/methods/mahalanobis.js +92 -0
  205. package/esm/methods/neighbors.d.ts +9 -0
  206. package/esm/methods/neighbors.d.ts.map +1 -0
  207. package/esm/methods/neighbors.js +81 -0
  208. package/esm/methods/normalizeVector.d.ts +5 -0
  209. package/esm/methods/normalizeVector.d.ts.map +1 -0
  210. package/esm/methods/normalizeVector.js +132 -0
  211. package/esm/methods/paths.d.ts +12 -0
  212. package/esm/methods/paths.d.ts.map +1 -0
  213. package/esm/methods/paths.js +287 -0
  214. package/esm/methods/reachable.d.ts +11 -0
  215. package/esm/methods/reachable.d.ts.map +1 -0
  216. package/esm/methods/reachable.js +131 -0
  217. package/esm/methods/rowToVector.d.ts +5 -0
  218. package/esm/methods/rowToVector.d.ts.map +1 -0
  219. package/esm/methods/rowToVector.js +77 -0
  220. package/esm/methods/shortestPath.d.ts +12 -0
  221. package/esm/methods/shortestPath.d.ts.map +1 -0
  222. package/esm/methods/shortestPath.js +337 -0
  223. package/esm/methods/topologicalSort.d.ts +7 -0
  224. package/esm/methods/topologicalSort.d.ts.map +1 -0
  225. package/esm/methods/topologicalSort.js +164 -0
  226. package/llm.md +2106 -143
  227. package/llms.txt +1 -1
  228. package/package.json +1 -1
  229. package/script/class/SDAError.d.ts +6 -6
  230. package/script/class/SDAError.js +6 -6
  231. package/script/class/Simple.d.ts +9 -9
  232. package/script/class/Simple.js +9 -9
  233. package/script/class/SimpleDB.d.ts +80 -76
  234. package/script/class/SimpleDB.d.ts.map +1 -1
  235. package/script/class/SimpleDB.js +80 -76
  236. package/script/class/SimpleTable.d.ts +2795 -1139
  237. package/script/class/SimpleTable.d.ts.map +1 -1
  238. package/script/class/SimpleTable.js +2781 -1149
  239. package/script/helpers/buildApproximateMutualReachabilityMst.d.ts +45 -0
  240. package/script/helpers/buildApproximateMutualReachabilityMst.d.ts.map +1 -0
  241. package/script/helpers/buildApproximateMutualReachabilityMst.js +219 -0
  242. package/script/helpers/buildChronologicalGraphComponentsSql.d.ts +14 -0
  243. package/script/helpers/buildChronologicalGraphComponentsSql.d.ts.map +1 -0
  244. package/script/helpers/buildChronologicalGraphComponentsSql.js +174 -0
  245. package/script/helpers/buildExactMutualReachabilityMst.d.ts +28 -0
  246. package/script/helpers/buildExactMutualReachabilityMst.d.ts.map +1 -0
  247. package/script/helpers/buildExactMutualReachabilityMst.js +103 -0
  248. package/script/helpers/buildGraphTemporalCostStateSql.d.ts +12 -0
  249. package/script/helpers/buildGraphTemporalCostStateSql.d.ts.map +1 -0
  250. package/script/helpers/buildGraphTemporalCostStateSql.js +92 -0
  251. package/script/helpers/buildGraphTemporalReachabilitySql.d.ts +13 -0
  252. package/script/helpers/buildGraphTemporalReachabilitySql.d.ts.map +1 -0
  253. package/script/helpers/buildGraphTemporalReachabilitySql.js +76 -0
  254. package/script/helpers/buildSparseMutualReachabilityMst.d.ts +10 -0
  255. package/script/helpers/buildSparseMutualReachabilityMst.d.ts.map +1 -0
  256. package/script/helpers/buildSparseMutualReachabilityMst.js +50 -0
  257. package/script/helpers/buildUmapGraph.d.ts +2 -5
  258. package/script/helpers/buildUmapGraph.d.ts.map +1 -1
  259. package/script/helpers/buildUmapGraph.js +6 -100
  260. package/script/helpers/buildVectorNeighbors.d.ts +45 -0
  261. package/script/helpers/buildVectorNeighbors.d.ts.map +1 -0
  262. package/script/helpers/buildVectorNeighbors.js +176 -0
  263. package/script/helpers/buildWeakGraphComponentsSql.d.ts +3 -0
  264. package/script/helpers/buildWeakGraphComponentsSql.d.ts.map +1 -0
  265. package/script/helpers/buildWeakGraphComponentsSql.js +38 -0
  266. package/script/helpers/camelCase.d.ts +7 -5
  267. package/script/helpers/camelCase.d.ts.map +1 -1
  268. package/script/helpers/camelCase.js +7 -5
  269. package/script/helpers/capitalize.d.ts +6 -4
  270. package/script/helpers/capitalize.d.ts.map +1 -1
  271. package/script/helpers/capitalize.js +6 -4
  272. package/script/helpers/clusterHdbscan.d.ts +18 -0
  273. package/script/helpers/clusterHdbscan.d.ts.map +1 -0
  274. package/script/helpers/clusterHdbscan.js +346 -0
  275. package/script/helpers/computeCovariance.d.ts +16 -0
  276. package/script/helpers/computeCovariance.d.ts.map +1 -0
  277. package/script/helpers/computeCovariance.js +105 -0
  278. package/script/helpers/computeMahalanobisDistances.d.ts +14 -0
  279. package/script/helpers/computeMahalanobisDistances.d.ts.map +1 -0
  280. package/script/helpers/computeMahalanobisDistances.js +93 -0
  281. package/script/helpers/createDirectory.d.ts +4 -3
  282. package/script/helpers/createDirectory.d.ts.map +1 -1
  283. package/script/helpers/createDirectory.js +4 -3
  284. package/script/helpers/dataToArrays.d.ts +6 -4
  285. package/script/helpers/dataToArrays.d.ts.map +1 -1
  286. package/script/helpers/dataToArrays.js +6 -4
  287. package/script/helpers/extractTypes.d.ts +1 -1
  288. package/script/helpers/extractTypes.js +4 -9
  289. package/script/helpers/factorCovariance.d.ts +17 -0
  290. package/script/helpers/factorCovariance.d.ts.map +1 -0
  291. package/script/helpers/factorCovariance.js +194 -0
  292. package/script/helpers/findGeoColumn.d.ts +6 -4
  293. package/script/helpers/findGeoColumn.d.ts.map +1 -1
  294. package/script/helpers/findGeoColumn.js +6 -4
  295. package/script/helpers/findGeoColumnFromSchema.d.ts +8 -5
  296. package/script/helpers/findGeoColumnFromSchema.d.ts.map +1 -1
  297. package/script/helpers/findGeoColumnFromSchema.js +8 -5
  298. package/script/helpers/formatDate.d.ts +12 -6
  299. package/script/helpers/formatDate.d.ts.map +1 -1
  300. package/script/helpers/formatDate.js +12 -6
  301. package/script/helpers/formatMissingTables.d.ts +8 -5
  302. package/script/helpers/formatMissingTables.d.ts.map +1 -1
  303. package/script/helpers/formatMissingTables.js +8 -5
  304. package/script/helpers/formatNumber.d.ts +19 -10
  305. package/script/helpers/formatNumber.d.ts.map +1 -1
  306. package/script/helpers/formatNumber.js +32 -17
  307. package/script/helpers/getGraphEdgeIdColumn.d.ts +9 -0
  308. package/script/helpers/getGraphEdgeIdColumn.d.ts.map +1 -0
  309. package/script/helpers/getGraphEdgeIdColumn.js +31 -0
  310. package/script/helpers/getGraphEndpointColumns.d.ts +11 -0
  311. package/script/helpers/getGraphEndpointColumns.d.ts.map +1 -0
  312. package/script/helpers/getGraphEndpointColumns.js +166 -0
  313. package/script/helpers/getGraphWeightColumn.d.ts +10 -0
  314. package/script/helpers/getGraphWeightColumn.d.ts.map +1 -0
  315. package/script/helpers/getGraphWeightColumn.js +46 -0
  316. package/script/helpers/graphRouteResultSchema.d.ts +4 -0
  317. package/script/helpers/graphRouteResultSchema.d.ts.map +1 -0
  318. package/script/helpers/graphRouteResultSchema.js +18 -0
  319. package/script/helpers/graphRouteResultSelect.d.ts +4 -0
  320. package/script/helpers/graphRouteResultSelect.d.ts.map +1 -0
  321. package/script/helpers/graphRouteResultSelect.js +28 -0
  322. package/script/helpers/hasGeometryColumn.d.ts +4 -3
  323. package/script/helpers/hasGeometryColumn.d.ts.map +1 -1
  324. package/script/helpers/hasGeometryColumn.js +4 -3
  325. package/script/helpers/inspectGraphConnectivity.d.ts +10 -0
  326. package/script/helpers/inspectGraphConnectivity.d.ts.map +1 -0
  327. package/script/helpers/inspectGraphConnectivity.js +58 -0
  328. package/script/helpers/mergeOptions.d.ts +24 -13
  329. package/script/helpers/mergeOptions.d.ts.map +1 -1
  330. package/script/helpers/mergeOptions.js +24 -13
  331. package/script/helpers/parseValue.d.ts +6 -4
  332. package/script/helpers/parseValue.d.ts.map +1 -1
  333. package/script/helpers/parseValue.js +6 -4
  334. package/script/helpers/prepareGraphRouteSql.d.ts +31 -0
  335. package/script/helpers/prepareGraphRouteSql.d.ts.map +1 -0
  336. package/script/helpers/prepareGraphRouteSql.js +127 -0
  337. package/script/helpers/prepareGraphStarts.d.ts +9 -0
  338. package/script/helpers/prepareGraphStarts.d.ts.map +1 -0
  339. package/script/helpers/prepareGraphStarts.js +71 -0
  340. package/script/helpers/prepareGraphTemporalSql.d.ts +28 -0
  341. package/script/helpers/prepareGraphTemporalSql.d.ts.map +1 -0
  342. package/script/helpers/prepareGraphTemporalSql.js +161 -0
  343. package/script/helpers/prepareGraphTraversal.d.ts +19 -0
  344. package/script/helpers/prepareGraphTraversal.d.ts.map +1 -0
  345. package/script/helpers/prepareGraphTraversal.js +87 -0
  346. package/script/helpers/prepareNumericFeatures.d.ts +41 -0
  347. package/script/helpers/prepareNumericFeatures.d.ts.map +1 -0
  348. package/script/helpers/prepareNumericFeatures.js +217 -0
  349. package/script/helpers/prettyDuration.d.ts +14 -8
  350. package/script/helpers/prettyDuration.d.ts.map +1 -1
  351. package/script/helpers/prettyDuration.js +14 -8
  352. package/script/helpers/printTable.d.ts +18 -13
  353. package/script/helpers/printTable.d.ts.map +1 -1
  354. package/script/helpers/printTable.js +18 -13
  355. package/script/helpers/publishPreparedColumns.d.ts +37 -0
  356. package/script/helpers/publishPreparedColumns.d.ts.map +1 -0
  357. package/script/helpers/publishPreparedColumns.js +119 -0
  358. package/script/helpers/queryDB.d.ts +24 -13
  359. package/script/helpers/queryDB.d.ts.map +1 -1
  360. package/script/helpers/queryDB.js +24 -13
  361. package/script/helpers/queueAsyncBarrier.d.ts +12 -7
  362. package/script/helpers/queueAsyncBarrier.d.ts.map +1 -1
  363. package/script/helpers/queueAsyncBarrier.js +12 -7
  364. package/script/helpers/queueGraphResult.d.ts +18 -0
  365. package/script/helpers/queueGraphResult.d.ts.map +1 -0
  366. package/script/helpers/queueGraphResult.js +45 -0
  367. package/script/helpers/quoteIdentifier.d.ts +4 -3
  368. package/script/helpers/quoteIdentifier.d.ts.map +1 -1
  369. package/script/helpers/quoteIdentifier.js +4 -3
  370. package/script/helpers/quoteQualifiedIdentifier.d.ts +6 -4
  371. package/script/helpers/quoteQualifiedIdentifier.d.ts.map +1 -1
  372. package/script/helpers/quoteQualifiedIdentifier.js +6 -4
  373. package/script/helpers/runQuery.d.ts.map +1 -1
  374. package/script/helpers/runQuery.js +17 -3
  375. package/script/helpers/selectFuzzyReplacements.d.ts +11 -0
  376. package/script/helpers/selectFuzzyReplacements.d.ts.map +1 -0
  377. package/script/helpers/selectFuzzyReplacements.js +127 -0
  378. package/script/helpers/stabilizeCosineVectors.d.ts +14 -0
  379. package/script/helpers/stabilizeCosineVectors.d.ts.map +1 -0
  380. package/script/helpers/stabilizeCosineVectors.js +40 -0
  381. package/script/helpers/stringToArray.d.ts +4 -3
  382. package/script/helpers/stringToArray.d.ts.map +1 -1
  383. package/script/helpers/stringToArray.js +4 -3
  384. package/script/helpers/updateColumnsWithJS.d.ts +12 -6
  385. package/script/helpers/updateColumnsWithJS.d.ts.map +1 -1
  386. package/script/helpers/updateColumnsWithJS.js +12 -6
  387. package/script/helpers/validateGraphRouteResultSchema.d.ts +4 -0
  388. package/script/helpers/validateGraphRouteResultSchema.d.ts.map +1 -0
  389. package/script/helpers/validateGraphRouteResultSchema.js +19 -0
  390. package/script/helpers/validateGraphTemporalEvents.d.ts +7 -0
  391. package/script/helpers/validateGraphTemporalEvents.d.ts.map +1 -0
  392. package/script/helpers/validateGraphTemporalEvents.js +53 -0
  393. package/script/helpers/validateNumericalAnalysis.d.ts +10 -6
  394. package/script/helpers/validateNumericalAnalysis.d.ts.map +1 -1
  395. package/script/helpers/validateNumericalAnalysis.js +10 -6
  396. package/script/helpers/validateVectorRowIds.d.ts +4 -0
  397. package/script/helpers/validateVectorRowIds.d.ts.map +1 -0
  398. package/script/helpers/validateVectorRowIds.js +19 -0
  399. package/script/helpers/vectorDistanceExpression.d.ts +6 -0
  400. package/script/helpers/vectorDistanceExpression.d.ts.map +1 -0
  401. package/script/helpers/vectorDistanceExpression.js +14 -0
  402. package/script/helpers/wrapString.d.ts +10 -7
  403. package/script/helpers/wrapString.d.ts.map +1 -1
  404. package/script/helpers/wrapString.js +10 -7
  405. package/script/methods/addId.d.ts +5 -0
  406. package/script/methods/addId.d.ts.map +1 -0
  407. package/script/methods/addId.js +44 -0
  408. package/script/methods/commonNeighbors.d.ts +10 -0
  409. package/script/methods/commonNeighbors.d.ts.map +1 -0
  410. package/script/methods/commonNeighbors.js +140 -0
  411. package/script/methods/connectedComponents.d.ts +9 -0
  412. package/script/methods/connectedComponents.d.ts.map +1 -0
  413. package/script/methods/connectedComponents.js +186 -0
  414. package/script/methods/degree.d.ts +9 -0
  415. package/script/methods/degree.d.ts.map +1 -0
  416. package/script/methods/degree.js +141 -0
  417. package/script/methods/distances.d.ts +12 -0
  418. package/script/methods/distances.d.ts.map +1 -0
  419. package/script/methods/distances.js +203 -0
  420. package/script/methods/findCycles.d.ts +12 -0
  421. package/script/methods/findCycles.d.ts.map +1 -0
  422. package/script/methods/findCycles.js +369 -0
  423. package/script/methods/fuzzyClean.d.ts.map +1 -1
  424. package/script/methods/fuzzyClean.js +17 -136
  425. package/script/methods/fuzzyJoin.js +70 -16
  426. package/script/methods/getTypes.d.ts +1 -1
  427. package/script/methods/hdbscan.d.ts +5 -0
  428. package/script/methods/hdbscan.d.ts.map +1 -0
  429. package/script/methods/hdbscan.js +214 -0
  430. package/script/methods/mahalanobis.d.ts +5 -0
  431. package/script/methods/mahalanobis.d.ts.map +1 -0
  432. package/script/methods/mahalanobis.js +98 -0
  433. package/script/methods/neighbors.d.ts +9 -0
  434. package/script/methods/neighbors.d.ts.map +1 -0
  435. package/script/methods/neighbors.js +120 -0
  436. package/script/methods/normalizeVector.d.ts +5 -0
  437. package/script/methods/normalizeVector.d.ts.map +1 -0
  438. package/script/methods/normalizeVector.js +138 -0
  439. package/script/methods/paths.d.ts +12 -0
  440. package/script/methods/paths.d.ts.map +1 -0
  441. package/script/methods/paths.js +326 -0
  442. package/script/methods/reachable.d.ts +11 -0
  443. package/script/methods/reachable.d.ts.map +1 -0
  444. package/script/methods/reachable.js +170 -0
  445. package/script/methods/rowToVector.d.ts +5 -0
  446. package/script/methods/rowToVector.d.ts.map +1 -0
  447. package/script/methods/rowToVector.js +83 -0
  448. package/script/methods/shortestPath.d.ts +12 -0
  449. package/script/methods/shortestPath.d.ts.map +1 -0
  450. package/script/methods/shortestPath.js +376 -0
  451. package/script/methods/topologicalSort.d.ts +7 -0
  452. package/script/methods/topologicalSort.d.ts.map +1 -0
  453. package/script/methods/topologicalSort.js +170 -0
@@ -0,0 +1,113 @@
1
+ import foldIdentifier from "./foldIdentifier.js";
2
+ import mergeOptions from "./mergeOptions.js";
3
+ import queryDB from "./queryDB.js";
4
+ import quoteIdentifier from "./quoteIdentifier.js";
5
+ /**
6
+ * Atomically publishes validated algorithm outputs from a prepared numeric
7
+ * feature snapshot. New outputs are appended, while replacements retain the
8
+ * source column's position. Existing native DuckDB indexes are recreated in
9
+ * the same transaction because CREATE OR REPLACE drops them.
10
+ *
11
+ * Output expressions are trusted internal SQL. They may reference `p`, the
12
+ * prepared relation alias, and `r` when a result relation is supplied. The
13
+ * consumer must fully compute and validate one result row per prepared row
14
+ * before calling this helper, and remains responsible for scratch cleanup.
15
+ */
16
+ export default async function publishPreparedColumns(table, prepared, options) {
17
+ validateOutputs(prepared.sourceColumns, options.outputs);
18
+ const connection = table.connection;
19
+ const q = quoteIdentifier;
20
+ const source = q(table.name);
21
+ const tableDetails = (await connection.runAndReadAll(`SELECT table_oid FROM duckdb_tables()
22
+ WHERE translate(table_name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = $1
23
+ AND schema_name = current_schema()
24
+ AND database_name IN (current_database(), 'temp')
25
+ AND temporary = $2
26
+ LIMIT 1`, [foldIdentifier(table.name), prepared.sourceTemporary])).getRowsJS()[0];
27
+ if (tableDetails === undefined) {
28
+ throw new Error(`${options.method} requires a materialized source table.`);
29
+ }
30
+ const tableOid = tableDetails[0];
31
+ if (typeof tableOid !== "number" && typeof tableOid !== "bigint") {
32
+ throw new Error(`${options.method} could not identify the source table.`);
33
+ }
34
+ const indexes = (await connection.runAndReadAll("SELECT sql FROM duckdb_indexes() WHERE table_oid = $1 ORDER BY index_name", [tableOid])).getRowsJS().map((row) => String(row[0]));
35
+ const replacements = new Map(options.outputs.filter((output) => output.replace !== undefined).map((output) => [foldIdentifier(output.replace), output]));
36
+ const select = prepared.sourceColumns.map((column) => {
37
+ const replacement = replacements.get(foldIdentifier(column));
38
+ return replacement === undefined
39
+ ? `p.${q(column)}`
40
+ : `${replacement.expression} AS ${q(column)}`;
41
+ });
42
+ for (const output of options.outputs) {
43
+ if (output.replace === undefined) {
44
+ select.push(`${output.expression} AS ${q(output.name)}`);
45
+ }
46
+ }
47
+ const resultJoin = options.result === undefined
48
+ ? ""
49
+ : ` JOIN ${q(options.result.relation)} r
50
+ ON p.${q(prepared.rowIdColumn)} = r.${q(options.result.rowIdColumn)}`;
51
+ await connection.run("BEGIN TRANSACTION");
52
+ try {
53
+ await queryDB(table, `CREATE OR REPLACE ${prepared.sourceTemporary ? "TEMP " : ""}TABLE ${source} AS
54
+ SELECT ${select.join(", ")}
55
+ FROM ${q(prepared.relation)} p${resultJoin}
56
+ ORDER BY p.${q(prepared.rowIdColumn)}`, mergeOptions(table, {
57
+ table: table.name,
58
+ method: options.method,
59
+ parameters: options.parameters,
60
+ noClean: true,
61
+ }));
62
+ for (const sql of indexes) {
63
+ try {
64
+ await connection.run(sql);
65
+ }
66
+ catch (error) {
67
+ const detail = error instanceof Error ? ` ${error.message}` : "";
68
+ throw new Error(`${options.method} could not restore an existing DuckDB index while publishing its output. Remove or rebuild indexes that do not support the output column types.${detail}`, { cause: error });
69
+ }
70
+ }
71
+ await connection.run("COMMIT");
72
+ }
73
+ catch (error) {
74
+ try {
75
+ await connection.run("ROLLBACK");
76
+ }
77
+ catch {
78
+ // DuckDB may already abort the transaction after an index-build error.
79
+ // Preserve the publication error that explains why the operation failed.
80
+ }
81
+ // UNIQUE violations can be deferred until COMMIT, which may also fail for
82
+ // unrelated reasons. Preserve that diagnostic instead of blaming indexes.
83
+ throw error;
84
+ }
85
+ }
86
+ function validateOutputs(sourceColumns, outputs) {
87
+ const outputNames = new Set();
88
+ const replacements = new Set();
89
+ for (const output of outputs) {
90
+ const outputName = foldIdentifier(output.name);
91
+ if (outputNames.has(outputName)) {
92
+ throw new Error(`Internal publication received duplicate output column ${quoteIdentifier(output.name)}.`);
93
+ }
94
+ outputNames.add(outputName);
95
+ if (output.replace === undefined) {
96
+ if (sourceColumns.some((column) => foldIdentifier(column) === outputName)) {
97
+ throw new Error(`Internal publication cannot append existing column ${quoteIdentifier(output.name)}.`);
98
+ }
99
+ continue;
100
+ }
101
+ const replacement = foldIdentifier(output.replace);
102
+ if (outputName !== replacement) {
103
+ throw new Error(`Internal publication output ${quoteIdentifier(output.name)} must match its replacement column ${quoteIdentifier(output.replace)}.`);
104
+ }
105
+ if (!sourceColumns.some((column) => foldIdentifier(column) === replacement)) {
106
+ throw new Error(`Internal publication cannot replace missing column ${quoteIdentifier(output.replace)}.`);
107
+ }
108
+ if (replacements.has(replacement)) {
109
+ throw new Error(`Internal publication received duplicate replacement column ${quoteIdentifier(output.replace)}.`);
110
+ }
111
+ replacements.add(replacement);
112
+ }
113
+ }
@@ -8,19 +8,6 @@ type DuckDBValue = NativeDuckDBValue;
8
8
  * Starts the database on first use and applies its SQL logging settings.
9
9
  * Extension authors can construct `options` with `mergeOptions()`.
10
10
  *
11
- * @param simple - The table or database that owns the query.
12
- * @param query - The SQL statement to execute.
13
- * @param options - Query execution and diagnostic settings.
14
- * @param options.table - The table name used for diagnostics, or `null`.
15
- * @param options.method - The calling method used for diagnostics, or `null`.
16
- * @param options.parameters - Arguments included in error diagnostics, or `null`.
17
- * @param options.rowsToLog - The caller's row-display limit, retained for compatibility.
18
- * @param options.charsToLog - The caller's per-cell display limit, retained for compatibility.
19
- * @param options.returnData - Whether to convert and return the result rows.
20
- * @param options.values - DuckDB-native values bound to SQL placeholders, in order.
21
- * @param options.noClean - Whether to preserve the SQL text without cleaning it.
22
- * @returns Converted rows when `returnData` is true, otherwise `null`.
23
- *
24
11
  * @example
25
12
  * ```ts
26
13
  * import { mergeOptions, queryDB, quoteIdentifier } from "@nshiab/simple-data-analysis-core/helpers";
@@ -35,6 +22,30 @@ type DuckDBValue = NativeDuckDBValue;
35
22
  * }));
36
23
  * await table.log();
37
24
  * ```
25
+ *
26
+ * @param simple - The table or database that owns the query.
27
+ *
28
+ * @param query - The SQL statement to execute.
29
+ *
30
+ * @param options - Query execution and diagnostic settings.
31
+ *
32
+ * @param options.table - The table name used for diagnostics, or `null`.
33
+ *
34
+ * @param options.method - The calling method used for diagnostics, or `null`.
35
+ *
36
+ * @param options.parameters - Arguments included in error diagnostics, or `null`.
37
+ *
38
+ * @param options.rowsToLog - The caller's row-display limit, retained for compatibility.
39
+ *
40
+ * @param options.charsToLog - The caller's per-cell display limit, retained for compatibility.
41
+ *
42
+ * @param options.returnData - Whether to convert and return the result rows.
43
+ *
44
+ * @param options.values - DuckDB-native values bound to SQL placeholders, in order.
45
+ *
46
+ * @param options.noClean - Whether to preserve the SQL text without cleaning it.
47
+ *
48
+ * @returns Converted rows when `returnData` is true, otherwise `null`.
38
49
  */
39
50
  export default function queryDB(simple: SimpleTable | SimpleDB, query: string, options: {
40
51
  table: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"queryDB.d.ts","sourceRoot":"","sources":["../../src/helpers/queryDB.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAK5C,kGAAkG;AAClG,KAAK,WAAW,GAAG,iBAAiB,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAA8B,OAAO,CACnC,MAAM,EAAE,WAAW,GAAG,QAAQ,EAC9B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;IACP,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,OAAO,CACN;IACA,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,EAAE,GACD,IAAI,CACP,CAuDA"}
1
+ {"version":3,"file":"queryDB.d.ts","sourceRoot":"","sources":["../../src/helpers/queryDB.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAK5C,kGAAkG;AAClG,KAAK,WAAW,GAAG,iBAAiB,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAA8B,OAAO,CACnC,MAAM,EAAE,WAAW,GAAG,QAAQ,EAC9B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;IACP,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,OAAO,CACN;IACA,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,EAAE,GACD,IAAI,CACP,CAuDA"}
@@ -8,19 +8,6 @@ import { recordCacheTableAccess } from "./cacheTableDependencies.js";
8
8
  * Starts the database on first use and applies its SQL logging settings.
9
9
  * Extension authors can construct `options` with `mergeOptions()`.
10
10
  *
11
- * @param simple - The table or database that owns the query.
12
- * @param query - The SQL statement to execute.
13
- * @param options - Query execution and diagnostic settings.
14
- * @param options.table - The table name used for diagnostics, or `null`.
15
- * @param options.method - The calling method used for diagnostics, or `null`.
16
- * @param options.parameters - Arguments included in error diagnostics, or `null`.
17
- * @param options.rowsToLog - The caller's row-display limit, retained for compatibility.
18
- * @param options.charsToLog - The caller's per-cell display limit, retained for compatibility.
19
- * @param options.returnData - Whether to convert and return the result rows.
20
- * @param options.values - DuckDB-native values bound to SQL placeholders, in order.
21
- * @param options.noClean - Whether to preserve the SQL text without cleaning it.
22
- * @returns Converted rows when `returnData` is true, otherwise `null`.
23
- *
24
11
  * @example
25
12
  * ```ts
26
13
  * import { mergeOptions, queryDB, quoteIdentifier } from "@nshiab/simple-data-analysis-core/helpers";
@@ -35,6 +22,30 @@ import { recordCacheTableAccess } from "./cacheTableDependencies.js";
35
22
  * }));
36
23
  * await table.log();
37
24
  * ```
25
+ *
26
+ * @param simple - The table or database that owns the query.
27
+ *
28
+ * @param query - The SQL statement to execute.
29
+ *
30
+ * @param options - Query execution and diagnostic settings.
31
+ *
32
+ * @param options.table - The table name used for diagnostics, or `null`.
33
+ *
34
+ * @param options.method - The calling method used for diagnostics, or `null`.
35
+ *
36
+ * @param options.parameters - Arguments included in error diagnostics, or `null`.
37
+ *
38
+ * @param options.rowsToLog - The caller's row-display limit, retained for compatibility.
39
+ *
40
+ * @param options.charsToLog - The caller's per-cell display limit, retained for compatibility.
41
+ *
42
+ * @param options.returnData - Whether to convert and return the result rows.
43
+ *
44
+ * @param options.values - DuckDB-native values bound to SQL placeholders, in order.
45
+ *
46
+ * @param options.noClean - Whether to preserve the SQL text without cleaning it.
47
+ *
48
+ * @returns Converted rows when `returnData` is true, otherwise `null`.
38
49
  */
39
50
  export default async function queryDB(simple, query, options) {
40
51
  if (simple instanceof SimpleTable) {
@@ -15,13 +15,6 @@ import type SimpleTable from "../class/SimpleTable.js";
15
15
  * the failing table's remaining chain is aborted, but unexecuted work for other
16
16
  * tables is requeued for their next observation.
17
17
  *
18
- * @param simpleTable - The table whose chain owns the asynchronous work.
19
- * @param operation - The asynchronous extension operation to queue.
20
- * @param operation.method - The public method name used for diagnostics.
21
- * @param operation.parameters - A snapshot of the public method parameters used for diagnostics.
22
- * @param operation.execute - The asynchronous work to run at the barrier's position in the chain.
23
- * @returns Nothing. The public builder should return its target table.
24
- *
25
18
  * @example
26
19
  * ```ts
27
20
  * import type { SimpleTable } from "@nshiab/simple-data-analysis-core";
@@ -40,6 +33,18 @@ import type SimpleTable from "../class/SimpleTable.js";
40
33
  * return table;
41
34
  * }
42
35
  * ```
36
+ *
37
+ * @param simpleTable - The table whose chain owns the asynchronous work.
38
+ *
39
+ * @param operation - The asynchronous extension operation to queue.
40
+ *
41
+ * @param operation.method - The public method name used for diagnostics.
42
+ *
43
+ * @param operation.parameters - A snapshot of the public method parameters used for diagnostics.
44
+ *
45
+ * @param operation.execute - The asynchronous work to run at the barrier's position in the chain.
46
+ *
47
+ * @returns Nothing. The public builder should return its target table.
43
48
  */
44
49
  export default function queueAsyncBarrier(simpleTable: SimpleTable, operation: {
45
50
  method: string;
@@ -1 +1 @@
1
- {"version":3,"file":"queueAsyncBarrier.d.ts","sourceRoot":"","sources":["../../src/helpers/queueAsyncBarrier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE;IACT,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,GACA,IAAI,CAKN"}
1
+ {"version":3,"file":"queueAsyncBarrier.d.ts","sourceRoot":"","sources":["../../src/helpers/queueAsyncBarrier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE;IACT,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,GACA,IAAI,CAKN"}
@@ -15,13 +15,6 @@ import queueOp from "./queueOp.js";
15
15
  * the failing table's remaining chain is aborted, but unexecuted work for other
16
16
  * tables is requeued for their next observation.
17
17
  *
18
- * @param simpleTable - The table whose chain owns the asynchronous work.
19
- * @param operation - The asynchronous extension operation to queue.
20
- * @param operation.method - The public method name used for diagnostics.
21
- * @param operation.parameters - A snapshot of the public method parameters used for diagnostics.
22
- * @param operation.execute - The asynchronous work to run at the barrier's position in the chain.
23
- * @returns Nothing. The public builder should return its target table.
24
- *
25
18
  * @example
26
19
  * ```ts
27
20
  * import type { SimpleTable } from "@nshiab/simple-data-analysis-core";
@@ -40,6 +33,18 @@ import queueOp from "./queueOp.js";
40
33
  * return table;
41
34
  * }
42
35
  * ```
36
+ *
37
+ * @param simpleTable - The table whose chain owns the asynchronous work.
38
+ *
39
+ * @param operation - The asynchronous extension operation to queue.
40
+ *
41
+ * @param operation.method - The public method name used for diagnostics.
42
+ *
43
+ * @param operation.parameters - A snapshot of the public method parameters used for diagnostics.
44
+ *
45
+ * @param operation.execute - The asynchronous work to run at the barrier's position in the chain.
46
+ *
47
+ * @returns Nothing. The public builder should return its target table.
43
48
  */
44
49
  export default function queueAsyncBarrier(simpleTable, operation) {
45
50
  queueOp(simpleTable, {
@@ -0,0 +1,18 @@
1
+ import type { DuckDBValue } from "@duckdb/node-api";
2
+ import type SimpleTable from "../class/SimpleTable.js";
3
+ import type { TableSchema } from "./pendingOps.js";
4
+ type GraphResult = {
5
+ buildSelect: (input: string, schema: TableSchema) => string;
6
+ method: string;
7
+ outputSchema: (schema: TableSchema) => TableSchema;
8
+ outputTable?: string | boolean;
9
+ parameters: {
10
+ [key: string]: unknown;
11
+ };
12
+ preflight?: (input: SimpleTable) => Promise<void>;
13
+ values: (schema: TableSchema) => DuckDBValue[];
14
+ };
15
+ /** Queues a graph SELECT for overwrite or a source-preserving output table. */
16
+ export default function queueGraphResult(simpleTable: SimpleTable, result: GraphResult): SimpleTable;
17
+ export {};
18
+ //# sourceMappingURL=queueGraphResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queueGraphResult.d.ts","sourceRoot":"","sources":["../../src/helpers/queueGraphResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAKnD,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,MAAM,CAAC;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,WAAW,CAAC;IACnD,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACvC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,WAAW,EAAE,CAAC;CAChD,CAAC;AAEF,+EAA+E;AAC/E,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,WAAW,GAClB,WAAW,CAqCb"}
@@ -0,0 +1,39 @@
1
+ import queueOp from "./queueOp.js";
2
+ import quoteIdentifier from "./quoteIdentifier.js";
3
+ import resolveOutputTable from "./resolveOutputTable.js";
4
+ /** Queues a graph SELECT for overwrite or a source-preserving output table. */
5
+ export default function queueGraphResult(simpleTable, result) {
6
+ const resolvedOutput = resolveOutputTable(simpleTable, result.outputTable);
7
+ const outputTable = typeof resolvedOutput === "string"
8
+ ? simpleTable.sdb.newTable(resolvedOutput)
9
+ : simpleTable;
10
+ if (outputTable !== simpleTable) {
11
+ queueOp(outputTable, {
12
+ kind: "source",
13
+ method: result.method,
14
+ parameters: result.parameters,
15
+ rawSQL: [quoteIdentifier(simpleTable.name)],
16
+ buildSelect: () => `SELECT * FROM ${quoteIdentifier(simpleTable.name)}`,
17
+ });
18
+ }
19
+ // A separate barrier keeps invalid-event checks observable after LIMIT 0.
20
+ const preflight = result.preflight;
21
+ if (preflight !== undefined) {
22
+ queueOp(outputTable, {
23
+ kind: "barrier",
24
+ method: result.method,
25
+ parameters: result.parameters,
26
+ execute: () => preflight(outputTable),
27
+ });
28
+ }
29
+ queueOp(outputTable, {
30
+ kind: "fusable",
31
+ method: result.method,
32
+ parameters: result.parameters,
33
+ needsSchema: true,
34
+ values: result.values,
35
+ buildSelect: result.buildSelect,
36
+ outputSchema: result.outputSchema,
37
+ });
38
+ return outputTable;
39
+ }
@@ -3,14 +3,15 @@
3
3
  * Use this for library-generated table, column, schema, database, and alias
4
4
  * names. User-authored SQL expressions must remain unmodified.
5
5
  *
6
- * @param identifier - The identifier to quote.
7
- * @returns The identifier wrapped in double quotes with embedded quotes doubled.
8
- *
9
6
  * @example
10
7
  * ```ts
11
8
  * quoteIdentifier('people "archive"');
12
9
  * // '"people ""archive"""'
13
10
  * ```
11
+ *
12
+ * @param identifier - The identifier to quote.
13
+ *
14
+ * @returns The identifier wrapped in double quotes with embedded quotes doubled.
14
15
  */
15
16
  export default function quoteIdentifier(identifier: string): string;
16
17
  //# sourceMappingURL=quoteIdentifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quoteIdentifier.d.ts","sourceRoot":"","sources":["../../src/helpers/quoteIdentifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAElE"}
1
+ {"version":3,"file":"quoteIdentifier.d.ts","sourceRoot":"","sources":["../../src/helpers/quoteIdentifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAElE"}
@@ -3,14 +3,15 @@
3
3
  * Use this for library-generated table, column, schema, database, and alias
4
4
  * names. User-authored SQL expressions must remain unmodified.
5
5
  *
6
- * @param identifier - The identifier to quote.
7
- * @returns The identifier wrapped in double quotes with embedded quotes doubled.
8
- *
9
6
  * @example
10
7
  * ```ts
11
8
  * quoteIdentifier('people "archive"');
12
9
  * // '"people ""archive"""'
13
10
  * ```
11
+ *
12
+ * @param identifier - The identifier to quote.
13
+ *
14
+ * @returns The identifier wrapped in double quotes with embedded quotes doubled.
14
15
  */
15
16
  export default function quoteIdentifier(identifier) {
16
17
  return `"${identifier.replaceAll('"', '""')}"`;
@@ -4,15 +4,17 @@
4
4
  * Qualifying column references prevents DuckDB from resolving a relation name
5
5
  * as its row struct when a missing column has the same name as the relation.
6
6
  *
7
- * @param relation - The table or relation containing the identifier.
8
- * @param identifier - The identifier to qualify.
9
- * @returns The separately quoted relation and identifier joined by a period.
10
- *
11
7
  * @example
12
8
  * ```ts
13
9
  * quoteQualifiedIdentifier("people", "full name");
14
10
  * // '"people"."full name"'
15
11
  * ```
12
+ *
13
+ * @param relation - The table or relation containing the identifier.
14
+ *
15
+ * @param identifier - The identifier to qualify.
16
+ *
17
+ * @returns The separately quoted relation and identifier joined by a period.
16
18
  */
17
19
  export default function quoteQualifiedIdentifier(relation: string, identifier: string): string;
18
20
  //# sourceMappingURL=quoteQualifiedIdentifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quoteQualifiedIdentifier.d.ts","sourceRoot":"","sources":["../../src/helpers/quoteQualifiedIdentifier.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER"}
1
+ {"version":3,"file":"quoteQualifiedIdentifier.d.ts","sourceRoot":"","sources":["../../src/helpers/quoteQualifiedIdentifier.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER"}
@@ -5,15 +5,17 @@ import quoteIdentifier from "./quoteIdentifier.js";
5
5
  * Qualifying column references prevents DuckDB from resolving a relation name
6
6
  * as its row struct when a missing column has the same name as the relation.
7
7
  *
8
- * @param relation - The table or relation containing the identifier.
9
- * @param identifier - The identifier to qualify.
10
- * @returns The separately quoted relation and identifier joined by a period.
11
- *
12
8
  * @example
13
9
  * ```ts
14
10
  * quoteQualifiedIdentifier("people", "full name");
15
11
  * // '"people"."full name"'
16
12
  * ```
13
+ *
14
+ * @param relation - The table or relation containing the identifier.
15
+ *
16
+ * @param identifier - The identifier to qualify.
17
+ *
18
+ * @returns The separately quoted relation and identifier joined by a period.
17
19
  */
18
20
  export default function quoteQualifiedIdentifier(relation, identifier) {
19
21
  return `${quoteIdentifier(relation)}.${quoteIdentifier(identifier)}`;
@@ -1 +1 @@
1
- {"version":3,"file":"runQuery.d.ts","sourceRoot":"","sources":["../../src/helpers/runQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,gBAAgB,EAIrB,KAAK,UAAU,EAEf,KAAK,WAAW,EAIjB,MAAM,kBAAkB,CAAC;AAI1B,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AA8CF,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAM,GAAG,IAAW,GAC9B,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAoCjC;AAED,wBAA8B,QAAQ,CACpC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,gBAAgB,EAC5B,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,eAAe,GACvB,OAAO,CACN;IACA,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,EAAE,GACD,IAAI,CACP,CAoEA"}
1
+ {"version":3,"file":"runQuery.d.ts","sourceRoot":"","sources":["../../src/helpers/runQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,gBAAgB,EAIrB,KAAK,UAAU,EAEf,KAAK,WAAW,EAIjB,MAAM,kBAAkB,CAAC;AAI1B,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AA8CF,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAM,GAAG,IAAW,GAC9B,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAoCjC;AAED,wBAA8B,QAAQ,CACpC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,gBAAgB,EAC5B,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,eAAe,GACvB,OAAO,CACN;IACA,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,EAAE,GACD,IAAI,CACP,CAiFA"}
@@ -99,9 +99,23 @@ export default async function runQuery(query, connection, returnData, options) {
99
99
  for (let j = 0; j < columnCount; j++) {
100
100
  const columnName = columnNames[j];
101
101
  const converter = converters[j];
102
- chunk.visitColumnValues(j, (value, rowIndex) => {
103
- rows[base + rowIndex][columnName] = converter(value);
104
- });
102
+ if (columnName === "__proto__") {
103
+ // This valid SQL identifier must define data, not invoke Node's
104
+ // legacy Object.prototype setter. Keep ordinary columns fast.
105
+ chunk.visitColumnValues(j, (value, rowIndex) => {
106
+ Object.defineProperty(rows[base + rowIndex], columnName, {
107
+ value: converter(value),
108
+ enumerable: true,
109
+ configurable: true,
110
+ writable: true,
111
+ });
112
+ });
113
+ }
114
+ else {
115
+ chunk.visitColumnValues(j, (value, rowIndex) => {
116
+ rows[base + rowIndex][columnName] = converter(value);
117
+ });
118
+ }
105
119
  }
106
120
  }
107
121
  return rows;
@@ -0,0 +1,11 @@
1
+ export type FuzzyPair = {
2
+ left_value: string;
3
+ right_value: string;
4
+ left_cnt: number;
5
+ right_cnt: number;
6
+ score: number;
7
+ };
8
+ export type FuzzyStrategy = "mostCommon" | "longestString" | "shortestString" | "mostCentral" | "maxScore";
9
+ /** Groups matching values transitively and chooses each component's canonical value. */
10
+ export default function selectFuzzyReplacements(pairs: FuzzyPair[], strategy: FuzzyStrategy): Map<string, string>;
11
+ //# sourceMappingURL=selectFuzzyReplacements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectFuzzyReplacements.d.ts","sourceRoot":"","sources":["../../src/helpers/selectFuzzyReplacements.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,UAAU,CAAC;AAEf,wFAAwF;AACxF,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,KAAK,EAAE,SAAS,EAAE,EAClB,QAAQ,EAAE,aAAa,GACtB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA8HrB"}
@@ -0,0 +1,124 @@
1
+ /** Groups matching values transitively and chooses each component's canonical value. */
2
+ export default function selectFuzzyReplacements(pairs, strategy) {
3
+ // Build count map from the pairs — no separate query needed.
4
+ const countMap = new Map();
5
+ for (const { left_value, left_cnt, right_value, right_cnt } of pairs) {
6
+ countMap.set(left_value, Number(left_cnt));
7
+ countMap.set(right_value, Number(right_cnt));
8
+ }
9
+ // Union-Find — only over values that actually participate in a pair.
10
+ const parent = new Map();
11
+ const find = (x) => {
12
+ if (!parent.has(x))
13
+ parent.set(x, x);
14
+ if (parent.get(x) !== x)
15
+ parent.set(x, find(parent.get(x)));
16
+ return parent.get(x);
17
+ };
18
+ const union = (a, b) => {
19
+ const ra = find(a);
20
+ const rb = find(b);
21
+ if (ra !== rb)
22
+ parent.set(ra, rb);
23
+ };
24
+ for (const v of countMap.keys())
25
+ find(v);
26
+ for (const { left_value, right_value } of pairs) {
27
+ union(left_value, right_value);
28
+ }
29
+ // Group values by their cluster root.
30
+ const clusters = new Map();
31
+ for (const v of countMap.keys()) {
32
+ const root = find(v);
33
+ if (!clusters.has(root))
34
+ clusters.set(root, []);
35
+ clusters.get(root).push(v);
36
+ }
37
+ // Pick the canonical value for each cluster.
38
+ const replacement = new Map();
39
+ // Every pair belongs to exactly one component. Accumulate scores globally,
40
+ // at most once, instead of scanning all pairs separately for each cluster.
41
+ // Keep this lazy: distinct counts/lengths can choose a winner without scores.
42
+ // Iterating in the original pair order also preserves floating-point ties.
43
+ let scoreSum = null;
44
+ const getScoreSum = () => {
45
+ if (scoreSum === null) {
46
+ scoreSum = new Map();
47
+ for (const { left_value, right_value, score } of pairs) {
48
+ scoreSum.set(left_value, (scoreSum.get(left_value) ?? 0) + score);
49
+ scoreSum.set(right_value, (scoreSum.get(right_value) ?? 0) + score);
50
+ }
51
+ }
52
+ return scoreSum;
53
+ };
54
+ let scoreMax = null;
55
+ const getScoreMax = () => {
56
+ if (scoreMax === null) {
57
+ scoreMax = new Map();
58
+ for (const { left_value, right_value, score } of pairs) {
59
+ scoreMax.set(left_value, Math.max(scoreMax.get(left_value) ?? 0, score));
60
+ scoreMax.set(right_value, Math.max(scoreMax.get(right_value) ?? 0, score));
61
+ }
62
+ }
63
+ return scoreMax;
64
+ };
65
+ for (const members of clusters.values()) {
66
+ if (members.length === 1)
67
+ continue;
68
+ // Sum-based comparator: highest total similarity, then alphabetical.
69
+ const byScore = (a, b) => {
70
+ const sum = getScoreSum();
71
+ const sa = sum.get(a) ?? 0;
72
+ const sb = sum.get(b) ?? 0;
73
+ if (sa !== sb)
74
+ return sa > sb ? a : b;
75
+ return a <= b ? a : b; // alphabetical tie-break
76
+ };
77
+ // Max-based comparator: highest single-pair score, then sum, then alphabetical.
78
+ const byMaxScore = (a, b) => {
79
+ const mx = getScoreMax();
80
+ const ma = mx.get(a) ?? 0;
81
+ const mb = mx.get(b) ?? 0;
82
+ if (ma !== mb)
83
+ return ma > mb ? a : b;
84
+ return byScore(a, b); // sum then alphabetical tie-break
85
+ };
86
+ let canonical;
87
+ if (strategy === "longestString") {
88
+ canonical = members.reduce((a, b) => {
89
+ if (a.length !== b.length)
90
+ return a.length > b.length ? a : b;
91
+ return byScore(a, b);
92
+ });
93
+ }
94
+ else if (strategy === "shortestString") {
95
+ canonical = members.reduce((a, b) => {
96
+ if (a.length !== b.length)
97
+ return a.length < b.length ? a : b;
98
+ return byScore(a, b);
99
+ });
100
+ }
101
+ else if (strategy === "mostCommon") {
102
+ canonical = members.reduce((a, b) => {
103
+ const ca = countMap.get(a) ?? 0;
104
+ const cb = countMap.get(b) ?? 0;
105
+ if (ca !== cb)
106
+ return ca > cb ? a : b;
107
+ return byScore(a, b);
108
+ });
109
+ }
110
+ else if (strategy === "mostCentral") {
111
+ // Most central string — highest total similarity to all other cluster members.
112
+ canonical = members.reduce((a, b) => byScore(a, b));
113
+ }
114
+ else {
115
+ // "maxScore": the string participating in the single highest-scoring pair.
116
+ canonical = members.reduce((a, b) => byMaxScore(a, b));
117
+ }
118
+ for (const m of members) {
119
+ if (m !== canonical)
120
+ replacement.set(m, canonical);
121
+ }
122
+ }
123
+ return replacement;
124
+ }
@@ -0,0 +1,14 @@
1
+ import type { DuckDBConnection } from "@duckdb/node-api";
2
+ /**
3
+ * Stabilizes cosine arithmetic in a caller-owned private vector relation.
4
+ * The already-quoted relation has unique vertex ids and a fixed-size DOUBLE
5
+ * vec column. Source data must be retained separately by the caller.
6
+ *
7
+ * Safe vectors keep their existing arithmetic and tie behavior. Outside the
8
+ * safe range, divide by the largest absolute component, then by the resulting
9
+ * length. This preserves direction without overflowing or underflowing norms.
10
+ * The bounds keep squared-norm products between 1e-300 and 1e300, with room
11
+ * for rounding. Only the private vec column changes; no scratch tables remain.
12
+ */
13
+ export default function stabilizeCosineVectors(connection: DuckDBConnection, rows: string): Promise<void>;
14
+ //# sourceMappingURL=stabilizeCosineVectors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stabilizeCosineVectors.d.ts","sourceRoot":"","sources":["../../src/helpers/stabilizeCosineVectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGzD;;;;;;;;;;GAUG;AACH,wBAA8B,sBAAsB,CAClD,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CA4Bf"}