@nshiab/simple-data-analysis-core 2.0.9 → 2.1.1
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.
- package/esm/class/SDAError.d.ts +6 -6
- package/esm/class/SDAError.js +6 -6
- package/esm/class/Simple.d.ts +9 -9
- package/esm/class/Simple.js +9 -9
- package/esm/class/SimpleDB.d.ts +80 -76
- package/esm/class/SimpleDB.d.ts.map +1 -1
- package/esm/class/SimpleDB.js +80 -76
- package/esm/class/SimpleTable.d.ts +2806 -1139
- package/esm/class/SimpleTable.d.ts.map +1 -1
- package/esm/class/SimpleTable.js +2792 -1149
- package/esm/helpers/buildApproximateMutualReachabilityMst.d.ts +45 -0
- package/esm/helpers/buildApproximateMutualReachabilityMst.d.ts.map +1 -0
- package/esm/helpers/buildApproximateMutualReachabilityMst.js +212 -0
- package/esm/helpers/buildChronologicalGraphComponentsSql.d.ts +14 -0
- package/esm/helpers/buildChronologicalGraphComponentsSql.d.ts.map +1 -0
- package/esm/helpers/buildChronologicalGraphComponentsSql.js +167 -0
- package/esm/helpers/buildExactMutualReachabilityMst.d.ts +28 -0
- package/esm/helpers/buildExactMutualReachabilityMst.d.ts.map +1 -0
- package/esm/helpers/buildExactMutualReachabilityMst.js +97 -0
- package/esm/helpers/buildGraphTemporalCostStateSql.d.ts +12 -0
- package/esm/helpers/buildGraphTemporalCostStateSql.d.ts.map +1 -0
- package/esm/helpers/buildGraphTemporalCostStateSql.js +86 -0
- package/esm/helpers/buildGraphTemporalReachabilitySql.d.ts +13 -0
- package/esm/helpers/buildGraphTemporalReachabilitySql.d.ts.map +1 -0
- package/esm/helpers/buildGraphTemporalReachabilitySql.js +70 -0
- package/esm/helpers/buildSparseMutualReachabilityMst.d.ts +10 -0
- package/esm/helpers/buildSparseMutualReachabilityMst.d.ts.map +1 -0
- package/esm/helpers/buildSparseMutualReachabilityMst.js +47 -0
- package/esm/helpers/buildUmapGraph.d.ts +2 -5
- package/esm/helpers/buildUmapGraph.d.ts.map +1 -1
- package/esm/helpers/buildUmapGraph.js +6 -100
- package/esm/helpers/buildVectorNeighbors.d.ts +45 -0
- package/esm/helpers/buildVectorNeighbors.d.ts.map +1 -0
- package/esm/helpers/buildVectorNeighbors.js +170 -0
- package/esm/helpers/buildWeakGraphComponentsSql.d.ts +3 -0
- package/esm/helpers/buildWeakGraphComponentsSql.d.ts.map +1 -0
- package/esm/helpers/buildWeakGraphComponentsSql.js +32 -0
- package/esm/helpers/camelCase.d.ts +7 -5
- package/esm/helpers/camelCase.d.ts.map +1 -1
- package/esm/helpers/camelCase.js +7 -5
- package/esm/helpers/capitalize.d.ts +6 -4
- package/esm/helpers/capitalize.d.ts.map +1 -1
- package/esm/helpers/capitalize.js +6 -4
- package/esm/helpers/clusterHdbscan.d.ts +18 -0
- package/esm/helpers/clusterHdbscan.d.ts.map +1 -0
- package/esm/helpers/clusterHdbscan.js +342 -0
- package/esm/helpers/computeCovariance.d.ts +16 -0
- package/esm/helpers/computeCovariance.d.ts.map +1 -0
- package/esm/helpers/computeCovariance.js +99 -0
- package/esm/helpers/computeMahalanobisDistances.d.ts +14 -0
- package/esm/helpers/computeMahalanobisDistances.d.ts.map +1 -0
- package/esm/helpers/computeMahalanobisDistances.js +87 -0
- package/esm/helpers/createDirectory.d.ts +4 -3
- package/esm/helpers/createDirectory.d.ts.map +1 -1
- package/esm/helpers/createDirectory.js +4 -3
- package/esm/helpers/dataToArrays.d.ts +6 -4
- package/esm/helpers/dataToArrays.d.ts.map +1 -1
- package/esm/helpers/dataToArrays.js +6 -4
- package/esm/helpers/extractTypes.d.ts +1 -1
- package/esm/helpers/extractTypes.js +4 -9
- package/esm/helpers/factorCovariance.d.ts +17 -0
- package/esm/helpers/factorCovariance.d.ts.map +1 -0
- package/esm/helpers/factorCovariance.js +189 -0
- package/esm/helpers/findGeoColumn.d.ts +6 -4
- package/esm/helpers/findGeoColumn.d.ts.map +1 -1
- package/esm/helpers/findGeoColumn.js +6 -4
- package/esm/helpers/findGeoColumnFromSchema.d.ts +8 -5
- package/esm/helpers/findGeoColumnFromSchema.d.ts.map +1 -1
- package/esm/helpers/findGeoColumnFromSchema.js +8 -5
- package/esm/helpers/formatDate.d.ts +12 -6
- package/esm/helpers/formatDate.d.ts.map +1 -1
- package/esm/helpers/formatDate.js +12 -6
- package/esm/helpers/formatMissingTables.d.ts +8 -5
- package/esm/helpers/formatMissingTables.d.ts.map +1 -1
- package/esm/helpers/formatMissingTables.js +8 -5
- package/esm/helpers/formatNumber.d.ts +19 -10
- package/esm/helpers/formatNumber.d.ts.map +1 -1
- package/esm/helpers/formatNumber.js +32 -17
- package/esm/helpers/getGraphEdgeIdColumn.d.ts +9 -0
- package/esm/helpers/getGraphEdgeIdColumn.d.ts.map +1 -0
- package/esm/helpers/getGraphEdgeIdColumn.js +25 -0
- package/esm/helpers/getGraphEndpointColumns.d.ts +11 -0
- package/esm/helpers/getGraphEndpointColumns.d.ts.map +1 -0
- package/esm/helpers/getGraphEndpointColumns.js +160 -0
- package/esm/helpers/getGraphWeightColumn.d.ts +10 -0
- package/esm/helpers/getGraphWeightColumn.d.ts.map +1 -0
- package/esm/helpers/getGraphWeightColumn.js +40 -0
- package/esm/helpers/graphRouteResultSchema.d.ts +4 -0
- package/esm/helpers/graphRouteResultSchema.d.ts.map +1 -0
- package/esm/helpers/graphRouteResultSchema.js +12 -0
- package/esm/helpers/graphRouteResultSelect.d.ts +4 -0
- package/esm/helpers/graphRouteResultSelect.d.ts.map +1 -0
- package/esm/helpers/graphRouteResultSelect.js +22 -0
- package/esm/helpers/hasGeometryColumn.d.ts +4 -3
- package/esm/helpers/hasGeometryColumn.d.ts.map +1 -1
- package/esm/helpers/hasGeometryColumn.js +4 -3
- package/esm/helpers/inspectGraphConnectivity.d.ts +10 -0
- package/esm/helpers/inspectGraphConnectivity.d.ts.map +1 -0
- package/esm/helpers/inspectGraphConnectivity.js +55 -0
- package/esm/helpers/mergeOptions.d.ts +24 -13
- package/esm/helpers/mergeOptions.d.ts.map +1 -1
- package/esm/helpers/mergeOptions.js +24 -13
- package/esm/helpers/parseValue.d.ts +6 -4
- package/esm/helpers/parseValue.d.ts.map +1 -1
- package/esm/helpers/parseValue.js +6 -4
- package/esm/helpers/prepareGraphRouteSql.d.ts +31 -0
- package/esm/helpers/prepareGraphRouteSql.d.ts.map +1 -0
- package/esm/helpers/prepareGraphRouteSql.js +86 -0
- package/esm/helpers/prepareGraphStarts.d.ts +9 -0
- package/esm/helpers/prepareGraphStarts.d.ts.map +1 -0
- package/esm/helpers/prepareGraphStarts.js +68 -0
- package/esm/helpers/prepareGraphTemporalSql.d.ts +28 -0
- package/esm/helpers/prepareGraphTemporalSql.d.ts.map +1 -0
- package/esm/helpers/prepareGraphTemporalSql.js +154 -0
- package/esm/helpers/prepareGraphTraversal.d.ts +19 -0
- package/esm/helpers/prepareGraphTraversal.d.ts.map +1 -0
- package/esm/helpers/prepareGraphTraversal.js +79 -0
- package/esm/helpers/prepareNumericFeatures.d.ts +41 -0
- package/esm/helpers/prepareNumericFeatures.d.ts.map +1 -0
- package/esm/helpers/prepareNumericFeatures.js +210 -0
- package/esm/helpers/prettyDuration.d.ts +14 -8
- package/esm/helpers/prettyDuration.d.ts.map +1 -1
- package/esm/helpers/prettyDuration.js +14 -8
- package/esm/helpers/printTable.d.ts +18 -13
- package/esm/helpers/printTable.d.ts.map +1 -1
- package/esm/helpers/printTable.js +18 -13
- package/esm/helpers/publishPreparedColumns.d.ts +37 -0
- package/esm/helpers/publishPreparedColumns.d.ts.map +1 -0
- package/esm/helpers/publishPreparedColumns.js +113 -0
- package/esm/helpers/queryDB.d.ts +24 -13
- package/esm/helpers/queryDB.d.ts.map +1 -1
- package/esm/helpers/queryDB.js +24 -13
- package/esm/helpers/queueAsyncBarrier.d.ts +12 -7
- package/esm/helpers/queueAsyncBarrier.d.ts.map +1 -1
- package/esm/helpers/queueAsyncBarrier.js +12 -7
- package/esm/helpers/queueGraphResult.d.ts +18 -0
- package/esm/helpers/queueGraphResult.d.ts.map +1 -0
- package/esm/helpers/queueGraphResult.js +39 -0
- package/esm/helpers/quoteIdentifier.d.ts +4 -3
- package/esm/helpers/quoteIdentifier.d.ts.map +1 -1
- package/esm/helpers/quoteIdentifier.js +4 -3
- package/esm/helpers/quoteQualifiedIdentifier.d.ts +6 -4
- package/esm/helpers/quoteQualifiedIdentifier.d.ts.map +1 -1
- package/esm/helpers/quoteQualifiedIdentifier.js +6 -4
- package/esm/helpers/runQuery.d.ts.map +1 -1
- package/esm/helpers/runQuery.js +17 -3
- package/esm/helpers/selectFuzzyReplacements.d.ts +11 -0
- package/esm/helpers/selectFuzzyReplacements.d.ts.map +1 -0
- package/esm/helpers/selectFuzzyReplacements.js +124 -0
- package/esm/helpers/stabilizeCosineVectors.d.ts +14 -0
- package/esm/helpers/stabilizeCosineVectors.d.ts.map +1 -0
- package/esm/helpers/stabilizeCosineVectors.js +34 -0
- package/esm/helpers/stringToArray.d.ts +4 -3
- package/esm/helpers/stringToArray.d.ts.map +1 -1
- package/esm/helpers/stringToArray.js +4 -3
- package/esm/helpers/updateColumnsWithJS.d.ts +12 -6
- package/esm/helpers/updateColumnsWithJS.d.ts.map +1 -1
- package/esm/helpers/updateColumnsWithJS.js +12 -6
- package/esm/helpers/validateGraphRouteResultSchema.d.ts +4 -0
- package/esm/helpers/validateGraphRouteResultSchema.d.ts.map +1 -0
- package/esm/helpers/validateGraphRouteResultSchema.js +13 -0
- package/esm/helpers/validateGraphTemporalEvents.d.ts +7 -0
- package/esm/helpers/validateGraphTemporalEvents.d.ts.map +1 -0
- package/esm/helpers/validateGraphTemporalEvents.js +47 -0
- package/esm/helpers/validateNumericalAnalysis.d.ts +10 -6
- package/esm/helpers/validateNumericalAnalysis.d.ts.map +1 -1
- package/esm/helpers/validateNumericalAnalysis.js +10 -6
- package/esm/helpers/validateVectorRowIds.d.ts +4 -0
- package/esm/helpers/validateVectorRowIds.d.ts.map +1 -0
- package/esm/helpers/validateVectorRowIds.js +16 -0
- package/esm/helpers/vectorDistanceExpression.d.ts +6 -0
- package/esm/helpers/vectorDistanceExpression.d.ts.map +1 -0
- package/esm/helpers/vectorDistanceExpression.js +11 -0
- package/esm/helpers/wrapString.d.ts +10 -7
- package/esm/helpers/wrapString.d.ts.map +1 -1
- package/esm/helpers/wrapString.js +10 -7
- package/esm/methods/addId.d.ts +5 -0
- package/esm/methods/addId.d.ts.map +1 -0
- package/esm/methods/addId.js +38 -0
- package/esm/methods/commonNeighbors.d.ts +10 -0
- package/esm/methods/commonNeighbors.d.ts.map +1 -0
- package/esm/methods/commonNeighbors.js +101 -0
- package/esm/methods/connectedComponents.d.ts +9 -0
- package/esm/methods/connectedComponents.d.ts.map +1 -0
- package/esm/methods/connectedComponents.js +147 -0
- package/esm/methods/degree.d.ts +9 -0
- package/esm/methods/degree.d.ts.map +1 -0
- package/esm/methods/degree.js +135 -0
- package/esm/methods/distances.d.ts +12 -0
- package/esm/methods/distances.d.ts.map +1 -0
- package/esm/methods/distances.js +164 -0
- package/esm/methods/findCycles.d.ts +12 -0
- package/esm/methods/findCycles.d.ts.map +1 -0
- package/esm/methods/findCycles.js +330 -0
- package/esm/methods/fuzzyClean.d.ts.map +1 -1
- package/esm/methods/fuzzyClean.js +17 -136
- package/esm/methods/fuzzyJoin.js +70 -16
- package/esm/methods/getTypes.d.ts +1 -1
- package/esm/methods/hdbscan.d.ts +5 -0
- package/esm/methods/hdbscan.d.ts.map +1 -0
- package/esm/methods/hdbscan.js +208 -0
- package/esm/methods/mahalanobis.d.ts +5 -0
- package/esm/methods/mahalanobis.d.ts.map +1 -0
- package/esm/methods/mahalanobis.js +92 -0
- package/esm/methods/neighbors.d.ts +9 -0
- package/esm/methods/neighbors.d.ts.map +1 -0
- package/esm/methods/neighbors.js +81 -0
- package/esm/methods/normalizeVector.d.ts +5 -0
- package/esm/methods/normalizeVector.d.ts.map +1 -0
- package/esm/methods/normalizeVector.js +132 -0
- package/esm/methods/paths.d.ts +12 -0
- package/esm/methods/paths.d.ts.map +1 -0
- package/esm/methods/paths.js +287 -0
- package/esm/methods/reachable.d.ts +11 -0
- package/esm/methods/reachable.d.ts.map +1 -0
- package/esm/methods/reachable.js +131 -0
- package/esm/methods/rowToVector.d.ts +5 -0
- package/esm/methods/rowToVector.d.ts.map +1 -0
- package/esm/methods/rowToVector.js +77 -0
- package/esm/methods/shortestPath.d.ts +12 -0
- package/esm/methods/shortestPath.d.ts.map +1 -0
- package/esm/methods/shortestPath.js +337 -0
- package/esm/methods/topologicalSort.d.ts +7 -0
- package/esm/methods/topologicalSort.d.ts.map +1 -0
- package/esm/methods/topologicalSort.js +164 -0
- package/esm/methods/trim.d.ts +1 -1
- package/esm/methods/trim.d.ts.map +1 -1
- package/esm/methods/trim.js +17 -8
- package/llm.md +2146 -173
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/script/class/SDAError.d.ts +6 -6
- package/script/class/SDAError.js +6 -6
- package/script/class/Simple.d.ts +9 -9
- package/script/class/Simple.js +9 -9
- package/script/class/SimpleDB.d.ts +80 -76
- package/script/class/SimpleDB.d.ts.map +1 -1
- package/script/class/SimpleDB.js +80 -76
- package/script/class/SimpleTable.d.ts +2806 -1139
- package/script/class/SimpleTable.d.ts.map +1 -1
- package/script/class/SimpleTable.js +2792 -1149
- package/script/helpers/buildApproximateMutualReachabilityMst.d.ts +45 -0
- package/script/helpers/buildApproximateMutualReachabilityMst.d.ts.map +1 -0
- package/script/helpers/buildApproximateMutualReachabilityMst.js +219 -0
- package/script/helpers/buildChronologicalGraphComponentsSql.d.ts +14 -0
- package/script/helpers/buildChronologicalGraphComponentsSql.d.ts.map +1 -0
- package/script/helpers/buildChronologicalGraphComponentsSql.js +174 -0
- package/script/helpers/buildExactMutualReachabilityMst.d.ts +28 -0
- package/script/helpers/buildExactMutualReachabilityMst.d.ts.map +1 -0
- package/script/helpers/buildExactMutualReachabilityMst.js +103 -0
- package/script/helpers/buildGraphTemporalCostStateSql.d.ts +12 -0
- package/script/helpers/buildGraphTemporalCostStateSql.d.ts.map +1 -0
- package/script/helpers/buildGraphTemporalCostStateSql.js +92 -0
- package/script/helpers/buildGraphTemporalReachabilitySql.d.ts +13 -0
- package/script/helpers/buildGraphTemporalReachabilitySql.d.ts.map +1 -0
- package/script/helpers/buildGraphTemporalReachabilitySql.js +76 -0
- package/script/helpers/buildSparseMutualReachabilityMst.d.ts +10 -0
- package/script/helpers/buildSparseMutualReachabilityMst.d.ts.map +1 -0
- package/script/helpers/buildSparseMutualReachabilityMst.js +50 -0
- package/script/helpers/buildUmapGraph.d.ts +2 -5
- package/script/helpers/buildUmapGraph.d.ts.map +1 -1
- package/script/helpers/buildUmapGraph.js +6 -100
- package/script/helpers/buildVectorNeighbors.d.ts +45 -0
- package/script/helpers/buildVectorNeighbors.d.ts.map +1 -0
- package/script/helpers/buildVectorNeighbors.js +176 -0
- package/script/helpers/buildWeakGraphComponentsSql.d.ts +3 -0
- package/script/helpers/buildWeakGraphComponentsSql.d.ts.map +1 -0
- package/script/helpers/buildWeakGraphComponentsSql.js +38 -0
- package/script/helpers/camelCase.d.ts +7 -5
- package/script/helpers/camelCase.d.ts.map +1 -1
- package/script/helpers/camelCase.js +7 -5
- package/script/helpers/capitalize.d.ts +6 -4
- package/script/helpers/capitalize.d.ts.map +1 -1
- package/script/helpers/capitalize.js +6 -4
- package/script/helpers/clusterHdbscan.d.ts +18 -0
- package/script/helpers/clusterHdbscan.d.ts.map +1 -0
- package/script/helpers/clusterHdbscan.js +346 -0
- package/script/helpers/computeCovariance.d.ts +16 -0
- package/script/helpers/computeCovariance.d.ts.map +1 -0
- package/script/helpers/computeCovariance.js +105 -0
- package/script/helpers/computeMahalanobisDistances.d.ts +14 -0
- package/script/helpers/computeMahalanobisDistances.d.ts.map +1 -0
- package/script/helpers/computeMahalanobisDistances.js +93 -0
- package/script/helpers/createDirectory.d.ts +4 -3
- package/script/helpers/createDirectory.d.ts.map +1 -1
- package/script/helpers/createDirectory.js +4 -3
- package/script/helpers/dataToArrays.d.ts +6 -4
- package/script/helpers/dataToArrays.d.ts.map +1 -1
- package/script/helpers/dataToArrays.js +6 -4
- package/script/helpers/extractTypes.d.ts +1 -1
- package/script/helpers/extractTypes.js +4 -9
- package/script/helpers/factorCovariance.d.ts +17 -0
- package/script/helpers/factorCovariance.d.ts.map +1 -0
- package/script/helpers/factorCovariance.js +194 -0
- package/script/helpers/findGeoColumn.d.ts +6 -4
- package/script/helpers/findGeoColumn.d.ts.map +1 -1
- package/script/helpers/findGeoColumn.js +6 -4
- package/script/helpers/findGeoColumnFromSchema.d.ts +8 -5
- package/script/helpers/findGeoColumnFromSchema.d.ts.map +1 -1
- package/script/helpers/findGeoColumnFromSchema.js +8 -5
- package/script/helpers/formatDate.d.ts +12 -6
- package/script/helpers/formatDate.d.ts.map +1 -1
- package/script/helpers/formatDate.js +12 -6
- package/script/helpers/formatMissingTables.d.ts +8 -5
- package/script/helpers/formatMissingTables.d.ts.map +1 -1
- package/script/helpers/formatMissingTables.js +8 -5
- package/script/helpers/formatNumber.d.ts +19 -10
- package/script/helpers/formatNumber.d.ts.map +1 -1
- package/script/helpers/formatNumber.js +32 -17
- package/script/helpers/getGraphEdgeIdColumn.d.ts +9 -0
- package/script/helpers/getGraphEdgeIdColumn.d.ts.map +1 -0
- package/script/helpers/getGraphEdgeIdColumn.js +31 -0
- package/script/helpers/getGraphEndpointColumns.d.ts +11 -0
- package/script/helpers/getGraphEndpointColumns.d.ts.map +1 -0
- package/script/helpers/getGraphEndpointColumns.js +166 -0
- package/script/helpers/getGraphWeightColumn.d.ts +10 -0
- package/script/helpers/getGraphWeightColumn.d.ts.map +1 -0
- package/script/helpers/getGraphWeightColumn.js +46 -0
- package/script/helpers/graphRouteResultSchema.d.ts +4 -0
- package/script/helpers/graphRouteResultSchema.d.ts.map +1 -0
- package/script/helpers/graphRouteResultSchema.js +18 -0
- package/script/helpers/graphRouteResultSelect.d.ts +4 -0
- package/script/helpers/graphRouteResultSelect.d.ts.map +1 -0
- package/script/helpers/graphRouteResultSelect.js +28 -0
- package/script/helpers/hasGeometryColumn.d.ts +4 -3
- package/script/helpers/hasGeometryColumn.d.ts.map +1 -1
- package/script/helpers/hasGeometryColumn.js +4 -3
- package/script/helpers/inspectGraphConnectivity.d.ts +10 -0
- package/script/helpers/inspectGraphConnectivity.d.ts.map +1 -0
- package/script/helpers/inspectGraphConnectivity.js +58 -0
- package/script/helpers/mergeOptions.d.ts +24 -13
- package/script/helpers/mergeOptions.d.ts.map +1 -1
- package/script/helpers/mergeOptions.js +24 -13
- package/script/helpers/parseValue.d.ts +6 -4
- package/script/helpers/parseValue.d.ts.map +1 -1
- package/script/helpers/parseValue.js +6 -4
- package/script/helpers/prepareGraphRouteSql.d.ts +31 -0
- package/script/helpers/prepareGraphRouteSql.d.ts.map +1 -0
- package/script/helpers/prepareGraphRouteSql.js +127 -0
- package/script/helpers/prepareGraphStarts.d.ts +9 -0
- package/script/helpers/prepareGraphStarts.d.ts.map +1 -0
- package/script/helpers/prepareGraphStarts.js +71 -0
- package/script/helpers/prepareGraphTemporalSql.d.ts +28 -0
- package/script/helpers/prepareGraphTemporalSql.d.ts.map +1 -0
- package/script/helpers/prepareGraphTemporalSql.js +161 -0
- package/script/helpers/prepareGraphTraversal.d.ts +19 -0
- package/script/helpers/prepareGraphTraversal.d.ts.map +1 -0
- package/script/helpers/prepareGraphTraversal.js +87 -0
- package/script/helpers/prepareNumericFeatures.d.ts +41 -0
- package/script/helpers/prepareNumericFeatures.d.ts.map +1 -0
- package/script/helpers/prepareNumericFeatures.js +217 -0
- package/script/helpers/prettyDuration.d.ts +14 -8
- package/script/helpers/prettyDuration.d.ts.map +1 -1
- package/script/helpers/prettyDuration.js +14 -8
- package/script/helpers/printTable.d.ts +18 -13
- package/script/helpers/printTable.d.ts.map +1 -1
- package/script/helpers/printTable.js +18 -13
- package/script/helpers/publishPreparedColumns.d.ts +37 -0
- package/script/helpers/publishPreparedColumns.d.ts.map +1 -0
- package/script/helpers/publishPreparedColumns.js +119 -0
- package/script/helpers/queryDB.d.ts +24 -13
- package/script/helpers/queryDB.d.ts.map +1 -1
- package/script/helpers/queryDB.js +24 -13
- package/script/helpers/queueAsyncBarrier.d.ts +12 -7
- package/script/helpers/queueAsyncBarrier.d.ts.map +1 -1
- package/script/helpers/queueAsyncBarrier.js +12 -7
- package/script/helpers/queueGraphResult.d.ts +18 -0
- package/script/helpers/queueGraphResult.d.ts.map +1 -0
- package/script/helpers/queueGraphResult.js +45 -0
- package/script/helpers/quoteIdentifier.d.ts +4 -3
- package/script/helpers/quoteIdentifier.d.ts.map +1 -1
- package/script/helpers/quoteIdentifier.js +4 -3
- package/script/helpers/quoteQualifiedIdentifier.d.ts +6 -4
- package/script/helpers/quoteQualifiedIdentifier.d.ts.map +1 -1
- package/script/helpers/quoteQualifiedIdentifier.js +6 -4
- package/script/helpers/runQuery.d.ts.map +1 -1
- package/script/helpers/runQuery.js +17 -3
- package/script/helpers/selectFuzzyReplacements.d.ts +11 -0
- package/script/helpers/selectFuzzyReplacements.d.ts.map +1 -0
- package/script/helpers/selectFuzzyReplacements.js +127 -0
- package/script/helpers/stabilizeCosineVectors.d.ts +14 -0
- package/script/helpers/stabilizeCosineVectors.d.ts.map +1 -0
- package/script/helpers/stabilizeCosineVectors.js +40 -0
- package/script/helpers/stringToArray.d.ts +4 -3
- package/script/helpers/stringToArray.d.ts.map +1 -1
- package/script/helpers/stringToArray.js +4 -3
- package/script/helpers/updateColumnsWithJS.d.ts +12 -6
- package/script/helpers/updateColumnsWithJS.d.ts.map +1 -1
- package/script/helpers/updateColumnsWithJS.js +12 -6
- package/script/helpers/validateGraphRouteResultSchema.d.ts +4 -0
- package/script/helpers/validateGraphRouteResultSchema.d.ts.map +1 -0
- package/script/helpers/validateGraphRouteResultSchema.js +19 -0
- package/script/helpers/validateGraphTemporalEvents.d.ts +7 -0
- package/script/helpers/validateGraphTemporalEvents.d.ts.map +1 -0
- package/script/helpers/validateGraphTemporalEvents.js +53 -0
- package/script/helpers/validateNumericalAnalysis.d.ts +10 -6
- package/script/helpers/validateNumericalAnalysis.d.ts.map +1 -1
- package/script/helpers/validateNumericalAnalysis.js +10 -6
- package/script/helpers/validateVectorRowIds.d.ts +4 -0
- package/script/helpers/validateVectorRowIds.d.ts.map +1 -0
- package/script/helpers/validateVectorRowIds.js +19 -0
- package/script/helpers/vectorDistanceExpression.d.ts +6 -0
- package/script/helpers/vectorDistanceExpression.d.ts.map +1 -0
- package/script/helpers/vectorDistanceExpression.js +14 -0
- package/script/helpers/wrapString.d.ts +10 -7
- package/script/helpers/wrapString.d.ts.map +1 -1
- package/script/helpers/wrapString.js +10 -7
- package/script/methods/addId.d.ts +5 -0
- package/script/methods/addId.d.ts.map +1 -0
- package/script/methods/addId.js +44 -0
- package/script/methods/commonNeighbors.d.ts +10 -0
- package/script/methods/commonNeighbors.d.ts.map +1 -0
- package/script/methods/commonNeighbors.js +140 -0
- package/script/methods/connectedComponents.d.ts +9 -0
- package/script/methods/connectedComponents.d.ts.map +1 -0
- package/script/methods/connectedComponents.js +186 -0
- package/script/methods/degree.d.ts +9 -0
- package/script/methods/degree.d.ts.map +1 -0
- package/script/methods/degree.js +141 -0
- package/script/methods/distances.d.ts +12 -0
- package/script/methods/distances.d.ts.map +1 -0
- package/script/methods/distances.js +203 -0
- package/script/methods/findCycles.d.ts +12 -0
- package/script/methods/findCycles.d.ts.map +1 -0
- package/script/methods/findCycles.js +369 -0
- package/script/methods/fuzzyClean.d.ts.map +1 -1
- package/script/methods/fuzzyClean.js +17 -136
- package/script/methods/fuzzyJoin.js +70 -16
- package/script/methods/getTypes.d.ts +1 -1
- package/script/methods/hdbscan.d.ts +5 -0
- package/script/methods/hdbscan.d.ts.map +1 -0
- package/script/methods/hdbscan.js +214 -0
- package/script/methods/mahalanobis.d.ts +5 -0
- package/script/methods/mahalanobis.d.ts.map +1 -0
- package/script/methods/mahalanobis.js +98 -0
- package/script/methods/neighbors.d.ts +9 -0
- package/script/methods/neighbors.d.ts.map +1 -0
- package/script/methods/neighbors.js +120 -0
- package/script/methods/normalizeVector.d.ts +5 -0
- package/script/methods/normalizeVector.d.ts.map +1 -0
- package/script/methods/normalizeVector.js +138 -0
- package/script/methods/paths.d.ts +12 -0
- package/script/methods/paths.d.ts.map +1 -0
- package/script/methods/paths.js +326 -0
- package/script/methods/reachable.d.ts +11 -0
- package/script/methods/reachable.d.ts.map +1 -0
- package/script/methods/reachable.js +170 -0
- package/script/methods/rowToVector.d.ts +5 -0
- package/script/methods/rowToVector.d.ts.map +1 -0
- package/script/methods/rowToVector.js +83 -0
- package/script/methods/shortestPath.d.ts +12 -0
- package/script/methods/shortestPath.d.ts.map +1 -0
- package/script/methods/shortestPath.js +376 -0
- package/script/methods/topologicalSort.d.ts +7 -0
- package/script/methods/topologicalSort.d.ts.map +1 -0
- package/script/methods/topologicalSort.js +170 -0
- package/script/methods/trim.d.ts +1 -1
- package/script/methods/trim.d.ts.map +1 -1
- package/script/methods/trim.js +17 -8
|
@@ -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
|
|
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"}
|
|
@@ -2,11 +2,6 @@ import quoteIdentifier from "./quoteIdentifier.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Formats a missing-table error with the requested and available table names.
|
|
4
4
|
*
|
|
5
|
-
* @param method - The SDA method looking up the tables.
|
|
6
|
-
* @param missingTables - The requested table names that were not found.
|
|
7
|
-
* @param availableTables - The table names currently available.
|
|
8
|
-
* @returns An actionable missing-table error message.
|
|
9
|
-
*
|
|
10
5
|
* @example
|
|
11
6
|
* ```ts
|
|
12
7
|
* const message = formatMissingTables(
|
|
@@ -15,6 +10,14 @@ import quoteIdentifier from "./quoteIdentifier.js";
|
|
|
15
10
|
* ["votes", "districts"],
|
|
16
11
|
* );
|
|
17
12
|
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param method - The SDA method looking up the tables.
|
|
15
|
+
*
|
|
16
|
+
* @param missingTables - The requested table names that were not found.
|
|
17
|
+
*
|
|
18
|
+
* @param availableTables - The table names currently available.
|
|
19
|
+
*
|
|
20
|
+
* @returns An actionable missing-table error message.
|
|
18
21
|
*/
|
|
19
22
|
export default function formatMissingTables(method, missingTables, availableTables) {
|
|
20
23
|
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":"
|
|
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"}
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Rounds a number based on specified criteria: a fixed number of decimal places or to a specific number of significant digits.
|
|
3
3
|
*
|
|
4
|
-
* @param number - The number to be rounded.
|
|
5
|
-
* @param options - An object containing options for rounding.
|
|
6
|
-
* @param options.decimals - The number of decimal places to keep when rounding.
|
|
7
|
-
* @param options.significantDigits - The number of significant digits to retain.
|
|
8
|
-
* @returns The rounded number.
|
|
9
|
-
* @throws {Error} If more than one rounding option is provided.
|
|
10
|
-
*
|
|
11
4
|
* @example
|
|
12
5
|
* ```ts
|
|
13
6
|
* // Round to one decimal place.
|
|
14
7
|
* const result = round(1234.567, { decimals: 1 });
|
|
15
8
|
* console.log(result); // 1234.6
|
|
16
9
|
* ```
|
|
10
|
+
*
|
|
17
11
|
* @example
|
|
18
12
|
* ```ts
|
|
19
13
|
* // Round to 3 significant digits.
|
|
20
14
|
* const result = round(0.004622, { significantDigits: 3 });
|
|
21
15
|
* console.log(result); // 0.00462
|
|
22
16
|
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param number - The number to be rounded.
|
|
19
|
+
*
|
|
20
|
+
* @param options - An object containing options for rounding.
|
|
21
|
+
*
|
|
22
|
+
* @param options.decimals - The number of decimal places to keep when rounding.
|
|
23
|
+
*
|
|
24
|
+
* @param options.significantDigits - The number of significant digits to retain.
|
|
25
|
+
*
|
|
26
|
+
* @returns The rounded number.
|
|
27
|
+
*
|
|
28
|
+
* @throws {Error} If more than one rounding option is provided.
|
|
23
29
|
*/
|
|
24
30
|
function round(number, options = {}) {
|
|
25
31
|
if (typeof options.decimals === "number" &&
|
|
@@ -39,40 +45,49 @@ function round(number, options = {}) {
|
|
|
39
45
|
/**
|
|
40
46
|
* Formats a number with thousands separators, decimals, abbreviations, and more.
|
|
41
47
|
*
|
|
42
|
-
* @param number - The number to be formatted.
|
|
43
|
-
* @param options - An object containing various formatting options.
|
|
44
|
-
* @param options.decimals - The number of decimal places to round to.
|
|
45
|
-
* @param options.significantDigits - The number of significant digits to round to.
|
|
46
|
-
* @param options.abbreviation - If `true`, the number will be abbreviated (e.g., 1,200,000 becomes "1.2M").
|
|
47
|
-
* @param options.prefix - A string to prepend before the formatted number.
|
|
48
|
-
* @param options.suffix - A string to append after the formatted number.
|
|
49
|
-
*
|
|
50
|
-
* @returns The formatted number as a string.
|
|
51
|
-
*
|
|
52
48
|
* @example
|
|
53
49
|
* ```ts
|
|
54
50
|
* // Basic usage: Format a number with thousands separator.
|
|
55
51
|
* const num1 = formatNumber(1234567.89);
|
|
56
52
|
* console.log(num1); // "1,234,567.89"
|
|
57
53
|
* ```
|
|
54
|
+
*
|
|
58
55
|
* @example
|
|
59
56
|
* ```ts
|
|
60
57
|
* // With significant digits and suffix.
|
|
61
58
|
* const num2 = formatNumber(66.666, { significantDigits: 3, suffix: "%" });
|
|
62
59
|
* console.log(num2); // "66.7%"
|
|
63
60
|
* ```
|
|
61
|
+
*
|
|
64
62
|
* @example
|
|
65
63
|
* ```ts
|
|
66
64
|
* // Abbreviation.
|
|
67
65
|
* const num3 = formatNumber(12000, { abbreviation: true });
|
|
68
66
|
* console.log(num3); // "12K"
|
|
69
67
|
* ```
|
|
68
|
+
*
|
|
70
69
|
* @example
|
|
71
70
|
* ```ts
|
|
72
71
|
* // With decimal places.
|
|
73
72
|
* const num4 = formatNumber(123.456, { decimals: 1 });
|
|
74
73
|
* console.log(num4); // "123.5"
|
|
75
74
|
* ```
|
|
75
|
+
*
|
|
76
|
+
* @param number - The number to be formatted.
|
|
77
|
+
*
|
|
78
|
+
* @param options - An object containing various formatting options.
|
|
79
|
+
*
|
|
80
|
+
* @param options.decimals - The number of decimal places to round to.
|
|
81
|
+
*
|
|
82
|
+
* @param options.significantDigits - The number of significant digits to round to.
|
|
83
|
+
*
|
|
84
|
+
* @param options.abbreviation - If `true`, the number will be abbreviated (e.g., 1,200,000 becomes "1.2M").
|
|
85
|
+
*
|
|
86
|
+
* @param options.prefix - A string to prepend before the formatted number.
|
|
87
|
+
*
|
|
88
|
+
* @param options.suffix - A string to append after the formatted number.
|
|
89
|
+
*
|
|
90
|
+
* @returns The formatted number as a string.
|
|
76
91
|
*/
|
|
77
92
|
export default function formatNumber(number, options = {}) {
|
|
78
93
|
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,25 @@
|
|
|
1
|
+
import foldIdentifier from "./foldIdentifier.js";
|
|
2
|
+
import getGraphEndpointColumns from "./getGraphEndpointColumns.js";
|
|
3
|
+
import quoteIdentifier from "./quoteIdentifier.js";
|
|
4
|
+
/** Resolves a route edge-ID column and its exact comparison type. */
|
|
5
|
+
export default function getGraphEdgeIdColumn(schema, requestedEdgeId, method) {
|
|
6
|
+
const folded = foldIdentifier(requestedEdgeId);
|
|
7
|
+
const column = Object.keys(schema).find((name) => foldIdentifier(name) === folded);
|
|
8
|
+
if (column === undefined) {
|
|
9
|
+
throw new Error(`${method} the column ${quoteIdentifier(requestedEdgeId)} does not exist. Check for typos, or load the data first.`);
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
const resolved = getGraphEndpointColumns({ [column]: schema[column] }, column, column, method);
|
|
13
|
+
return {
|
|
14
|
+
column,
|
|
15
|
+
family: resolved.family,
|
|
16
|
+
idType: resolved.idType,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (error instanceof TypeError) {
|
|
21
|
+
throw new TypeError(`${method} requires string or whole-number edge IDs, but column ${quoteIdentifier(column)} has type ${schema[column]}.`);
|
|
22
|
+
}
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -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,160 @@
|
|
|
1
|
+
import foldIdentifier from "./foldIdentifier.js";
|
|
2
|
+
import quoteIdentifier from "./quoteIdentifier.js";
|
|
3
|
+
const integerTypes = {
|
|
4
|
+
TINYINT: { signed: true, bits: 8, digits: 3 },
|
|
5
|
+
SMALLINT: { signed: true, bits: 16, digits: 5 },
|
|
6
|
+
INTEGER: { signed: true, bits: 32, digits: 10 },
|
|
7
|
+
BIGINT: { signed: true, bits: 64, digits: 19 },
|
|
8
|
+
HUGEINT: { signed: true, bits: 128, digits: 39 },
|
|
9
|
+
UTINYINT: { signed: false, bits: 8, digits: 3 },
|
|
10
|
+
USMALLINT: { signed: false, bits: 16, digits: 5 },
|
|
11
|
+
UINTEGER: { signed: false, bits: 32, digits: 10 },
|
|
12
|
+
UBIGINT: { signed: false, bits: 64, digits: 20 },
|
|
13
|
+
UHUGEINT: { signed: false, bits: 128, digits: 39 },
|
|
14
|
+
};
|
|
15
|
+
/** Resolves and validates a graph's endpoint columns from an existing schema. */
|
|
16
|
+
export default function getGraphEndpointColumns(schema, requestedSource, requestedTarget, method) {
|
|
17
|
+
const source = findColumn(schema, requestedSource);
|
|
18
|
+
const target = findColumn(schema, requestedTarget);
|
|
19
|
+
const missing = [
|
|
20
|
+
source === undefined ? requestedSource : undefined,
|
|
21
|
+
target === undefined ? requestedTarget : undefined,
|
|
22
|
+
].filter((column) => column !== undefined);
|
|
23
|
+
if (missing.length > 0) {
|
|
24
|
+
const plural = missing.length > 1;
|
|
25
|
+
throw new Error(`${method} the column${plural ? "s" : ""} ${missing.map(quoteIdentifier).join(", ")} ${plural ? "do" : "does"} not exist. Check for typos, or load the data first.`);
|
|
26
|
+
}
|
|
27
|
+
const sourceType = normalizeType(schema[source]);
|
|
28
|
+
const targetType = normalizeType(schema[target]);
|
|
29
|
+
const sourceKind = typeKind(sourceType);
|
|
30
|
+
const targetKind = typeKind(targetType);
|
|
31
|
+
if (sourceKind === undefined || targetKind === undefined) {
|
|
32
|
+
const unsupported = sourceKind === undefined
|
|
33
|
+
? { column: source, type: sourceType }
|
|
34
|
+
: { column: target, type: targetType };
|
|
35
|
+
throw new TypeError(`${method} requires string or numeric endpoint IDs, but column ${quoteIdentifier(unsupported.column)} has type ${unsupported.type}.`);
|
|
36
|
+
}
|
|
37
|
+
if (sourceKind.family !== targetKind.family) {
|
|
38
|
+
throw new TypeError(`${method} requires compatible source and target ID types, but ${quoteIdentifier(source)} has type ${sourceType} and ${quoteIdentifier(target)} has type ${targetType}.`);
|
|
39
|
+
}
|
|
40
|
+
if (sourceKind.family === "string") {
|
|
41
|
+
return {
|
|
42
|
+
source: source,
|
|
43
|
+
target: target,
|
|
44
|
+
idType: "VARCHAR",
|
|
45
|
+
family: "string",
|
|
46
|
+
floating: false,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const idType = compatibleNumericType(sourceType, targetType);
|
|
50
|
+
if (idType === undefined) {
|
|
51
|
+
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.`);
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
source: source,
|
|
55
|
+
target: target,
|
|
56
|
+
idType,
|
|
57
|
+
family: "numeric",
|
|
58
|
+
floating: isFloating(sourceType) || isFloating(targetType),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function findColumn(schema, requested) {
|
|
62
|
+
const folded = foldIdentifier(requested);
|
|
63
|
+
return Object.keys(schema).find((column) => foldIdentifier(column) === folded);
|
|
64
|
+
}
|
|
65
|
+
function normalizeType(type) {
|
|
66
|
+
return type.toUpperCase().replace(/^REAL$/, "FLOAT");
|
|
67
|
+
}
|
|
68
|
+
function typeKind(type) {
|
|
69
|
+
if (type === "VARCHAR")
|
|
70
|
+
return { family: "string" };
|
|
71
|
+
if (integerTypes[type] !== undefined || isDecimal(type) || isFloating(type) ||
|
|
72
|
+
type === "BIGNUM") {
|
|
73
|
+
return { family: "numeric" };
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
function compatibleNumericType(left, right) {
|
|
78
|
+
if (left === right)
|
|
79
|
+
return left;
|
|
80
|
+
if (isFloating(left) || isFloating(right)) {
|
|
81
|
+
return isFloating(left) && isFloating(right) ? "DOUBLE" : undefined;
|
|
82
|
+
}
|
|
83
|
+
if (left === "BIGNUM" || right === "BIGNUM") {
|
|
84
|
+
const other = left === "BIGNUM" ? right : left;
|
|
85
|
+
return integerTypes[other] !== undefined || decimalScale(other) === 0
|
|
86
|
+
? "BIGNUM"
|
|
87
|
+
: undefined;
|
|
88
|
+
}
|
|
89
|
+
const leftInteger = integerTypes[left];
|
|
90
|
+
const rightInteger = integerTypes[right];
|
|
91
|
+
if (leftInteger !== undefined && rightInteger !== undefined) {
|
|
92
|
+
return commonIntegerType(leftInteger, rightInteger);
|
|
93
|
+
}
|
|
94
|
+
const leftDecimal = parseDecimal(left);
|
|
95
|
+
const rightDecimal = parseDecimal(right);
|
|
96
|
+
if (leftDecimal === undefined && rightDecimal === undefined)
|
|
97
|
+
return undefined;
|
|
98
|
+
const scale = Math.max(leftDecimal?.scale ?? 0, rightDecimal?.scale ?? 0);
|
|
99
|
+
const integerDigits = Math.max(leftDecimal === undefined
|
|
100
|
+
? leftInteger.digits
|
|
101
|
+
: leftDecimal.precision - leftDecimal.scale, rightDecimal === undefined
|
|
102
|
+
? rightInteger.digits
|
|
103
|
+
: rightDecimal.precision - rightDecimal.scale);
|
|
104
|
+
const precision = integerDigits + scale;
|
|
105
|
+
return precision <= 38 ? `DECIMAL(${precision},${scale})` : undefined;
|
|
106
|
+
}
|
|
107
|
+
function commonIntegerType(left, right) {
|
|
108
|
+
if (left.signed === right.signed) {
|
|
109
|
+
const bits = Math.max(left.bits, right.bits);
|
|
110
|
+
return integerTypeName(left.signed, bits);
|
|
111
|
+
}
|
|
112
|
+
const signed = left.signed ? left : right;
|
|
113
|
+
const unsigned = left.signed ? right : left;
|
|
114
|
+
const requiredBits = Math.max(signed.bits, nextBits(unsigned.bits));
|
|
115
|
+
return requiredBits > 128 ? undefined : integerTypeName(true, requiredBits);
|
|
116
|
+
}
|
|
117
|
+
function nextBits(bits) {
|
|
118
|
+
if (bits <= 8)
|
|
119
|
+
return 16;
|
|
120
|
+
if (bits <= 16)
|
|
121
|
+
return 32;
|
|
122
|
+
if (bits <= 32)
|
|
123
|
+
return 64;
|
|
124
|
+
if (bits <= 64)
|
|
125
|
+
return 128;
|
|
126
|
+
return 256;
|
|
127
|
+
}
|
|
128
|
+
function integerTypeName(signed, bits) {
|
|
129
|
+
const names = signed
|
|
130
|
+
? {
|
|
131
|
+
8: "TINYINT",
|
|
132
|
+
16: "SMALLINT",
|
|
133
|
+
32: "INTEGER",
|
|
134
|
+
64: "BIGINT",
|
|
135
|
+
128: "HUGEINT",
|
|
136
|
+
}
|
|
137
|
+
: {
|
|
138
|
+
8: "UTINYINT",
|
|
139
|
+
16: "USMALLINT",
|
|
140
|
+
32: "UINTEGER",
|
|
141
|
+
64: "UBIGINT",
|
|
142
|
+
128: "UHUGEINT",
|
|
143
|
+
};
|
|
144
|
+
return names[bits];
|
|
145
|
+
}
|
|
146
|
+
function isFloating(type) {
|
|
147
|
+
return type === "FLOAT" || type === "DOUBLE";
|
|
148
|
+
}
|
|
149
|
+
function isDecimal(type) {
|
|
150
|
+
return /^DECIMAL\(\d+,\d+\)$/.test(type);
|
|
151
|
+
}
|
|
152
|
+
function parseDecimal(type) {
|
|
153
|
+
const match = /^DECIMAL\((\d+),(\d+)\)$/.exec(type);
|
|
154
|
+
return match === null
|
|
155
|
+
? undefined
|
|
156
|
+
: { precision: Number(match[1]), scale: Number(match[2]) };
|
|
157
|
+
}
|
|
158
|
+
function decimalScale(type) {
|
|
159
|
+
return parseDecimal(type)?.scale;
|
|
160
|
+
}
|
|
@@ -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,40 @@
|
|
|
1
|
+
import foldIdentifier from "./foldIdentifier.js";
|
|
2
|
+
import quoteIdentifier from "./quoteIdentifier.js";
|
|
3
|
+
const integerTypes = new Set([
|
|
4
|
+
"TINYINT",
|
|
5
|
+
"SMALLINT",
|
|
6
|
+
"INTEGER",
|
|
7
|
+
"BIGINT",
|
|
8
|
+
"UTINYINT",
|
|
9
|
+
"USMALLINT",
|
|
10
|
+
"UINTEGER",
|
|
11
|
+
"UBIGINT",
|
|
12
|
+
]);
|
|
13
|
+
const wideIntegerTypes = new Set(["HUGEINT", "UHUGEINT", "BIGNUM"]);
|
|
14
|
+
/** Resolves a numeric graph weight and a precision-preserving sum type. */
|
|
15
|
+
export default function getGraphWeightColumn(schema, requestedWeight, method) {
|
|
16
|
+
const folded = foldIdentifier(requestedWeight);
|
|
17
|
+
const column = Object.keys(schema).find((name) => foldIdentifier(name) === folded);
|
|
18
|
+
if (column === undefined) {
|
|
19
|
+
throw new Error(`${method} the column ${quoteIdentifier(requestedWeight)} does not exist. Check for typos, or load the data first.`);
|
|
20
|
+
}
|
|
21
|
+
const type = schema[column].toUpperCase().replace(/^REAL$/, "FLOAT");
|
|
22
|
+
if (integerTypes.has(type)) {
|
|
23
|
+
return { column, type, distanceType: "HUGEINT" };
|
|
24
|
+
}
|
|
25
|
+
if (wideIntegerTypes.has(type)) {
|
|
26
|
+
return { column, type, distanceType: "BIGNUM" };
|
|
27
|
+
}
|
|
28
|
+
if (type === "FLOAT" || type === "DOUBLE") {
|
|
29
|
+
return { column, type, distanceType: type };
|
|
30
|
+
}
|
|
31
|
+
const decimal = /^DECIMAL\((\d+),(\d+)\)$/.exec(type);
|
|
32
|
+
if (decimal !== null) {
|
|
33
|
+
return {
|
|
34
|
+
column,
|
|
35
|
+
type,
|
|
36
|
+
distanceType: `DECIMAL(38,${Number(decimal[2])})`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
throw new TypeError(`${method} requires a numeric weight column, but column ${quoteIdentifier(column)} has type ${type}.`);
|
|
40
|
+
}
|
|
@@ -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,12 @@
|
|
|
1
|
+
import validateGraphRouteResultSchema from "./validateGraphRouteResultSchema.js";
|
|
2
|
+
/** Derives the route result schema while preserving input columns and types. */
|
|
3
|
+
export default function graphRouteResultSchema(schema, distanceType, method) {
|
|
4
|
+
validateGraphRouteResultSchema(schema, method);
|
|
5
|
+
return {
|
|
6
|
+
pathId: "BIGINT",
|
|
7
|
+
step: "BIGINT",
|
|
8
|
+
weight: distanceType,
|
|
9
|
+
total: distanceType,
|
|
10
|
+
...schema,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GraphEdgeIdColumn } from "./getGraphEdgeIdColumn.js";
|
|
2
|
+
/** Joins ranked route steps to their original input rows for final output. */
|
|
3
|
+
export default function graphRouteResultSelect(rankedRelation: string, input: string, edgeIdColumn: GraphEdgeIdColumn, includeStart?: boolean): string;
|
|
4
|
+
//# sourceMappingURL=graphRouteResultSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphRouteResultSelect.d.ts","sourceRoot":"","sources":["../../src/helpers/graphRouteResultSelect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,8EAA8E;AAC9E,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,iBAAiB,EAC/B,YAAY,UAAQ,GACnB,MAAM,CAyBR"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import quoteIdentifier from "./quoteIdentifier.js";
|
|
2
|
+
/** Joins ranked route steps to their original input rows for final output. */
|
|
3
|
+
export default function graphRouteResultSelect(rankedRelation, input, edgeIdColumn, includeStart = false) {
|
|
4
|
+
const q = quoteIdentifier;
|
|
5
|
+
const routeStep = `${q("unnested")}.${q("route_step")}`;
|
|
6
|
+
const originalEdgeId = `${q("original")}.${q(edgeIdColumn.column)}`;
|
|
7
|
+
const edgeMatch = edgeIdColumn.family === "string"
|
|
8
|
+
? `ENCODE(CAST(${originalEdgeId} AS VARCHAR)) =
|
|
9
|
+
ENCODE(${routeStep}.${q("edgeId")})`
|
|
10
|
+
: `CAST(${originalEdgeId} AS ${edgeIdColumn.idType}) =
|
|
11
|
+
${routeStep}.${q("edgeId")}`;
|
|
12
|
+
return `SELECT ${includeStart ? `${q("ranked")}.${q("start")},\n ` : ""}${q("ranked")}.${q("pathId")},
|
|
13
|
+
CAST(${q("unnested")}.${q("step")} AS BIGINT) AS ${q("step")},
|
|
14
|
+
${routeStep}.${q("weight")} AS ${q("weight")},
|
|
15
|
+
${routeStep}.${q("distance")} AS ${q("total")},
|
|
16
|
+
${q("original")}.*
|
|
17
|
+
FROM ${rankedRelation} AS ${q("ranked")},
|
|
18
|
+
UNNEST(${q("ranked")}.${q("steps")}) WITH ORDINALITY AS ${q("unnested")}(${q("route_step")}, ${q("step")})
|
|
19
|
+
INNER JOIN ${input} AS ${q("original")}
|
|
20
|
+
ON ${edgeMatch}
|
|
21
|
+
ORDER BY ${includeStart ? `${q("ranked")}.${q("__start_key")}, ` : ""}${q("ranked")}.${q("pathId")}, ${q("unnested")}.${q("step")}`;
|
|
22
|
+
}
|
|
@@ -5,9 +5,6 @@ import type SimpleTable from "../class/SimpleTable.js";
|
|
|
5
5
|
* Uses `getTypes()` to inspect column types and checks for any column
|
|
6
6
|
* whose type normalizes to `"geometry"`.
|
|
7
7
|
*
|
|
8
|
-
* @param table - The SimpleTable instance to inspect.
|
|
9
|
-
* @returns `true` if at least one geometry column exists, `false` otherwise.
|
|
10
|
-
*
|
|
11
8
|
* @example
|
|
12
9
|
* ```ts
|
|
13
10
|
* const hasGeo = await hasGeometryColumn(table);
|
|
@@ -15,6 +12,10 @@ import type SimpleTable from "../class/SimpleTable.js";
|
|
|
15
12
|
* console.log("This table contains geometry columns");
|
|
16
13
|
* }
|
|
17
14
|
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param table - The SimpleTable instance to inspect.
|
|
17
|
+
*
|
|
18
|
+
* @returns `true` if at least one geometry column exists, `false` otherwise.
|
|
18
19
|
*/
|
|
19
20
|
export default function hasGeometryColumn(table: SimpleTable): Promise<boolean>;
|
|
20
21
|
//# sourceMappingURL=hasGeometryColumn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasGeometryColumn.d.ts","sourceRoot":"","sources":["../../src/helpers/hasGeometryColumn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"hasGeometryColumn.d.ts","sourceRoot":"","sources":["../../src/helpers/hasGeometryColumn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAEvD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAA8B,iBAAiB,CAC7C,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,OAAO,CAAC,CAGlB"}
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
* Uses `getTypes()` to inspect column types and checks for any column
|
|
5
5
|
* whose type normalizes to `"geometry"`.
|
|
6
6
|
*
|
|
7
|
-
* @param table - The SimpleTable instance to inspect.
|
|
8
|
-
* @returns `true` if at least one geometry column exists, `false` otherwise.
|
|
9
|
-
*
|
|
10
7
|
* @example
|
|
11
8
|
* ```ts
|
|
12
9
|
* const hasGeo = await hasGeometryColumn(table);
|
|
@@ -14,6 +11,10 @@
|
|
|
14
11
|
* console.log("This table contains geometry columns");
|
|
15
12
|
* }
|
|
16
13
|
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param table - The SimpleTable instance to inspect.
|
|
16
|
+
*
|
|
17
|
+
* @returns `true` if at least one geometry column exists, `false` otherwise.
|
|
17
18
|
*/
|
|
18
19
|
export default async function hasGeometryColumn(table) {
|
|
19
20
|
const types = await table.getTypes();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DuckDBConnection } from "@duckdb/node-api";
|
|
2
|
+
/**
|
|
3
|
+
* Inspect connectivity of an edge relation while transferring ids, not vectors.
|
|
4
|
+
* Isolated vertices count as one-point components. Invalid ids fail closed.
|
|
5
|
+
*/
|
|
6
|
+
export default function inspectGraphConnectivity(connection: DuckDBConnection, edges: string, vertexCount: number): Promise<{
|
|
7
|
+
componentCount: number;
|
|
8
|
+
sizes: number[];
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=inspectGraphConnectivity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspectGraphConnectivity.d.ts","sourceRoot":"","sources":["../../src/helpers/inspectGraphConnectivity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;GAGG;AACH,wBAA8B,wBAAwB,CACpD,UAAU,EAAE,gBAAgB,EAC5B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAoDtD"}
|