@nshiab/simple-data-analysis-core 0.0.12
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/LICENSE +20 -0
- package/README.md +43 -0
- package/esm/class/Simple.d.ts +66 -0
- package/esm/class/Simple.d.ts.map +1 -0
- package/esm/class/Simple.js +94 -0
- package/esm/class/SimpleDB.d.ts +487 -0
- package/esm/class/SimpleDB.d.ts.map +1 -0
- package/esm/class/SimpleDB.js +807 -0
- package/esm/class/SimpleTable.d.ts +4408 -0
- package/esm/class/SimpleTable.d.ts.map +1 -0
- package/esm/class/SimpleTable.js +5401 -0
- package/esm/helpers/accumulateQuery.d.ts +4 -0
- package/esm/helpers/accumulateQuery.d.ts.map +1 -0
- package/esm/helpers/accumulateQuery.js +15 -0
- package/esm/helpers/camelCase.d.ts +30 -0
- package/esm/helpers/camelCase.d.ts.map +1 -0
- package/esm/helpers/camelCase.js +45 -0
- package/esm/helpers/capitalize.d.ts +28 -0
- package/esm/helpers/capitalize.d.ts.map +1 -0
- package/esm/helpers/capitalize.js +33 -0
- package/esm/helpers/checkVssIndexes.d.ts +2 -0
- package/esm/helpers/checkVssIndexes.d.ts.map +1 -0
- package/esm/helpers/checkVssIndexes.js +16 -0
- package/esm/helpers/cleanCache.d.ts +3 -0
- package/esm/helpers/cleanCache.d.ts.map +1 -0
- package/esm/helpers/cleanCache.js +17 -0
- package/esm/helpers/cleanPath.d.ts +2 -0
- package/esm/helpers/cleanPath.d.ts.map +1 -0
- package/esm/helpers/cleanPath.js +3 -0
- package/esm/helpers/cleanSQL.d.ts +2 -0
- package/esm/helpers/cleanSQL.d.ts.map +1 -0
- package/esm/helpers/cleanSQL.js +24 -0
- package/esm/helpers/concatenateRowQuery.d.ts +2 -0
- package/esm/helpers/concatenateRowQuery.d.ts.map +1 -0
- package/esm/helpers/concatenateRowQuery.js +9 -0
- package/esm/helpers/convertForJS.d.ts +6 -0
- package/esm/helpers/convertForJS.d.ts.map +1 -0
- package/esm/helpers/convertForJS.js +39 -0
- package/esm/helpers/createDirectory.d.ts +2 -0
- package/esm/helpers/createDirectory.d.ts.map +1 -0
- package/esm/helpers/createDirectory.js +10 -0
- package/esm/helpers/csvFormat.d.ts +3 -0
- package/esm/helpers/csvFormat.d.ts.map +1 -0
- package/esm/helpers/csvFormat.js +165 -0
- package/esm/helpers/dataToArrays.d.ts +51 -0
- package/esm/helpers/dataToArrays.d.ts.map +1 -0
- package/esm/helpers/dataToArrays.js +55 -0
- package/esm/helpers/extractTypes.d.ts +6 -0
- package/esm/helpers/extractTypes.d.ts.map +1 -0
- package/esm/helpers/extractTypes.js +11 -0
- package/esm/helpers/findGeoColumn.d.ts +3 -0
- package/esm/helpers/findGeoColumn.d.ts.map +1 -0
- package/esm/helpers/findGeoColumn.js +18 -0
- package/esm/helpers/formatDate.d.ts +34 -0
- package/esm/helpers/formatDate.d.ts.map +1 -0
- package/esm/helpers/formatDate.js +69 -0
- package/esm/helpers/formatNumber.d.ts +46 -0
- package/esm/helpers/formatNumber.d.ts.map +1 -0
- package/esm/helpers/formatNumber.js +122 -0
- package/esm/helpers/getCombinations.d.ts +3 -0
- package/esm/helpers/getCombinations.d.ts.map +1 -0
- package/esm/helpers/getCombinations.js +24 -0
- package/esm/helpers/getExtension.d.ts +2 -0
- package/esm/helpers/getExtension.d.ts.map +1 -0
- package/esm/helpers/getExtension.js +9 -0
- package/esm/helpers/getIdenticalColumns.d.ts +2 -0
- package/esm/helpers/getIdenticalColumns.d.ts.map +1 -0
- package/esm/helpers/getIdenticalColumns.js +3 -0
- package/esm/helpers/getName.d.ts +2 -0
- package/esm/helpers/getName.d.ts.map +1 -0
- package/esm/helpers/getName.js +14 -0
- package/esm/helpers/getProjection.d.ts +3 -0
- package/esm/helpers/getProjection.d.ts.map +1 -0
- package/esm/helpers/getProjection.js +22 -0
- package/esm/helpers/getProjectionParquet.d.ts +3 -0
- package/esm/helpers/getProjectionParquet.d.ts.map +1 -0
- package/esm/helpers/getProjectionParquet.js +24 -0
- package/esm/helpers/index.d.ts +20 -0
- package/esm/helpers/index.d.ts.map +1 -0
- package/esm/helpers/index.js +19 -0
- package/esm/helpers/keepNumericalColumns.d.ts +4 -0
- package/esm/helpers/keepNumericalColumns.d.ts.map +1 -0
- package/esm/helpers/keepNumericalColumns.js +13 -0
- package/esm/helpers/logData.d.ts +6 -0
- package/esm/helpers/logData.d.ts.map +1 -0
- package/esm/helpers/logData.js +48 -0
- package/esm/helpers/mergeOptions.d.ts +28 -0
- package/esm/helpers/mergeOptions.d.ts.map +1 -0
- package/esm/helpers/mergeOptions.js +12 -0
- package/esm/helpers/nestQuery.d.ts +2 -0
- package/esm/helpers/nestQuery.d.ts.map +1 -0
- package/esm/helpers/nestQuery.js +13 -0
- package/esm/helpers/parseDuckDBType.d.ts +2 -0
- package/esm/helpers/parseDuckDBType.d.ts.map +1 -0
- package/esm/helpers/parseDuckDBType.js +38 -0
- package/esm/helpers/parseTypes.d.ts +2 -0
- package/esm/helpers/parseTypes.d.ts.map +1 -0
- package/esm/helpers/parseTypes.js +35 -0
- package/esm/helpers/parseValue.d.ts +2 -0
- package/esm/helpers/parseValue.d.ts.map +1 -0
- package/esm/helpers/parseValue.js +20 -0
- package/esm/helpers/prettyDuration.d.ts +55 -0
- package/esm/helpers/prettyDuration.d.ts.map +1 -0
- package/esm/helpers/prettyDuration.js +145 -0
- package/esm/helpers/printTable.d.ts +47 -0
- package/esm/helpers/printTable.d.ts.map +1 -0
- package/esm/helpers/printTable.js +217 -0
- package/esm/helpers/queryDB.d.ts +19 -0
- package/esm/helpers/queryDB.d.ts.map +1 -0
- package/esm/helpers/queryDB.js +62 -0
- package/esm/helpers/rewind.d.ts +3 -0
- package/esm/helpers/rewind.d.ts.map +1 -0
- package/esm/helpers/rewind.js +1293 -0
- package/esm/helpers/runQuery.d.ts +14 -0
- package/esm/helpers/runQuery.d.ts.map +1 -0
- package/esm/helpers/runQuery.js +26 -0
- package/esm/helpers/setDbProps.d.ts +3 -0
- package/esm/helpers/setDbProps.d.ts.map +1 -0
- package/esm/helpers/setDbProps.js +25 -0
- package/esm/helpers/shouldFlipBeforeExport.d.ts +2 -0
- package/esm/helpers/shouldFlipBeforeExport.d.ts.map +1 -0
- package/esm/helpers/shouldFlipBeforeExport.js +3 -0
- package/esm/helpers/stringToArray.d.ts +2 -0
- package/esm/helpers/stringToArray.d.ts.map +1 -0
- package/esm/helpers/stringToArray.js +11 -0
- package/esm/helpers/stringifyDates.d.ts +5 -0
- package/esm/helpers/stringifyDates.d.ts.map +1 -0
- package/esm/helpers/stringifyDates.js +14 -0
- package/esm/helpers/stringifyDatesInvert.d.ts +5 -0
- package/esm/helpers/stringifyDatesInvert.d.ts.map +1 -0
- package/esm/helpers/stringifyDatesInvert.js +14 -0
- package/esm/helpers/unifyColumns.d.ts +9 -0
- package/esm/helpers/unifyColumns.d.ts.map +1 -0
- package/esm/helpers/unifyColumns.js +21 -0
- package/esm/helpers/unnestQuery.d.ts +2 -0
- package/esm/helpers/unnestQuery.d.ts.map +1 -0
- package/esm/helpers/unnestQuery.js +8 -0
- package/esm/helpers/wrapString.d.ts +35 -0
- package/esm/helpers/wrapString.d.ts.map +1 -0
- package/esm/helpers/wrapString.js +83 -0
- package/esm/helpers/writeDataAsArrays.d.ts +3 -0
- package/esm/helpers/writeDataAsArrays.d.ts.map +1 -0
- package/esm/helpers/writeDataAsArrays.js +13 -0
- package/esm/helpers/writeProjectionsAndIndexes.d.ts +3 -0
- package/esm/helpers/writeProjectionsAndIndexes.d.ts.map +1 -0
- package/esm/helpers/writeProjectionsAndIndexes.js +29 -0
- package/esm/index.d.ts +31 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +30 -0
- package/esm/methods/aggregateGeoQuery.d.ts +5 -0
- package/esm/methods/aggregateGeoQuery.d.ts.map +1 -0
- package/esm/methods/aggregateGeoQuery.js +24 -0
- package/esm/methods/binsQuery.d.ts +5 -0
- package/esm/methods/binsQuery.d.ts.map +1 -0
- package/esm/methods/binsQuery.js +40 -0
- package/esm/methods/bm25.d.ts +17 -0
- package/esm/methods/bm25.d.ts.map +1 -0
- package/esm/methods/bm25.js +48 -0
- package/esm/methods/cache.d.ts +6 -0
- package/esm/methods/cache.d.ts.map +1 -0
- package/esm/methods/cache.js +133 -0
- package/esm/methods/capitalizeQuery.d.ts +2 -0
- package/esm/methods/capitalizeQuery.d.ts.map +1 -0
- package/esm/methods/capitalizeQuery.js +8 -0
- package/esm/methods/cloneColumn.d.ts +4 -0
- package/esm/methods/cloneColumn.d.ts.map +1 -0
- package/esm/methods/cloneColumn.js +13 -0
- package/esm/methods/cloneQuery.d.ts +4 -0
- package/esm/methods/cloneQuery.d.ts.map +1 -0
- package/esm/methods/cloneQuery.js +6 -0
- package/esm/methods/concatenateQuery.d.ts +4 -0
- package/esm/methods/concatenateQuery.d.ts.map +1 -0
- package/esm/methods/concatenateQuery.js +13 -0
- package/esm/methods/convertQuery.d.ts +7 -0
- package/esm/methods/convertQuery.d.ts.map +1 -0
- package/esm/methods/convertQuery.js +78 -0
- package/esm/methods/correlations.d.ts +9 -0
- package/esm/methods/correlations.d.ts.map +1 -0
- package/esm/methods/correlations.js +40 -0
- package/esm/methods/correlationsQuery.d.ts +5 -0
- package/esm/methods/correlationsQuery.d.ts.map +1 -0
- package/esm/methods/correlationsQuery.js +26 -0
- package/esm/methods/createFtsIndex.d.ts +11 -0
- package/esm/methods/createFtsIndex.d.ts.map +1 -0
- package/esm/methods/createFtsIndex.js +28 -0
- package/esm/methods/createVssIndex.d.ts +9 -0
- package/esm/methods/createVssIndex.d.ts.map +1 -0
- package/esm/methods/createVssIndex.js +38 -0
- package/esm/methods/crossJoinQuery.d.ts +4 -0
- package/esm/methods/crossJoinQuery.d.ts.map +1 -0
- package/esm/methods/crossJoinQuery.js +3 -0
- package/esm/methods/distanceQuery.d.ts +6 -0
- package/esm/methods/distanceQuery.d.ts.map +1 -0
- package/esm/methods/distanceQuery.js +42 -0
- package/esm/methods/fill.d.ts +7 -0
- package/esm/methods/fill.d.ts.map +1 -0
- package/esm/methods/fill.js +60 -0
- package/esm/methods/fuzzyClean.d.ts +7 -0
- package/esm/methods/fuzzyClean.d.ts.map +1 -0
- package/esm/methods/fuzzyClean.js +194 -0
- package/esm/methods/fuzzyJoin.d.ts +8 -0
- package/esm/methods/fuzzyJoin.d.ts.map +1 -0
- package/esm/methods/fuzzyJoin.js +57 -0
- package/esm/methods/fuzzyJoinQuery.d.ts +2 -0
- package/esm/methods/fuzzyJoinQuery.d.ts.map +1 -0
- package/esm/methods/fuzzyJoinQuery.js +19 -0
- package/esm/methods/getBottom.d.ts +8 -0
- package/esm/methods/getBottom.d.ts.map +1 -0
- package/esm/methods/getBottom.js +22 -0
- package/esm/methods/getColumns.d.ts +3 -0
- package/esm/methods/getColumns.d.ts.map +1 -0
- package/esm/methods/getColumns.js +15 -0
- package/esm/methods/getDescription.d.ts +9 -0
- package/esm/methods/getDescription.d.ts.map +1 -0
- package/esm/methods/getDescription.js +20 -0
- package/esm/methods/getFirstRow.d.ts +7 -0
- package/esm/methods/getFirstRow.d.ts.map +1 -0
- package/esm/methods/getFirstRow.js +15 -0
- package/esm/methods/getGeoData.d.ts +17 -0
- package/esm/methods/getGeoData.d.ts.map +1 -0
- package/esm/methods/getGeoData.js +41 -0
- package/esm/methods/getLastRow.d.ts +7 -0
- package/esm/methods/getLastRow.d.ts.map +1 -0
- package/esm/methods/getLastRow.js +19 -0
- package/esm/methods/getMax.d.ts +3 -0
- package/esm/methods/getMax.d.ts.map +1 -0
- package/esm/methods/getMax.js +18 -0
- package/esm/methods/getMean.d.ts +5 -0
- package/esm/methods/getMean.d.ts.map +1 -0
- package/esm/methods/getMean.js +17 -0
- package/esm/methods/getMedian.d.ts +5 -0
- package/esm/methods/getMedian.d.ts.map +1 -0
- package/esm/methods/getMedian.js +17 -0
- package/esm/methods/getMin.d.ts +3 -0
- package/esm/methods/getMin.d.ts.map +1 -0
- package/esm/methods/getMin.js +18 -0
- package/esm/methods/getNbCharacters.d.ts +3 -0
- package/esm/methods/getNbCharacters.d.ts.map +1 -0
- package/esm/methods/getNbCharacters.js +15 -0
- package/esm/methods/getNbRows.d.ts +3 -0
- package/esm/methods/getNbRows.d.ts.map +1 -0
- package/esm/methods/getNbRows.js +15 -0
- package/esm/methods/getQuantile.d.ts +5 -0
- package/esm/methods/getQuantile.d.ts.map +1 -0
- package/esm/methods/getQuantile.js +17 -0
- package/esm/methods/getSkew.d.ts +5 -0
- package/esm/methods/getSkew.d.ts.map +1 -0
- package/esm/methods/getSkew.js +17 -0
- package/esm/methods/getStdDev.d.ts +5 -0
- package/esm/methods/getStdDev.d.ts.map +1 -0
- package/esm/methods/getStdDev.js +17 -0
- package/esm/methods/getSum.d.ts +3 -0
- package/esm/methods/getSum.d.ts.map +1 -0
- package/esm/methods/getSum.js +15 -0
- package/esm/methods/getTableNames.d.ts +3 -0
- package/esm/methods/getTableNames.d.ts.map +1 -0
- package/esm/methods/getTableNames.js +15 -0
- package/esm/methods/getTop.d.ts +7 -0
- package/esm/methods/getTop.d.ts.map +1 -0
- package/esm/methods/getTop.js +14 -0
- package/esm/methods/getTypes.d.ts +5 -0
- package/esm/methods/getTypes.d.ts.map +1 -0
- package/esm/methods/getTypes.js +13 -0
- package/esm/methods/getUniques.d.ts +3 -0
- package/esm/methods/getUniques.d.ts.map +1 -0
- package/esm/methods/getUniques.js +15 -0
- package/esm/methods/getValues.d.ts +3 -0
- package/esm/methods/getValues.d.ts.map +1 -0
- package/esm/methods/getValues.js +15 -0
- package/esm/methods/getVar.d.ts +5 -0
- package/esm/methods/getVar.d.ts.map +1 -0
- package/esm/methods/getVar.js +17 -0
- package/esm/methods/insertRowsQuery.d.ts +4 -0
- package/esm/methods/insertRowsQuery.d.ts.map +1 -0
- package/esm/methods/insertRowsQuery.js +11 -0
- package/esm/methods/join.d.ts +7 -0
- package/esm/methods/join.d.ts.map +1 -0
- package/esm/methods/join.js +63 -0
- package/esm/methods/joinGeo.d.ts +10 -0
- package/esm/methods/joinGeo.d.ts.map +1 -0
- package/esm/methods/joinGeo.js +76 -0
- package/esm/methods/joinGeoQuery.d.ts +2 -0
- package/esm/methods/joinGeoQuery.d.ts.map +1 -0
- package/esm/methods/joinGeoQuery.js +55 -0
- package/esm/methods/joinQuery.d.ts +2 -0
- package/esm/methods/joinQuery.d.ts.map +1 -0
- package/esm/methods/joinQuery.js +21 -0
- package/esm/methods/keepQuery.d.ts +4 -0
- package/esm/methods/keepQuery.d.ts.map +1 -0
- package/esm/methods/keepQuery.js +15 -0
- package/esm/methods/linearRegressionQuery.d.ts +5 -0
- package/esm/methods/linearRegressionQuery.d.ts.map +1 -0
- package/esm/methods/linearRegressionQuery.js +37 -0
- package/esm/methods/linearRegressions.d.ts +9 -0
- package/esm/methods/linearRegressions.d.ts.map +1 -0
- package/esm/methods/linearRegressions.js +43 -0
- package/esm/methods/loadArray.d.ts +5 -0
- package/esm/methods/loadArray.d.ts.map +1 -0
- package/esm/methods/loadArray.js +78 -0
- package/esm/methods/loadDataQuery.d.ts +23 -0
- package/esm/methods/loadDataQuery.d.ts.map +1 -0
- package/esm/methods/loadDataQuery.js +77 -0
- package/esm/methods/lowerQuery.d.ts +2 -0
- package/esm/methods/lowerQuery.d.ts.map +1 -0
- package/esm/methods/lowerQuery.js +7 -0
- package/esm/methods/normalizeQuery.d.ts +5 -0
- package/esm/methods/normalizeQuery.d.ts.map +1 -0
- package/esm/methods/normalizeQuery.js +22 -0
- package/esm/methods/normalizeString.d.ts +5 -0
- package/esm/methods/normalizeString.d.ts.map +1 -0
- package/esm/methods/normalizeString.js +26 -0
- package/esm/methods/outliersIQRQuery.d.ts +4 -0
- package/esm/methods/outliersIQRQuery.d.ts.map +1 -0
- package/esm/methods/outliersIQRQuery.js +31 -0
- package/esm/methods/proportionsHorizontalQuery.d.ts +5 -0
- package/esm/methods/proportionsHorizontalQuery.d.ts.map +1 -0
- package/esm/methods/proportionsHorizontalQuery.js +15 -0
- package/esm/methods/proportionsVerticalQuery.d.ts +5 -0
- package/esm/methods/proportionsVerticalQuery.d.ts.map +1 -0
- package/esm/methods/proportionsVerticalQuery.js +19 -0
- package/esm/methods/quantilesQuery.d.ts +4 -0
- package/esm/methods/quantilesQuery.d.ts.map +1 -0
- package/esm/methods/quantilesQuery.js +12 -0
- package/esm/methods/ranksQuery.d.ts +6 -0
- package/esm/methods/ranksQuery.d.ts.map +1 -0
- package/esm/methods/ranksQuery.js +12 -0
- package/esm/methods/removeDuplicatesQuery.d.ts +4 -0
- package/esm/methods/removeDuplicatesQuery.d.ts.map +1 -0
- package/esm/methods/removeDuplicatesQuery.js +12 -0
- package/esm/methods/removeMissing.d.ts +7 -0
- package/esm/methods/removeMissing.d.ts.map +1 -0
- package/esm/methods/removeMissing.js +21 -0
- package/esm/methods/removeMissingQuery.d.ts +7 -0
- package/esm/methods/removeMissingQuery.d.ts.map +1 -0
- package/esm/methods/removeMissingQuery.js +43 -0
- package/esm/methods/removeQuery.d.ts +4 -0
- package/esm/methods/removeQuery.d.ts.map +1 -0
- package/esm/methods/removeQuery.js +15 -0
- package/esm/methods/renameColumnQuery.d.ts +2 -0
- package/esm/methods/renameColumnQuery.d.ts.map +1 -0
- package/esm/methods/renameColumnQuery.js +7 -0
- package/esm/methods/replaceNullsQuery.d.ts +2 -0
- package/esm/methods/replaceNullsQuery.d.ts.map +1 -0
- package/esm/methods/replaceNullsQuery.js +10 -0
- package/esm/methods/replaceQuery.d.ts +5 -0
- package/esm/methods/replaceQuery.d.ts.map +1 -0
- package/esm/methods/replaceQuery.js +24 -0
- package/esm/methods/rollingQuery.d.ts +5 -0
- package/esm/methods/rollingQuery.d.ts.map +1 -0
- package/esm/methods/rollingQuery.js +33 -0
- package/esm/methods/roundQuery.d.ts +5 -0
- package/esm/methods/roundQuery.d.ts.map +1 -0
- package/esm/methods/roundQuery.js +16 -0
- package/esm/methods/selectRowsQuery.d.ts +5 -0
- package/esm/methods/selectRowsQuery.d.ts.map +1 -0
- package/esm/methods/selectRowsQuery.js +3 -0
- package/esm/methods/sortQuery.d.ts +8 -0
- package/esm/methods/sortQuery.d.ts.map +1 -0
- package/esm/methods/sortQuery.js +18 -0
- package/esm/methods/splitSpread.d.ts +5 -0
- package/esm/methods/splitSpread.d.ts.map +1 -0
- package/esm/methods/splitSpread.js +61 -0
- package/esm/methods/summarize.d.ts +13 -0
- package/esm/methods/summarize.d.ts.map +1 -0
- package/esm/methods/summarize.js +60 -0
- package/esm/methods/summarizeQuery.d.ts +7 -0
- package/esm/methods/summarizeQuery.d.ts.map +1 -0
- package/esm/methods/summarizeQuery.js +112 -0
- package/esm/methods/trimQuery.d.ts +5 -0
- package/esm/methods/trimQuery.d.ts.map +1 -0
- package/esm/methods/trimQuery.js +29 -0
- package/esm/methods/truncateQuery.d.ts +2 -0
- package/esm/methods/truncateQuery.d.ts.map +1 -0
- package/esm/methods/truncateQuery.js +3 -0
- package/esm/methods/upperQuery.d.ts +2 -0
- package/esm/methods/upperQuery.d.ts.map +1 -0
- package/esm/methods/upperQuery.js +7 -0
- package/esm/methods/writeDataQuery.d.ts +5 -0
- package/esm/methods/writeDataQuery.d.ts.map +1 -0
- package/esm/methods/writeDataQuery.js +44 -0
- package/esm/methods/writeGeoDataQuery.d.ts +4 -0
- package/esm/methods/writeGeoDataQuery.d.ts.map +1 -0
- package/esm/methods/writeGeoDataQuery.js +16 -0
- package/esm/methods/zScoreQuery.d.ts +5 -0
- package/esm/methods/zScoreQuery.d.ts.map +1 -0
- package/esm/methods/zScoreQuery.js +23 -0
- package/esm/package.json +3 -0
- package/package.json +27 -0
- package/script/class/Simple.d.ts +66 -0
- package/script/class/Simple.d.ts.map +1 -0
- package/script/class/Simple.js +97 -0
- package/script/class/SimpleDB.d.ts +487 -0
- package/script/class/SimpleDB.d.ts.map +1 -0
- package/script/class/SimpleDB.js +813 -0
- package/script/class/SimpleTable.d.ts +4408 -0
- package/script/class/SimpleTable.d.ts.map +1 -0
- package/script/class/SimpleTable.js +5407 -0
- package/script/helpers/accumulateQuery.d.ts +4 -0
- package/script/helpers/accumulateQuery.d.ts.map +1 -0
- package/script/helpers/accumulateQuery.js +21 -0
- package/script/helpers/camelCase.d.ts +30 -0
- package/script/helpers/camelCase.d.ts.map +1 -0
- package/script/helpers/camelCase.js +51 -0
- package/script/helpers/capitalize.d.ts +28 -0
- package/script/helpers/capitalize.d.ts.map +1 -0
- package/script/helpers/capitalize.js +36 -0
- package/script/helpers/checkVssIndexes.d.ts +2 -0
- package/script/helpers/checkVssIndexes.d.ts.map +1 -0
- package/script/helpers/checkVssIndexes.js +19 -0
- package/script/helpers/cleanCache.d.ts +3 -0
- package/script/helpers/cleanCache.d.ts.map +1 -0
- package/script/helpers/cleanCache.js +20 -0
- package/script/helpers/cleanPath.d.ts +2 -0
- package/script/helpers/cleanPath.d.ts.map +1 -0
- package/script/helpers/cleanPath.js +6 -0
- package/script/helpers/cleanSQL.d.ts +2 -0
- package/script/helpers/cleanSQL.d.ts.map +1 -0
- package/script/helpers/cleanSQL.js +27 -0
- package/script/helpers/concatenateRowQuery.d.ts +2 -0
- package/script/helpers/concatenateRowQuery.d.ts.map +1 -0
- package/script/helpers/concatenateRowQuery.js +12 -0
- package/script/helpers/convertForJS.d.ts +6 -0
- package/script/helpers/convertForJS.d.ts.map +1 -0
- package/script/helpers/convertForJS.js +42 -0
- package/script/helpers/createDirectory.d.ts +2 -0
- package/script/helpers/createDirectory.d.ts.map +1 -0
- package/script/helpers/createDirectory.js +13 -0
- package/script/helpers/csvFormat.d.ts +3 -0
- package/script/helpers/csvFormat.d.ts.map +1 -0
- package/script/helpers/csvFormat.js +168 -0
- package/script/helpers/dataToArrays.d.ts +51 -0
- package/script/helpers/dataToArrays.d.ts.map +1 -0
- package/script/helpers/dataToArrays.js +58 -0
- package/script/helpers/extractTypes.d.ts +6 -0
- package/script/helpers/extractTypes.d.ts.map +1 -0
- package/script/helpers/extractTypes.js +14 -0
- package/script/helpers/findGeoColumn.d.ts +3 -0
- package/script/helpers/findGeoColumn.d.ts.map +1 -0
- package/script/helpers/findGeoColumn.js +21 -0
- package/script/helpers/formatDate.d.ts +34 -0
- package/script/helpers/formatDate.d.ts.map +1 -0
- package/script/helpers/formatDate.js +72 -0
- package/script/helpers/formatNumber.d.ts +46 -0
- package/script/helpers/formatNumber.d.ts.map +1 -0
- package/script/helpers/formatNumber.js +125 -0
- package/script/helpers/getCombinations.d.ts +3 -0
- package/script/helpers/getCombinations.d.ts.map +1 -0
- package/script/helpers/getCombinations.js +26 -0
- package/script/helpers/getExtension.d.ts +2 -0
- package/script/helpers/getExtension.d.ts.map +1 -0
- package/script/helpers/getExtension.js +12 -0
- package/script/helpers/getIdenticalColumns.d.ts +2 -0
- package/script/helpers/getIdenticalColumns.d.ts.map +1 -0
- package/script/helpers/getIdenticalColumns.js +6 -0
- package/script/helpers/getName.d.ts +2 -0
- package/script/helpers/getName.d.ts.map +1 -0
- package/script/helpers/getName.js +17 -0
- package/script/helpers/getProjection.d.ts +3 -0
- package/script/helpers/getProjection.d.ts.map +1 -0
- package/script/helpers/getProjection.js +28 -0
- package/script/helpers/getProjectionParquet.d.ts +3 -0
- package/script/helpers/getProjectionParquet.d.ts.map +1 -0
- package/script/helpers/getProjectionParquet.js +30 -0
- package/script/helpers/index.d.ts +20 -0
- package/script/helpers/index.d.ts.map +1 -0
- package/script/helpers/index.js +30 -0
- package/script/helpers/keepNumericalColumns.d.ts +4 -0
- package/script/helpers/keepNumericalColumns.d.ts.map +1 -0
- package/script/helpers/keepNumericalColumns.js +16 -0
- package/script/helpers/logData.d.ts +6 -0
- package/script/helpers/logData.d.ts.map +1 -0
- package/script/helpers/logData.js +54 -0
- package/script/helpers/mergeOptions.d.ts +28 -0
- package/script/helpers/mergeOptions.d.ts.map +1 -0
- package/script/helpers/mergeOptions.js +15 -0
- package/script/helpers/nestQuery.d.ts +2 -0
- package/script/helpers/nestQuery.d.ts.map +1 -0
- package/script/helpers/nestQuery.js +19 -0
- package/script/helpers/parseDuckDBType.d.ts +2 -0
- package/script/helpers/parseDuckDBType.d.ts.map +1 -0
- package/script/helpers/parseDuckDBType.js +41 -0
- package/script/helpers/parseTypes.d.ts +2 -0
- package/script/helpers/parseTypes.d.ts.map +1 -0
- package/script/helpers/parseTypes.js +38 -0
- package/script/helpers/parseValue.d.ts +2 -0
- package/script/helpers/parseValue.d.ts.map +1 -0
- package/script/helpers/parseValue.js +23 -0
- package/script/helpers/prettyDuration.d.ts +55 -0
- package/script/helpers/prettyDuration.d.ts.map +1 -0
- package/script/helpers/prettyDuration.js +148 -0
- package/script/helpers/printTable.d.ts +47 -0
- package/script/helpers/printTable.d.ts.map +1 -0
- package/script/helpers/printTable.js +223 -0
- package/script/helpers/queryDB.d.ts +19 -0
- package/script/helpers/queryDB.d.ts.map +1 -0
- package/script/helpers/queryDB.js +68 -0
- package/script/helpers/rewind.d.ts +3 -0
- package/script/helpers/rewind.d.ts.map +1 -0
- package/script/helpers/rewind.js +1295 -0
- package/script/helpers/runQuery.d.ts +14 -0
- package/script/helpers/runQuery.d.ts.map +1 -0
- package/script/helpers/runQuery.js +32 -0
- package/script/helpers/setDbProps.d.ts +3 -0
- package/script/helpers/setDbProps.d.ts.map +1 -0
- package/script/helpers/setDbProps.js +28 -0
- package/script/helpers/shouldFlipBeforeExport.d.ts +2 -0
- package/script/helpers/shouldFlipBeforeExport.d.ts.map +1 -0
- package/script/helpers/shouldFlipBeforeExport.js +6 -0
- package/script/helpers/stringToArray.d.ts +2 -0
- package/script/helpers/stringToArray.d.ts.map +1 -0
- package/script/helpers/stringToArray.js +14 -0
- package/script/helpers/stringifyDates.d.ts +5 -0
- package/script/helpers/stringifyDates.d.ts.map +1 -0
- package/script/helpers/stringifyDates.js +17 -0
- package/script/helpers/stringifyDatesInvert.d.ts +5 -0
- package/script/helpers/stringifyDatesInvert.d.ts.map +1 -0
- package/script/helpers/stringifyDatesInvert.js +17 -0
- package/script/helpers/unifyColumns.d.ts +9 -0
- package/script/helpers/unifyColumns.d.ts.map +1 -0
- package/script/helpers/unifyColumns.js +24 -0
- package/script/helpers/unnestQuery.d.ts +2 -0
- package/script/helpers/unnestQuery.d.ts.map +1 -0
- package/script/helpers/unnestQuery.js +11 -0
- package/script/helpers/wrapString.d.ts +35 -0
- package/script/helpers/wrapString.d.ts.map +1 -0
- package/script/helpers/wrapString.js +86 -0
- package/script/helpers/writeDataAsArrays.d.ts +3 -0
- package/script/helpers/writeDataAsArrays.d.ts.map +1 -0
- package/script/helpers/writeDataAsArrays.js +19 -0
- package/script/helpers/writeProjectionsAndIndexes.d.ts +3 -0
- package/script/helpers/writeProjectionsAndIndexes.d.ts.map +1 -0
- package/script/helpers/writeProjectionsAndIndexes.js +32 -0
- package/script/index.d.ts +31 -0
- package/script/index.d.ts.map +1 -0
- package/script/index.js +38 -0
- package/script/methods/aggregateGeoQuery.d.ts +5 -0
- package/script/methods/aggregateGeoQuery.d.ts.map +1 -0
- package/script/methods/aggregateGeoQuery.js +30 -0
- package/script/methods/binsQuery.d.ts +5 -0
- package/script/methods/binsQuery.d.ts.map +1 -0
- package/script/methods/binsQuery.js +43 -0
- package/script/methods/bm25.d.ts +17 -0
- package/script/methods/bm25.d.ts.map +1 -0
- package/script/methods/bm25.js +54 -0
- package/script/methods/cache.d.ts +6 -0
- package/script/methods/cache.d.ts.map +1 -0
- package/script/methods/cache.js +139 -0
- package/script/methods/capitalizeQuery.d.ts +2 -0
- package/script/methods/capitalizeQuery.d.ts.map +1 -0
- package/script/methods/capitalizeQuery.js +11 -0
- package/script/methods/cloneColumn.d.ts +4 -0
- package/script/methods/cloneColumn.d.ts.map +1 -0
- package/script/methods/cloneColumn.js +16 -0
- package/script/methods/cloneQuery.d.ts +4 -0
- package/script/methods/cloneQuery.d.ts.map +1 -0
- package/script/methods/cloneQuery.js +9 -0
- package/script/methods/concatenateQuery.d.ts +4 -0
- package/script/methods/concatenateQuery.d.ts.map +1 -0
- package/script/methods/concatenateQuery.js +16 -0
- package/script/methods/convertQuery.d.ts +7 -0
- package/script/methods/convertQuery.d.ts.map +1 -0
- package/script/methods/convertQuery.js +84 -0
- package/script/methods/correlations.d.ts +9 -0
- package/script/methods/correlations.d.ts.map +1 -0
- package/script/methods/correlations.js +46 -0
- package/script/methods/correlationsQuery.d.ts +5 -0
- package/script/methods/correlationsQuery.d.ts.map +1 -0
- package/script/methods/correlationsQuery.js +32 -0
- package/script/methods/createFtsIndex.d.ts +11 -0
- package/script/methods/createFtsIndex.d.ts.map +1 -0
- package/script/methods/createFtsIndex.js +34 -0
- package/script/methods/createVssIndex.d.ts +9 -0
- package/script/methods/createVssIndex.d.ts.map +1 -0
- package/script/methods/createVssIndex.js +44 -0
- package/script/methods/crossJoinQuery.d.ts +4 -0
- package/script/methods/crossJoinQuery.d.ts.map +1 -0
- package/script/methods/crossJoinQuery.js +6 -0
- package/script/methods/distanceQuery.d.ts +6 -0
- package/script/methods/distanceQuery.d.ts.map +1 -0
- package/script/methods/distanceQuery.js +45 -0
- package/script/methods/fill.d.ts +7 -0
- package/script/methods/fill.d.ts.map +1 -0
- package/script/methods/fill.js +66 -0
- package/script/methods/fuzzyClean.d.ts +7 -0
- package/script/methods/fuzzyClean.d.ts.map +1 -0
- package/script/methods/fuzzyClean.js +200 -0
- package/script/methods/fuzzyJoin.d.ts +8 -0
- package/script/methods/fuzzyJoin.d.ts.map +1 -0
- package/script/methods/fuzzyJoin.js +63 -0
- package/script/methods/fuzzyJoinQuery.d.ts +2 -0
- package/script/methods/fuzzyJoinQuery.d.ts.map +1 -0
- package/script/methods/fuzzyJoinQuery.js +22 -0
- package/script/methods/getBottom.d.ts +8 -0
- package/script/methods/getBottom.d.ts.map +1 -0
- package/script/methods/getBottom.js +28 -0
- package/script/methods/getColumns.d.ts +3 -0
- package/script/methods/getColumns.d.ts.map +1 -0
- package/script/methods/getColumns.js +21 -0
- package/script/methods/getDescription.d.ts +9 -0
- package/script/methods/getDescription.d.ts.map +1 -0
- package/script/methods/getDescription.js +23 -0
- package/script/methods/getFirstRow.d.ts +7 -0
- package/script/methods/getFirstRow.d.ts.map +1 -0
- package/script/methods/getFirstRow.js +21 -0
- package/script/methods/getGeoData.d.ts +17 -0
- package/script/methods/getGeoData.d.ts.map +1 -0
- package/script/methods/getGeoData.js +47 -0
- package/script/methods/getLastRow.d.ts +7 -0
- package/script/methods/getLastRow.d.ts.map +1 -0
- package/script/methods/getLastRow.js +25 -0
- package/script/methods/getMax.d.ts +3 -0
- package/script/methods/getMax.d.ts.map +1 -0
- package/script/methods/getMax.js +24 -0
- package/script/methods/getMean.d.ts +5 -0
- package/script/methods/getMean.d.ts.map +1 -0
- package/script/methods/getMean.js +23 -0
- package/script/methods/getMedian.d.ts +5 -0
- package/script/methods/getMedian.d.ts.map +1 -0
- package/script/methods/getMedian.js +23 -0
- package/script/methods/getMin.d.ts +3 -0
- package/script/methods/getMin.d.ts.map +1 -0
- package/script/methods/getMin.js +24 -0
- package/script/methods/getNbCharacters.d.ts +3 -0
- package/script/methods/getNbCharacters.d.ts.map +1 -0
- package/script/methods/getNbCharacters.js +21 -0
- package/script/methods/getNbRows.d.ts +3 -0
- package/script/methods/getNbRows.d.ts.map +1 -0
- package/script/methods/getNbRows.js +21 -0
- package/script/methods/getQuantile.d.ts +5 -0
- package/script/methods/getQuantile.d.ts.map +1 -0
- package/script/methods/getQuantile.js +23 -0
- package/script/methods/getSkew.d.ts +5 -0
- package/script/methods/getSkew.d.ts.map +1 -0
- package/script/methods/getSkew.js +23 -0
- package/script/methods/getStdDev.d.ts +5 -0
- package/script/methods/getStdDev.d.ts.map +1 -0
- package/script/methods/getStdDev.js +23 -0
- package/script/methods/getSum.d.ts +3 -0
- package/script/methods/getSum.d.ts.map +1 -0
- package/script/methods/getSum.js +21 -0
- package/script/methods/getTableNames.d.ts +3 -0
- package/script/methods/getTableNames.d.ts.map +1 -0
- package/script/methods/getTableNames.js +21 -0
- package/script/methods/getTop.d.ts +7 -0
- package/script/methods/getTop.d.ts.map +1 -0
- package/script/methods/getTop.js +20 -0
- package/script/methods/getTypes.d.ts +5 -0
- package/script/methods/getTypes.d.ts.map +1 -0
- package/script/methods/getTypes.js +19 -0
- package/script/methods/getUniques.d.ts +3 -0
- package/script/methods/getUniques.d.ts.map +1 -0
- package/script/methods/getUniques.js +21 -0
- package/script/methods/getValues.d.ts +3 -0
- package/script/methods/getValues.d.ts.map +1 -0
- package/script/methods/getValues.js +21 -0
- package/script/methods/getVar.d.ts +5 -0
- package/script/methods/getVar.d.ts.map +1 -0
- package/script/methods/getVar.js +23 -0
- package/script/methods/insertRowsQuery.d.ts +4 -0
- package/script/methods/insertRowsQuery.d.ts.map +1 -0
- package/script/methods/insertRowsQuery.js +17 -0
- package/script/methods/join.d.ts +7 -0
- package/script/methods/join.d.ts.map +1 -0
- package/script/methods/join.js +69 -0
- package/script/methods/joinGeo.d.ts +10 -0
- package/script/methods/joinGeo.d.ts.map +1 -0
- package/script/methods/joinGeo.js +82 -0
- package/script/methods/joinGeoQuery.d.ts +2 -0
- package/script/methods/joinGeoQuery.d.ts.map +1 -0
- package/script/methods/joinGeoQuery.js +58 -0
- package/script/methods/joinQuery.d.ts +2 -0
- package/script/methods/joinQuery.d.ts.map +1 -0
- package/script/methods/joinQuery.js +24 -0
- package/script/methods/keepQuery.d.ts +4 -0
- package/script/methods/keepQuery.d.ts.map +1 -0
- package/script/methods/keepQuery.js +21 -0
- package/script/methods/linearRegressionQuery.d.ts +5 -0
- package/script/methods/linearRegressionQuery.d.ts.map +1 -0
- package/script/methods/linearRegressionQuery.js +43 -0
- package/script/methods/linearRegressions.d.ts +9 -0
- package/script/methods/linearRegressions.d.ts.map +1 -0
- package/script/methods/linearRegressions.js +49 -0
- package/script/methods/loadArray.d.ts +5 -0
- package/script/methods/loadArray.d.ts.map +1 -0
- package/script/methods/loadArray.js +84 -0
- package/script/methods/loadDataQuery.d.ts +23 -0
- package/script/methods/loadDataQuery.d.ts.map +1 -0
- package/script/methods/loadDataQuery.js +83 -0
- package/script/methods/lowerQuery.d.ts +2 -0
- package/script/methods/lowerQuery.d.ts.map +1 -0
- package/script/methods/lowerQuery.js +10 -0
- package/script/methods/normalizeQuery.d.ts +5 -0
- package/script/methods/normalizeQuery.d.ts.map +1 -0
- package/script/methods/normalizeQuery.js +28 -0
- package/script/methods/normalizeString.d.ts +5 -0
- package/script/methods/normalizeString.d.ts.map +1 -0
- package/script/methods/normalizeString.js +32 -0
- package/script/methods/outliersIQRQuery.d.ts +4 -0
- package/script/methods/outliersIQRQuery.d.ts.map +1 -0
- package/script/methods/outliersIQRQuery.js +37 -0
- package/script/methods/proportionsHorizontalQuery.d.ts +5 -0
- package/script/methods/proportionsHorizontalQuery.d.ts.map +1 -0
- package/script/methods/proportionsHorizontalQuery.js +18 -0
- package/script/methods/proportionsVerticalQuery.d.ts +5 -0
- package/script/methods/proportionsVerticalQuery.d.ts.map +1 -0
- package/script/methods/proportionsVerticalQuery.js +25 -0
- package/script/methods/quantilesQuery.d.ts +4 -0
- package/script/methods/quantilesQuery.d.ts.map +1 -0
- package/script/methods/quantilesQuery.js +18 -0
- package/script/methods/ranksQuery.d.ts +6 -0
- package/script/methods/ranksQuery.d.ts.map +1 -0
- package/script/methods/ranksQuery.js +18 -0
- package/script/methods/removeDuplicatesQuery.d.ts +4 -0
- package/script/methods/removeDuplicatesQuery.d.ts.map +1 -0
- package/script/methods/removeDuplicatesQuery.js +18 -0
- package/script/methods/removeMissing.d.ts +7 -0
- package/script/methods/removeMissing.d.ts.map +1 -0
- package/script/methods/removeMissing.js +27 -0
- package/script/methods/removeMissingQuery.d.ts +7 -0
- package/script/methods/removeMissingQuery.d.ts.map +1 -0
- package/script/methods/removeMissingQuery.js +46 -0
- package/script/methods/removeQuery.d.ts +4 -0
- package/script/methods/removeQuery.d.ts.map +1 -0
- package/script/methods/removeQuery.js +21 -0
- package/script/methods/renameColumnQuery.d.ts +2 -0
- package/script/methods/renameColumnQuery.d.ts.map +1 -0
- package/script/methods/renameColumnQuery.js +10 -0
- package/script/methods/replaceNullsQuery.d.ts +2 -0
- package/script/methods/replaceNullsQuery.d.ts.map +1 -0
- package/script/methods/replaceNullsQuery.js +16 -0
- package/script/methods/replaceQuery.d.ts +5 -0
- package/script/methods/replaceQuery.d.ts.map +1 -0
- package/script/methods/replaceQuery.js +27 -0
- package/script/methods/rollingQuery.d.ts +5 -0
- package/script/methods/rollingQuery.d.ts.map +1 -0
- package/script/methods/rollingQuery.js +39 -0
- package/script/methods/roundQuery.d.ts +5 -0
- package/script/methods/roundQuery.d.ts.map +1 -0
- package/script/methods/roundQuery.js +19 -0
- package/script/methods/selectRowsQuery.d.ts +5 -0
- package/script/methods/selectRowsQuery.d.ts.map +1 -0
- package/script/methods/selectRowsQuery.js +6 -0
- package/script/methods/sortQuery.d.ts +8 -0
- package/script/methods/sortQuery.d.ts.map +1 -0
- package/script/methods/sortQuery.js +21 -0
- package/script/methods/splitSpread.d.ts +5 -0
- package/script/methods/splitSpread.d.ts.map +1 -0
- package/script/methods/splitSpread.js +67 -0
- package/script/methods/summarize.d.ts +13 -0
- package/script/methods/summarize.d.ts.map +1 -0
- package/script/methods/summarize.js +66 -0
- package/script/methods/summarizeQuery.d.ts +7 -0
- package/script/methods/summarizeQuery.d.ts.map +1 -0
- package/script/methods/summarizeQuery.js +115 -0
- package/script/methods/trimQuery.d.ts +5 -0
- package/script/methods/trimQuery.d.ts.map +1 -0
- package/script/methods/trimQuery.js +32 -0
- package/script/methods/truncateQuery.d.ts +2 -0
- package/script/methods/truncateQuery.d.ts.map +1 -0
- package/script/methods/truncateQuery.js +6 -0
- package/script/methods/upperQuery.d.ts +2 -0
- package/script/methods/upperQuery.d.ts.map +1 -0
- package/script/methods/upperQuery.js +10 -0
- package/script/methods/writeDataQuery.d.ts +5 -0
- package/script/methods/writeDataQuery.d.ts.map +1 -0
- package/script/methods/writeDataQuery.js +50 -0
- package/script/methods/writeGeoDataQuery.d.ts +4 -0
- package/script/methods/writeGeoDataQuery.d.ts.map +1 -0
- package/script/methods/writeGeoDataQuery.js +22 -0
- package/script/methods/zScoreQuery.d.ts +5 -0
- package/script/methods/zScoreQuery.d.ts.map +1 -0
- package/script/methods/zScoreQuery.js +29 -0
- package/script/package.json +3 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default function mergeOptions(simple, options) {
|
|
2
|
+
return {
|
|
3
|
+
table: options.table,
|
|
4
|
+
method: options.method,
|
|
5
|
+
parameters: options.parameters,
|
|
6
|
+
nbRowsToLog: options.nbRowsToLog ?? simple.nbRowsToLog,
|
|
7
|
+
nbCharactersToLog: simple.nbCharactersToLog,
|
|
8
|
+
returnDataFrom: options.returnDataFrom ?? "none",
|
|
9
|
+
debug: options.debug ?? simple.debug,
|
|
10
|
+
types: options.types,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nestQuery.d.ts","sourceRoot":"","sources":["../../src/helpers/nestQuery.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,UAc9B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import stringToArray from "./stringToArray.js";
|
|
2
|
+
export default function nestQuery(table, column, separator, categories) {
|
|
3
|
+
const cats = stringToArray(categories);
|
|
4
|
+
const groupBy = cats.map((d) => `"${d}"`).join(", ");
|
|
5
|
+
const selectColumns = `${groupBy}, `;
|
|
6
|
+
const orderBy = `\nORDER BY ${cats.map((d) => `"${d}" ASC`).join(", ")}`;
|
|
7
|
+
const query = `CREATE OR REPLACE TABLE "${table}" AS
|
|
8
|
+
SELECT
|
|
9
|
+
${selectColumns}STRING_AGG("${column}", '${separator}') AS "${column}"
|
|
10
|
+
FROM "${table}"
|
|
11
|
+
GROUP BY ${groupBy}${orderBy};`;
|
|
12
|
+
return query;
|
|
13
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export default function parseDuckDBType(type: string): import("@duckdb/node-api").DuckDBIntegerType | import("@duckdb/node-api").DuckDBBigIntType | import("@duckdb/node-api").DuckDBDoubleType | import("@duckdb/node-api").DuckDBVarCharType | import("@duckdb/node-api").DuckDBTimestampType | import("@duckdb/node-api").DuckDBTimestampTZType | import("@duckdb/node-api").DuckDBDateType | import("@duckdb/node-api").DuckDBTimeType | import("@duckdb/node-api").DuckDBBooleanType | import("@duckdb/node-api").DuckDBArrayType;
|
|
2
|
+
//# sourceMappingURL=parseDuckDBType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseDuckDBType.d.ts","sourceRoot":"","sources":["../../src/helpers/parseDuckDBType.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,IAAI,EAAE,MAAM,mdA0BnD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ARRAY, BIGINT, BOOLEAN, DATE, DOUBLE, FLOAT, INTEGER, TIME, TIMESTAMP, TIMESTAMPTZ, VARCHAR, } from "@duckdb/node-api";
|
|
2
|
+
export default function parseDuckDBType(type) {
|
|
3
|
+
if (type === "INTEGER") {
|
|
4
|
+
return INTEGER;
|
|
5
|
+
}
|
|
6
|
+
else if (type === "BIGINT") {
|
|
7
|
+
return BIGINT;
|
|
8
|
+
}
|
|
9
|
+
else if (type === "DOUBLE") {
|
|
10
|
+
return DOUBLE;
|
|
11
|
+
}
|
|
12
|
+
else if (type === "VARCHAR") {
|
|
13
|
+
return VARCHAR;
|
|
14
|
+
}
|
|
15
|
+
else if (type === "TIMESTAMP") {
|
|
16
|
+
return TIMESTAMP;
|
|
17
|
+
}
|
|
18
|
+
else if (type === "TIMESTAMP WITH TIME ZONE") {
|
|
19
|
+
return TIMESTAMPTZ;
|
|
20
|
+
}
|
|
21
|
+
else if (type === "DATE") {
|
|
22
|
+
return DATE;
|
|
23
|
+
}
|
|
24
|
+
else if (type === "TIME") {
|
|
25
|
+
return TIME;
|
|
26
|
+
}
|
|
27
|
+
else if (type === "BOOLEAN") {
|
|
28
|
+
return BOOLEAN;
|
|
29
|
+
}
|
|
30
|
+
else if (type.includes("FLOAT[")) {
|
|
31
|
+
// For embeddings
|
|
32
|
+
const size = type.replace("FLOAT[", "").replace("]", "");
|
|
33
|
+
return ARRAY(FLOAT, parseInt(size));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
throw new Error(`Type ${type} not supported.`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export default function parseType(type: "integer" | "float" | "number" | "string" | "date" | "time" | "datetime" | "datetimeTz" | "bigint" | "double" | "varchar" | "timestamp" | "timestamp with time zone" | "boolean" | "geometry"): string;
|
|
2
|
+
//# sourceMappingURL=parseTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseTypes.d.ts","sourceRoot":"","sources":["../../src/helpers/parseTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,IAAI,EACA,SAAS,GACT,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,MAAM,GACN,UAAU,GACV,YAAY,GACZ,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,WAAW,GACX,0BAA0B,GAC1B,SAAS,GACT,UAAU,UA+Bf"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export default function parseType(type) {
|
|
2
|
+
const typeLowerCase = type.toLowerCase();
|
|
3
|
+
if (typeLowerCase === "integer") {
|
|
4
|
+
return "INTEGER";
|
|
5
|
+
}
|
|
6
|
+
else if (typeLowerCase === "float" || typeLowerCase === "number") {
|
|
7
|
+
return "DOUBLE";
|
|
8
|
+
}
|
|
9
|
+
else if (typeLowerCase === "string") {
|
|
10
|
+
return "VARCHAR";
|
|
11
|
+
}
|
|
12
|
+
else if (typeLowerCase === "datetime") {
|
|
13
|
+
return "TIMESTAMP";
|
|
14
|
+
}
|
|
15
|
+
else if (typeLowerCase === "datetimetz") {
|
|
16
|
+
return "TIMESTAMP WITH TIME ZONE";
|
|
17
|
+
}
|
|
18
|
+
else if ([
|
|
19
|
+
"date",
|
|
20
|
+
"time",
|
|
21
|
+
"bigint",
|
|
22
|
+
"hugeint",
|
|
23
|
+
"double",
|
|
24
|
+
"varchar",
|
|
25
|
+
"timestamp",
|
|
26
|
+
"timestamp with time zone",
|
|
27
|
+
"boolean",
|
|
28
|
+
"geometry",
|
|
29
|
+
].includes(typeLowerCase)) {
|
|
30
|
+
return type.toUpperCase();
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
throw new Error(`Unknown type ${type}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseValue.d.ts","sourceRoot":"","sources":["../../src/helpers/parseValue.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAc5E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default function parseValue(value) {
|
|
2
|
+
if (Number.isNaN(value) || value === undefined || value === null) {
|
|
3
|
+
return "NULL";
|
|
4
|
+
}
|
|
5
|
+
else if (value instanceof Date) {
|
|
6
|
+
return `'${value.toISOString()}'`;
|
|
7
|
+
}
|
|
8
|
+
else if (typeof value === "string") {
|
|
9
|
+
return `'${value.replaceAll("'", "''")}'`;
|
|
10
|
+
}
|
|
11
|
+
else if (typeof value === "boolean") {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
else if (typeof value === "number") {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
throw new Error(`Unkown type ${typeof value} of ${value}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a duration into a human-readable string, breaking it down into years, months, days, hours, minutes, seconds, and milliseconds. This function is useful for displaying elapsed time in a user-friendly format, such as for performance logging, task completion times, or general time tracking.
|
|
3
|
+
*
|
|
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
|
+
*
|
|
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
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* // A starting Date somewhere in your code.
|
|
17
|
+
* const startDate = new Date(); // or Date.now()
|
|
18
|
+
*
|
|
19
|
+
* // When you want to know the elapsed duration, pass the start date.
|
|
20
|
+
* const duration = prettyDuration(startDate);
|
|
21
|
+
* console.log(duration); // Returns something like "22 days, 6 h, 3 min, 15 sec, 3 ms"
|
|
22
|
+
* ```
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* // If you want to console.log it directly, set the `log` option to `true`.
|
|
26
|
+
* // This will print the duration to the console and also return the string.
|
|
27
|
+
* const startDateForLog = new Date();
|
|
28
|
+
* // ... some operations ...
|
|
29
|
+
* prettyDuration(startDateForLog, { log: true });
|
|
30
|
+
* ```
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* // You can also use a prefix and/or suffix for the output string.
|
|
34
|
+
* const startDateWithPrefixSuffix = new Date();
|
|
35
|
+
* // ... some operations ...
|
|
36
|
+
* prettyDuration(startDateWithPrefixSuffix, { log: true, prefix: "Elapsed time: ", suffix: " (Main function)" });
|
|
37
|
+
* // Returns and logs something like "Total duration: 3 min, 15 sec, 3 ms (Main function)"
|
|
38
|
+
* ```
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* // If you want to format the duration between two specific dates, use the `end` option.
|
|
42
|
+
* const start = new Date("2024-01-01T17:00:00Z");
|
|
43
|
+
* const end = new Date("2024-01-23T23:03:15Z");
|
|
44
|
+
* const specificDuration = prettyDuration(start, { end });
|
|
45
|
+
* console.log(specificDuration); // Returns "22 days, 6 h, 3 min, 15 sec, 0 ms"
|
|
46
|
+
* ```
|
|
47
|
+
* @category Formatting
|
|
48
|
+
*/
|
|
49
|
+
export default function prettyDuration(start: Date | number, options?: {
|
|
50
|
+
log?: boolean;
|
|
51
|
+
end?: Date | number;
|
|
52
|
+
prefix?: string;
|
|
53
|
+
suffix?: string;
|
|
54
|
+
}): string;
|
|
55
|
+
//# sourceMappingURL=prettyDuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prettyDuration.d.ts","sourceRoot":"","sources":["../../src/helpers/prettyDuration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;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"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a duration into a human-readable string, breaking it down into years, months, days, hours, minutes, seconds, and milliseconds. This function is useful for displaying elapsed time in a user-friendly format, such as for performance logging, task completion times, or general time tracking.
|
|
3
|
+
*
|
|
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
|
+
*
|
|
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
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* // A starting Date somewhere in your code.
|
|
17
|
+
* const startDate = new Date(); // or Date.now()
|
|
18
|
+
*
|
|
19
|
+
* // When you want to know the elapsed duration, pass the start date.
|
|
20
|
+
* const duration = prettyDuration(startDate);
|
|
21
|
+
* console.log(duration); // Returns something like "22 days, 6 h, 3 min, 15 sec, 3 ms"
|
|
22
|
+
* ```
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* // If you want to console.log it directly, set the `log` option to `true`.
|
|
26
|
+
* // This will print the duration to the console and also return the string.
|
|
27
|
+
* const startDateForLog = new Date();
|
|
28
|
+
* // ... some operations ...
|
|
29
|
+
* prettyDuration(startDateForLog, { log: true });
|
|
30
|
+
* ```
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* // You can also use a prefix and/or suffix for the output string.
|
|
34
|
+
* const startDateWithPrefixSuffix = new Date();
|
|
35
|
+
* // ... some operations ...
|
|
36
|
+
* prettyDuration(startDateWithPrefixSuffix, { log: true, prefix: "Elapsed time: ", suffix: " (Main function)" });
|
|
37
|
+
* // Returns and logs something like "Total duration: 3 min, 15 sec, 3 ms (Main function)"
|
|
38
|
+
* ```
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* // If you want to format the duration between two specific dates, use the `end` option.
|
|
42
|
+
* const start = new Date("2024-01-01T17:00:00Z");
|
|
43
|
+
* const end = new Date("2024-01-23T23:03:15Z");
|
|
44
|
+
* const specificDuration = prettyDuration(start, { end });
|
|
45
|
+
* console.log(specificDuration); // Returns "22 days, 6 h, 3 min, 15 sec, 0 ms"
|
|
46
|
+
* ```
|
|
47
|
+
* @category Formatting
|
|
48
|
+
*/
|
|
49
|
+
export default function prettyDuration(start, options = {}) {
|
|
50
|
+
if (start instanceof Date) {
|
|
51
|
+
start = start.getTime();
|
|
52
|
+
}
|
|
53
|
+
let end;
|
|
54
|
+
if (options.end instanceof Date) {
|
|
55
|
+
end = options.end.getTime();
|
|
56
|
+
}
|
|
57
|
+
else if (typeof options.end === "number") {
|
|
58
|
+
end = options.end;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
end = Date.now();
|
|
62
|
+
}
|
|
63
|
+
const differenceInMs = end - start;
|
|
64
|
+
let prettyDuration = "";
|
|
65
|
+
if (differenceInMs < 1000) {
|
|
66
|
+
// Less than a second
|
|
67
|
+
prettyDuration = `${differenceInMs} ms`;
|
|
68
|
+
}
|
|
69
|
+
else if (differenceInMs < 60_000) {
|
|
70
|
+
// Less than a minute
|
|
71
|
+
const sec = Math.floor(differenceInMs / 1000);
|
|
72
|
+
const ms = differenceInMs % 1000;
|
|
73
|
+
prettyDuration = `${sec} sec, ${ms} ms`;
|
|
74
|
+
}
|
|
75
|
+
else if (differenceInMs < 3_600_000) {
|
|
76
|
+
// Less than an hour
|
|
77
|
+
const min = Math.floor(differenceInMs / 60_000);
|
|
78
|
+
const remainingMs = differenceInMs % 60_000;
|
|
79
|
+
const sec = Math.floor(remainingMs / 1000);
|
|
80
|
+
const ms = remainingMs % 1000;
|
|
81
|
+
prettyDuration = `${min} min, ${sec} sec, ${ms} ms`;
|
|
82
|
+
}
|
|
83
|
+
else if (differenceInMs < 86_400_000) {
|
|
84
|
+
// Less than a day
|
|
85
|
+
const hours = Math.floor(differenceInMs / 3_600_000);
|
|
86
|
+
const remainingMsAfterHours = differenceInMs % 3_600_000;
|
|
87
|
+
const min = Math.floor(remainingMsAfterHours / 60_000);
|
|
88
|
+
const remainingMsAfterMinutes = remainingMsAfterHours % 60_000;
|
|
89
|
+
const sec = Math.floor(remainingMsAfterMinutes / 1000);
|
|
90
|
+
const ms = remainingMsAfterMinutes % 1000;
|
|
91
|
+
prettyDuration = `${hours} h, ${min} min, ${sec} sec, ${ms} ms`;
|
|
92
|
+
}
|
|
93
|
+
else if (differenceInMs < 2_592_000_000) {
|
|
94
|
+
// Less than a month
|
|
95
|
+
const days = Math.floor(differenceInMs / 86_400_000);
|
|
96
|
+
const remainingMsAfterDays = differenceInMs % 86_400_000;
|
|
97
|
+
const hours = Math.floor(remainingMsAfterDays / 3_600_000);
|
|
98
|
+
const remainingMsAfterHours = remainingMsAfterDays % 3_600_000;
|
|
99
|
+
const min = Math.floor(remainingMsAfterHours / 60_000);
|
|
100
|
+
const remainingMsAfterMin = remainingMsAfterHours % 60_000;
|
|
101
|
+
const sec = Math.floor(remainingMsAfterMin / 1000);
|
|
102
|
+
const ms = remainingMsAfterMin % 1000;
|
|
103
|
+
prettyDuration = `${days} ${days <= 1 ? "day" : "days"}, ${hours} h, ${min} min, ${sec} sec, ${ms} ms`;
|
|
104
|
+
}
|
|
105
|
+
else if (differenceInMs < 31_536_000_000) {
|
|
106
|
+
// Less than a year
|
|
107
|
+
const months = Math.floor(differenceInMs / 2_592_000_000);
|
|
108
|
+
const remainingMsAfterMonths = differenceInMs % 2_592_000_000;
|
|
109
|
+
const days = Math.floor(remainingMsAfterMonths / 86_400_000);
|
|
110
|
+
const remainingMsAfterDays = differenceInMs % 86_400_000;
|
|
111
|
+
const hours = Math.floor(remainingMsAfterDays / 3_600_000);
|
|
112
|
+
const remainingMsAfterHours = remainingMsAfterDays % 3_600_000;
|
|
113
|
+
const min = Math.floor(remainingMsAfterHours / 60_000);
|
|
114
|
+
const remainingMsAfterMin = remainingMsAfterHours % 60_000;
|
|
115
|
+
const sec = Math.floor(remainingMsAfterMin / 1000);
|
|
116
|
+
const ms = remainingMsAfterMin % 1000;
|
|
117
|
+
prettyDuration = `${months} ${months <= 1 ? "month" : "months"}, ${days} ${days <= 1 ? "day" : "days"}, ${hours} h, ${min} min, ${sec} sec, ${ms} ms`;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
// More than a year
|
|
121
|
+
const years = Math.floor(differenceInMs / 31_536_000_000);
|
|
122
|
+
const remainingMsAfterYears = differenceInMs % 31_536_000_000;
|
|
123
|
+
const months = Math.floor(remainingMsAfterYears / 2_592_000_000);
|
|
124
|
+
const remainingMsAfterMonths = differenceInMs % 2_592_000_000;
|
|
125
|
+
const days = Math.floor(remainingMsAfterMonths / 86_400_000);
|
|
126
|
+
const remainingMsAfterDays = differenceInMs % 86_400_000;
|
|
127
|
+
const hours = Math.floor(remainingMsAfterDays / 3_600_000);
|
|
128
|
+
const remainingMsAfterHours = remainingMsAfterDays % 3_600_000;
|
|
129
|
+
const min = Math.floor(remainingMsAfterHours / 60_000);
|
|
130
|
+
const remainingMsAfterMin = remainingMsAfterHours % 60_000;
|
|
131
|
+
const sec = Math.floor(remainingMsAfterMin / 1000);
|
|
132
|
+
const ms = remainingMsAfterMin % 1000;
|
|
133
|
+
prettyDuration = `${years} ${years <= 1 ? "year" : "years"}, ${months} ${months <= 1 ? "month" : "months"}, ${days} ${days <= 1 ? "day" : "days"}, ${hours} h, ${min} min, ${sec} sec, ${ms} ms`;
|
|
134
|
+
}
|
|
135
|
+
if (typeof options.prefix === "string") {
|
|
136
|
+
prettyDuration = `${options.prefix}${prettyDuration}`;
|
|
137
|
+
}
|
|
138
|
+
if (typeof options.suffix === "string") {
|
|
139
|
+
prettyDuration = `${prettyDuration}${options.suffix}`;
|
|
140
|
+
}
|
|
141
|
+
if (options.log === true) {
|
|
142
|
+
console.log(prettyDuration);
|
|
143
|
+
}
|
|
144
|
+
return prettyDuration;
|
|
145
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prints a formatted table to the console with support for word wrapping
|
|
3
|
+
* within cells. Unlike `console.table()`, this function properly handles
|
|
4
|
+
* multi-line content within cells, making it ideal for displaying data with
|
|
5
|
+
* long text values.
|
|
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`). Values exceeding this width will be wrapped at word boundaries.
|
|
12
|
+
* @param options.minColumnWidth - The minimum width for any column (default:
|
|
13
|
+
* `3`).
|
|
14
|
+
* @param options.typesRowIndex - The index of a row that contains type
|
|
15
|
+
* annotations (e.g. `"VARCHAR/string"`). This row will be rendered in grey.
|
|
16
|
+
* If omitted, no row is treated as a types row.
|
|
17
|
+
* @returns void - The table is printed directly to the console.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const data = [
|
|
22
|
+
* { name: "Alice", description: "A software engineer with expertise in TypeScript" },
|
|
23
|
+
* { name: "Bob", description: "A product manager" }
|
|
24
|
+
* ];
|
|
25
|
+
* printTable(data, { maxColumnWidth: 30 });
|
|
26
|
+
* // Outputs a nicely formatted table with word-wrapped description column
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* // With types row
|
|
32
|
+
* const types = { name: "VARCHAR/string", age: "INTEGER/number" };
|
|
33
|
+
* const data = [
|
|
34
|
+
* { name: "Alice", age: 30 },
|
|
35
|
+
* { name: "Bob", age: 25 }
|
|
36
|
+
* ];
|
|
37
|
+
* printTable([types, ...data], { typesRowIndex: 0 });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export default function printTable(data: {
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
}[], options?: {
|
|
43
|
+
maxColumnWidth?: number;
|
|
44
|
+
minColumnWidth?: number;
|
|
45
|
+
typesRowIndex?: number;
|
|
46
|
+
}): void;
|
|
47
|
+
//# sourceMappingURL=printTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printTable.d.ts","sourceRoot":"","sources":["../../src/helpers/printTable.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;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,CAuNN"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import wrapString from "./wrapString.js";
|
|
2
|
+
/**
|
|
3
|
+
* Prints a formatted table to the console with support for word wrapping
|
|
4
|
+
* within cells. Unlike `console.table()`, this function properly handles
|
|
5
|
+
* multi-line content within cells, making it ideal for displaying data with
|
|
6
|
+
* long text values.
|
|
7
|
+
*
|
|
8
|
+
* @param data - An array of objects representing the rows of the table. Each
|
|
9
|
+
* object should have string keys.
|
|
10
|
+
* @param options - Optional configuration for table rendering.
|
|
11
|
+
* @param options.maxColumnWidth - The maximum width for any column (default:
|
|
12
|
+
* `75`). Values exceeding this width will be wrapped at word 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
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const data = [
|
|
23
|
+
* { name: "Alice", description: "A software engineer with expertise in TypeScript" },
|
|
24
|
+
* { name: "Bob", description: "A product manager" }
|
|
25
|
+
* ];
|
|
26
|
+
* printTable(data, { maxColumnWidth: 30 });
|
|
27
|
+
* // Outputs a nicely formatted table with word-wrapped description column
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* // With types row
|
|
33
|
+
* const types = { name: "VARCHAR/string", age: "INTEGER/number" };
|
|
34
|
+
* const data = [
|
|
35
|
+
* { name: "Alice", age: 30 },
|
|
36
|
+
* { name: "Bob", age: 25 }
|
|
37
|
+
* ];
|
|
38
|
+
* printTable([types, ...data], { typesRowIndex: 0 });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export default function printTable(data, options) {
|
|
42
|
+
if (!data || data.length === 0) {
|
|
43
|
+
console.log("(empty table)");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const maxColumnWidth = options?.maxColumnWidth ?? 75;
|
|
47
|
+
const minColumnWidth = options?.minColumnWidth ?? 3;
|
|
48
|
+
// Helper function to format values for display
|
|
49
|
+
const formatValue = (value) => {
|
|
50
|
+
if (value instanceof Date) {
|
|
51
|
+
return value.toISOString();
|
|
52
|
+
}
|
|
53
|
+
return String(value);
|
|
54
|
+
};
|
|
55
|
+
// Get all column names
|
|
56
|
+
const columns = Object.keys(data[0]);
|
|
57
|
+
if (columns.length === 0) {
|
|
58
|
+
console.log("(empty table)");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
// Single pass: calculate column widths and prepare wrapped data.
|
|
62
|
+
// First, seed widths from header names.
|
|
63
|
+
const columnWidths = {};
|
|
64
|
+
for (const col of columns) {
|
|
65
|
+
columnWidths[col] = col.length;
|
|
66
|
+
}
|
|
67
|
+
// Format every cell, track the longest raw line per column, and
|
|
68
|
+
// store the formatted strings for the wrapping step that follows.
|
|
69
|
+
const formattedData = [];
|
|
70
|
+
for (const row of data) {
|
|
71
|
+
const formattedRow = [];
|
|
72
|
+
for (let c = 0; c < columns.length; c++) {
|
|
73
|
+
const col = columns[c];
|
|
74
|
+
const value = formatValue(row[col]);
|
|
75
|
+
formattedRow.push(value);
|
|
76
|
+
// Track longest line (handles embedded newlines)
|
|
77
|
+
const lines = value.split("\n");
|
|
78
|
+
let longestLine = 0;
|
|
79
|
+
for (const line of lines) {
|
|
80
|
+
if (line.length > longestLine)
|
|
81
|
+
longestLine = line.length;
|
|
82
|
+
}
|
|
83
|
+
if (longestLine > columnWidths[col]) {
|
|
84
|
+
columnWidths[col] = longestLine;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
formattedData.push(formattedRow);
|
|
88
|
+
}
|
|
89
|
+
// Apply min/max constraints
|
|
90
|
+
for (const col of columns) {
|
|
91
|
+
columnWidths[col] = Math.min(Math.max(columnWidths[col], minColumnWidth), maxColumnWidth);
|
|
92
|
+
}
|
|
93
|
+
// Wrap pre-formatted strings into multi-line cells
|
|
94
|
+
const wrappedData = [];
|
|
95
|
+
for (let r = 0; r < formattedData.length; r++) {
|
|
96
|
+
const wrappedRow = {};
|
|
97
|
+
for (let c = 0; c < columns.length; c++) {
|
|
98
|
+
const col = columns[c];
|
|
99
|
+
const value = formattedData[r][c];
|
|
100
|
+
const width = columnWidths[col];
|
|
101
|
+
// Split by existing newlines, then wrap each part
|
|
102
|
+
const lines = value.split("\n");
|
|
103
|
+
const allWrappedLines = [];
|
|
104
|
+
for (const line of lines) {
|
|
105
|
+
if (line.length <= width) {
|
|
106
|
+
allWrappedLines.push(line);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
// Wrap long lines at word boundaries
|
|
110
|
+
const wrapped = wrapString(line, width);
|
|
111
|
+
allWrappedLines.push(...wrapped.split("\n"));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
wrappedRow[col] = allWrappedLines.length > 0 ? allWrappedLines : [""];
|
|
115
|
+
}
|
|
116
|
+
wrappedData.push(wrappedRow);
|
|
117
|
+
}
|
|
118
|
+
// ANSI color codes (matching Deno's console colors)
|
|
119
|
+
const colors = {
|
|
120
|
+
reset: "\x1b[0m",
|
|
121
|
+
bold: "\x1b[1m",
|
|
122
|
+
grey: "\x1b[90m",
|
|
123
|
+
string: "\x1b[32m", // green
|
|
124
|
+
number: "\x1b[33m", // yellow
|
|
125
|
+
boolean: "\x1b[95m", // bright magenta/pink
|
|
126
|
+
date: "\x1b[36m", // cyan
|
|
127
|
+
null: "\x1b[90m", // grey
|
|
128
|
+
};
|
|
129
|
+
// Helper function to get color for a value based on its actual JavaScript type
|
|
130
|
+
const getColorForValue = (value, isTypeRow) => {
|
|
131
|
+
if (isTypeRow)
|
|
132
|
+
return colors.grey;
|
|
133
|
+
if (value === null || value === undefined)
|
|
134
|
+
return colors.null;
|
|
135
|
+
if (value instanceof Date)
|
|
136
|
+
return colors.date;
|
|
137
|
+
if (typeof value === "boolean")
|
|
138
|
+
return colors.boolean;
|
|
139
|
+
if (typeof value === "number")
|
|
140
|
+
return colors.number;
|
|
141
|
+
return colors.string;
|
|
142
|
+
};
|
|
143
|
+
// Helper function to create a horizontal border line with column junctions
|
|
144
|
+
const createBorderLine = (left, middle, right) => {
|
|
145
|
+
const segments = columns.map((col) => "─".repeat(columnWidths[col] + 2));
|
|
146
|
+
return colors.grey + left + segments.join(middle) + right + colors.reset;
|
|
147
|
+
};
|
|
148
|
+
// Helper function to create a separator line
|
|
149
|
+
const createSeparator = () => createBorderLine("├", "┼", "┤");
|
|
150
|
+
// Helper function to create the top border
|
|
151
|
+
const createTopBorder = () => createBorderLine("┌", "┬", "┐");
|
|
152
|
+
// Helper function to create the bottom border
|
|
153
|
+
const createBottomBorder = () => createBorderLine("└", "┴", "┘");
|
|
154
|
+
// Helper function to pad a string to a specific width
|
|
155
|
+
const pad = (str, width) => {
|
|
156
|
+
return str + " ".repeat(Math.max(0, width - str.length));
|
|
157
|
+
};
|
|
158
|
+
// Print top border
|
|
159
|
+
console.log(createTopBorder());
|
|
160
|
+
// Print header row (bold)
|
|
161
|
+
const headerParts = columns.map((col) => ` ${colors.bold}${pad(col, columnWidths[col])}${colors.reset} `);
|
|
162
|
+
console.log(colors.grey + "│" + colors.reset +
|
|
163
|
+
headerParts.join(colors.grey + "│" + colors.reset) + colors.grey + "│" +
|
|
164
|
+
colors.reset);
|
|
165
|
+
// Detect if any row has word wrapping (spans multiple lines)
|
|
166
|
+
let hasWordWrapping = false;
|
|
167
|
+
for (const wrappedRow of wrappedData) {
|
|
168
|
+
for (const col of columns) {
|
|
169
|
+
if (wrappedRow[col].length > 1) {
|
|
170
|
+
hasWordWrapping = true;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (hasWordWrapping)
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
// Print separator after header (unless the first row is the types row,
|
|
178
|
+
// in which case the separator is printed after the types row instead)
|
|
179
|
+
if (options?.typesRowIndex !== 0) {
|
|
180
|
+
console.log(createSeparator());
|
|
181
|
+
}
|
|
182
|
+
// Print data rows
|
|
183
|
+
for (let i = 0; i < wrappedData.length; i++) {
|
|
184
|
+
const wrappedRow = wrappedData[i];
|
|
185
|
+
const originalRow = data[i];
|
|
186
|
+
const isTypeRow = i === options?.typesRowIndex;
|
|
187
|
+
// Find the maximum number of lines in this row
|
|
188
|
+
let maxLines = 1;
|
|
189
|
+
for (const col of columns) {
|
|
190
|
+
if (wrappedRow[col].length > maxLines) {
|
|
191
|
+
maxLines = wrappedRow[col].length;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// Print each line of this row
|
|
195
|
+
for (let lineIdx = 0; lineIdx < maxLines; lineIdx++) {
|
|
196
|
+
const lineParts = columns.map((col) => {
|
|
197
|
+
const lines = wrappedRow[col];
|
|
198
|
+
const lineValue = lineIdx < lines.length ? lines[lineIdx] : "";
|
|
199
|
+
const color = getColorForValue(originalRow[col], isTypeRow);
|
|
200
|
+
return ` ${color}${pad(lineValue, columnWidths[col])}${colors.reset} `;
|
|
201
|
+
});
|
|
202
|
+
console.log(colors.grey + "│" + colors.reset +
|
|
203
|
+
lineParts.join(colors.grey + "│" + colors.reset) + colors.grey +
|
|
204
|
+
"│" +
|
|
205
|
+
colors.reset);
|
|
206
|
+
}
|
|
207
|
+
// Print separator after types row
|
|
208
|
+
if (isTypeRow) {
|
|
209
|
+
console.log(createSeparator());
|
|
210
|
+
} // Print separator between rows when word wrapping is present (except after last row)
|
|
211
|
+
else if (hasWordWrapping && i < wrappedData.length - 1) {
|
|
212
|
+
console.log(createSeparator());
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Print bottom border
|
|
216
|
+
console.log(createBottomBorder());
|
|
217
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import SimpleTable from "../class/SimpleTable.js";
|
|
2
|
+
import SimpleDB from "../class/SimpleDB.js";
|
|
3
|
+
export default function queryDB(simple: SimpleTable | SimpleDB, query: string, options: {
|
|
4
|
+
table: string | null;
|
|
5
|
+
method: string | null;
|
|
6
|
+
parameters: {
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
} | null;
|
|
9
|
+
nbRowsToLog: number;
|
|
10
|
+
nbCharactersToLog: number | undefined;
|
|
11
|
+
returnDataFrom: "query" | "none";
|
|
12
|
+
debug: boolean;
|
|
13
|
+
types?: {
|
|
14
|
+
[key: string]: string;
|
|
15
|
+
};
|
|
16
|
+
}): Promise<{
|
|
17
|
+
[key: string]: string | number | boolean | Date | null;
|
|
18
|
+
}[] | null>;
|
|
19
|
+
//# sourceMappingURL=queryDB.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryDB.d.ts","sourceRoot":"","sources":["../../src/helpers/queryDB.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAG5C,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,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,cAAc,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACnC,GACA,OAAO,CACN;IACA,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC;CACxD,EAAE,GACD,IAAI,CACP,CA+DA"}
|