@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
@@ -8,11 +8,6 @@ const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
8
8
  /**
9
9
  * Returns the only geometry column in a table schema.
10
10
  *
11
- * @param types - The table schema to inspect.
12
- * @param method - The SDA method requesting a geometry column.
13
- * @param tableName - The name of the table represented by the schema.
14
- * @returns The name of the only geometry column.
15
- *
16
11
  * @example
17
12
  * ```ts
18
13
  * const column = findGeoColumnFromSchema(
@@ -21,6 +16,14 @@ const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
21
16
  * "places",
22
17
  * );
23
18
  * ```
19
+ *
20
+ * @param types - The table schema to inspect.
21
+ *
22
+ * @param method - The SDA method requesting a geometry column.
23
+ *
24
+ * @param tableName - The name of the table represented by the schema.
25
+ *
26
+ * @returns The name of the only geometry column.
24
27
  */
25
28
  function findGeoColumnFromSchema(types, method, tableName) {
26
29
  const geometryColumns = Object.keys(types).filter((column) => types[column].toLowerCase().includes("geometry")).sort();
@@ -2,12 +2,6 @@
2
2
  * Formats a `Date` object into a human-readable string using only the format
3
3
  * strings actually used in the project.
4
4
  *
5
- * @param date - The `Date` object to format.
6
- * @param format - The format string to use. Only `"Month DD, YYYY, at HH:MM period"` and `"Month DD"` are supported.
7
- * @param options - Optional settings.
8
- * @param options.utc - If `true`, format the date in UTC instead of local time. Defaults to `false`.
9
- * @returns The formatted date string.
10
- *
11
5
  * @example
12
6
  * ```ts
13
7
  * // Format a date with time (local time).
@@ -15,18 +9,30 @@
15
9
  * const formatted = formatDate(date, "Month DD, YYYY, at HH:MM period");
16
10
  * console.log(formatted); // "January 1, 2023, at 1:35 a.m."
17
11
  * ```
12
+ *
18
13
  * @example
19
14
  * ```ts
20
15
  * // Format a date as month and day only (UTC).
21
16
  * const formatted = formatDate(new Date("2023-01-01"), "Month DD", { utc: true });
22
17
  * console.log(formatted); // "January 1"
23
18
  * ```
19
+ *
24
20
  * @example
25
21
  * ```ts
26
22
  * // Minutes of ":00" are omitted.
27
23
  * const formatted = formatDate(new Date("2023-01-01T01:00:00"), "Month DD, YYYY, at HH:MM period", { utc: true });
28
24
  * console.log(formatted); // "January 1, 2023, at 1 a.m."
29
25
  * ```
26
+ *
27
+ * @param date - The `Date` object to format.
28
+ *
29
+ * @param format - The format string to use. Only `"Month DD, YYYY, at HH:MM period"` and `"Month DD"` are supported.
30
+ *
31
+ * @param options - Optional settings.
32
+ *
33
+ * @param options.utc - If `true`, format the date in UTC instead of local time. Defaults to `false`.
34
+ *
35
+ * @returns The formatted date string.
30
36
  */
31
37
  export default function formatDate(date: Date, format: "Month DD, YYYY, at HH:MM period" | "Month DD", options?: {
32
38
  utc?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"formatDate.d.ts","sourceRoot":"","sources":["../../src/helpers/formatDate.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,iCAAiC,GAAG,UAAU,EACtD,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAO,GAC9B,MAAM,CA2BR"}
1
+ {"version":3,"file":"formatDate.d.ts","sourceRoot":"","sources":["../../src/helpers/formatDate.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,iCAAiC,GAAG,UAAU,EACtD,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAO,GAC9B,MAAM,CA2BR"}
@@ -19,12 +19,6 @@ const MONTHS = [
19
19
  * Formats a `Date` object into a human-readable string using only the format
20
20
  * strings actually used in the project.
21
21
  *
22
- * @param date - The `Date` object to format.
23
- * @param format - The format string to use. Only `"Month DD, YYYY, at HH:MM period"` and `"Month DD"` are supported.
24
- * @param options - Optional settings.
25
- * @param options.utc - If `true`, format the date in UTC instead of local time. Defaults to `false`.
26
- * @returns The formatted date string.
27
- *
28
22
  * @example
29
23
  * ```ts
30
24
  * // Format a date with time (local time).
@@ -32,18 +26,30 @@ const MONTHS = [
32
26
  * const formatted = formatDate(date, "Month DD, YYYY, at HH:MM period");
33
27
  * console.log(formatted); // "January 1, 2023, at 1:35 a.m."
34
28
  * ```
29
+ *
35
30
  * @example
36
31
  * ```ts
37
32
  * // Format a date as month and day only (UTC).
38
33
  * const formatted = formatDate(new Date("2023-01-01"), "Month DD", { utc: true });
39
34
  * console.log(formatted); // "January 1"
40
35
  * ```
36
+ *
41
37
  * @example
42
38
  * ```ts
43
39
  * // Minutes of ":00" are omitted.
44
40
  * const formatted = formatDate(new Date("2023-01-01T01:00:00"), "Month DD, YYYY, at HH:MM period", { utc: true });
45
41
  * console.log(formatted); // "January 1, 2023, at 1 a.m."
46
42
  * ```
43
+ *
44
+ * @param date - The `Date` object to format.
45
+ *
46
+ * @param format - The format string to use. Only `"Month DD, YYYY, at HH:MM period"` and `"Month DD"` are supported.
47
+ *
48
+ * @param options - Optional settings.
49
+ *
50
+ * @param options.utc - If `true`, format the date in UTC instead of local time. Defaults to `false`.
51
+ *
52
+ * @returns The formatted date string.
47
53
  */
48
54
  function formatDate(date, format, options = {}) {
49
55
  const getFullYear = options.utc ? date.getUTCFullYear : date.getFullYear;
@@ -1,11 +1,6 @@
1
1
  /**
2
2
  * Formats a missing-table error with the requested and available table names.
3
3
  *
4
- * @param method - The SDA method looking up the tables.
5
- * @param missingTables - The requested table names that were not found.
6
- * @param availableTables - The table names currently available.
7
- * @returns An actionable missing-table error message.
8
- *
9
4
  * @example
10
5
  * ```ts
11
6
  * const message = formatMissingTables(
@@ -14,6 +9,14 @@
14
9
  * ["votes", "districts"],
15
10
  * );
16
11
  * ```
12
+ *
13
+ * @param method - The SDA method looking up the tables.
14
+ *
15
+ * @param missingTables - The requested table names that were not found.
16
+ *
17
+ * @param availableTables - The table names currently available.
18
+ *
19
+ * @returns An actionable missing-table error message.
17
20
  */
18
21
  export default function formatMissingTables(method: string, missingTables: string[], availableTables: string[]): string;
19
22
  //# sourceMappingURL=formatMissingTables.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatMissingTables.d.ts","sourceRoot":"","sources":["../../src/helpers/formatMissingTables.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EAAE,EACvB,eAAe,EAAE,MAAM,EAAE,GACxB,MAAM,CAUR"}
1
+ {"version":3,"file":"formatMissingTables.d.ts","sourceRoot":"","sources":["../../src/helpers/formatMissingTables.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EAAE,EACvB,eAAe,EAAE,MAAM,EAAE,GACxB,MAAM,CAUR"}
@@ -8,11 +8,6 @@ const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
8
8
  /**
9
9
  * Formats a missing-table error with the requested and available table names.
10
10
  *
11
- * @param method - The SDA method looking up the tables.
12
- * @param missingTables - The requested table names that were not found.
13
- * @param availableTables - The table names currently available.
14
- * @returns An actionable missing-table error message.
15
- *
16
11
  * @example
17
12
  * ```ts
18
13
  * const message = formatMissingTables(
@@ -21,6 +16,14 @@ const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
21
16
  * ["votes", "districts"],
22
17
  * );
23
18
  * ```
19
+ *
20
+ * @param method - The SDA method looking up the tables.
21
+ *
22
+ * @param missingTables - The requested table names that were not found.
23
+ *
24
+ * @param availableTables - The table names currently available.
25
+ *
26
+ * @returns An actionable missing-table error message.
24
27
  */
25
28
  function formatMissingTables(method, missingTables, availableTables) {
26
29
  const missing = [...missingTables].sort();
@@ -1,40 +1,49 @@
1
1
  /**
2
2
  * Formats a number with thousands separators, decimals, abbreviations, and more.
3
3
  *
4
- * @param number - The number to be formatted.
5
- * @param options - An object containing various formatting options.
6
- * @param options.decimals - The number of decimal places to round to.
7
- * @param options.significantDigits - The number of significant digits to round to.
8
- * @param options.abbreviation - If `true`, the number will be abbreviated (e.g., 1,200,000 becomes "1.2M").
9
- * @param options.prefix - A string to prepend before the formatted number.
10
- * @param options.suffix - A string to append after the formatted number.
11
- *
12
- * @returns The formatted number as a string.
13
- *
14
4
  * @example
15
5
  * ```ts
16
6
  * // Basic usage: Format a number with thousands separator.
17
7
  * const num1 = formatNumber(1234567.89);
18
8
  * console.log(num1); // "1,234,567.89"
19
9
  * ```
10
+ *
20
11
  * @example
21
12
  * ```ts
22
13
  * // With significant digits and suffix.
23
14
  * const num2 = formatNumber(66.666, { significantDigits: 3, suffix: "%" });
24
15
  * console.log(num2); // "66.7%"
25
16
  * ```
17
+ *
26
18
  * @example
27
19
  * ```ts
28
20
  * // Abbreviation.
29
21
  * const num3 = formatNumber(12000, { abbreviation: true });
30
22
  * console.log(num3); // "12K"
31
23
  * ```
24
+ *
32
25
  * @example
33
26
  * ```ts
34
27
  * // With decimal places.
35
28
  * const num4 = formatNumber(123.456, { decimals: 1 });
36
29
  * console.log(num4); // "123.5"
37
30
  * ```
31
+ *
32
+ * @param number - The number to be formatted.
33
+ *
34
+ * @param options - An object containing various formatting options.
35
+ *
36
+ * @param options.decimals - The number of decimal places to round to.
37
+ *
38
+ * @param options.significantDigits - The number of significant digits to round to.
39
+ *
40
+ * @param options.abbreviation - If `true`, the number will be abbreviated (e.g., 1,200,000 becomes "1.2M").
41
+ *
42
+ * @param options.prefix - A string to prepend before the formatted number.
43
+ *
44
+ * @param options.suffix - A string to append after the formatted number.
45
+ *
46
+ * @returns The formatted number as a string.
38
47
  */
39
48
  export default function formatNumber(number: number, options?: {
40
49
  decimals?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"formatNumber.d.ts","sourceRoot":"","sources":["../../src/helpers/formatNumber.ts"],"names":[],"mappings":"AAgDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACZ,GACL,MAAM,CAgER"}
1
+ {"version":3,"file":"formatNumber.d.ts","sourceRoot":"","sources":["../../src/helpers/formatNumber.ts"],"names":[],"mappings":"AAsDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACZ,GACL,MAAM,CAgER"}
@@ -4,25 +4,31 @@ exports.default = formatNumber;
4
4
  /**
5
5
  * Rounds a number based on specified criteria: a fixed number of decimal places or to a specific number of significant digits.
6
6
  *
7
- * @param number - The number to be rounded.
8
- * @param options - An object containing options for rounding.
9
- * @param options.decimals - The number of decimal places to keep when rounding.
10
- * @param options.significantDigits - The number of significant digits to retain.
11
- * @returns The rounded number.
12
- * @throws {Error} If more than one rounding option is provided.
13
- *
14
7
  * @example
15
8
  * ```ts
16
9
  * // Round to one decimal place.
17
10
  * const result = round(1234.567, { decimals: 1 });
18
11
  * console.log(result); // 1234.6
19
12
  * ```
13
+ *
20
14
  * @example
21
15
  * ```ts
22
16
  * // Round to 3 significant digits.
23
17
  * const result = round(0.004622, { significantDigits: 3 });
24
18
  * console.log(result); // 0.00462
25
19
  * ```
20
+ *
21
+ * @param number - The number to be rounded.
22
+ *
23
+ * @param options - An object containing options for rounding.
24
+ *
25
+ * @param options.decimals - The number of decimal places to keep when rounding.
26
+ *
27
+ * @param options.significantDigits - The number of significant digits to retain.
28
+ *
29
+ * @returns The rounded number.
30
+ *
31
+ * @throws {Error} If more than one rounding option is provided.
26
32
  */
27
33
  function round(number, options = {}) {
28
34
  if (typeof options.decimals === "number" &&
@@ -42,40 +48,49 @@ function round(number, options = {}) {
42
48
  /**
43
49
  * Formats a number with thousands separators, decimals, abbreviations, and more.
44
50
  *
45
- * @param number - The number to be formatted.
46
- * @param options - An object containing various formatting options.
47
- * @param options.decimals - The number of decimal places to round to.
48
- * @param options.significantDigits - The number of significant digits to round to.
49
- * @param options.abbreviation - If `true`, the number will be abbreviated (e.g., 1,200,000 becomes "1.2M").
50
- * @param options.prefix - A string to prepend before the formatted number.
51
- * @param options.suffix - A string to append after the formatted number.
52
- *
53
- * @returns The formatted number as a string.
54
- *
55
51
  * @example
56
52
  * ```ts
57
53
  * // Basic usage: Format a number with thousands separator.
58
54
  * const num1 = formatNumber(1234567.89);
59
55
  * console.log(num1); // "1,234,567.89"
60
56
  * ```
57
+ *
61
58
  * @example
62
59
  * ```ts
63
60
  * // With significant digits and suffix.
64
61
  * const num2 = formatNumber(66.666, { significantDigits: 3, suffix: "%" });
65
62
  * console.log(num2); // "66.7%"
66
63
  * ```
64
+ *
67
65
  * @example
68
66
  * ```ts
69
67
  * // Abbreviation.
70
68
  * const num3 = formatNumber(12000, { abbreviation: true });
71
69
  * console.log(num3); // "12K"
72
70
  * ```
71
+ *
73
72
  * @example
74
73
  * ```ts
75
74
  * // With decimal places.
76
75
  * const num4 = formatNumber(123.456, { decimals: 1 });
77
76
  * console.log(num4); // "123.5"
78
77
  * ```
78
+ *
79
+ * @param number - The number to be formatted.
80
+ *
81
+ * @param options - An object containing various formatting options.
82
+ *
83
+ * @param options.decimals - The number of decimal places to round to.
84
+ *
85
+ * @param options.significantDigits - The number of significant digits to round to.
86
+ *
87
+ * @param options.abbreviation - If `true`, the number will be abbreviated (e.g., 1,200,000 becomes "1.2M").
88
+ *
89
+ * @param options.prefix - A string to prepend before the formatted number.
90
+ *
91
+ * @param options.suffix - A string to append after the formatted number.
92
+ *
93
+ * @returns The formatted number as a string.
79
94
  */
80
95
  function formatNumber(number, options = {}) {
81
96
  if (typeof number !== "number") {
@@ -0,0 +1,9 @@
1
+ import type { TableSchema } from "./pendingOps.js";
2
+ export type GraphEdgeIdColumn = {
3
+ column: string;
4
+ family: "string" | "numeric";
5
+ idType: string;
6
+ };
7
+ /** Resolves a route edge-ID column and its exact comparison type. */
8
+ export default function getGraphEdgeIdColumn(schema: TableSchema, requestedEdgeId: string, method: string): GraphEdgeIdColumn;
9
+ //# sourceMappingURL=getGraphEdgeIdColumn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGraphEdgeIdColumn.d.ts","sourceRoot":"","sources":["../../src/helpers/getGraphEdgeIdColumn.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qEAAqE;AACrE,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,GACb,iBAAiB,CAmCnB"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = getGraphEdgeIdColumn;
7
+ const foldIdentifier_js_1 = __importDefault(require("./foldIdentifier.js"));
8
+ const getGraphEndpointColumns_js_1 = __importDefault(require("./getGraphEndpointColumns.js"));
9
+ const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
10
+ /** Resolves a route edge-ID column and its exact comparison type. */
11
+ function getGraphEdgeIdColumn(schema, requestedEdgeId, method) {
12
+ const folded = (0, foldIdentifier_js_1.default)(requestedEdgeId);
13
+ const column = Object.keys(schema).find((name) => (0, foldIdentifier_js_1.default)(name) === folded);
14
+ if (column === undefined) {
15
+ throw new Error(`${method} the column ${(0, quoteIdentifier_js_1.default)(requestedEdgeId)} does not exist. Check for typos, or load the data first.`);
16
+ }
17
+ try {
18
+ const resolved = (0, getGraphEndpointColumns_js_1.default)({ [column]: schema[column] }, column, column, method);
19
+ return {
20
+ column,
21
+ family: resolved.family,
22
+ idType: resolved.idType,
23
+ };
24
+ }
25
+ catch (error) {
26
+ if (error instanceof TypeError) {
27
+ throw new TypeError(`${method} requires string or whole-number edge IDs, but column ${(0, quoteIdentifier_js_1.default)(column)} has type ${schema[column]}.`);
28
+ }
29
+ throw error;
30
+ }
31
+ }
@@ -0,0 +1,11 @@
1
+ import type { TableSchema } from "./pendingOps.js";
2
+ export type GraphEndpointColumns = {
3
+ source: string;
4
+ target: string;
5
+ idType: string;
6
+ family: "string" | "numeric";
7
+ floating: boolean;
8
+ };
9
+ /** Resolves and validates a graph's endpoint columns from an existing schema. */
10
+ export default function getGraphEndpointColumns(schema: TableSchema, requestedSource: string, requestedTarget: string, method: string): GraphEndpointColumns;
11
+ //# sourceMappingURL=getGraphEndpointColumns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGraphEndpointColumns.d.ts","sourceRoot":"","sources":["../../src/helpers/getGraphEndpointColumns.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAqBF,iFAAiF;AACjF,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,GACb,oBAAoB,CAiEtB"}
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = getGraphEndpointColumns;
7
+ const foldIdentifier_js_1 = __importDefault(require("./foldIdentifier.js"));
8
+ const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
9
+ const integerTypes = {
10
+ TINYINT: { signed: true, bits: 8, digits: 3 },
11
+ SMALLINT: { signed: true, bits: 16, digits: 5 },
12
+ INTEGER: { signed: true, bits: 32, digits: 10 },
13
+ BIGINT: { signed: true, bits: 64, digits: 19 },
14
+ HUGEINT: { signed: true, bits: 128, digits: 39 },
15
+ UTINYINT: { signed: false, bits: 8, digits: 3 },
16
+ USMALLINT: { signed: false, bits: 16, digits: 5 },
17
+ UINTEGER: { signed: false, bits: 32, digits: 10 },
18
+ UBIGINT: { signed: false, bits: 64, digits: 20 },
19
+ UHUGEINT: { signed: false, bits: 128, digits: 39 },
20
+ };
21
+ /** Resolves and validates a graph's endpoint columns from an existing schema. */
22
+ function getGraphEndpointColumns(schema, requestedSource, requestedTarget, method) {
23
+ const source = findColumn(schema, requestedSource);
24
+ const target = findColumn(schema, requestedTarget);
25
+ const missing = [
26
+ source === undefined ? requestedSource : undefined,
27
+ target === undefined ? requestedTarget : undefined,
28
+ ].filter((column) => column !== undefined);
29
+ if (missing.length > 0) {
30
+ const plural = missing.length > 1;
31
+ throw new Error(`${method} the column${plural ? "s" : ""} ${missing.map(quoteIdentifier_js_1.default).join(", ")} ${plural ? "do" : "does"} not exist. Check for typos, or load the data first.`);
32
+ }
33
+ const sourceType = normalizeType(schema[source]);
34
+ const targetType = normalizeType(schema[target]);
35
+ const sourceKind = typeKind(sourceType);
36
+ const targetKind = typeKind(targetType);
37
+ if (sourceKind === undefined || targetKind === undefined) {
38
+ const unsupported = sourceKind === undefined
39
+ ? { column: source, type: sourceType }
40
+ : { column: target, type: targetType };
41
+ throw new TypeError(`${method} requires string or numeric endpoint IDs, but column ${(0, quoteIdentifier_js_1.default)(unsupported.column)} has type ${unsupported.type}.`);
42
+ }
43
+ if (sourceKind.family !== targetKind.family) {
44
+ throw new TypeError(`${method} requires compatible source and target ID types, but ${(0, quoteIdentifier_js_1.default)(source)} has type ${sourceType} and ${(0, quoteIdentifier_js_1.default)(target)} has type ${targetType}.`);
45
+ }
46
+ if (sourceKind.family === "string") {
47
+ return {
48
+ source: source,
49
+ target: target,
50
+ idType: "VARCHAR",
51
+ family: "string",
52
+ floating: false,
53
+ };
54
+ }
55
+ const idType = compatibleNumericType(sourceType, targetType);
56
+ if (idType === undefined) {
57
+ throw new TypeError(`${method} cannot combine endpoint types ${sourceType} and ${targetType} without losing ID precision. Convert both columns to one compatible exact numeric type first.`);
58
+ }
59
+ return {
60
+ source: source,
61
+ target: target,
62
+ idType,
63
+ family: "numeric",
64
+ floating: isFloating(sourceType) || isFloating(targetType),
65
+ };
66
+ }
67
+ function findColumn(schema, requested) {
68
+ const folded = (0, foldIdentifier_js_1.default)(requested);
69
+ return Object.keys(schema).find((column) => (0, foldIdentifier_js_1.default)(column) === folded);
70
+ }
71
+ function normalizeType(type) {
72
+ return type.toUpperCase().replace(/^REAL$/, "FLOAT");
73
+ }
74
+ function typeKind(type) {
75
+ if (type === "VARCHAR")
76
+ return { family: "string" };
77
+ if (integerTypes[type] !== undefined || isDecimal(type) || isFloating(type) ||
78
+ type === "BIGNUM") {
79
+ return { family: "numeric" };
80
+ }
81
+ return undefined;
82
+ }
83
+ function compatibleNumericType(left, right) {
84
+ if (left === right)
85
+ return left;
86
+ if (isFloating(left) || isFloating(right)) {
87
+ return isFloating(left) && isFloating(right) ? "DOUBLE" : undefined;
88
+ }
89
+ if (left === "BIGNUM" || right === "BIGNUM") {
90
+ const other = left === "BIGNUM" ? right : left;
91
+ return integerTypes[other] !== undefined || decimalScale(other) === 0
92
+ ? "BIGNUM"
93
+ : undefined;
94
+ }
95
+ const leftInteger = integerTypes[left];
96
+ const rightInteger = integerTypes[right];
97
+ if (leftInteger !== undefined && rightInteger !== undefined) {
98
+ return commonIntegerType(leftInteger, rightInteger);
99
+ }
100
+ const leftDecimal = parseDecimal(left);
101
+ const rightDecimal = parseDecimal(right);
102
+ if (leftDecimal === undefined && rightDecimal === undefined)
103
+ return undefined;
104
+ const scale = Math.max(leftDecimal?.scale ?? 0, rightDecimal?.scale ?? 0);
105
+ const integerDigits = Math.max(leftDecimal === undefined
106
+ ? leftInteger.digits
107
+ : leftDecimal.precision - leftDecimal.scale, rightDecimal === undefined
108
+ ? rightInteger.digits
109
+ : rightDecimal.precision - rightDecimal.scale);
110
+ const precision = integerDigits + scale;
111
+ return precision <= 38 ? `DECIMAL(${precision},${scale})` : undefined;
112
+ }
113
+ function commonIntegerType(left, right) {
114
+ if (left.signed === right.signed) {
115
+ const bits = Math.max(left.bits, right.bits);
116
+ return integerTypeName(left.signed, bits);
117
+ }
118
+ const signed = left.signed ? left : right;
119
+ const unsigned = left.signed ? right : left;
120
+ const requiredBits = Math.max(signed.bits, nextBits(unsigned.bits));
121
+ return requiredBits > 128 ? undefined : integerTypeName(true, requiredBits);
122
+ }
123
+ function nextBits(bits) {
124
+ if (bits <= 8)
125
+ return 16;
126
+ if (bits <= 16)
127
+ return 32;
128
+ if (bits <= 32)
129
+ return 64;
130
+ if (bits <= 64)
131
+ return 128;
132
+ return 256;
133
+ }
134
+ function integerTypeName(signed, bits) {
135
+ const names = signed
136
+ ? {
137
+ 8: "TINYINT",
138
+ 16: "SMALLINT",
139
+ 32: "INTEGER",
140
+ 64: "BIGINT",
141
+ 128: "HUGEINT",
142
+ }
143
+ : {
144
+ 8: "UTINYINT",
145
+ 16: "USMALLINT",
146
+ 32: "UINTEGER",
147
+ 64: "UBIGINT",
148
+ 128: "UHUGEINT",
149
+ };
150
+ return names[bits];
151
+ }
152
+ function isFloating(type) {
153
+ return type === "FLOAT" || type === "DOUBLE";
154
+ }
155
+ function isDecimal(type) {
156
+ return /^DECIMAL\(\d+,\d+\)$/.test(type);
157
+ }
158
+ function parseDecimal(type) {
159
+ const match = /^DECIMAL\((\d+),(\d+)\)$/.exec(type);
160
+ return match === null
161
+ ? undefined
162
+ : { precision: Number(match[1]), scale: Number(match[2]) };
163
+ }
164
+ function decimalScale(type) {
165
+ return parseDecimal(type)?.scale;
166
+ }
@@ -0,0 +1,10 @@
1
+ import type { TableSchema } from "./pendingOps.js";
2
+ type GraphWeightColumn = {
3
+ column: string;
4
+ distanceType: string;
5
+ type: string;
6
+ };
7
+ /** Resolves a numeric graph weight and a precision-preserving sum type. */
8
+ export default function getGraphWeightColumn(schema: TableSchema, requestedWeight: string, method: string): GraphWeightColumn;
9
+ export {};
10
+ //# sourceMappingURL=getGraphWeightColumn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGraphWeightColumn.d.ts","sourceRoot":"","sources":["../../src/helpers/getGraphWeightColumn.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAcF,2EAA2E;AAC3E,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,GACb,iBAAiB,CAsCnB"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = getGraphWeightColumn;
7
+ const foldIdentifier_js_1 = __importDefault(require("./foldIdentifier.js"));
8
+ const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
9
+ const integerTypes = new Set([
10
+ "TINYINT",
11
+ "SMALLINT",
12
+ "INTEGER",
13
+ "BIGINT",
14
+ "UTINYINT",
15
+ "USMALLINT",
16
+ "UINTEGER",
17
+ "UBIGINT",
18
+ ]);
19
+ const wideIntegerTypes = new Set(["HUGEINT", "UHUGEINT", "BIGNUM"]);
20
+ /** Resolves a numeric graph weight and a precision-preserving sum type. */
21
+ function getGraphWeightColumn(schema, requestedWeight, method) {
22
+ const folded = (0, foldIdentifier_js_1.default)(requestedWeight);
23
+ const column = Object.keys(schema).find((name) => (0, foldIdentifier_js_1.default)(name) === folded);
24
+ if (column === undefined) {
25
+ throw new Error(`${method} the column ${(0, quoteIdentifier_js_1.default)(requestedWeight)} does not exist. Check for typos, or load the data first.`);
26
+ }
27
+ const type = schema[column].toUpperCase().replace(/^REAL$/, "FLOAT");
28
+ if (integerTypes.has(type)) {
29
+ return { column, type, distanceType: "HUGEINT" };
30
+ }
31
+ if (wideIntegerTypes.has(type)) {
32
+ return { column, type, distanceType: "BIGNUM" };
33
+ }
34
+ if (type === "FLOAT" || type === "DOUBLE") {
35
+ return { column, type, distanceType: type };
36
+ }
37
+ const decimal = /^DECIMAL\((\d+),(\d+)\)$/.exec(type);
38
+ if (decimal !== null) {
39
+ return {
40
+ column,
41
+ type,
42
+ distanceType: `DECIMAL(38,${Number(decimal[2])})`,
43
+ };
44
+ }
45
+ throw new TypeError(`${method} requires a numeric weight column, but column ${(0, quoteIdentifier_js_1.default)(column)} has type ${type}.`);
46
+ }
@@ -0,0 +1,4 @@
1
+ import type { TableSchema } from "./pendingOps.js";
2
+ /** Derives the route result schema while preserving input columns and types. */
3
+ export default function graphRouteResultSchema(schema: TableSchema, distanceType: string, method: string): TableSchema;
4
+ //# sourceMappingURL=graphRouteResultSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphRouteResultSchema.d.ts","sourceRoot":"","sources":["../../src/helpers/graphRouteResultSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD,gFAAgF;AAChF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,MAAM,EAAE,WAAW,EACnB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,GACb,WAAW,CASb"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = graphRouteResultSchema;
7
+ const validateGraphRouteResultSchema_js_1 = __importDefault(require("./validateGraphRouteResultSchema.js"));
8
+ /** Derives the route result schema while preserving input columns and types. */
9
+ function graphRouteResultSchema(schema, distanceType, method) {
10
+ (0, validateGraphRouteResultSchema_js_1.default)(schema, method);
11
+ return {
12
+ pathId: "BIGINT",
13
+ step: "BIGINT",
14
+ weight: distanceType,
15
+ total: distanceType,
16
+ ...schema,
17
+ };
18
+ }