@flowblade/sqlduck 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { getLogger } from "@logtape/logtape";
2
2
  import fs from "node:fs";
3
- import { basename, dirname } from "node:path";
3
+ import path, { basename, dirname } from "node:path";
4
4
  //#region src/config/flowblade-logtape-sqlduck.config.ts
5
5
  const flowbladeLogtapeSqlduckConfig = { categories: ["flowblade", "sqlduck"] };
6
6
  //#endregion
@@ -85,8 +85,35 @@ var FileSystemUtils = class {
85
85
  * Returns false if either path doesn't exist.
86
86
  */
87
87
  isSamePath = (path1, path2) => {
88
+ if (typeof path1 !== "string" || typeof path2 !== "string" || path1.trim().length === 0 || path2.trim().length === 0) return false;
89
+ return path.resolve(path1) == path.resolve(path2);
90
+ };
91
+ /**
92
+ * Check whether two paths (file, directory...) exists and are identical by comparing their real paths.
93
+ * Returns false if either path doesn't exist.
94
+ */
95
+ isSamePathAndExists = (path1, path2) => {
96
+ if (typeof path1 !== "string" || typeof path2 !== "string" || path1.trim().length === 0 || path2.trim().length === 0) return false;
88
97
  return fs.existsSync(path1) && fs.existsSync(path2) && fs.realpathSync(path1) === fs.realpathSync(path2);
89
98
  };
99
+ /**
100
+ * Return directory and filename as absolute directory (cross-platform)
101
+ */
102
+ join = (params) => {
103
+ const { dirname, filename } = params;
104
+ if (typeof dirname !== "string" || typeof filename !== "string" || dirname.trim().length === 0 || filename.trim().length === 0) throw new Error("dirname and filename parameters must be non empty string");
105
+ const combinedPath = path.join(dirname, filename);
106
+ return path.resolve(combinedPath);
107
+ };
108
+ /**
109
+ * Return the filesize in bytes or null either if the file doesn't exist or if the path is not a file
110
+ */
111
+ getFileSize = (path) => {
112
+ const stats = fs.statSync(path, { throwIfNoEntry: false });
113
+ if (stats === void 0) return null;
114
+ if (stats.isFile()) return stats.size;
115
+ return null;
116
+ };
90
117
  };
91
118
  //#endregion
92
119
  export { sqlduckDefaultLogtapeLogger as n, flowbladeLogtapeSqlduckConfig as r, FileSystemUtils as t };
@@ -34,6 +34,22 @@ declare class FileSystemUtils {
34
34
  * Returns false if either path doesn't exist.
35
35
  */
36
36
  isSamePath: (path1: string, path2: string) => boolean;
37
+ /**
38
+ * Check whether two paths (file, directory...) exists and are identical by comparing their real paths.
39
+ * Returns false if either path doesn't exist.
40
+ */
41
+ isSamePathAndExists: (path1: string, path2: string) => boolean;
42
+ /**
43
+ * Return directory and filename as absolute directory (cross-platform)
44
+ */
45
+ join: (params: {
46
+ dirname: string;
47
+ filename: string;
48
+ }) => string;
49
+ /**
50
+ * Return the filesize in bytes or null either if the file doesn't exist or if the path is not a file
51
+ */
52
+ getFileSize: (path: string) => number | null;
37
53
  }
38
54
  //#endregion
39
55
  export { FileSystemUtils };
@@ -1,2 +1,2 @@
1
- import { t as FileSystemUtils } from "../file-system-utils-DdgNpyGk.mjs";
1
+ import { t as FileSystemUtils } from "../file-system-utils-BX51TrfT.mjs";
2
2
  export { FileSystemUtils };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as sqlduckDefaultLogtapeLogger, r as flowbladeLogtapeSqlduckConfig, t as FileSystemUtils } from "./file-system-utils-DdgNpyGk.mjs";
1
+ import { n as sqlduckDefaultLogtapeLogger, r as flowbladeLogtapeSqlduckConfig, t as FileSystemUtils } from "./file-system-utils-BX51TrfT.mjs";
2
2
  import { t as duckReservedKeywords } from "./duck-reserved-keywords-D_yi_PVW.mjs";
3
3
  import { c as duckValidatorsZod, r as assertValidAliasName, s as duckConnectionParamsZodSchema } from "./zod-uQPzaK64.mjs";
4
4
  import { BIGINT, BOOLEAN, DOUBLE, DuckDBDataChunk, DuckDBInstanceCache, DuckDBTimestampMillisecondsValue, DuckDBTypeId, ENUM, FLOAT, HUGEINT, INTEGER, SMALLINT, TIMESTAMP, TIMESTAMP_MS, TINYINT, UBIGINT, UHUGEINT, UINTEGER, USMALLINT, UTINYINT, UUID, VARCHAR } from "@duckdb/node-api";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowblade/sqlduck",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -76,16 +76,20 @@
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@duckdb/node-api": "^1.5.3-r.2",
79
+ "kysely": "^0.29.0",
79
80
  "valibot": "^1.3.1"
80
81
  },
81
82
  "peerDependenciesMeta": {
83
+ "kysely": {
84
+ "optional": true
85
+ },
82
86
  "valibot": {
83
87
  "optional": true
84
88
  }
85
89
  },
86
90
  "devDependencies": {
87
91
  "@belgattitude/eslint-config-bases": "8.15.0",
88
- "@dotenvx/dotenvx": "1.68.1",
92
+ "@dotenvx/dotenvx": "1.69.1",
89
93
  "@duckdb/node-api": "1.5.3-r.2",
90
94
  "@faker-js/faker": "10.4.0",
91
95
  "@flowblade/source-kysely": "^1.4.1",
@@ -98,7 +102,7 @@
98
102
  "@types/node": "25.9.1",
99
103
  "@typescript-eslint/eslint-plugin": "8.60.0",
100
104
  "@typescript-eslint/parser": "8.60.0",
101
- "@typescript/native-preview": "7.0.0-dev.20260525.1",
105
+ "@typescript/native-preview": "7.0.0-dev.20260526.1",
102
106
  "@vitest/coverage-v8": "4.1.7",
103
107
  "@vitest/ui": "4.1.7",
104
108
  "ansis": "4.3.0",