@nshiab/simple-data-analysis-core 2.0.8 → 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.
- 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 +2805 -1077
- package/esm/class/SimpleTable.d.ts.map +1 -1
- package/esm/class/SimpleTable.js +2777 -1077
- package/esm/helpers/appendColumnBatches.d.ts +3 -0
- package/esm/helpers/appendColumnBatches.d.ts.map +1 -0
- package/esm/helpers/appendColumnBatches.js +21 -0
- 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 +21 -0
- package/esm/helpers/buildUmapGraph.d.ts.map +1 -0
- package/esm/helpers/buildUmapGraph.js +61 -0
- 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/cacheDatabase.d.ts.map +1 -1
- package/esm/helpers/cacheDatabase.js +2 -1
- 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/fitUmapCurve.d.ts +2 -0
- package/esm/helpers/fitUmapCurve.d.ts.map +1 -0
- package/esm/helpers/fitUmapCurve.js +66 -0
- 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/initialUmapCoordinates.d.ts +2 -0
- package/esm/helpers/initialUmapCoordinates.d.ts.map +1 -0
- package/esm/helpers/initialUmapCoordinates.js +5 -0
- 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/optimizeUmapLayout.d.ts +7 -0
- package/esm/helpers/optimizeUmapLayout.d.ts.map +1 -0
- package/esm/helpers/optimizeUmapLayout.js +93 -0
- 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/prepareUmapLayoutOptions.d.ts +14 -0
- package/esm/helpers/prepareUmapLayoutOptions.d.ts.map +1 -0
- package/esm/helpers/prepareUmapLayoutOptions.js +23 -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/readScalarNumber.d.ts +3 -0
- package/esm/helpers/readScalarNumber.d.ts.map +1 -0
- package/esm/helpers/readScalarNumber.js +4 -0
- 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/umapRandom.d.ts +2 -0
- package/esm/helpers/umapRandom.d.ts.map +1 -0
- package/esm/helpers/umapRandom.js +10 -0
- 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/cache.js +1 -1
- 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/loadArray.d.ts.map +1 -1
- package/esm/methods/loadArray.js +3 -20
- 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/umap.d.ts +5 -0
- package/esm/methods/umap.d.ts.map +1 -0
- package/esm/methods/umap.js +156 -0
- package/esm/methods/updateWithJS.js +9 -21
- package/llm.md +2170 -128
- 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 +2805 -1077
- package/script/class/SimpleTable.d.ts.map +1 -1
- package/script/class/SimpleTable.js +2777 -1077
- package/script/helpers/appendColumnBatches.d.ts +3 -0
- package/script/helpers/appendColumnBatches.d.ts.map +1 -0
- package/script/helpers/appendColumnBatches.js +24 -0
- 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 +21 -0
- package/script/helpers/buildUmapGraph.d.ts.map +1 -0
- package/script/helpers/buildUmapGraph.js +67 -0
- 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/cacheDatabase.d.ts.map +1 -1
- package/script/helpers/cacheDatabase.js +2 -1
- 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/fitUmapCurve.d.ts +2 -0
- package/script/helpers/fitUmapCurve.d.ts.map +1 -0
- package/script/helpers/fitUmapCurve.js +69 -0
- 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/initialUmapCoordinates.d.ts +2 -0
- package/script/helpers/initialUmapCoordinates.d.ts.map +1 -0
- package/script/helpers/initialUmapCoordinates.js +11 -0
- 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/optimizeUmapLayout.d.ts +7 -0
- package/script/helpers/optimizeUmapLayout.d.ts.map +1 -0
- package/script/helpers/optimizeUmapLayout.js +99 -0
- 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/prepareUmapLayoutOptions.d.ts +14 -0
- package/script/helpers/prepareUmapLayoutOptions.d.ts.map +1 -0
- package/script/helpers/prepareUmapLayoutOptions.js +29 -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/readScalarNumber.d.ts +3 -0
- package/script/helpers/readScalarNumber.d.ts.map +1 -0
- package/script/helpers/readScalarNumber.js +7 -0
- 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/umapRandom.d.ts +2 -0
- package/script/helpers/umapRandom.d.ts.map +1 -0
- package/script/helpers/umapRandom.js +13 -0
- 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/cache.js +1 -1
- 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/loadArray.d.ts.map +1 -1
- package/script/methods/loadArray.js +2 -19
- 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/umap.d.ts +5 -0
- package/script/methods/umap.d.ts.map +1 -0
- package/script/methods/umap.js +162 -0
- package/script/methods/updateWithJS.js +9 -21
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
* Use this for library-generated table, column, schema, database, and alias
|
|
4
4
|
* names. User-authored SQL expressions must remain unmodified.
|
|
5
5
|
*
|
|
6
|
-
* @param identifier - The identifier to quote.
|
|
7
|
-
* @returns The identifier wrapped in double quotes with embedded quotes doubled.
|
|
8
|
-
*
|
|
9
6
|
* @example
|
|
10
7
|
* ```ts
|
|
11
8
|
* quoteIdentifier('people "archive"');
|
|
12
9
|
* // '"people ""archive"""'
|
|
13
10
|
* ```
|
|
11
|
+
*
|
|
12
|
+
* @param identifier - The identifier to quote.
|
|
13
|
+
*
|
|
14
|
+
* @returns The identifier wrapped in double quotes with embedded quotes doubled.
|
|
14
15
|
*/
|
|
15
16
|
export default function quoteIdentifier(identifier: string): string;
|
|
16
17
|
//# sourceMappingURL=quoteIdentifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quoteIdentifier.d.ts","sourceRoot":"","sources":["../../src/helpers/quoteIdentifier.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"quoteIdentifier.d.ts","sourceRoot":"","sources":["../../src/helpers/quoteIdentifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAElE"}
|
|
@@ -6,14 +6,15 @@ exports.default = quoteIdentifier;
|
|
|
6
6
|
* Use this for library-generated table, column, schema, database, and alias
|
|
7
7
|
* names. User-authored SQL expressions must remain unmodified.
|
|
8
8
|
*
|
|
9
|
-
* @param identifier - The identifier to quote.
|
|
10
|
-
* @returns The identifier wrapped in double quotes with embedded quotes doubled.
|
|
11
|
-
*
|
|
12
9
|
* @example
|
|
13
10
|
* ```ts
|
|
14
11
|
* quoteIdentifier('people "archive"');
|
|
15
12
|
* // '"people ""archive"""'
|
|
16
13
|
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param identifier - The identifier to quote.
|
|
16
|
+
*
|
|
17
|
+
* @returns The identifier wrapped in double quotes with embedded quotes doubled.
|
|
17
18
|
*/
|
|
18
19
|
function quoteIdentifier(identifier) {
|
|
19
20
|
return `"${identifier.replaceAll('"', '""')}"`;
|
|
@@ -4,15 +4,17 @@
|
|
|
4
4
|
* Qualifying column references prevents DuckDB from resolving a relation name
|
|
5
5
|
* as its row struct when a missing column has the same name as the relation.
|
|
6
6
|
*
|
|
7
|
-
* @param relation - The table or relation containing the identifier.
|
|
8
|
-
* @param identifier - The identifier to qualify.
|
|
9
|
-
* @returns The separately quoted relation and identifier joined by a period.
|
|
10
|
-
*
|
|
11
7
|
* @example
|
|
12
8
|
* ```ts
|
|
13
9
|
* quoteQualifiedIdentifier("people", "full name");
|
|
14
10
|
* // '"people"."full name"'
|
|
15
11
|
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param relation - The table or relation containing the identifier.
|
|
14
|
+
*
|
|
15
|
+
* @param identifier - The identifier to qualify.
|
|
16
|
+
*
|
|
17
|
+
* @returns The separately quoted relation and identifier joined by a period.
|
|
16
18
|
*/
|
|
17
19
|
export default function quoteQualifiedIdentifier(relation: string, identifier: string): string;
|
|
18
20
|
//# sourceMappingURL=quoteQualifiedIdentifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quoteQualifiedIdentifier.d.ts","sourceRoot":"","sources":["../../src/helpers/quoteQualifiedIdentifier.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"quoteQualifiedIdentifier.d.ts","sourceRoot":"","sources":["../../src/helpers/quoteQualifiedIdentifier.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER"}
|
|
@@ -11,15 +11,17 @@ const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
|
|
|
11
11
|
* Qualifying column references prevents DuckDB from resolving a relation name
|
|
12
12
|
* as its row struct when a missing column has the same name as the relation.
|
|
13
13
|
*
|
|
14
|
-
* @param relation - The table or relation containing the identifier.
|
|
15
|
-
* @param identifier - The identifier to qualify.
|
|
16
|
-
* @returns The separately quoted relation and identifier joined by a period.
|
|
17
|
-
*
|
|
18
14
|
* @example
|
|
19
15
|
* ```ts
|
|
20
16
|
* quoteQualifiedIdentifier("people", "full name");
|
|
21
17
|
* // '"people"."full name"'
|
|
22
18
|
* ```
|
|
19
|
+
*
|
|
20
|
+
* @param relation - The table or relation containing the identifier.
|
|
21
|
+
*
|
|
22
|
+
* @param identifier - The identifier to qualify.
|
|
23
|
+
*
|
|
24
|
+
* @returns The separately quoted relation and identifier joined by a period.
|
|
23
25
|
*/
|
|
24
26
|
function quoteQualifiedIdentifier(relation, identifier) {
|
|
25
27
|
return `${(0, quoteIdentifier_js_1.default)(relation)}.${(0, quoteIdentifier_js_1.default)(identifier)}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readScalarNumber.d.ts","sourceRoot":"","sources":["../../src/helpers/readScalarNumber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,wBAA8B,gBAAgB,CAC5C,UAAU,EAAE,gBAAgB,EAC5B,GAAG,EAAE,MAAM,mBAGZ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = readScalarNumber;
|
|
4
|
+
// For internal queries returning a single numeric value, such as row counts.
|
|
5
|
+
async function readScalarNumber(connection, sql) {
|
|
6
|
+
return Number((await connection.runAndReadAll(sql)).getRowsJS()[0][0]);
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runQuery.d.ts","sourceRoot":"","sources":["../../src/helpers/runQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,gBAAgB,EAIrB,KAAK,UAAU,EAEf,KAAK,WAAW,EAIjB,MAAM,kBAAkB,CAAC;AAI1B,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AA8CF,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAM,GAAG,IAAW,GAC9B,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAoCjC;AAED,wBAA8B,QAAQ,CACpC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,gBAAgB,EAC5B,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,eAAe,GACvB,OAAO,CACN;IACA,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,EAAE,GACD,IAAI,CACP,
|
|
1
|
+
{"version":3,"file":"runQuery.d.ts","sourceRoot":"","sources":["../../src/helpers/runQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,gBAAgB,EAIrB,KAAK,UAAU,EAEf,KAAK,WAAW,EAIjB,MAAM,kBAAkB,CAAC;AAI1B,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AA8CF,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAM,GAAG,IAAW,GAC9B,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAoCjC;AAED,wBAA8B,QAAQ,CACpC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,gBAAgB,EAC5B,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,eAAe,GACvB,OAAO,CACN;IACA,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,EAAE,GACD,IAAI,CACP,CAiFA"}
|
|
@@ -106,9 +106,23 @@ async function runQuery(query, connection, returnData, options) {
|
|
|
106
106
|
for (let j = 0; j < columnCount; j++) {
|
|
107
107
|
const columnName = columnNames[j];
|
|
108
108
|
const converter = converters[j];
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
if (columnName === "__proto__") {
|
|
110
|
+
// This valid SQL identifier must define data, not invoke Node's
|
|
111
|
+
// legacy Object.prototype setter. Keep ordinary columns fast.
|
|
112
|
+
chunk.visitColumnValues(j, (value, rowIndex) => {
|
|
113
|
+
Object.defineProperty(rows[base + rowIndex], columnName, {
|
|
114
|
+
value: converter(value),
|
|
115
|
+
enumerable: true,
|
|
116
|
+
configurable: true,
|
|
117
|
+
writable: true,
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
chunk.visitColumnValues(j, (value, rowIndex) => {
|
|
123
|
+
rows[base + rowIndex][columnName] = converter(value);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
112
126
|
}
|
|
113
127
|
}
|
|
114
128
|
return rows;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type FuzzyPair = {
|
|
2
|
+
left_value: string;
|
|
3
|
+
right_value: string;
|
|
4
|
+
left_cnt: number;
|
|
5
|
+
right_cnt: number;
|
|
6
|
+
score: number;
|
|
7
|
+
};
|
|
8
|
+
export type FuzzyStrategy = "mostCommon" | "longestString" | "shortestString" | "mostCentral" | "maxScore";
|
|
9
|
+
/** Groups matching values transitively and chooses each component's canonical value. */
|
|
10
|
+
export default function selectFuzzyReplacements(pairs: FuzzyPair[], strategy: FuzzyStrategy): Map<string, string>;
|
|
11
|
+
//# sourceMappingURL=selectFuzzyReplacements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectFuzzyReplacements.d.ts","sourceRoot":"","sources":["../../src/helpers/selectFuzzyReplacements.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,UAAU,CAAC;AAEf,wFAAwF;AACxF,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,KAAK,EAAE,SAAS,EAAE,EAClB,QAAQ,EAAE,aAAa,GACtB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA8HrB"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = selectFuzzyReplacements;
|
|
4
|
+
/** Groups matching values transitively and chooses each component's canonical value. */
|
|
5
|
+
function selectFuzzyReplacements(pairs, strategy) {
|
|
6
|
+
// Build count map from the pairs — no separate query needed.
|
|
7
|
+
const countMap = new Map();
|
|
8
|
+
for (const { left_value, left_cnt, right_value, right_cnt } of pairs) {
|
|
9
|
+
countMap.set(left_value, Number(left_cnt));
|
|
10
|
+
countMap.set(right_value, Number(right_cnt));
|
|
11
|
+
}
|
|
12
|
+
// Union-Find — only over values that actually participate in a pair.
|
|
13
|
+
const parent = new Map();
|
|
14
|
+
const find = (x) => {
|
|
15
|
+
if (!parent.has(x))
|
|
16
|
+
parent.set(x, x);
|
|
17
|
+
if (parent.get(x) !== x)
|
|
18
|
+
parent.set(x, find(parent.get(x)));
|
|
19
|
+
return parent.get(x);
|
|
20
|
+
};
|
|
21
|
+
const union = (a, b) => {
|
|
22
|
+
const ra = find(a);
|
|
23
|
+
const rb = find(b);
|
|
24
|
+
if (ra !== rb)
|
|
25
|
+
parent.set(ra, rb);
|
|
26
|
+
};
|
|
27
|
+
for (const v of countMap.keys())
|
|
28
|
+
find(v);
|
|
29
|
+
for (const { left_value, right_value } of pairs) {
|
|
30
|
+
union(left_value, right_value);
|
|
31
|
+
}
|
|
32
|
+
// Group values by their cluster root.
|
|
33
|
+
const clusters = new Map();
|
|
34
|
+
for (const v of countMap.keys()) {
|
|
35
|
+
const root = find(v);
|
|
36
|
+
if (!clusters.has(root))
|
|
37
|
+
clusters.set(root, []);
|
|
38
|
+
clusters.get(root).push(v);
|
|
39
|
+
}
|
|
40
|
+
// Pick the canonical value for each cluster.
|
|
41
|
+
const replacement = new Map();
|
|
42
|
+
// Every pair belongs to exactly one component. Accumulate scores globally,
|
|
43
|
+
// at most once, instead of scanning all pairs separately for each cluster.
|
|
44
|
+
// Keep this lazy: distinct counts/lengths can choose a winner without scores.
|
|
45
|
+
// Iterating in the original pair order also preserves floating-point ties.
|
|
46
|
+
let scoreSum = null;
|
|
47
|
+
const getScoreSum = () => {
|
|
48
|
+
if (scoreSum === null) {
|
|
49
|
+
scoreSum = new Map();
|
|
50
|
+
for (const { left_value, right_value, score } of pairs) {
|
|
51
|
+
scoreSum.set(left_value, (scoreSum.get(left_value) ?? 0) + score);
|
|
52
|
+
scoreSum.set(right_value, (scoreSum.get(right_value) ?? 0) + score);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return scoreSum;
|
|
56
|
+
};
|
|
57
|
+
let scoreMax = null;
|
|
58
|
+
const getScoreMax = () => {
|
|
59
|
+
if (scoreMax === null) {
|
|
60
|
+
scoreMax = new Map();
|
|
61
|
+
for (const { left_value, right_value, score } of pairs) {
|
|
62
|
+
scoreMax.set(left_value, Math.max(scoreMax.get(left_value) ?? 0, score));
|
|
63
|
+
scoreMax.set(right_value, Math.max(scoreMax.get(right_value) ?? 0, score));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return scoreMax;
|
|
67
|
+
};
|
|
68
|
+
for (const members of clusters.values()) {
|
|
69
|
+
if (members.length === 1)
|
|
70
|
+
continue;
|
|
71
|
+
// Sum-based comparator: highest total similarity, then alphabetical.
|
|
72
|
+
const byScore = (a, b) => {
|
|
73
|
+
const sum = getScoreSum();
|
|
74
|
+
const sa = sum.get(a) ?? 0;
|
|
75
|
+
const sb = sum.get(b) ?? 0;
|
|
76
|
+
if (sa !== sb)
|
|
77
|
+
return sa > sb ? a : b;
|
|
78
|
+
return a <= b ? a : b; // alphabetical tie-break
|
|
79
|
+
};
|
|
80
|
+
// Max-based comparator: highest single-pair score, then sum, then alphabetical.
|
|
81
|
+
const byMaxScore = (a, b) => {
|
|
82
|
+
const mx = getScoreMax();
|
|
83
|
+
const ma = mx.get(a) ?? 0;
|
|
84
|
+
const mb = mx.get(b) ?? 0;
|
|
85
|
+
if (ma !== mb)
|
|
86
|
+
return ma > mb ? a : b;
|
|
87
|
+
return byScore(a, b); // sum then alphabetical tie-break
|
|
88
|
+
};
|
|
89
|
+
let canonical;
|
|
90
|
+
if (strategy === "longestString") {
|
|
91
|
+
canonical = members.reduce((a, b) => {
|
|
92
|
+
if (a.length !== b.length)
|
|
93
|
+
return a.length > b.length ? a : b;
|
|
94
|
+
return byScore(a, b);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
else if (strategy === "shortestString") {
|
|
98
|
+
canonical = members.reduce((a, b) => {
|
|
99
|
+
if (a.length !== b.length)
|
|
100
|
+
return a.length < b.length ? a : b;
|
|
101
|
+
return byScore(a, b);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
else if (strategy === "mostCommon") {
|
|
105
|
+
canonical = members.reduce((a, b) => {
|
|
106
|
+
const ca = countMap.get(a) ?? 0;
|
|
107
|
+
const cb = countMap.get(b) ?? 0;
|
|
108
|
+
if (ca !== cb)
|
|
109
|
+
return ca > cb ? a : b;
|
|
110
|
+
return byScore(a, b);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
else if (strategy === "mostCentral") {
|
|
114
|
+
// Most central string — highest total similarity to all other cluster members.
|
|
115
|
+
canonical = members.reduce((a, b) => byScore(a, b));
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// "maxScore": the string participating in the single highest-scoring pair.
|
|
119
|
+
canonical = members.reduce((a, b) => byMaxScore(a, b));
|
|
120
|
+
}
|
|
121
|
+
for (const m of members) {
|
|
122
|
+
if (m !== canonical)
|
|
123
|
+
replacement.set(m, canonical);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return replacement;
|
|
127
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DuckDBConnection } from "@duckdb/node-api";
|
|
2
|
+
/**
|
|
3
|
+
* Stabilizes cosine arithmetic in a caller-owned private vector relation.
|
|
4
|
+
* The already-quoted relation has unique vertex ids and a fixed-size DOUBLE
|
|
5
|
+
* vec column. Source data must be retained separately by the caller.
|
|
6
|
+
*
|
|
7
|
+
* Safe vectors keep their existing arithmetic and tie behavior. Outside the
|
|
8
|
+
* safe range, divide by the largest absolute component, then by the resulting
|
|
9
|
+
* length. This preserves direction without overflowing or underflowing norms.
|
|
10
|
+
* The bounds keep squared-norm products between 1e-300 and 1e300, with room
|
|
11
|
+
* for rounding. Only the private vec column changes; no scratch tables remain.
|
|
12
|
+
*/
|
|
13
|
+
export default function stabilizeCosineVectors(connection: DuckDBConnection, rows: string): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=stabilizeCosineVectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stabilizeCosineVectors.d.ts","sourceRoot":"","sources":["../../src/helpers/stabilizeCosineVectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGzD;;;;;;;;;;GAUG;AACH,wBAA8B,sBAAsB,CAClD,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 = stabilizeCosineVectors;
|
|
7
|
+
const readScalarNumber_js_1 = __importDefault(require("./readScalarNumber.js"));
|
|
8
|
+
/**
|
|
9
|
+
* Stabilizes cosine arithmetic in a caller-owned private vector relation.
|
|
10
|
+
* The already-quoted relation has unique vertex ids and a fixed-size DOUBLE
|
|
11
|
+
* vec column. Source data must be retained separately by the caller.
|
|
12
|
+
*
|
|
13
|
+
* Safe vectors keep their existing arithmetic and tie behavior. Outside the
|
|
14
|
+
* safe range, divide by the largest absolute component, then by the resulting
|
|
15
|
+
* length. This preserves direction without overflowing or underflowing norms.
|
|
16
|
+
* The bounds keep squared-norm products between 1e-300 and 1e300, with room
|
|
17
|
+
* for rounding. Only the private vec column changes; no scratch tables remain.
|
|
18
|
+
*/
|
|
19
|
+
async function stabilizeCosineVectors(connection, rows) {
|
|
20
|
+
if (await (0, readScalarNumber_js_1.default)(connection, `SELECT count(*) FROM ${rows} WHERE vec IS NULL
|
|
21
|
+
OR len(vec)=0 OR list_count(vec)!=len(vec)
|
|
22
|
+
OR NOT list_bool_and(list_transform(vec, value -> isfinite(value)))
|
|
23
|
+
OR list_max(list_transform(vec, value -> abs(value)))=0`)) {
|
|
24
|
+
throw new Error("Cosine distance requires finite, non-null values and nonzero vectors.");
|
|
25
|
+
}
|
|
26
|
+
await connection.run(`WITH magnitudes AS MATERIALIZED (
|
|
27
|
+
SELECT vertex,vec,list_max(list_transform(vec, value -> abs(value))) AS magnitude
|
|
28
|
+
FROM ${rows}
|
|
29
|
+
), scaled AS MATERIALIZED (
|
|
30
|
+
SELECT vertex,list_transform(vec, value -> value / magnitude) AS vec
|
|
31
|
+
FROM magnitudes
|
|
32
|
+
WHERE magnitude < 1e-75 OR magnitude > 1e75 / sqrt(len(vec))
|
|
33
|
+
), lengths AS MATERIALIZED (
|
|
34
|
+
SELECT vertex,vec,sqrt(list_sum(list_transform(vec, value -> value * value))) AS norm
|
|
35
|
+
FROM scaled
|
|
36
|
+
)
|
|
37
|
+
UPDATE ${rows} AS target SET vec=cast_to_type(
|
|
38
|
+
list_transform(lengths.vec, value -> value / lengths.norm),target.vec)
|
|
39
|
+
FROM lengths WHERE target.vertex=lengths.vertex`);
|
|
40
|
+
}
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
* Normalizes a string or array of strings to a new array.
|
|
3
3
|
* Existing arrays are copied so callers can change the result independently.
|
|
4
4
|
*
|
|
5
|
-
* @param argument - One string or an array of strings.
|
|
6
|
-
* @returns A new array containing the supplied strings.
|
|
7
|
-
*
|
|
8
5
|
* @example
|
|
9
6
|
* ```ts
|
|
10
7
|
* import { stringToArray } from "@nshiab/simple-data-analysis-core/helpers";
|
|
11
8
|
* console.log(stringToArray("name")); // ["name"]
|
|
12
9
|
* console.log(stringToArray(["name", "age"])); // ["name", "age"]
|
|
13
10
|
* ```
|
|
11
|
+
*
|
|
12
|
+
* @param argument - One string or an array of strings.
|
|
13
|
+
*
|
|
14
|
+
* @returns A new array containing the supplied strings.
|
|
14
15
|
*/
|
|
15
16
|
export default function stringToArray(argument: string | string[]): string[];
|
|
16
17
|
//# sourceMappingURL=stringToArray.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringToArray.d.ts","sourceRoot":"","sources":["../../src/helpers/stringToArray.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stringToArray.d.ts","sourceRoot":"","sources":["../../src/helpers/stringToArray.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAQ3E"}
|
|
@@ -5,15 +5,16 @@ exports.default = stringToArray;
|
|
|
5
5
|
* Normalizes a string or array of strings to a new array.
|
|
6
6
|
* Existing arrays are copied so callers can change the result independently.
|
|
7
7
|
*
|
|
8
|
-
* @param argument - One string or an array of strings.
|
|
9
|
-
* @returns A new array containing the supplied strings.
|
|
10
|
-
*
|
|
11
8
|
* @example
|
|
12
9
|
* ```ts
|
|
13
10
|
* import { stringToArray } from "@nshiab/simple-data-analysis-core/helpers";
|
|
14
11
|
* console.log(stringToArray("name")); // ["name"]
|
|
15
12
|
* console.log(stringToArray(["name", "age"])); // ["name", "age"]
|
|
16
13
|
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param argument - One string or an array of strings.
|
|
16
|
+
*
|
|
17
|
+
* @returns A new array containing the supplied strings.
|
|
17
18
|
*/
|
|
18
19
|
function stringToArray(argument) {
|
|
19
20
|
if (Array.isArray(argument)) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"umapRandom.d.ts","sourceRoot":"","sources":["../../src/helpers/umapRandom.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,IAAI,EAAE,MAAM,gBAQ9C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = umapRandom;
|
|
4
|
+
// Mulberry32: separate initialization and sampling streams, stable per seed.
|
|
5
|
+
function umapRandom(seed) {
|
|
6
|
+
let state = seed >>> 0;
|
|
7
|
+
return () => {
|
|
8
|
+
state = (state + 0x6D2B79F5) | 0;
|
|
9
|
+
let value = Math.imul(state ^ state >>> 15, 1 | state);
|
|
10
|
+
value ^= value + Math.imul(value ^ value >>> 7, 61 | value);
|
|
11
|
+
return ((value ^ value >>> 14) >>> 0) / 4294967296;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -18,12 +18,6 @@ import type SimpleTable from "../class/SimpleTable.js";
|
|
|
18
18
|
* inputs or overwritten as outputs; use updateWithJS() for editable GeoJSON.
|
|
19
19
|
* This SQL-only preservation path accepts any source CRS.
|
|
20
20
|
*
|
|
21
|
-
* @param table - Table to enrich.
|
|
22
|
-
* @param inputColumns - Columns available to the callback.
|
|
23
|
-
* @param outputColumns - Generated columns to add or replace.
|
|
24
|
-
* @param generate - Produces one result per input row, in input order.
|
|
25
|
-
* @param options - Controls the maximum rows read, generated, and staged at once.
|
|
26
|
-
* @returns Resolves after merging the generated columns into the table.
|
|
27
21
|
* @example
|
|
28
22
|
* ```ts
|
|
29
23
|
* queueAsyncBarrier(table, {
|
|
@@ -35,6 +29,18 @@ import type SimpleTable from "../class/SimpleTable.js";
|
|
|
35
29
|
* });
|
|
36
30
|
* await table.log();
|
|
37
31
|
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param table - Table to enrich.
|
|
34
|
+
*
|
|
35
|
+
* @param inputColumns - Columns available to the callback.
|
|
36
|
+
*
|
|
37
|
+
* @param outputColumns - Generated columns to add or replace.
|
|
38
|
+
*
|
|
39
|
+
* @param generate - Produces one result per input row, in input order.
|
|
40
|
+
*
|
|
41
|
+
* @param options - Controls the maximum rows read, generated, and staged at once.
|
|
42
|
+
*
|
|
43
|
+
* @returns Resolves after merging the generated columns into the table.
|
|
38
44
|
*/
|
|
39
45
|
export default function updateColumnsWithJS(table: SimpleTable, inputColumns: string[], outputColumns: string[], generate: (rows: {
|
|
40
46
|
[key: string]: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateColumnsWithJS.d.ts","sourceRoot":"","sources":["../../src/helpers/updateColumnsWithJS.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAMvD
|
|
1
|
+
{"version":3,"file":"updateColumnsWithJS.d.ts","sourceRoot":"","sources":["../../src/helpers/updateColumnsWithJS.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAMvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAA8B,mBAAmB,CAC/C,KAAK,EAAE,WAAW,EAClB,YAAY,EAAE,MAAM,EAAE,EACtB,aAAa,EAAE,MAAM,EAAE,EACvB,QAAQ,EAAE,CACR,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EAAE,KAC/B,OAAO,CAAC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EAAE,CAAC,EAC1C,OAAO,GAAE;IACP;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACf,GACL,OAAO,CAAC,IAAI,CAAC,CAoJf"}
|
|
@@ -27,12 +27,6 @@ const loadArray_js_1 = require("../methods/loadArray.js");
|
|
|
27
27
|
* inputs or overwritten as outputs; use updateWithJS() for editable GeoJSON.
|
|
28
28
|
* This SQL-only preservation path accepts any source CRS.
|
|
29
29
|
*
|
|
30
|
-
* @param table - Table to enrich.
|
|
31
|
-
* @param inputColumns - Columns available to the callback.
|
|
32
|
-
* @param outputColumns - Generated columns to add or replace.
|
|
33
|
-
* @param generate - Produces one result per input row, in input order.
|
|
34
|
-
* @param options - Controls the maximum rows read, generated, and staged at once.
|
|
35
|
-
* @returns Resolves after merging the generated columns into the table.
|
|
36
30
|
* @example
|
|
37
31
|
* ```ts
|
|
38
32
|
* queueAsyncBarrier(table, {
|
|
@@ -44,6 +38,18 @@ const loadArray_js_1 = require("../methods/loadArray.js");
|
|
|
44
38
|
* });
|
|
45
39
|
* await table.log();
|
|
46
40
|
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param table - Table to enrich.
|
|
43
|
+
*
|
|
44
|
+
* @param inputColumns - Columns available to the callback.
|
|
45
|
+
*
|
|
46
|
+
* @param outputColumns - Generated columns to add or replace.
|
|
47
|
+
*
|
|
48
|
+
* @param generate - Produces one result per input row, in input order.
|
|
49
|
+
*
|
|
50
|
+
* @param options - Controls the maximum rows read, generated, and staged at once.
|
|
51
|
+
*
|
|
52
|
+
* @returns Resolves after merging the generated columns into the table.
|
|
47
53
|
*/
|
|
48
54
|
async function updateColumnsWithJS(table, inputColumns, outputColumns, generate, options = {}) {
|
|
49
55
|
const batchSize = options.batchSize ?? 1000;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TableSchema } from "./pendingOps.js";
|
|
2
|
+
/** Validates that route result columns do not replace original input columns. */
|
|
3
|
+
export default function validateGraphRouteResultSchema(schema: TableSchema, method: string, additionalResultColumns?: readonly string[]): void;
|
|
4
|
+
//# sourceMappingURL=validateGraphRouteResultSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateGraphRouteResultSchema.d.ts","sourceRoot":"","sources":["../../src/helpers/validateGraphRouteResultSchema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAKnD,iFAAiF;AACjF,MAAM,CAAC,OAAO,UAAU,8BAA8B,CACpD,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,MAAM,EACd,uBAAuB,GAAE,SAAS,MAAM,EAAO,GAC9C,IAAI,CAkBN"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 = validateGraphRouteResultSchema;
|
|
7
|
+
const foldIdentifier_js_1 = __importDefault(require("./foldIdentifier.js"));
|
|
8
|
+
const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
|
|
9
|
+
const resultColumns = ["pathId", "step", "weight", "total"];
|
|
10
|
+
/** Validates that route result columns do not replace original input columns. */
|
|
11
|
+
function validateGraphRouteResultSchema(schema, method, additionalResultColumns = []) {
|
|
12
|
+
for (const resultColumn of [...resultColumns, ...additionalResultColumns]) {
|
|
13
|
+
const folded = (0, foldIdentifier_js_1.default)(resultColumn);
|
|
14
|
+
const inputColumn = Object.keys(schema).find((column) => (0, foldIdentifier_js_1.default)(column) === folded);
|
|
15
|
+
if (inputColumn !== undefined) {
|
|
16
|
+
throw new Error(`${method} cannot add ${(0, quoteIdentifier_js_1.default)(resultColumn)} because input column ${(0, quoteIdentifier_js_1.default)(inputColumn)} conflicts with that result column. Rename ${(0, quoteIdentifier_js_1.default)(inputColumn)} with renameColumns() before calculating the graph.`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type SimpleTable from "../class/SimpleTable.js";
|
|
2
|
+
import { type PreparedGraphTemporalOptions } from "./prepareGraphTemporalSql.js";
|
|
3
|
+
/** Rejects invalid selected timestamps before a chronological graph runs. */
|
|
4
|
+
export default function validateGraphTemporalEvents(simpleTable: SimpleTable, options: PreparedGraphTemporalOptions, method: string, parameters: {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=validateGraphTemporalEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateGraphTemporalEvents.d.ts","sourceRoot":"","sources":["../../src/helpers/validateGraphTemporalEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAEvD,OAAgC,EAC9B,KAAK,4BAA4B,EAClC,MAAM,8BAA8B,CAAC;AAItC,6EAA6E;AAC7E,wBAA8B,2BAA2B,CACvD,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,4BAA4B,EACrC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GACrC,OAAO,CAAC,IAAI,CAAC,CAiDf"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 = validateGraphTemporalEvents;
|
|
7
|
+
const mergeOptions_js_1 = __importDefault(require("./mergeOptions.js"));
|
|
8
|
+
const prepareGraphTemporalSql_js_1 = __importDefault(require("./prepareGraphTemporalSql.js"));
|
|
9
|
+
const queryDB_js_1 = __importDefault(require("./queryDB.js"));
|
|
10
|
+
const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
|
|
11
|
+
/** Rejects invalid selected timestamps before a chronological graph runs. */
|
|
12
|
+
async function validateGraphTemporalEvents(simpleTable, options, method, parameters) {
|
|
13
|
+
const schema = await simpleTable.getTypes();
|
|
14
|
+
const temporal = (0, prepareGraphTemporalSql_js_1.default)(schema, options, method);
|
|
15
|
+
const q = quoteIdentifier_js_1.default;
|
|
16
|
+
const eventsName = "__graph_temporal_events";
|
|
17
|
+
const events = q(eventsName);
|
|
18
|
+
const eventStart = `${events}.${q("__event_start")}`;
|
|
19
|
+
const eventEnd = `${events}.${q("__event_end")}`;
|
|
20
|
+
const rows = await (0, queryDB_js_1.default)(simpleTable, `SELECT CASE
|
|
21
|
+
WHEN ${eventStart} IS NULL THEN 1
|
|
22
|
+
WHEN ${eventEnd} IS NULL THEN 2
|
|
23
|
+
WHEN NOT isfinite(${eventStart}) THEN 3
|
|
24
|
+
WHEN NOT isfinite(${eventEnd}) THEN 4
|
|
25
|
+
ELSE 5
|
|
26
|
+
END AS ${q("reason")}
|
|
27
|
+
FROM (
|
|
28
|
+
SELECT ${temporal.eventSelections().join(", ")}
|
|
29
|
+
FROM ${q(simpleTable.name)}
|
|
30
|
+
) AS ${events}
|
|
31
|
+
WHERE (${temporal.eventValidity(eventsName)}) IS NOT TRUE
|
|
32
|
+
LIMIT 1`, (0, mergeOptions_js_1.default)(simpleTable, {
|
|
33
|
+
table: simpleTable.name,
|
|
34
|
+
method,
|
|
35
|
+
parameters,
|
|
36
|
+
returnData: true,
|
|
37
|
+
}));
|
|
38
|
+
const reason = rows?.[0]?.reason;
|
|
39
|
+
if (reason === undefined)
|
|
40
|
+
return;
|
|
41
|
+
const startColumn = temporal.startTimeColumn ?? temporal.endTimeColumn;
|
|
42
|
+
const endColumn = temporal.endTimeColumn ?? temporal.startTimeColumn;
|
|
43
|
+
const message = reason === 1
|
|
44
|
+
? `selected start-time column ${q(startColumn)} contains a null timestamp.`
|
|
45
|
+
: reason === 2
|
|
46
|
+
? `selected end-time column ${q(endColumn)} contains a null timestamp.`
|
|
47
|
+
: reason === 3
|
|
48
|
+
? `selected start-time column ${q(startColumn)} contains an infinite timestamp.`
|
|
49
|
+
: reason === 4
|
|
50
|
+
? `selected end-time column ${q(endColumn)} contains an infinite timestamp.`
|
|
51
|
+
: `selected end-time column ${q(endColumn)} contains a timestamp before its start in ${q(startColumn)}.`;
|
|
52
|
+
throw new TypeError(`${method} ${message}`);
|
|
53
|
+
}
|
|
@@ -2,12 +2,6 @@ import type { TableSchema } from "./pendingOps.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Validates the column options shared by numerical pair analyses.
|
|
4
4
|
*
|
|
5
|
-
* @param types - The schema of the table being analyzed.
|
|
6
|
-
* @param options - The optional x and y columns selected by the caller.
|
|
7
|
-
* @param method - The SDA method performing the analysis.
|
|
8
|
-
* @param tableName - The name of the table being analyzed.
|
|
9
|
-
* @returns All numeric columns in the table schema.
|
|
10
|
-
*
|
|
11
5
|
* @example
|
|
12
6
|
* ```ts
|
|
13
7
|
* const columns = validateNumericalAnalysis(
|
|
@@ -17,6 +11,16 @@ import type { TableSchema } from "./pendingOps.js";
|
|
|
17
11
|
* "measurements",
|
|
18
12
|
* );
|
|
19
13
|
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param types - The schema of the table being analyzed.
|
|
16
|
+
*
|
|
17
|
+
* @param options - The optional x and y columns selected by the caller.
|
|
18
|
+
*
|
|
19
|
+
* @param method - The SDA method performing the analysis.
|
|
20
|
+
*
|
|
21
|
+
* @param tableName - The name of the table being analyzed.
|
|
22
|
+
*
|
|
23
|
+
* @returns All numeric columns in the table schema.
|
|
20
24
|
*/
|
|
21
25
|
export default function validateNumericalAnalysis(types: TableSchema, options: {
|
|
22
26
|
x?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateNumericalAnalysis.d.ts","sourceRoot":"","sources":["../../src/helpers/validateNumericalAnalysis.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"validateNumericalAnalysis.d.ts","sourceRoot":"","sources":["../../src/helpers/validateNumericalAnalysis.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACnC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,MAAM,EAAE,CAoDV"}
|