@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,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = keepNumericalColumns;
|
|
4
|
+
function keepNumericalColumns(types) {
|
|
5
|
+
const columns = [];
|
|
6
|
+
for (const col of Object.keys(types)) {
|
|
7
|
+
if (["FLOAT", "DOUBLE", "DECIMAL"].includes(types[col]) ||
|
|
8
|
+
types[col].includes("INT")) {
|
|
9
|
+
columns.push(col);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (columns.length === 0) {
|
|
13
|
+
throw new Error("No numerical columns");
|
|
14
|
+
}
|
|
15
|
+
return columns;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logData.d.ts","sourceRoot":"","sources":["../../src/helpers/logData.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,KAAK,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,IAAI,EACvC,IAAI,EACA;IACA,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC;CACxD,EAAE,GACD,IAAI,EACR,iBAAiB,CAAC,EAAE,MAAM,QAwD3B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 = logData;
|
|
7
|
+
const printTable_js_1 = __importDefault(require("./printTable.js"));
|
|
8
|
+
function logData(types, data, nbCharactersToLog) {
|
|
9
|
+
if (data === null) {
|
|
10
|
+
console.log("Data is null");
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
if (data.length === 0) {
|
|
14
|
+
console.log(data);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const dataToBeLogged = [];
|
|
18
|
+
const keys = Object.keys(data[0]);
|
|
19
|
+
for (let i = 0; i < data.length; i++) {
|
|
20
|
+
const newItem = {};
|
|
21
|
+
for (const key of keys) {
|
|
22
|
+
if (typeof nbCharactersToLog === "number" &&
|
|
23
|
+
typeof data[i][key] === "string" &&
|
|
24
|
+
data[i][key].length > nbCharactersToLog) {
|
|
25
|
+
newItem[key] = data[i][key].slice(0, nbCharactersToLog) + "...";
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
newItem[key] = data[i][key];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
dataToBeLogged.push(newItem);
|
|
32
|
+
}
|
|
33
|
+
let hasTypesRow = false;
|
|
34
|
+
if (types !== null) {
|
|
35
|
+
const columns = Object.keys(types);
|
|
36
|
+
if (columns.length > 0) {
|
|
37
|
+
for (const col of columns) {
|
|
38
|
+
types[col] = types[col] + "/" +
|
|
39
|
+
(data[0][col] === null ? null : typeof data[0][col]);
|
|
40
|
+
}
|
|
41
|
+
// Add types as the first row
|
|
42
|
+
dataToBeLogged.unshift(types);
|
|
43
|
+
hasTypesRow = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
(0, printTable_js_1.default)(dataToBeLogged, {
|
|
47
|
+
...(typeof nbCharactersToLog === "number"
|
|
48
|
+
? { maxColumnWidth: nbCharactersToLog }
|
|
49
|
+
: {}),
|
|
50
|
+
...(hasTypesRow ? { typesRowIndex: 0 } : {}),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type Simple from "../class/Simple.js";
|
|
2
|
+
export default function mergeOptions(simple: Simple, options: {
|
|
3
|
+
table: string | null;
|
|
4
|
+
method: string | null;
|
|
5
|
+
parameters: {
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
} | null;
|
|
8
|
+
nbRowsToLog?: number;
|
|
9
|
+
returnDataFrom?: "query" | "none";
|
|
10
|
+
debug?: boolean;
|
|
11
|
+
types?: {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
};
|
|
14
|
+
}): {
|
|
15
|
+
table: string | null;
|
|
16
|
+
method: string | null;
|
|
17
|
+
parameters: {
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
} | null;
|
|
20
|
+
nbRowsToLog: number;
|
|
21
|
+
nbCharactersToLog: number | undefined;
|
|
22
|
+
returnDataFrom: "query" | "none";
|
|
23
|
+
debug: boolean;
|
|
24
|
+
types?: {
|
|
25
|
+
[key: string]: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=mergeOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeOptions.d.ts","sourceRoot":"","sources":["../../src/helpers/mergeOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAE7C,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,MAAM,EAAE,MAAM,EACd,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,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACnC,GACA;IACD,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,CAWA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = mergeOptions;
|
|
4
|
+
function mergeOptions(simple, options) {
|
|
5
|
+
return {
|
|
6
|
+
table: options.table,
|
|
7
|
+
method: options.method,
|
|
8
|
+
parameters: options.parameters,
|
|
9
|
+
nbRowsToLog: options.nbRowsToLog ?? simple.nbRowsToLog,
|
|
10
|
+
nbCharactersToLog: simple.nbCharactersToLog,
|
|
11
|
+
returnDataFrom: options.returnDataFrom ?? "none",
|
|
12
|
+
debug: options.debug ?? simple.debug,
|
|
13
|
+
types: options.types,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -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,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = nestQuery;
|
|
7
|
+
const stringToArray_js_1 = __importDefault(require("./stringToArray.js"));
|
|
8
|
+
function nestQuery(table, column, separator, categories) {
|
|
9
|
+
const cats = (0, stringToArray_js_1.default)(categories);
|
|
10
|
+
const groupBy = cats.map((d) => `"${d}"`).join(", ");
|
|
11
|
+
const selectColumns = `${groupBy}, `;
|
|
12
|
+
const orderBy = `\nORDER BY ${cats.map((d) => `"${d}" ASC`).join(", ")}`;
|
|
13
|
+
const query = `CREATE OR REPLACE TABLE "${table}" AS
|
|
14
|
+
SELECT
|
|
15
|
+
${selectColumns}STRING_AGG("${column}", '${separator}') AS "${column}"
|
|
16
|
+
FROM "${table}"
|
|
17
|
+
GROUP BY ${groupBy}${orderBy};`;
|
|
18
|
+
return query;
|
|
19
|
+
}
|
|
@@ -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,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = parseDuckDBType;
|
|
4
|
+
const node_api_1 = require("@duckdb/node-api");
|
|
5
|
+
function parseDuckDBType(type) {
|
|
6
|
+
if (type === "INTEGER") {
|
|
7
|
+
return node_api_1.INTEGER;
|
|
8
|
+
}
|
|
9
|
+
else if (type === "BIGINT") {
|
|
10
|
+
return node_api_1.BIGINT;
|
|
11
|
+
}
|
|
12
|
+
else if (type === "DOUBLE") {
|
|
13
|
+
return node_api_1.DOUBLE;
|
|
14
|
+
}
|
|
15
|
+
else if (type === "VARCHAR") {
|
|
16
|
+
return node_api_1.VARCHAR;
|
|
17
|
+
}
|
|
18
|
+
else if (type === "TIMESTAMP") {
|
|
19
|
+
return node_api_1.TIMESTAMP;
|
|
20
|
+
}
|
|
21
|
+
else if (type === "TIMESTAMP WITH TIME ZONE") {
|
|
22
|
+
return node_api_1.TIMESTAMPTZ;
|
|
23
|
+
}
|
|
24
|
+
else if (type === "DATE") {
|
|
25
|
+
return node_api_1.DATE;
|
|
26
|
+
}
|
|
27
|
+
else if (type === "TIME") {
|
|
28
|
+
return node_api_1.TIME;
|
|
29
|
+
}
|
|
30
|
+
else if (type === "BOOLEAN") {
|
|
31
|
+
return node_api_1.BOOLEAN;
|
|
32
|
+
}
|
|
33
|
+
else if (type.includes("FLOAT[")) {
|
|
34
|
+
// For embeddings
|
|
35
|
+
const size = type.replace("FLOAT[", "").replace("]", "");
|
|
36
|
+
return (0, node_api_1.ARRAY)(node_api_1.FLOAT, parseInt(size));
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
throw new Error(`Type ${type} not supported.`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -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,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = parseType;
|
|
4
|
+
function parseType(type) {
|
|
5
|
+
const typeLowerCase = type.toLowerCase();
|
|
6
|
+
if (typeLowerCase === "integer") {
|
|
7
|
+
return "INTEGER";
|
|
8
|
+
}
|
|
9
|
+
else if (typeLowerCase === "float" || typeLowerCase === "number") {
|
|
10
|
+
return "DOUBLE";
|
|
11
|
+
}
|
|
12
|
+
else if (typeLowerCase === "string") {
|
|
13
|
+
return "VARCHAR";
|
|
14
|
+
}
|
|
15
|
+
else if (typeLowerCase === "datetime") {
|
|
16
|
+
return "TIMESTAMP";
|
|
17
|
+
}
|
|
18
|
+
else if (typeLowerCase === "datetimetz") {
|
|
19
|
+
return "TIMESTAMP WITH TIME ZONE";
|
|
20
|
+
}
|
|
21
|
+
else if ([
|
|
22
|
+
"date",
|
|
23
|
+
"time",
|
|
24
|
+
"bigint",
|
|
25
|
+
"hugeint",
|
|
26
|
+
"double",
|
|
27
|
+
"varchar",
|
|
28
|
+
"timestamp",
|
|
29
|
+
"timestamp with time zone",
|
|
30
|
+
"boolean",
|
|
31
|
+
"geometry",
|
|
32
|
+
].includes(typeLowerCase)) {
|
|
33
|
+
return type.toUpperCase();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
throw new Error(`Unknown type ${type}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -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,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = parseValue;
|
|
4
|
+
function parseValue(value) {
|
|
5
|
+
if (Number.isNaN(value) || value === undefined || value === null) {
|
|
6
|
+
return "NULL";
|
|
7
|
+
}
|
|
8
|
+
else if (value instanceof Date) {
|
|
9
|
+
return `'${value.toISOString()}'`;
|
|
10
|
+
}
|
|
11
|
+
else if (typeof value === "string") {
|
|
12
|
+
return `'${value.replaceAll("'", "''")}'`;
|
|
13
|
+
}
|
|
14
|
+
else if (typeof value === "boolean") {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
else if (typeof value === "number") {
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
throw new Error(`Unkown type ${typeof value} of ${value}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -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,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = prettyDuration;
|
|
4
|
+
/**
|
|
5
|
+
* 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.
|
|
6
|
+
*
|
|
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
|
+
*
|
|
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
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* // A starting Date somewhere in your code.
|
|
20
|
+
* const startDate = new Date(); // or Date.now()
|
|
21
|
+
*
|
|
22
|
+
* // When you want to know the elapsed duration, pass the start date.
|
|
23
|
+
* const duration = prettyDuration(startDate);
|
|
24
|
+
* console.log(duration); // Returns something like "22 days, 6 h, 3 min, 15 sec, 3 ms"
|
|
25
|
+
* ```
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* // If you want to console.log it directly, set the `log` option to `true`.
|
|
29
|
+
* // This will print the duration to the console and also return the string.
|
|
30
|
+
* const startDateForLog = new Date();
|
|
31
|
+
* // ... some operations ...
|
|
32
|
+
* prettyDuration(startDateForLog, { log: true });
|
|
33
|
+
* ```
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* // You can also use a prefix and/or suffix for the output string.
|
|
37
|
+
* const startDateWithPrefixSuffix = new Date();
|
|
38
|
+
* // ... some operations ...
|
|
39
|
+
* prettyDuration(startDateWithPrefixSuffix, { log: true, prefix: "Elapsed time: ", suffix: " (Main function)" });
|
|
40
|
+
* // Returns and logs something like "Total duration: 3 min, 15 sec, 3 ms (Main function)"
|
|
41
|
+
* ```
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* // If you want to format the duration between two specific dates, use the `end` option.
|
|
45
|
+
* const start = new Date("2024-01-01T17:00:00Z");
|
|
46
|
+
* const end = new Date("2024-01-23T23:03:15Z");
|
|
47
|
+
* const specificDuration = prettyDuration(start, { end });
|
|
48
|
+
* console.log(specificDuration); // Returns "22 days, 6 h, 3 min, 15 sec, 0 ms"
|
|
49
|
+
* ```
|
|
50
|
+
* @category Formatting
|
|
51
|
+
*/
|
|
52
|
+
function prettyDuration(start, options = {}) {
|
|
53
|
+
if (start instanceof Date) {
|
|
54
|
+
start = start.getTime();
|
|
55
|
+
}
|
|
56
|
+
let end;
|
|
57
|
+
if (options.end instanceof Date) {
|
|
58
|
+
end = options.end.getTime();
|
|
59
|
+
}
|
|
60
|
+
else if (typeof options.end === "number") {
|
|
61
|
+
end = options.end;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
end = Date.now();
|
|
65
|
+
}
|
|
66
|
+
const differenceInMs = end - start;
|
|
67
|
+
let prettyDuration = "";
|
|
68
|
+
if (differenceInMs < 1000) {
|
|
69
|
+
// Less than a second
|
|
70
|
+
prettyDuration = `${differenceInMs} ms`;
|
|
71
|
+
}
|
|
72
|
+
else if (differenceInMs < 60_000) {
|
|
73
|
+
// Less than a minute
|
|
74
|
+
const sec = Math.floor(differenceInMs / 1000);
|
|
75
|
+
const ms = differenceInMs % 1000;
|
|
76
|
+
prettyDuration = `${sec} sec, ${ms} ms`;
|
|
77
|
+
}
|
|
78
|
+
else if (differenceInMs < 3_600_000) {
|
|
79
|
+
// Less than an hour
|
|
80
|
+
const min = Math.floor(differenceInMs / 60_000);
|
|
81
|
+
const remainingMs = differenceInMs % 60_000;
|
|
82
|
+
const sec = Math.floor(remainingMs / 1000);
|
|
83
|
+
const ms = remainingMs % 1000;
|
|
84
|
+
prettyDuration = `${min} min, ${sec} sec, ${ms} ms`;
|
|
85
|
+
}
|
|
86
|
+
else if (differenceInMs < 86_400_000) {
|
|
87
|
+
// Less than a day
|
|
88
|
+
const hours = Math.floor(differenceInMs / 3_600_000);
|
|
89
|
+
const remainingMsAfterHours = differenceInMs % 3_600_000;
|
|
90
|
+
const min = Math.floor(remainingMsAfterHours / 60_000);
|
|
91
|
+
const remainingMsAfterMinutes = remainingMsAfterHours % 60_000;
|
|
92
|
+
const sec = Math.floor(remainingMsAfterMinutes / 1000);
|
|
93
|
+
const ms = remainingMsAfterMinutes % 1000;
|
|
94
|
+
prettyDuration = `${hours} h, ${min} min, ${sec} sec, ${ms} ms`;
|
|
95
|
+
}
|
|
96
|
+
else if (differenceInMs < 2_592_000_000) {
|
|
97
|
+
// Less than a month
|
|
98
|
+
const days = Math.floor(differenceInMs / 86_400_000);
|
|
99
|
+
const remainingMsAfterDays = differenceInMs % 86_400_000;
|
|
100
|
+
const hours = Math.floor(remainingMsAfterDays / 3_600_000);
|
|
101
|
+
const remainingMsAfterHours = remainingMsAfterDays % 3_600_000;
|
|
102
|
+
const min = Math.floor(remainingMsAfterHours / 60_000);
|
|
103
|
+
const remainingMsAfterMin = remainingMsAfterHours % 60_000;
|
|
104
|
+
const sec = Math.floor(remainingMsAfterMin / 1000);
|
|
105
|
+
const ms = remainingMsAfterMin % 1000;
|
|
106
|
+
prettyDuration = `${days} ${days <= 1 ? "day" : "days"}, ${hours} h, ${min} min, ${sec} sec, ${ms} ms`;
|
|
107
|
+
}
|
|
108
|
+
else if (differenceInMs < 31_536_000_000) {
|
|
109
|
+
// Less than a year
|
|
110
|
+
const months = Math.floor(differenceInMs / 2_592_000_000);
|
|
111
|
+
const remainingMsAfterMonths = differenceInMs % 2_592_000_000;
|
|
112
|
+
const days = Math.floor(remainingMsAfterMonths / 86_400_000);
|
|
113
|
+
const remainingMsAfterDays = differenceInMs % 86_400_000;
|
|
114
|
+
const hours = Math.floor(remainingMsAfterDays / 3_600_000);
|
|
115
|
+
const remainingMsAfterHours = remainingMsAfterDays % 3_600_000;
|
|
116
|
+
const min = Math.floor(remainingMsAfterHours / 60_000);
|
|
117
|
+
const remainingMsAfterMin = remainingMsAfterHours % 60_000;
|
|
118
|
+
const sec = Math.floor(remainingMsAfterMin / 1000);
|
|
119
|
+
const ms = remainingMsAfterMin % 1000;
|
|
120
|
+
prettyDuration = `${months} ${months <= 1 ? "month" : "months"}, ${days} ${days <= 1 ? "day" : "days"}, ${hours} h, ${min} min, ${sec} sec, ${ms} ms`;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
// More than a year
|
|
124
|
+
const years = Math.floor(differenceInMs / 31_536_000_000);
|
|
125
|
+
const remainingMsAfterYears = differenceInMs % 31_536_000_000;
|
|
126
|
+
const months = Math.floor(remainingMsAfterYears / 2_592_000_000);
|
|
127
|
+
const remainingMsAfterMonths = differenceInMs % 2_592_000_000;
|
|
128
|
+
const days = Math.floor(remainingMsAfterMonths / 86_400_000);
|
|
129
|
+
const remainingMsAfterDays = differenceInMs % 86_400_000;
|
|
130
|
+
const hours = Math.floor(remainingMsAfterDays / 3_600_000);
|
|
131
|
+
const remainingMsAfterHours = remainingMsAfterDays % 3_600_000;
|
|
132
|
+
const min = Math.floor(remainingMsAfterHours / 60_000);
|
|
133
|
+
const remainingMsAfterMin = remainingMsAfterHours % 60_000;
|
|
134
|
+
const sec = Math.floor(remainingMsAfterMin / 1000);
|
|
135
|
+
const ms = remainingMsAfterMin % 1000;
|
|
136
|
+
prettyDuration = `${years} ${years <= 1 ? "year" : "years"}, ${months} ${months <= 1 ? "month" : "months"}, ${days} ${days <= 1 ? "day" : "days"}, ${hours} h, ${min} min, ${sec} sec, ${ms} ms`;
|
|
137
|
+
}
|
|
138
|
+
if (typeof options.prefix === "string") {
|
|
139
|
+
prettyDuration = `${options.prefix}${prettyDuration}`;
|
|
140
|
+
}
|
|
141
|
+
if (typeof options.suffix === "string") {
|
|
142
|
+
prettyDuration = `${prettyDuration}${options.suffix}`;
|
|
143
|
+
}
|
|
144
|
+
if (options.log === true) {
|
|
145
|
+
console.log(prettyDuration);
|
|
146
|
+
}
|
|
147
|
+
return prettyDuration;
|
|
148
|
+
}
|
|
@@ -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"}
|