@nshiab/simple-data-analysis-core 2.0.9 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +2795 -1139
- package/esm/class/SimpleTable.d.ts.map +1 -1
- package/esm/class/SimpleTable.js +2781 -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/llm.md +2106 -143
- 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 +2795 -1139
- package/script/class/SimpleTable.d.ts.map +1 -1
- package/script/class/SimpleTable.js +2781 -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
|
@@ -0,0 +1,105 @@
|
|
|
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 = computeCovariance;
|
|
7
|
+
const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
|
|
8
|
+
const factorCovariance_js_1 = require("./factorCovariance.js");
|
|
9
|
+
async function computeCovariance(connection, input) {
|
|
10
|
+
const { observations, dimensions } = input;
|
|
11
|
+
if (!Number.isSafeInteger(dimensions) || dimensions < 1) {
|
|
12
|
+
throw new Error("Covariance requires at least one feature dimension.");
|
|
13
|
+
}
|
|
14
|
+
if (!Number.isSafeInteger(observations) || observations <= dimensions) {
|
|
15
|
+
throw new Error(`Covariance requires more observations than features (n > d), but received n=${observations} and d=${dimensions}. More observations are necessary, though constant or linearly dependent features can still make covariance singular.`);
|
|
16
|
+
}
|
|
17
|
+
const relation = (0, quoteIdentifier_js_1.default)(input.relation);
|
|
18
|
+
const rowId = (0, quoteIdentifier_js_1.default)(input.rowIdColumn);
|
|
19
|
+
const vector = (0, quoteIdentifier_js_1.default)(input.vectorColumn);
|
|
20
|
+
const expanded = `SELECT r.${rowId} AS observation,
|
|
21
|
+
f.feature::INTEGER AS feature,
|
|
22
|
+
array_extract(r.${vector}, f.feature)::DOUBLE AS value
|
|
23
|
+
FROM ${relation} r CROSS JOIN range(1, ${dimensions + 1}) f(feature)`;
|
|
24
|
+
const offsets = `SELECT observation, feature, value,
|
|
25
|
+
first_value(value) OVER (PARTITION BY feature ORDER BY observation
|
|
26
|
+
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS origin
|
|
27
|
+
FROM (${expanded})`;
|
|
28
|
+
const meanRows = (await connection.runAndReadAll(`SELECT feature - 1 AS feature, first(origin) AS origin,
|
|
29
|
+
avg(value - origin) AS mean_offset, max(abs(value - origin)) AS magnitude FROM (${offsets})
|
|
30
|
+
GROUP BY feature ORDER BY feature`)).getRowsJS();
|
|
31
|
+
if (meanRows.length !== dimensions) {
|
|
32
|
+
throw new Error("Covariance aggregation returned an incomplete centroid.");
|
|
33
|
+
}
|
|
34
|
+
const magnitudes = new Float64Array(dimensions);
|
|
35
|
+
const means = new Float64Array(dimensions);
|
|
36
|
+
const origins = new Float64Array(dimensions);
|
|
37
|
+
const meanOffsets = new Float64Array(dimensions);
|
|
38
|
+
for (const row of meanRows) {
|
|
39
|
+
const feature = Number(row[0]);
|
|
40
|
+
const origin = Number(row[1]);
|
|
41
|
+
const meanOffset = Number(row[2]);
|
|
42
|
+
if (!Number.isSafeInteger(feature) || !Number.isFinite(origin) ||
|
|
43
|
+
!Number.isFinite(meanOffset)) {
|
|
44
|
+
throw new Error("Covariance is numerically unstable because centroid aggregation produced a non-finite result. Rescale features or remove dimensions whose range cannot be represented as DOUBLE.");
|
|
45
|
+
}
|
|
46
|
+
const magnitude = Number(row[3]);
|
|
47
|
+
if (!Number.isFinite(magnitude) || magnitude <= 0) {
|
|
48
|
+
throw new Error(`Covariance is singular or numerically unstable (feature ${feature + 1} has constant values or an unrepresentable range). Constant columns, linearly dependent features, or too few observations are common causes. Remove redundant features or provide more observations.`);
|
|
49
|
+
}
|
|
50
|
+
magnitudes[feature] = magnitude;
|
|
51
|
+
origins[feature] = origin;
|
|
52
|
+
meanOffsets[feature] = meanOffset;
|
|
53
|
+
means[feature] = origin + meanOffset;
|
|
54
|
+
}
|
|
55
|
+
const covariance = new Float64Array(dimensions * dimensions);
|
|
56
|
+
// covar_samp divides centered cross-products by n - 1. Subtracting a native
|
|
57
|
+
// per-feature anchor first avoids cancellation in E[x*y] - E[x]E[y] and
|
|
58
|
+
// retains small deviations when a feature has a large common offset.
|
|
59
|
+
// Divide by each feature's observed magnitude before accumulating products.
|
|
60
|
+
// Otherwise the n-1 cross-product sum can overflow even when the final sample
|
|
61
|
+
// covariance is finite (e.g. [0, 1e154, 2e154], whose variance is 1e308).
|
|
62
|
+
const result = await connection.stream(`WITH features AS MATERIALIZED (
|
|
63
|
+
SELECT observation, feature, (value - origin) /
|
|
64
|
+
array_extract([${magnitudes.join(",")}]::DOUBLE[${dimensions}], feature) AS value
|
|
65
|
+
FROM (${offsets})
|
|
66
|
+
)
|
|
67
|
+
SELECT a.feature - 1 AS row, b.feature - 1 AS column,
|
|
68
|
+
covar_samp(a.value, b.value) AS covariance
|
|
69
|
+
FROM features a JOIN features b
|
|
70
|
+
ON a.observation = b.observation AND a.feature <= b.feature
|
|
71
|
+
GROUP BY a.feature, b.feature`);
|
|
72
|
+
let values = 0;
|
|
73
|
+
while (true) {
|
|
74
|
+
const chunk = await result.fetchChunk();
|
|
75
|
+
if (!chunk || chunk.rowCount === 0)
|
|
76
|
+
break;
|
|
77
|
+
const rows = new Int32Array(chunk.rowCount);
|
|
78
|
+
const columns = new Int32Array(chunk.rowCount);
|
|
79
|
+
const entries = new Float64Array(chunk.rowCount);
|
|
80
|
+
chunk.visitColumnValues(0, (value, row) => rows[row] = Number(value));
|
|
81
|
+
chunk.visitColumnValues(1, (value, row) => columns[row] = Number(value));
|
|
82
|
+
chunk.visitColumnValues(2, (value, row) => entries[row] = Number(value));
|
|
83
|
+
for (let i = 0; i < chunk.rowCount; i++) {
|
|
84
|
+
const row = rows[i];
|
|
85
|
+
const column = columns[i];
|
|
86
|
+
// Restore units using the larger magnitude first to avoid prematurely
|
|
87
|
+
// underflowing a finite cross-covariance between very different units.
|
|
88
|
+
const value = entries[i] * Math.max(magnitudes[row], magnitudes[column]) *
|
|
89
|
+
Math.min(magnitudes[row], magnitudes[column]);
|
|
90
|
+
covariance[row * dimensions + column] = value;
|
|
91
|
+
covariance[column * dimensions + row] = value;
|
|
92
|
+
values++;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (values !== dimensions * (dimensions + 1) / 2) {
|
|
96
|
+
throw new Error("Covariance aggregation returned an incomplete matrix.");
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
...(0, factorCovariance_js_1.factorCovariance)(covariance, dimensions),
|
|
100
|
+
means,
|
|
101
|
+
origins,
|
|
102
|
+
meanOffsets,
|
|
103
|
+
observations,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type DuckDBConnection } from "@duckdb/node-api";
|
|
2
|
+
import type { CovarianceModel } from "./computeCovariance.js";
|
|
3
|
+
/** Evaluates bulk distances in DuckDB; the caller owns the returned scratch table. */
|
|
4
|
+
export default function computeMahalanobisDistances(connection: DuckDBConnection, input: {
|
|
5
|
+
relation: string;
|
|
6
|
+
rowIdColumn: string;
|
|
7
|
+
vectorColumn: string;
|
|
8
|
+
}, model: CovarianceModel, referencePoint?: number[]): Promise<{
|
|
9
|
+
relation: string;
|
|
10
|
+
rowIdColumn: string;
|
|
11
|
+
distanceColumn: string;
|
|
12
|
+
cleanup: () => Promise<void>;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=computeMahalanobisDistances.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeMahalanobisDistances.d.ts","sourceRoot":"","sources":["../../src/helpers/computeMahalanobisDistances.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAI9D,sFAAsF;AACtF,wBAA8B,2BAA2B,CACvD,UAAU,EAAE,gBAAgB,EAC5B,KAAK,EAAE;IACL,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,EACD,KAAK,EAAE,eAAe,EACtB,cAAc,CAAC,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC,CAkGD"}
|
|
@@ -0,0 +1,93 @@
|
|
|
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 = computeMahalanobisDistances;
|
|
7
|
+
const node_api_1 = require("@duckdb/node-api");
|
|
8
|
+
const factorCovariance_js_1 = require("./factorCovariance.js");
|
|
9
|
+
const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
|
|
10
|
+
/** Evaluates bulk distances in DuckDB; the caller owns the returned scratch table. */
|
|
11
|
+
async function computeMahalanobisDistances(connection, input, model, referencePoint) {
|
|
12
|
+
const { dimensions, means, origins, meanOffsets } = model;
|
|
13
|
+
if ([means, origins, meanOffsets].some((values) => values.length !== dimensions)) {
|
|
14
|
+
throw new Error("The covariance centroid has the wrong dimensions.");
|
|
15
|
+
}
|
|
16
|
+
const vectorLiteral = (values) => {
|
|
17
|
+
if (values.some((value) => !Number.isFinite(value))) {
|
|
18
|
+
throw new Error("Mahalanobis centering requires finite coefficients.");
|
|
19
|
+
}
|
|
20
|
+
return `[${values.join(",")}]::DOUBLE[${dimensions}]`;
|
|
21
|
+
};
|
|
22
|
+
const originSql = vectorLiteral(origins);
|
|
23
|
+
const offsetSql = vectorLiteral(meanOffsets);
|
|
24
|
+
if (referencePoint !== undefined &&
|
|
25
|
+
(referencePoint.length !== dimensions ||
|
|
26
|
+
referencePoint.some((value) => !Number.isFinite(value)))) {
|
|
27
|
+
throw new Error("Mahalanobis reference point must contain one finite number per dimension.");
|
|
28
|
+
}
|
|
29
|
+
// Direct subtraction retains exact matches and tiny reference offsets that
|
|
30
|
+
// would be lost by subtracting the centroid from both points separately.
|
|
31
|
+
const centeredValue = referencePoint === undefined
|
|
32
|
+
? `(value - array_extract(${originSql}, dimension)) - array_extract(${offsetSql}, dimension)`
|
|
33
|
+
: `value - array_extract(${vectorLiteral(Float64Array.from(referencePoint))}, dimension)`;
|
|
34
|
+
const whitening = (0, factorCovariance_js_1.covarianceWhitening)(model);
|
|
35
|
+
const suffix = crypto.randomUUID().replaceAll("-", "");
|
|
36
|
+
const relation = `__sda_mahalanobis_distances_${suffix}`;
|
|
37
|
+
const weights = `__sda_mahalanobis_weights_${suffix}`;
|
|
38
|
+
const rowIdColumn = "row_id";
|
|
39
|
+
const distanceColumn = "distance";
|
|
40
|
+
const cleanup = async () => {
|
|
41
|
+
await connection.run(`DROP TABLE IF EXISTS ${(0, quoteIdentifier_js_1.default)(relation)}`);
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
await connection.run(`CREATE TEMP TABLE ${(0, quoteIdentifier_js_1.default)(weights)}
|
|
45
|
+
(weight DOUBLE[${dimensions}])`);
|
|
46
|
+
const appender = await connection.createAppender(weights);
|
|
47
|
+
try {
|
|
48
|
+
// Only O(d²) summary state crosses this boundary, one O(d) row at a time.
|
|
49
|
+
// Binding a native table avoids parsing a matrix-sized SQL literal and
|
|
50
|
+
// repeatedly evaluating it inside a per-observation lambda.
|
|
51
|
+
for (let row = 0; row < dimensions; row++) {
|
|
52
|
+
appender.appendArray(Array.from(whitening.subarray(row * dimensions, (row + 1) * dimensions)), (0, node_api_1.ARRAY)(node_api_1.DOUBLE, dimensions));
|
|
53
|
+
appender.endRow();
|
|
54
|
+
}
|
|
55
|
+
appender.flushSync();
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
appender.closeSync();
|
|
59
|
+
}
|
|
60
|
+
// Center once per observation. The cross product is consumed by a grouped
|
|
61
|
+
// aggregate: O(n d²) arithmetic, O(n d) centered storage, O(d²) coefficients,
|
|
62
|
+
// and O(n) aggregate/output state. Source vectors never enter JavaScript.
|
|
63
|
+
await connection.run(`CREATE TEMP TABLE ${(0, quoteIdentifier_js_1.default)(relation)} AS
|
|
64
|
+
WITH centered AS MATERIALIZED (
|
|
65
|
+
SELECT ${(0, quoteIdentifier_js_1.default)(input.rowIdColumn)} AS row_id,
|
|
66
|
+
list_transform(${(0, quoteIdentifier_js_1.default)(input.vectorColumn)},
|
|
67
|
+
(value, dimension) -> ${centeredValue})::DOUBLE[${dimensions}] AS vector
|
|
68
|
+
FROM ${(0, quoteIdentifier_js_1.default)(input.relation)}
|
|
69
|
+
), components AS MATERIALIZED (
|
|
70
|
+
SELECT row_id, abs(array_inner_product(weight, vector)) AS component
|
|
71
|
+
FROM centered CROSS JOIN ${(0, quoteIdentifier_js_1.default)(weights)}
|
|
72
|
+
), magnitudes AS (
|
|
73
|
+
SELECT row_id, max(component) AS magnitude FROM components GROUP BY row_id
|
|
74
|
+
)
|
|
75
|
+
SELECT row_id, CASE WHEN magnitude = 0 THEN 0::DOUBLE
|
|
76
|
+
ELSE magnitude * sqrt(sum(pow(component / magnitude, 2))) END AS distance
|
|
77
|
+
FROM components JOIN magnitudes USING (row_id)
|
|
78
|
+
GROUP BY row_id, magnitude`);
|
|
79
|
+
const invalid = Number((await connection.runAndReadAll(`SELECT count(*) FROM ${(0, quoteIdentifier_js_1.default)(relation)}
|
|
80
|
+
WHERE distance IS NULL OR NOT isfinite(distance)`)).getRowsJS()[0][0]);
|
|
81
|
+
if (invalid > 0) {
|
|
82
|
+
throw new Error(`Mahalanobis distance produced ${invalid} non-finite results. Rescale features or remove numerically unstable dimensions.`);
|
|
83
|
+
}
|
|
84
|
+
return { relation, rowIdColumn, distanceColumn, cleanup };
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
await cleanup();
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
await connection.run(`DROP TABLE IF EXISTS ${(0, quoteIdentifier_js_1.default)(weights)}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* Creates missing directories in an output path, including parent directories.
|
|
3
3
|
* Non-hidden path segments containing a dot are treated as filenames and omitted.
|
|
4
4
|
*
|
|
5
|
-
* @param path - An output file path or a directory path without dotted segments.
|
|
6
|
-
* @returns Nothing. Existing directories are left unchanged.
|
|
7
|
-
*
|
|
8
5
|
* @example
|
|
9
6
|
* ```ts
|
|
10
7
|
* import { createDirectory } from "@nshiab/simple-data-analysis-core/helpers";
|
|
11
8
|
* createDirectory("output/tables/results.csv"); // Creates output/tables.
|
|
12
9
|
* ```
|
|
10
|
+
*
|
|
11
|
+
* @param path - An output file path or a directory path without dotted segments.
|
|
12
|
+
*
|
|
13
|
+
* @returns Nothing. Existing directories are left unchanged.
|
|
13
14
|
*/
|
|
14
15
|
export default function createDirectory(path: string): void;
|
|
15
16
|
//# sourceMappingURL=createDirectory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDirectory.d.ts","sourceRoot":"","sources":["../../src/helpers/createDirectory.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"createDirectory.d.ts","sourceRoot":"","sources":["../../src/helpers/createDirectory.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAS1D"}
|
|
@@ -6,14 +6,15 @@ const node_fs_1 = require("node:fs");
|
|
|
6
6
|
* Creates missing directories in an output path, including parent directories.
|
|
7
7
|
* Non-hidden path segments containing a dot are treated as filenames and omitted.
|
|
8
8
|
*
|
|
9
|
-
* @param path - An output file path or a directory path without dotted segments.
|
|
10
|
-
* @returns Nothing. Existing directories are left unchanged.
|
|
11
|
-
*
|
|
12
9
|
* @example
|
|
13
10
|
* ```ts
|
|
14
11
|
* import { createDirectory } from "@nshiab/simple-data-analysis-core/helpers";
|
|
15
12
|
* createDirectory("output/tables/results.csv"); // Creates output/tables.
|
|
16
13
|
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param path - An output file path or a directory path without dotted segments.
|
|
16
|
+
*
|
|
17
|
+
* @returns Nothing. Existing directories are left unchanged.
|
|
17
18
|
*/
|
|
18
19
|
function createDirectory(path) {
|
|
19
20
|
path = path
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Transforms an array of objects into an object of arrays. This function is the inverse of `arraysToData` and is useful for converting data from a row-based format to a columnar format.
|
|
3
3
|
*
|
|
4
|
-
* @param data An array of objects. Each object is expected to have the same set of keys.
|
|
5
|
-
*
|
|
6
|
-
* @returns An object where each key maps to an array of values, effectively representing the data in a columnar format.
|
|
7
|
-
*
|
|
8
4
|
* @example
|
|
9
5
|
* ```ts
|
|
10
6
|
* // Basic usage with a simple dataset
|
|
@@ -24,6 +20,7 @@
|
|
|
24
20
|
* // city: ['New York', 'London', 'Paris']
|
|
25
21
|
* // }
|
|
26
22
|
* ```
|
|
23
|
+
*
|
|
27
24
|
* @example
|
|
28
25
|
* ```ts
|
|
29
26
|
* // Preparing data for statistical analysis
|
|
@@ -43,6 +40,11 @@
|
|
|
43
40
|
* // humidity: [60, 65, 55]
|
|
44
41
|
* // }
|
|
45
42
|
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param data An array of objects. Each object is expected to have the same set of keys.
|
|
45
|
+
*
|
|
46
|
+
* @returns An object where each key maps to an array of values, effectively representing the data in a columnar format.
|
|
47
|
+
*
|
|
46
48
|
* @category Formatting
|
|
47
49
|
*/
|
|
48
50
|
export default function dataToArrays<T extends Record<string, unknown>>(data: T[]): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataToArrays.d.ts","sourceRoot":"","sources":["../../src/helpers/dataToArrays.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"dataToArrays.d.ts","sourceRoot":"","sources":["../../src/helpers/dataToArrays.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpE,IAAI,EAAE,CAAC,EAAE,GACR;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;CAAE,CAU5B"}
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Transforms an array of objects into an object of arrays. This function is the inverse of `arraysToData` and is useful for converting data from a row-based format to a columnar format.
|
|
4
4
|
*
|
|
5
|
-
* @param data An array of objects. Each object is expected to have the same set of keys.
|
|
6
|
-
*
|
|
7
|
-
* @returns An object where each key maps to an array of values, effectively representing the data in a columnar format.
|
|
8
|
-
*
|
|
9
5
|
* @example
|
|
10
6
|
* ```ts
|
|
11
7
|
* // Basic usage with a simple dataset
|
|
@@ -25,6 +21,7 @@
|
|
|
25
21
|
* // city: ['New York', 'London', 'Paris']
|
|
26
22
|
* // }
|
|
27
23
|
* ```
|
|
24
|
+
*
|
|
28
25
|
* @example
|
|
29
26
|
* ```ts
|
|
30
27
|
* // Preparing data for statistical analysis
|
|
@@ -44,6 +41,11 @@
|
|
|
44
41
|
* // humidity: [60, 65, 55]
|
|
45
42
|
* // }
|
|
46
43
|
* ```
|
|
44
|
+
*
|
|
45
|
+
* @param data An array of objects. Each object is expected to have the same set of keys.
|
|
46
|
+
*
|
|
47
|
+
* @returns An object where each key maps to an array of values, effectively representing the data in a columnar format.
|
|
48
|
+
*
|
|
47
49
|
* @category Formatting
|
|
48
50
|
*/
|
|
49
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -2,13 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = extractTypes;
|
|
4
4
|
function extractTypes(types) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
typesObj[t.column_name] = t.column_type;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return typesObj;
|
|
5
|
+
const rows = (types ?? []);
|
|
6
|
+
// Define own properties so valid names such as __proto__ do not invoke
|
|
7
|
+
// Object.prototype setters in Node.js.
|
|
8
|
+
return Object.fromEntries(rows.filter((row) => row.column_name).map((row) => [row.column_name, row.column_type]));
|
|
14
9
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type CovarianceFactor = {
|
|
2
|
+
dimensions: number;
|
|
3
|
+
covariance: Float64Array;
|
|
4
|
+
scales: Float64Array;
|
|
5
|
+
cholesky: Float64Array;
|
|
6
|
+
reciprocalCondition: number;
|
|
7
|
+
};
|
|
8
|
+
/** Factors a sample covariance matrix for stable repeated linear solves. */
|
|
9
|
+
export declare function factorCovariance(covarianceInput: ArrayLike<number>, dimensions: number): CovarianceFactor;
|
|
10
|
+
/** Solves covariance * x = rightHandSide through the scaled Cholesky factor. */
|
|
11
|
+
export declare function solveCovariance(factor: CovarianceFactor, rightHandSide: ArrayLike<number>): Float64Array;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the lower-triangular transform whose squared norm is Mahalanobis
|
|
14
|
+
* squared distance. This inverts only the Cholesky factor, never covariance.
|
|
15
|
+
*/
|
|
16
|
+
export declare function covarianceWhitening(factor: CovarianceFactor): Float64Array;
|
|
17
|
+
//# sourceMappingURL=factorCovariance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factorCovariance.d.ts","sourceRoot":"","sources":["../../src/helpers/factorCovariance.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,YAAY,CAAC;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAkGF,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAC9B,eAAe,EAAE,SAAS,CAAC,MAAM,CAAC,EAClC,UAAU,EAAE,MAAM,GACjB,gBAAgB,CAoGlB;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAC7B,MAAM,EAAE,gBAAgB,EACxB,aAAa,EAAE,SAAS,CAAC,MAAM,CAAC,GAC/B,YAAY,CAsBd;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,gBAAgB,GACvB,YAAY,CA2Bd"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.factorCovariance = factorCovariance;
|
|
4
|
+
exports.solveCovariance = solveCovariance;
|
|
5
|
+
exports.covarianceWhitening = covarianceWhitening;
|
|
6
|
+
const instabilityMultiplier = 64;
|
|
7
|
+
function singularCovariance(reason) {
|
|
8
|
+
return new Error(`Covariance is singular or numerically unstable (${reason}). Constant columns, linearly dependent features, or too few observations are common causes. Remove redundant features or provide more observations.`);
|
|
9
|
+
}
|
|
10
|
+
function scaleCovarianceEntry(value, leftScale, rightScale) {
|
|
11
|
+
// Divide by the larger scale first. For a valid covariance, Cauchy-Schwarz
|
|
12
|
+
// bounds |value| by their product, so this avoids intermediate overflow when
|
|
13
|
+
// two otherwise equivalent features use radically different units.
|
|
14
|
+
return leftScale >= rightScale
|
|
15
|
+
? value / leftScale / rightScale
|
|
16
|
+
: value / rightScale / leftScale;
|
|
17
|
+
}
|
|
18
|
+
function solveCorrelation(cholesky, dimensions, rightHandSide) {
|
|
19
|
+
const solution = new Float64Array(dimensions);
|
|
20
|
+
for (let row = 0; row < dimensions; row++) {
|
|
21
|
+
let value = rightHandSide[row];
|
|
22
|
+
for (let column = 0; column < row; column++) {
|
|
23
|
+
value -= cholesky[row * dimensions + column] * solution[column];
|
|
24
|
+
}
|
|
25
|
+
solution[row] = value / cholesky[row * dimensions + row];
|
|
26
|
+
}
|
|
27
|
+
for (let row = dimensions - 1; row >= 0; row--) {
|
|
28
|
+
let value = solution[row];
|
|
29
|
+
for (let column = row + 1; column < dimensions; column++) {
|
|
30
|
+
value -= cholesky[column * dimensions + row] * solution[column];
|
|
31
|
+
}
|
|
32
|
+
solution[row] = value / cholesky[row * dimensions + row];
|
|
33
|
+
}
|
|
34
|
+
return solution;
|
|
35
|
+
}
|
|
36
|
+
// Hager's estimator avoids forming the inverse merely to decide whether the
|
|
37
|
+
// correlation-scaled covariance is safe to solve. Scaling first makes this
|
|
38
|
+
// rank decision invariant to a change of units in any feature.
|
|
39
|
+
function estimateInverseOneNorm(cholesky, dimensions) {
|
|
40
|
+
let vector = new Float64Array(dimensions).fill(1 / dimensions);
|
|
41
|
+
let estimate = 0;
|
|
42
|
+
let previousIndex = -1;
|
|
43
|
+
for (let iteration = 0; iteration < 8; iteration++) {
|
|
44
|
+
const solved = solveCorrelation(cholesky, dimensions, vector);
|
|
45
|
+
estimate = Math.max(estimate, solved.reduce((sum, value) => sum + Math.abs(value), 0));
|
|
46
|
+
const signs = solved.map((value) => value < 0 ? -1 : 1);
|
|
47
|
+
const dual = solveCorrelation(cholesky, dimensions, signs);
|
|
48
|
+
let index = 0;
|
|
49
|
+
for (let i = 1; i < dimensions; i++) {
|
|
50
|
+
if (Math.abs(dual[i]) > Math.abs(dual[index]))
|
|
51
|
+
index = i;
|
|
52
|
+
}
|
|
53
|
+
const directional = dual.reduce((sum, value, i) => sum + value * vector[i], 0);
|
|
54
|
+
if (Math.abs(dual[index]) <= directional || index === previousIndex)
|
|
55
|
+
break;
|
|
56
|
+
vector = new Float64Array(dimensions);
|
|
57
|
+
vector[index] = 1;
|
|
58
|
+
previousIndex = index;
|
|
59
|
+
}
|
|
60
|
+
// The all-positive initial vector can be an eigenvector that causes Hager's
|
|
61
|
+
// iteration to stop at the *smallest* inverse eigenvalue (for example an
|
|
62
|
+
// equicorrelation matrix). Higham's alternating, increasing-magnitude probe
|
|
63
|
+
// prevents that failure; normalize by its 1-norm to retain a lower estimate.
|
|
64
|
+
// Reference: https://www.netlib.org/lapack/double/dlacon.f (final stage).
|
|
65
|
+
const alternating = Float64Array.from({ length: dimensions }, (_, i) => (i % 2 === 0 ? 1 : -1) * (1 + i / Math.max(1, dimensions - 1)));
|
|
66
|
+
const alternatingNorm = alternating.reduce((sum, value) => sum + Math.abs(value), 0);
|
|
67
|
+
const solved = solveCorrelation(cholesky, dimensions, alternating);
|
|
68
|
+
estimate = Math.max(estimate, solved.reduce((sum, value) => sum + Math.abs(value), 0) / alternatingNorm);
|
|
69
|
+
return estimate;
|
|
70
|
+
}
|
|
71
|
+
/** Factors a sample covariance matrix for stable repeated linear solves. */
|
|
72
|
+
function factorCovariance(covarianceInput, dimensions) {
|
|
73
|
+
if (!Number.isSafeInteger(dimensions) || dimensions < 1) {
|
|
74
|
+
throw new Error("Covariance dimensions must be a positive safe integer.");
|
|
75
|
+
}
|
|
76
|
+
if (covarianceInput.length !== dimensions * dimensions) {
|
|
77
|
+
throw new Error(`Expected ${dimensions * dimensions} covariance values, received ${covarianceInput.length}.`);
|
|
78
|
+
}
|
|
79
|
+
const covariance = Float64Array.from(covarianceInput);
|
|
80
|
+
const scales = new Float64Array(dimensions);
|
|
81
|
+
for (let dimension = 0; dimension < dimensions; dimension++) {
|
|
82
|
+
const variance = covariance[dimension * dimensions + dimension];
|
|
83
|
+
if (!Number.isFinite(variance) || variance <= 0) {
|
|
84
|
+
throw singularCovariance(`feature ${dimension + 1} has non-positive or non-finite sample variance`);
|
|
85
|
+
}
|
|
86
|
+
scales[dimension] = Math.sqrt(variance);
|
|
87
|
+
}
|
|
88
|
+
const correlation = new Float64Array(dimensions * dimensions);
|
|
89
|
+
let correlationOneNorm = 0;
|
|
90
|
+
for (let column = 0; column < dimensions; column++) {
|
|
91
|
+
let columnSum = 0;
|
|
92
|
+
for (let row = 0; row < dimensions; row++) {
|
|
93
|
+
const left = covariance[row * dimensions + column];
|
|
94
|
+
const right = covariance[column * dimensions + row];
|
|
95
|
+
if (!Number.isFinite(left) || !Number.isFinite(right)) {
|
|
96
|
+
throw singularCovariance("the sample covariance contains non-finite values");
|
|
97
|
+
}
|
|
98
|
+
const value = row === column ? 1 : scaleCovarianceEntry(left, scales[row], scales[column]) / 2 + scaleCovarianceEntry(right, scales[row], scales[column]) / 2;
|
|
99
|
+
if (!Number.isFinite(value)) {
|
|
100
|
+
throw singularCovariance("correlation scaling produced a non-finite value");
|
|
101
|
+
}
|
|
102
|
+
correlation[row * dimensions + column] = value;
|
|
103
|
+
columnSum += Math.abs(value);
|
|
104
|
+
}
|
|
105
|
+
correlationOneNorm = Math.max(correlationOneNorm, columnSum);
|
|
106
|
+
}
|
|
107
|
+
const cholesky = new Float64Array(dimensions * dimensions);
|
|
108
|
+
for (let row = 0; row < dimensions; row++) {
|
|
109
|
+
for (let column = 0; column <= row; column++) {
|
|
110
|
+
let value = correlation[row * dimensions + column];
|
|
111
|
+
for (let k = 0; k < column; k++) {
|
|
112
|
+
value -= cholesky[row * dimensions + k] *
|
|
113
|
+
cholesky[column * dimensions + k];
|
|
114
|
+
}
|
|
115
|
+
if (row === column) {
|
|
116
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
117
|
+
throw singularCovariance(`correlation-scaled Cholesky pivot ${row + 1} is not positive`);
|
|
118
|
+
}
|
|
119
|
+
cholesky[row * dimensions + column] = Math.sqrt(value);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
cholesky[row * dimensions + column] = value /
|
|
123
|
+
cholesky[column * dimensions + column];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const inverseOneNorm = estimateInverseOneNorm(cholesky, dimensions);
|
|
128
|
+
const reciprocalCondition = 1 / (correlationOneNorm * inverseOneNorm);
|
|
129
|
+
// This is the usual dimension-scaled floating-point rank tolerance, with a
|
|
130
|
+
// modest safety factor for covariance aggregation and subsequent row solves.
|
|
131
|
+
const tolerance = instabilityMultiplier * dimensions * Number.EPSILON;
|
|
132
|
+
if (!Number.isFinite(reciprocalCondition) || reciprocalCondition <= tolerance) {
|
|
133
|
+
throw singularCovariance(`estimated reciprocal condition ${reciprocalCondition} is at or below ${tolerance}`);
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
dimensions,
|
|
137
|
+
covariance,
|
|
138
|
+
scales,
|
|
139
|
+
cholesky,
|
|
140
|
+
reciprocalCondition,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** Solves covariance * x = rightHandSide through the scaled Cholesky factor. */
|
|
144
|
+
function solveCovariance(factor, rightHandSide) {
|
|
145
|
+
const { dimensions, scales, cholesky } = factor;
|
|
146
|
+
if (rightHandSide.length !== dimensions) {
|
|
147
|
+
throw new Error(`Expected a right-hand side with ${dimensions} values, received ${rightHandSide.length}.`);
|
|
148
|
+
}
|
|
149
|
+
const scaled = new Float64Array(dimensions);
|
|
150
|
+
for (let i = 0; i < dimensions; i++) {
|
|
151
|
+
if (!Number.isFinite(rightHandSide[i])) {
|
|
152
|
+
throw new Error("The covariance solve requires finite values.");
|
|
153
|
+
}
|
|
154
|
+
scaled[i] = rightHandSide[i] / scales[i];
|
|
155
|
+
}
|
|
156
|
+
const solution = solveCorrelation(cholesky, dimensions, scaled);
|
|
157
|
+
for (let i = 0; i < dimensions; i++) {
|
|
158
|
+
solution[i] /= scales[i];
|
|
159
|
+
if (!Number.isFinite(solution[i])) {
|
|
160
|
+
throw singularCovariance("the linear solve produced a non-finite value");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return solution;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Returns the lower-triangular transform whose squared norm is Mahalanobis
|
|
167
|
+
* squared distance. This inverts only the Cholesky factor, never covariance.
|
|
168
|
+
*/
|
|
169
|
+
function covarianceWhitening(factor) {
|
|
170
|
+
const { dimensions, scales, cholesky } = factor;
|
|
171
|
+
const whitening = new Float64Array(dimensions * dimensions);
|
|
172
|
+
// Invert the triangular correlation factor first, then apply feature units.
|
|
173
|
+
// Keeping units out of the recurrence avoids repeated underflow/rounding of
|
|
174
|
+
// the same coefficient, and visits only the nonzero triangle.
|
|
175
|
+
for (let column = 0; column < dimensions; column++) {
|
|
176
|
+
for (let row = column; row < dimensions; row++) {
|
|
177
|
+
let value = row === column ? 1 : 0;
|
|
178
|
+
for (let k = column; k < row; k++) {
|
|
179
|
+
value -= cholesky[row * dimensions + k] *
|
|
180
|
+
whitening[k * dimensions + column];
|
|
181
|
+
}
|
|
182
|
+
whitening[row * dimensions + column] = value /
|
|
183
|
+
cholesky[row * dimensions + row];
|
|
184
|
+
}
|
|
185
|
+
for (let row = column; row < dimensions; row++) {
|
|
186
|
+
const index = row * dimensions + column;
|
|
187
|
+
whitening[index] /= scales[column];
|
|
188
|
+
if (!Number.isFinite(whitening[index])) {
|
|
189
|
+
throw singularCovariance("the whitening transform produced a non-finite value");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return whitening;
|
|
194
|
+
}
|
|
@@ -2,14 +2,16 @@ import type SimpleTable from "../class/SimpleTable.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Returns the only geometry column in a table.
|
|
4
4
|
*
|
|
5
|
-
* @param simpleTable - The table to inspect.
|
|
6
|
-
* @param method - The SDA method requesting a geometry column.
|
|
7
|
-
* @returns A promise resolving to the name of the only geometry column.
|
|
8
|
-
*
|
|
9
5
|
* @example
|
|
10
6
|
* ```ts
|
|
11
7
|
* const column = await findGeoColumn(table, "getGeoData()");
|
|
12
8
|
* ```
|
|
9
|
+
*
|
|
10
|
+
* @param simpleTable - The table to inspect.
|
|
11
|
+
*
|
|
12
|
+
* @param method - The SDA method requesting a geometry column.
|
|
13
|
+
*
|
|
14
|
+
* @returns A promise resolving to the name of the only geometry column.
|
|
13
15
|
*/
|
|
14
16
|
export default function findGeoColumn(simpleTable: SimpleTable, method: string): Promise<string>;
|
|
15
17
|
//# sourceMappingURL=findGeoColumn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findGeoColumn.d.ts","sourceRoot":"","sources":["../../src/helpers/findGeoColumn.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"findGeoColumn.d.ts","sourceRoot":"","sources":["../../src/helpers/findGeoColumn.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,wBAA8B,aAAa,CACzC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAMjB"}
|
|
@@ -8,14 +8,16 @@ const findGeoColumnFromSchema_js_1 = __importDefault(require("./findGeoColumnFro
|
|
|
8
8
|
/**
|
|
9
9
|
* Returns the only geometry column in a table.
|
|
10
10
|
*
|
|
11
|
-
* @param simpleTable - The table to inspect.
|
|
12
|
-
* @param method - The SDA method requesting a geometry column.
|
|
13
|
-
* @returns A promise resolving to the name of the only geometry column.
|
|
14
|
-
*
|
|
15
11
|
* @example
|
|
16
12
|
* ```ts
|
|
17
13
|
* const column = await findGeoColumn(table, "getGeoData()");
|
|
18
14
|
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param simpleTable - The table to inspect.
|
|
17
|
+
*
|
|
18
|
+
* @param method - The SDA method requesting a geometry column.
|
|
19
|
+
*
|
|
20
|
+
* @returns A promise resolving to the name of the only geometry column.
|
|
19
21
|
*/
|
|
20
22
|
async function findGeoColumn(simpleTable, method) {
|
|
21
23
|
return (0, findGeoColumnFromSchema_js_1.default)(await simpleTable.getTypes(), method, simpleTable.name);
|
|
@@ -2,11 +2,6 @@ import type { TableSchema } from "./pendingOps.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Returns the only geometry column in a table schema.
|
|
4
4
|
*
|
|
5
|
-
* @param types - The table schema to inspect.
|
|
6
|
-
* @param method - The SDA method requesting a geometry column.
|
|
7
|
-
* @param tableName - The name of the table represented by the schema.
|
|
8
|
-
* @returns The name of the only geometry column.
|
|
9
|
-
*
|
|
10
5
|
* @example
|
|
11
6
|
* ```ts
|
|
12
7
|
* const column = findGeoColumnFromSchema(
|
|
@@ -15,6 +10,14 @@ import type { TableSchema } from "./pendingOps.js";
|
|
|
15
10
|
* "places",
|
|
16
11
|
* );
|
|
17
12
|
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param types - The table schema to inspect.
|
|
15
|
+
*
|
|
16
|
+
* @param method - The SDA method requesting a geometry column.
|
|
17
|
+
*
|
|
18
|
+
* @param tableName - The name of the table represented by the schema.
|
|
19
|
+
*
|
|
20
|
+
* @returns The name of the only geometry column.
|
|
18
21
|
*/
|
|
19
22
|
export default function findGeoColumnFromSchema(types: TableSchema, method: string, tableName: string): string;
|
|
20
23
|
//# sourceMappingURL=findGeoColumnFromSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findGeoColumnFromSchema.d.ts","sourceRoot":"","sources":["../../src/helpers/findGeoColumnFromSchema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"findGeoColumnFromSchema.d.ts","sourceRoot":"","sources":["../../src/helpers/findGeoColumnFromSchema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,MAAM,CAoBR"}
|