@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
|
@@ -0,0 +1,29 @@
|
|
|
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 = prepareUmapLayoutOptions;
|
|
7
|
+
const fitUmapCurve_js_1 = __importDefault(require("./fitUmapCurve.js"));
|
|
8
|
+
// Resolve and validate settings before database work, fitting the curve once.
|
|
9
|
+
function prepareUmapLayoutOptions(options = {}) {
|
|
10
|
+
const { epochs = 200, seed = 42, minDistance = 0.1, learningRate = 1, negativeSamples = 5, } = options;
|
|
11
|
+
for (const [key, value] of Object.entries({ epochs, negativeSamples })) {
|
|
12
|
+
if (!Number.isSafeInteger(value) || value < 1) {
|
|
13
|
+
throw new Error(`${key} must be a positive safe integer.`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (!Number.isInteger(seed) || seed < 0 || seed > 0xffffffff) {
|
|
17
|
+
throw new Error("seed must be an integer between 0 and 4294967295.");
|
|
18
|
+
}
|
|
19
|
+
if (!Number.isFinite(learningRate) || learningRate <= 0) {
|
|
20
|
+
throw new Error("learningRate must be finite and positive.");
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
epochs,
|
|
24
|
+
seed,
|
|
25
|
+
learningRate,
|
|
26
|
+
negativeSamples,
|
|
27
|
+
curve: (0, fitUmapCurve_js_1.default)(minDistance),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -3,14 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The function can calculate the duration from a given start time to the current time, or between a specified start and end time. It provides options for logging the output directly to the console and adding custom prefixes or suffixes to the formatted string. Note that for simplicity, months are approximated as 30 days and years as 365 days.
|
|
5
5
|
*
|
|
6
|
-
* @param start - The starting point of the duration. This can be a `Date` object or a Unix timestamp (number of milliseconds since epoch).
|
|
7
|
-
* @param options - Optional settings to customize the duration formatting and output.
|
|
8
|
-
* @param options.log - If `true`, the formatted duration string will be logged to the console. Defaults to `false`.
|
|
9
|
-
* @param options.end - The ending point of the duration. This can be a `Date` object or a Unix timestamp. If omitted, the current time (`Date.now()`) will be used as the end point.
|
|
10
|
-
* @param options.prefix - A string to prepend to the formatted duration string (e.g., "Elapsed time: ").
|
|
11
|
-
* @param options.suffix - A string to append to the formatted duration string (e.g., " (Task completed)").
|
|
12
|
-
* @returns A human-readable string representing the duration.
|
|
13
|
-
*
|
|
14
6
|
* @example
|
|
15
7
|
* ```ts
|
|
16
8
|
* // A starting Date somewhere in your code.
|
|
@@ -20,6 +12,7 @@
|
|
|
20
12
|
* const duration = prettyDuration(startDate);
|
|
21
13
|
* console.log(duration); // Returns something like "22 days, 6 h, 3 min, 15 sec, 3 ms"
|
|
22
14
|
* ```
|
|
15
|
+
*
|
|
23
16
|
* @example
|
|
24
17
|
* ```ts
|
|
25
18
|
* // If you want to console.log it directly, set the `log` option to `true`.
|
|
@@ -28,6 +21,7 @@
|
|
|
28
21
|
* // ... some operations ...
|
|
29
22
|
* prettyDuration(startDateForLog, { log: true });
|
|
30
23
|
* ```
|
|
24
|
+
*
|
|
31
25
|
* @example
|
|
32
26
|
* ```ts
|
|
33
27
|
* // You can also use a prefix and/or suffix for the output string.
|
|
@@ -36,6 +30,7 @@
|
|
|
36
30
|
* prettyDuration(startDateWithPrefixSuffix, { log: true, prefix: "Elapsed time: ", suffix: " (Main function)" });
|
|
37
31
|
* // Returns and logs something like "Total duration: 3 min, 15 sec, 3 ms (Main function)"
|
|
38
32
|
* ```
|
|
33
|
+
*
|
|
39
34
|
* @example
|
|
40
35
|
* ```ts
|
|
41
36
|
* // If you want to format the duration between two specific dates, use the `end` option.
|
|
@@ -44,6 +39,17 @@
|
|
|
44
39
|
* const specificDuration = prettyDuration(start, { end });
|
|
45
40
|
* console.log(specificDuration); // Returns "22 days, 6 h, 3 min, 15 sec, 0 ms"
|
|
46
41
|
* ```
|
|
42
|
+
*
|
|
43
|
+
* @param start - The starting point of the duration. This can be a `Date` object or a Unix timestamp (number of milliseconds since epoch).
|
|
44
|
+
*
|
|
45
|
+
* @param options - Optional settings to customize the duration formatting and output.
|
|
46
|
+
* @param options.log - If `true`, the formatted duration string will be logged to the console. Defaults to `false`.
|
|
47
|
+
* @param options.end - The ending point of the duration. This can be a `Date` object or a Unix timestamp. If omitted, the current time (`Date.now()`) will be used as the end point.
|
|
48
|
+
* @param options.prefix - A string to prepend to the formatted duration string (e.g., "Elapsed time: ").
|
|
49
|
+
* @param options.suffix - A string to append to the formatted duration string (e.g., " (Task completed)").
|
|
50
|
+
*
|
|
51
|
+
* @returns A human-readable string representing the duration.
|
|
52
|
+
*
|
|
47
53
|
* @category Formatting
|
|
48
54
|
*/
|
|
49
55
|
export default function prettyDuration(start: Date | number, options?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettyDuration.d.ts","sourceRoot":"","sources":["../../src/helpers/prettyDuration.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"prettyDuration.d.ts","sourceRoot":"","sources":["../../src/helpers/prettyDuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,KAAK,EAAE,IAAI,GAAG,MAAM,EACpB,OAAO,GAAE;IACP,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACZ,GACL,MAAM,CAuGR"}
|
|
@@ -6,14 +6,6 @@ exports.default = prettyDuration;
|
|
|
6
6
|
*
|
|
7
7
|
* The function can calculate the duration from a given start time to the current time, or between a specified start and end time. It provides options for logging the output directly to the console and adding custom prefixes or suffixes to the formatted string. Note that for simplicity, months are approximated as 30 days and years as 365 days.
|
|
8
8
|
*
|
|
9
|
-
* @param start - The starting point of the duration. This can be a `Date` object or a Unix timestamp (number of milliseconds since epoch).
|
|
10
|
-
* @param options - Optional settings to customize the duration formatting and output.
|
|
11
|
-
* @param options.log - If `true`, the formatted duration string will be logged to the console. Defaults to `false`.
|
|
12
|
-
* @param options.end - The ending point of the duration. This can be a `Date` object or a Unix timestamp. If omitted, the current time (`Date.now()`) will be used as the end point.
|
|
13
|
-
* @param options.prefix - A string to prepend to the formatted duration string (e.g., "Elapsed time: ").
|
|
14
|
-
* @param options.suffix - A string to append to the formatted duration string (e.g., " (Task completed)").
|
|
15
|
-
* @returns A human-readable string representing the duration.
|
|
16
|
-
*
|
|
17
9
|
* @example
|
|
18
10
|
* ```ts
|
|
19
11
|
* // A starting Date somewhere in your code.
|
|
@@ -23,6 +15,7 @@ exports.default = prettyDuration;
|
|
|
23
15
|
* const duration = prettyDuration(startDate);
|
|
24
16
|
* console.log(duration); // Returns something like "22 days, 6 h, 3 min, 15 sec, 3 ms"
|
|
25
17
|
* ```
|
|
18
|
+
*
|
|
26
19
|
* @example
|
|
27
20
|
* ```ts
|
|
28
21
|
* // If you want to console.log it directly, set the `log` option to `true`.
|
|
@@ -31,6 +24,7 @@ exports.default = prettyDuration;
|
|
|
31
24
|
* // ... some operations ...
|
|
32
25
|
* prettyDuration(startDateForLog, { log: true });
|
|
33
26
|
* ```
|
|
27
|
+
*
|
|
34
28
|
* @example
|
|
35
29
|
* ```ts
|
|
36
30
|
* // You can also use a prefix and/or suffix for the output string.
|
|
@@ -39,6 +33,7 @@ exports.default = prettyDuration;
|
|
|
39
33
|
* prettyDuration(startDateWithPrefixSuffix, { log: true, prefix: "Elapsed time: ", suffix: " (Main function)" });
|
|
40
34
|
* // Returns and logs something like "Total duration: 3 min, 15 sec, 3 ms (Main function)"
|
|
41
35
|
* ```
|
|
36
|
+
*
|
|
42
37
|
* @example
|
|
43
38
|
* ```ts
|
|
44
39
|
* // If you want to format the duration between two specific dates, use the `end` option.
|
|
@@ -47,6 +42,17 @@ exports.default = prettyDuration;
|
|
|
47
42
|
* const specificDuration = prettyDuration(start, { end });
|
|
48
43
|
* console.log(specificDuration); // Returns "22 days, 6 h, 3 min, 15 sec, 0 ms"
|
|
49
44
|
* ```
|
|
45
|
+
*
|
|
46
|
+
* @param start - The starting point of the duration. This can be a `Date` object or a Unix timestamp (number of milliseconds since epoch).
|
|
47
|
+
*
|
|
48
|
+
* @param options - Optional settings to customize the duration formatting and output.
|
|
49
|
+
* @param options.log - If `true`, the formatted duration string will be logged to the console. Defaults to `false`.
|
|
50
|
+
* @param options.end - The ending point of the duration. This can be a `Date` object or a Unix timestamp. If omitted, the current time (`Date.now()`) will be used as the end point.
|
|
51
|
+
* @param options.prefix - A string to prepend to the formatted duration string (e.g., "Elapsed time: ").
|
|
52
|
+
* @param options.suffix - A string to append to the formatted duration string (e.g., " (Task completed)").
|
|
53
|
+
*
|
|
54
|
+
* @returns A human-readable string representing the duration.
|
|
55
|
+
*
|
|
50
56
|
* @category Formatting
|
|
51
57
|
*/
|
|
52
58
|
function prettyDuration(start, options = {}) {
|
|
@@ -4,19 +4,6 @@
|
|
|
4
4
|
* handles multi-line content, making it ideal for displaying data with long
|
|
5
5
|
* column names and text values.
|
|
6
6
|
*
|
|
7
|
-
* @param data - An array of objects representing the rows of the table. Each
|
|
8
|
-
* object should have string keys.
|
|
9
|
-
* @param options - Optional configuration for table rendering.
|
|
10
|
-
* @param options.maxColumnWidth - The maximum width for any column (default:
|
|
11
|
-
* `75`). Headers and values exceeding this width will be wrapped at word
|
|
12
|
-
* boundaries.
|
|
13
|
-
* @param options.minColumnWidth - The minimum width for any column (default:
|
|
14
|
-
* `3`).
|
|
15
|
-
* @param options.typesRowIndex - The index of a row that contains type
|
|
16
|
-
* annotations (e.g. `"VARCHAR/string"`). This row will be rendered in grey.
|
|
17
|
-
* If omitted, no row is treated as a types row.
|
|
18
|
-
* @returns void - The table is printed directly to the console.
|
|
19
|
-
*
|
|
20
7
|
* @example
|
|
21
8
|
* ```typescript
|
|
22
9
|
* const data = [
|
|
@@ -37,6 +24,24 @@
|
|
|
37
24
|
* ];
|
|
38
25
|
* printTable([types, ...data], { typesRowIndex: 0 });
|
|
39
26
|
* ```
|
|
27
|
+
*
|
|
28
|
+
* @param data - An array of objects representing the rows of the table. Each
|
|
29
|
+
* object should have string keys.
|
|
30
|
+
*
|
|
31
|
+
* @param options - Optional configuration for table rendering.
|
|
32
|
+
*
|
|
33
|
+
* @param options.maxColumnWidth - The maximum width for any column (default:
|
|
34
|
+
* `75`). Headers and values exceeding this width will be wrapped at word
|
|
35
|
+
* boundaries.
|
|
36
|
+
*
|
|
37
|
+
* @param options.minColumnWidth - The minimum width for any column (default:
|
|
38
|
+
* `3`).
|
|
39
|
+
*
|
|
40
|
+
* @param options.typesRowIndex - The index of a row that contains type
|
|
41
|
+
* annotations (e.g. `"VARCHAR/string"`). This row will be rendered in grey.
|
|
42
|
+
* If omitted, no row is treated as a types row.
|
|
43
|
+
*
|
|
44
|
+
* @returns void - The table is printed directly to the console.
|
|
40
45
|
*/
|
|
41
46
|
export default function printTable(data: {
|
|
42
47
|
[key: string]: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printTable.d.ts","sourceRoot":"","sources":["../../src/helpers/printTable.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"printTable.d.ts","sourceRoot":"","sources":["../../src/helpers/printTable.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EAAE,EAClC,OAAO,CAAC,EAAE;IACR,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GACA,IAAI,CAgNN"}
|
|
@@ -12,19 +12,6 @@ const wrapString_js_1 = __importDefault(require("./wrapString.js"));
|
|
|
12
12
|
* handles multi-line content, making it ideal for displaying data with long
|
|
13
13
|
* column names and text values.
|
|
14
14
|
*
|
|
15
|
-
* @param data - An array of objects representing the rows of the table. Each
|
|
16
|
-
* object should have string keys.
|
|
17
|
-
* @param options - Optional configuration for table rendering.
|
|
18
|
-
* @param options.maxColumnWidth - The maximum width for any column (default:
|
|
19
|
-
* `75`). Headers and values exceeding this width will be wrapped at word
|
|
20
|
-
* boundaries.
|
|
21
|
-
* @param options.minColumnWidth - The minimum width for any column (default:
|
|
22
|
-
* `3`).
|
|
23
|
-
* @param options.typesRowIndex - The index of a row that contains type
|
|
24
|
-
* annotations (e.g. `"VARCHAR/string"`). This row will be rendered in grey.
|
|
25
|
-
* If omitted, no row is treated as a types row.
|
|
26
|
-
* @returns void - The table is printed directly to the console.
|
|
27
|
-
*
|
|
28
15
|
* @example
|
|
29
16
|
* ```typescript
|
|
30
17
|
* const data = [
|
|
@@ -45,6 +32,24 @@ const wrapString_js_1 = __importDefault(require("./wrapString.js"));
|
|
|
45
32
|
* ];
|
|
46
33
|
* printTable([types, ...data], { typesRowIndex: 0 });
|
|
47
34
|
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param data - An array of objects representing the rows of the table. Each
|
|
37
|
+
* object should have string keys.
|
|
38
|
+
*
|
|
39
|
+
* @param options - Optional configuration for table rendering.
|
|
40
|
+
*
|
|
41
|
+
* @param options.maxColumnWidth - The maximum width for any column (default:
|
|
42
|
+
* `75`). Headers and values exceeding this width will be wrapped at word
|
|
43
|
+
* boundaries.
|
|
44
|
+
*
|
|
45
|
+
* @param options.minColumnWidth - The minimum width for any column (default:
|
|
46
|
+
* `3`).
|
|
47
|
+
*
|
|
48
|
+
* @param options.typesRowIndex - The index of a row that contains type
|
|
49
|
+
* annotations (e.g. `"VARCHAR/string"`). This row will be rendered in grey.
|
|
50
|
+
* If omitted, no row is treated as a types row.
|
|
51
|
+
*
|
|
52
|
+
* @returns void - The table is printed directly to the console.
|
|
48
53
|
*/
|
|
49
54
|
function printTable(data, options) {
|
|
50
55
|
if (!data || data.length === 0) {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type SimpleTable from "../class/SimpleTable.js";
|
|
2
|
+
import type { PreparedNumericFeatures } from "./prepareNumericFeatures.js";
|
|
3
|
+
type PublicationOutput = {
|
|
4
|
+
/** Raw output-column name. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Trusted internal SQL evaluated with the prepared relation aliased as p. */
|
|
7
|
+
expression: string;
|
|
8
|
+
/** Raw source-column name to replace in its original position. */
|
|
9
|
+
replace?: string;
|
|
10
|
+
};
|
|
11
|
+
type PublicationResult = {
|
|
12
|
+
/** Raw relation name joined to the prepared rows. */
|
|
13
|
+
relation: string;
|
|
14
|
+
/** Raw row-identity column in the result relation. */
|
|
15
|
+
rowIdColumn: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Atomically publishes validated algorithm outputs from a prepared numeric
|
|
19
|
+
* feature snapshot. New outputs are appended, while replacements retain the
|
|
20
|
+
* source column's position. Existing native DuckDB indexes are recreated in
|
|
21
|
+
* the same transaction because CREATE OR REPLACE drops them.
|
|
22
|
+
*
|
|
23
|
+
* Output expressions are trusted internal SQL. They may reference `p`, the
|
|
24
|
+
* prepared relation alias, and `r` when a result relation is supplied. The
|
|
25
|
+
* consumer must fully compute and validate one result row per prepared row
|
|
26
|
+
* before calling this helper, and remains responsible for scratch cleanup.
|
|
27
|
+
*/
|
|
28
|
+
export default function publishPreparedColumns(table: SimpleTable, prepared: Pick<PreparedNumericFeatures, "relation" | "rowIdColumn" | "sourceColumns" | "sourceTemporary">, options: {
|
|
29
|
+
method: string;
|
|
30
|
+
parameters: {
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
} | null;
|
|
33
|
+
outputs: PublicationOutput[];
|
|
34
|
+
result?: PublicationResult;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=publishPreparedColumns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publishPreparedColumns.d.ts","sourceRoot":"","sources":["../../src/helpers/publishPreparedColumns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAM3E,KAAK,iBAAiB,GAAG;IACvB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAA8B,sBAAsB,CAClD,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,IAAI,CACZ,uBAAuB,EACrB,UAAU,GACV,aAAa,GACb,eAAe,GACf,iBAAiB,CACpB,EACD,OAAO,EAAE;IACP,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B,GACA,OAAO,CAAC,IAAI,CAAC,CAwFf"}
|
|
@@ -0,0 +1,119 @@
|
|
|
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 = publishPreparedColumns;
|
|
7
|
+
const foldIdentifier_js_1 = __importDefault(require("./foldIdentifier.js"));
|
|
8
|
+
const mergeOptions_js_1 = __importDefault(require("./mergeOptions.js"));
|
|
9
|
+
const queryDB_js_1 = __importDefault(require("./queryDB.js"));
|
|
10
|
+
const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
|
|
11
|
+
/**
|
|
12
|
+
* Atomically publishes validated algorithm outputs from a prepared numeric
|
|
13
|
+
* feature snapshot. New outputs are appended, while replacements retain the
|
|
14
|
+
* source column's position. Existing native DuckDB indexes are recreated in
|
|
15
|
+
* the same transaction because CREATE OR REPLACE drops them.
|
|
16
|
+
*
|
|
17
|
+
* Output expressions are trusted internal SQL. They may reference `p`, the
|
|
18
|
+
* prepared relation alias, and `r` when a result relation is supplied. The
|
|
19
|
+
* consumer must fully compute and validate one result row per prepared row
|
|
20
|
+
* before calling this helper, and remains responsible for scratch cleanup.
|
|
21
|
+
*/
|
|
22
|
+
async function publishPreparedColumns(table, prepared, options) {
|
|
23
|
+
validateOutputs(prepared.sourceColumns, options.outputs);
|
|
24
|
+
const connection = table.connection;
|
|
25
|
+
const q = quoteIdentifier_js_1.default;
|
|
26
|
+
const source = q(table.name);
|
|
27
|
+
const tableDetails = (await connection.runAndReadAll(`SELECT table_oid FROM duckdb_tables()
|
|
28
|
+
WHERE translate(table_name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = $1
|
|
29
|
+
AND schema_name = current_schema()
|
|
30
|
+
AND database_name IN (current_database(), 'temp')
|
|
31
|
+
AND temporary = $2
|
|
32
|
+
LIMIT 1`, [(0, foldIdentifier_js_1.default)(table.name), prepared.sourceTemporary])).getRowsJS()[0];
|
|
33
|
+
if (tableDetails === undefined) {
|
|
34
|
+
throw new Error(`${options.method} requires a materialized source table.`);
|
|
35
|
+
}
|
|
36
|
+
const tableOid = tableDetails[0];
|
|
37
|
+
if (typeof tableOid !== "number" && typeof tableOid !== "bigint") {
|
|
38
|
+
throw new Error(`${options.method} could not identify the source table.`);
|
|
39
|
+
}
|
|
40
|
+
const indexes = (await connection.runAndReadAll("SELECT sql FROM duckdb_indexes() WHERE table_oid = $1 ORDER BY index_name", [tableOid])).getRowsJS().map((row) => String(row[0]));
|
|
41
|
+
const replacements = new Map(options.outputs.filter((output) => output.replace !== undefined).map((output) => [(0, foldIdentifier_js_1.default)(output.replace), output]));
|
|
42
|
+
const select = prepared.sourceColumns.map((column) => {
|
|
43
|
+
const replacement = replacements.get((0, foldIdentifier_js_1.default)(column));
|
|
44
|
+
return replacement === undefined
|
|
45
|
+
? `p.${q(column)}`
|
|
46
|
+
: `${replacement.expression} AS ${q(column)}`;
|
|
47
|
+
});
|
|
48
|
+
for (const output of options.outputs) {
|
|
49
|
+
if (output.replace === undefined) {
|
|
50
|
+
select.push(`${output.expression} AS ${q(output.name)}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const resultJoin = options.result === undefined
|
|
54
|
+
? ""
|
|
55
|
+
: ` JOIN ${q(options.result.relation)} r
|
|
56
|
+
ON p.${q(prepared.rowIdColumn)} = r.${q(options.result.rowIdColumn)}`;
|
|
57
|
+
await connection.run("BEGIN TRANSACTION");
|
|
58
|
+
try {
|
|
59
|
+
await (0, queryDB_js_1.default)(table, `CREATE OR REPLACE ${prepared.sourceTemporary ? "TEMP " : ""}TABLE ${source} AS
|
|
60
|
+
SELECT ${select.join(", ")}
|
|
61
|
+
FROM ${q(prepared.relation)} p${resultJoin}
|
|
62
|
+
ORDER BY p.${q(prepared.rowIdColumn)}`, (0, mergeOptions_js_1.default)(table, {
|
|
63
|
+
table: table.name,
|
|
64
|
+
method: options.method,
|
|
65
|
+
parameters: options.parameters,
|
|
66
|
+
noClean: true,
|
|
67
|
+
}));
|
|
68
|
+
for (const sql of indexes) {
|
|
69
|
+
try {
|
|
70
|
+
await connection.run(sql);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
const detail = error instanceof Error ? ` ${error.message}` : "";
|
|
74
|
+
throw new Error(`${options.method} could not restore an existing DuckDB index while publishing its output. Remove or rebuild indexes that do not support the output column types.${detail}`, { cause: error });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
await connection.run("COMMIT");
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
try {
|
|
81
|
+
await connection.run("ROLLBACK");
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// DuckDB may already abort the transaction after an index-build error.
|
|
85
|
+
// Preserve the publication error that explains why the operation failed.
|
|
86
|
+
}
|
|
87
|
+
// UNIQUE violations can be deferred until COMMIT, which may also fail for
|
|
88
|
+
// unrelated reasons. Preserve that diagnostic instead of blaming indexes.
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function validateOutputs(sourceColumns, outputs) {
|
|
93
|
+
const outputNames = new Set();
|
|
94
|
+
const replacements = new Set();
|
|
95
|
+
for (const output of outputs) {
|
|
96
|
+
const outputName = (0, foldIdentifier_js_1.default)(output.name);
|
|
97
|
+
if (outputNames.has(outputName)) {
|
|
98
|
+
throw new Error(`Internal publication received duplicate output column ${(0, quoteIdentifier_js_1.default)(output.name)}.`);
|
|
99
|
+
}
|
|
100
|
+
outputNames.add(outputName);
|
|
101
|
+
if (output.replace === undefined) {
|
|
102
|
+
if (sourceColumns.some((column) => (0, foldIdentifier_js_1.default)(column) === outputName)) {
|
|
103
|
+
throw new Error(`Internal publication cannot append existing column ${(0, quoteIdentifier_js_1.default)(output.name)}.`);
|
|
104
|
+
}
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const replacement = (0, foldIdentifier_js_1.default)(output.replace);
|
|
108
|
+
if (outputName !== replacement) {
|
|
109
|
+
throw new Error(`Internal publication output ${(0, quoteIdentifier_js_1.default)(output.name)} must match its replacement column ${(0, quoteIdentifier_js_1.default)(output.replace)}.`);
|
|
110
|
+
}
|
|
111
|
+
if (!sourceColumns.some((column) => (0, foldIdentifier_js_1.default)(column) === replacement)) {
|
|
112
|
+
throw new Error(`Internal publication cannot replace missing column ${(0, quoteIdentifier_js_1.default)(output.replace)}.`);
|
|
113
|
+
}
|
|
114
|
+
if (replacements.has(replacement)) {
|
|
115
|
+
throw new Error(`Internal publication received duplicate replacement column ${(0, quoteIdentifier_js_1.default)(output.replace)}.`);
|
|
116
|
+
}
|
|
117
|
+
replacements.add(replacement);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -8,19 +8,6 @@ type DuckDBValue = NativeDuckDBValue;
|
|
|
8
8
|
* Starts the database on first use and applies its SQL logging settings.
|
|
9
9
|
* Extension authors can construct `options` with `mergeOptions()`.
|
|
10
10
|
*
|
|
11
|
-
* @param simple - The table or database that owns the query.
|
|
12
|
-
* @param query - The SQL statement to execute.
|
|
13
|
-
* @param options - Query execution and diagnostic settings.
|
|
14
|
-
* @param options.table - The table name used for diagnostics, or `null`.
|
|
15
|
-
* @param options.method - The calling method used for diagnostics, or `null`.
|
|
16
|
-
* @param options.parameters - Arguments included in error diagnostics, or `null`.
|
|
17
|
-
* @param options.rowsToLog - The caller's row-display limit, retained for compatibility.
|
|
18
|
-
* @param options.charsToLog - The caller's per-cell display limit, retained for compatibility.
|
|
19
|
-
* @param options.returnData - Whether to convert and return the result rows.
|
|
20
|
-
* @param options.values - DuckDB-native values bound to SQL placeholders, in order.
|
|
21
|
-
* @param options.noClean - Whether to preserve the SQL text without cleaning it.
|
|
22
|
-
* @returns Converted rows when `returnData` is true, otherwise `null`.
|
|
23
|
-
*
|
|
24
11
|
* @example
|
|
25
12
|
* ```ts
|
|
26
13
|
* import { mergeOptions, queryDB, quoteIdentifier } from "@nshiab/simple-data-analysis-core/helpers";
|
|
@@ -35,6 +22,30 @@ type DuckDBValue = NativeDuckDBValue;
|
|
|
35
22
|
* }));
|
|
36
23
|
* await table.log();
|
|
37
24
|
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param simple - The table or database that owns the query.
|
|
27
|
+
*
|
|
28
|
+
* @param query - The SQL statement to execute.
|
|
29
|
+
*
|
|
30
|
+
* @param options - Query execution and diagnostic settings.
|
|
31
|
+
*
|
|
32
|
+
* @param options.table - The table name used for diagnostics, or `null`.
|
|
33
|
+
*
|
|
34
|
+
* @param options.method - The calling method used for diagnostics, or `null`.
|
|
35
|
+
*
|
|
36
|
+
* @param options.parameters - Arguments included in error diagnostics, or `null`.
|
|
37
|
+
*
|
|
38
|
+
* @param options.rowsToLog - The caller's row-display limit, retained for compatibility.
|
|
39
|
+
*
|
|
40
|
+
* @param options.charsToLog - The caller's per-cell display limit, retained for compatibility.
|
|
41
|
+
*
|
|
42
|
+
* @param options.returnData - Whether to convert and return the result rows.
|
|
43
|
+
*
|
|
44
|
+
* @param options.values - DuckDB-native values bound to SQL placeholders, in order.
|
|
45
|
+
*
|
|
46
|
+
* @param options.noClean - Whether to preserve the SQL text without cleaning it.
|
|
47
|
+
*
|
|
48
|
+
* @returns Converted rows when `returnData` is true, otherwise `null`.
|
|
38
49
|
*/
|
|
39
50
|
export default function queryDB(simple: SimpleTable | SimpleDB, query: string, options: {
|
|
40
51
|
table: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryDB.d.ts","sourceRoot":"","sources":["../../src/helpers/queryDB.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAK5C,kGAAkG;AAClG,KAAK,WAAW,GAAG,iBAAiB,CAAC;AAErC
|
|
1
|
+
{"version":3,"file":"queryDB.d.ts","sourceRoot":"","sources":["../../src/helpers/queryDB.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAK5C,kGAAkG;AAClG,KAAK,WAAW,GAAG,iBAAiB,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAA8B,OAAO,CACnC,MAAM,EAAE,WAAW,GAAG,QAAQ,EAC9B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;IACP,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,OAAO,CACN;IACA,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,EAAE,GACD,IAAI,CACP,CAuDA"}
|
|
@@ -14,19 +14,6 @@ const cacheTableDependencies_js_1 = require("./cacheTableDependencies.js");
|
|
|
14
14
|
* Starts the database on first use and applies its SQL logging settings.
|
|
15
15
|
* Extension authors can construct `options` with `mergeOptions()`.
|
|
16
16
|
*
|
|
17
|
-
* @param simple - The table or database that owns the query.
|
|
18
|
-
* @param query - The SQL statement to execute.
|
|
19
|
-
* @param options - Query execution and diagnostic settings.
|
|
20
|
-
* @param options.table - The table name used for diagnostics, or `null`.
|
|
21
|
-
* @param options.method - The calling method used for diagnostics, or `null`.
|
|
22
|
-
* @param options.parameters - Arguments included in error diagnostics, or `null`.
|
|
23
|
-
* @param options.rowsToLog - The caller's row-display limit, retained for compatibility.
|
|
24
|
-
* @param options.charsToLog - The caller's per-cell display limit, retained for compatibility.
|
|
25
|
-
* @param options.returnData - Whether to convert and return the result rows.
|
|
26
|
-
* @param options.values - DuckDB-native values bound to SQL placeholders, in order.
|
|
27
|
-
* @param options.noClean - Whether to preserve the SQL text without cleaning it.
|
|
28
|
-
* @returns Converted rows when `returnData` is true, otherwise `null`.
|
|
29
|
-
*
|
|
30
17
|
* @example
|
|
31
18
|
* ```ts
|
|
32
19
|
* import { mergeOptions, queryDB, quoteIdentifier } from "@nshiab/simple-data-analysis-core/helpers";
|
|
@@ -41,6 +28,30 @@ const cacheTableDependencies_js_1 = require("./cacheTableDependencies.js");
|
|
|
41
28
|
* }));
|
|
42
29
|
* await table.log();
|
|
43
30
|
* ```
|
|
31
|
+
*
|
|
32
|
+
* @param simple - The table or database that owns the query.
|
|
33
|
+
*
|
|
34
|
+
* @param query - The SQL statement to execute.
|
|
35
|
+
*
|
|
36
|
+
* @param options - Query execution and diagnostic settings.
|
|
37
|
+
*
|
|
38
|
+
* @param options.table - The table name used for diagnostics, or `null`.
|
|
39
|
+
*
|
|
40
|
+
* @param options.method - The calling method used for diagnostics, or `null`.
|
|
41
|
+
*
|
|
42
|
+
* @param options.parameters - Arguments included in error diagnostics, or `null`.
|
|
43
|
+
*
|
|
44
|
+
* @param options.rowsToLog - The caller's row-display limit, retained for compatibility.
|
|
45
|
+
*
|
|
46
|
+
* @param options.charsToLog - The caller's per-cell display limit, retained for compatibility.
|
|
47
|
+
*
|
|
48
|
+
* @param options.returnData - Whether to convert and return the result rows.
|
|
49
|
+
*
|
|
50
|
+
* @param options.values - DuckDB-native values bound to SQL placeholders, in order.
|
|
51
|
+
*
|
|
52
|
+
* @param options.noClean - Whether to preserve the SQL text without cleaning it.
|
|
53
|
+
*
|
|
54
|
+
* @returns Converted rows when `returnData` is true, otherwise `null`.
|
|
44
55
|
*/
|
|
45
56
|
async function queryDB(simple, query, options) {
|
|
46
57
|
if (simple instanceof SimpleTable_js_1.default) {
|
|
@@ -15,13 +15,6 @@ import type SimpleTable from "../class/SimpleTable.js";
|
|
|
15
15
|
* the failing table's remaining chain is aborted, but unexecuted work for other
|
|
16
16
|
* tables is requeued for their next observation.
|
|
17
17
|
*
|
|
18
|
-
* @param simpleTable - The table whose chain owns the asynchronous work.
|
|
19
|
-
* @param operation - The asynchronous extension operation to queue.
|
|
20
|
-
* @param operation.method - The public method name used for diagnostics.
|
|
21
|
-
* @param operation.parameters - A snapshot of the public method parameters used for diagnostics.
|
|
22
|
-
* @param operation.execute - The asynchronous work to run at the barrier's position in the chain.
|
|
23
|
-
* @returns Nothing. The public builder should return its target table.
|
|
24
|
-
*
|
|
25
18
|
* @example
|
|
26
19
|
* ```ts
|
|
27
20
|
* import type { SimpleTable } from "@nshiab/simple-data-analysis-core";
|
|
@@ -40,6 +33,18 @@ import type SimpleTable from "../class/SimpleTable.js";
|
|
|
40
33
|
* return table;
|
|
41
34
|
* }
|
|
42
35
|
* ```
|
|
36
|
+
*
|
|
37
|
+
* @param simpleTable - The table whose chain owns the asynchronous work.
|
|
38
|
+
*
|
|
39
|
+
* @param operation - The asynchronous extension operation to queue.
|
|
40
|
+
*
|
|
41
|
+
* @param operation.method - The public method name used for diagnostics.
|
|
42
|
+
*
|
|
43
|
+
* @param operation.parameters - A snapshot of the public method parameters used for diagnostics.
|
|
44
|
+
*
|
|
45
|
+
* @param operation.execute - The asynchronous work to run at the barrier's position in the chain.
|
|
46
|
+
*
|
|
47
|
+
* @returns Nothing. The public builder should return its target table.
|
|
43
48
|
*/
|
|
44
49
|
export default function queueAsyncBarrier(simpleTable: SimpleTable, operation: {
|
|
45
50
|
method: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queueAsyncBarrier.d.ts","sourceRoot":"","sources":["../../src/helpers/queueAsyncBarrier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAGvD
|
|
1
|
+
{"version":3,"file":"queueAsyncBarrier.d.ts","sourceRoot":"","sources":["../../src/helpers/queueAsyncBarrier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE;IACT,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,GACA,IAAI,CAKN"}
|
|
@@ -21,13 +21,6 @@ const queueOp_js_1 = __importDefault(require("./queueOp.js"));
|
|
|
21
21
|
* the failing table's remaining chain is aborted, but unexecuted work for other
|
|
22
22
|
* tables is requeued for their next observation.
|
|
23
23
|
*
|
|
24
|
-
* @param simpleTable - The table whose chain owns the asynchronous work.
|
|
25
|
-
* @param operation - The asynchronous extension operation to queue.
|
|
26
|
-
* @param operation.method - The public method name used for diagnostics.
|
|
27
|
-
* @param operation.parameters - A snapshot of the public method parameters used for diagnostics.
|
|
28
|
-
* @param operation.execute - The asynchronous work to run at the barrier's position in the chain.
|
|
29
|
-
* @returns Nothing. The public builder should return its target table.
|
|
30
|
-
*
|
|
31
24
|
* @example
|
|
32
25
|
* ```ts
|
|
33
26
|
* import type { SimpleTable } from "@nshiab/simple-data-analysis-core";
|
|
@@ -46,6 +39,18 @@ const queueOp_js_1 = __importDefault(require("./queueOp.js"));
|
|
|
46
39
|
* return table;
|
|
47
40
|
* }
|
|
48
41
|
* ```
|
|
42
|
+
*
|
|
43
|
+
* @param simpleTable - The table whose chain owns the asynchronous work.
|
|
44
|
+
*
|
|
45
|
+
* @param operation - The asynchronous extension operation to queue.
|
|
46
|
+
*
|
|
47
|
+
* @param operation.method - The public method name used for diagnostics.
|
|
48
|
+
*
|
|
49
|
+
* @param operation.parameters - A snapshot of the public method parameters used for diagnostics.
|
|
50
|
+
*
|
|
51
|
+
* @param operation.execute - The asynchronous work to run at the barrier's position in the chain.
|
|
52
|
+
*
|
|
53
|
+
* @returns Nothing. The public builder should return its target table.
|
|
49
54
|
*/
|
|
50
55
|
function queueAsyncBarrier(simpleTable, operation) {
|
|
51
56
|
(0, queueOp_js_1.default)(simpleTable, {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DuckDBValue } from "@duckdb/node-api";
|
|
2
|
+
import type SimpleTable from "../class/SimpleTable.js";
|
|
3
|
+
import type { TableSchema } from "./pendingOps.js";
|
|
4
|
+
type GraphResult = {
|
|
5
|
+
buildSelect: (input: string, schema: TableSchema) => string;
|
|
6
|
+
method: string;
|
|
7
|
+
outputSchema: (schema: TableSchema) => TableSchema;
|
|
8
|
+
outputTable?: string | boolean;
|
|
9
|
+
parameters: {
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
preflight?: (input: SimpleTable) => Promise<void>;
|
|
13
|
+
values: (schema: TableSchema) => DuckDBValue[];
|
|
14
|
+
};
|
|
15
|
+
/** Queues a graph SELECT for overwrite or a source-preserving output table. */
|
|
16
|
+
export default function queueGraphResult(simpleTable: SimpleTable, result: GraphResult): SimpleTable;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=queueGraphResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queueGraphResult.d.ts","sourceRoot":"","sources":["../../src/helpers/queueGraphResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAKnD,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,MAAM,CAAC;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,WAAW,CAAC;IACnD,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACvC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,WAAW,EAAE,CAAC;CAChD,CAAC;AAEF,+EAA+E;AAC/E,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,WAAW,GAClB,WAAW,CAqCb"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 = queueGraphResult;
|
|
7
|
+
const queueOp_js_1 = __importDefault(require("./queueOp.js"));
|
|
8
|
+
const quoteIdentifier_js_1 = __importDefault(require("./quoteIdentifier.js"));
|
|
9
|
+
const resolveOutputTable_js_1 = __importDefault(require("./resolveOutputTable.js"));
|
|
10
|
+
/** Queues a graph SELECT for overwrite or a source-preserving output table. */
|
|
11
|
+
function queueGraphResult(simpleTable, result) {
|
|
12
|
+
const resolvedOutput = (0, resolveOutputTable_js_1.default)(simpleTable, result.outputTable);
|
|
13
|
+
const outputTable = typeof resolvedOutput === "string"
|
|
14
|
+
? simpleTable.sdb.newTable(resolvedOutput)
|
|
15
|
+
: simpleTable;
|
|
16
|
+
if (outputTable !== simpleTable) {
|
|
17
|
+
(0, queueOp_js_1.default)(outputTable, {
|
|
18
|
+
kind: "source",
|
|
19
|
+
method: result.method,
|
|
20
|
+
parameters: result.parameters,
|
|
21
|
+
rawSQL: [(0, quoteIdentifier_js_1.default)(simpleTable.name)],
|
|
22
|
+
buildSelect: () => `SELECT * FROM ${(0, quoteIdentifier_js_1.default)(simpleTable.name)}`,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
// A separate barrier keeps invalid-event checks observable after LIMIT 0.
|
|
26
|
+
const preflight = result.preflight;
|
|
27
|
+
if (preflight !== undefined) {
|
|
28
|
+
(0, queueOp_js_1.default)(outputTable, {
|
|
29
|
+
kind: "barrier",
|
|
30
|
+
method: result.method,
|
|
31
|
+
parameters: result.parameters,
|
|
32
|
+
execute: () => preflight(outputTable),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
(0, queueOp_js_1.default)(outputTable, {
|
|
36
|
+
kind: "fusable",
|
|
37
|
+
method: result.method,
|
|
38
|
+
parameters: result.parameters,
|
|
39
|
+
needsSchema: true,
|
|
40
|
+
values: result.values,
|
|
41
|
+
buildSelect: result.buildSelect,
|
|
42
|
+
outputSchema: result.outputSchema,
|
|
43
|
+
});
|
|
44
|
+
return outputTable;
|
|
45
|
+
}
|