@flowblade/sqlduck 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{file-system-utils-DBihLfn2.mjs → file-system-utils-BX51TrfT.mjs} +9 -0
- package/dist/filesystem/index.d.mts +4 -0
- package/dist/filesystem/index.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/integrations/kysely/index.d.mts +16 -0
- package/dist/integrations/kysely/index.mjs +24 -0
- package/package.json +12 -4
|
@@ -105,6 +105,15 @@ var FileSystemUtils = class {
|
|
|
105
105
|
const combinedPath = path.join(dirname, filename);
|
|
106
106
|
return path.resolve(combinedPath);
|
|
107
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
|
+
};
|
|
108
117
|
};
|
|
109
118
|
//#endregion
|
|
110
119
|
export { sqlduckDefaultLogtapeLogger as n, flowbladeLogtapeSqlduckConfig as r, FileSystemUtils as t };
|
|
@@ -46,6 +46,10 @@ declare class FileSystemUtils {
|
|
|
46
46
|
dirname: string;
|
|
47
47
|
filename: string;
|
|
48
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;
|
|
49
53
|
}
|
|
50
54
|
//#endregion
|
|
51
55
|
export { FileSystemUtils };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as FileSystemUtils } from "../file-system-utils-
|
|
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-
|
|
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";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Kysely, SelectQueryBuilder } from "kysely";
|
|
2
|
+
|
|
3
|
+
//#region src/integrations/kysely/compile-duck-query.d.ts
|
|
4
|
+
type SqlTagInformation = {
|
|
5
|
+
text: string;
|
|
6
|
+
values: unknown[];
|
|
7
|
+
};
|
|
8
|
+
declare const compileDuckQuery: <T extends SelectQueryBuilder<any, any, any>>(query: T) => SqlTagInformation;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/integrations/kysely/create-duck-kysely-query-builder.d.ts
|
|
11
|
+
type KyselyQueryBuilder<TDatabase> = Pick<Kysely<TDatabase>, 'mergeInto' | 'selectFrom' | 'selectNoFrom' | 'deleteFrom' | 'updateTable' | 'insertInto' | 'replaceInto' | 'with' | 'withRecursive' | 'withTables'>;
|
|
12
|
+
declare const createDuckKysekyQueryBuilder: <TDatabase>(params?: {
|
|
13
|
+
schema?: string;
|
|
14
|
+
}) => KyselyQueryBuilder<TDatabase>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { compileDuckQuery, createDuckKysekyQueryBuilder };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DummyDriver, Kysely, PostgresAdapter, PostgresIntrospector, PostgresQueryCompiler } from "kysely";
|
|
2
|
+
//#region src/integrations/kysely/compile-duck-query.ts
|
|
3
|
+
const compileDuckQuery = (query) => {
|
|
4
|
+
const { sql, parameters } = query.compile();
|
|
5
|
+
return {
|
|
6
|
+
text: sql,
|
|
7
|
+
values: parameters
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/integrations/kysely/create-duck-kysely-query-builder.ts
|
|
12
|
+
let kyselyCache;
|
|
13
|
+
const createDuckKysekyQueryBuilder = (params) => {
|
|
14
|
+
kyselyCache ??= new Kysely({ dialect: {
|
|
15
|
+
createAdapter: () => new PostgresAdapter(),
|
|
16
|
+
createDriver: () => new DummyDriver(),
|
|
17
|
+
createIntrospector: (db) => new PostgresIntrospector(db),
|
|
18
|
+
createQueryCompiler: () => new PostgresQueryCompiler()
|
|
19
|
+
} });
|
|
20
|
+
if (params?.schema) return kyselyCache.withSchema(params.schema);
|
|
21
|
+
return kyselyCache;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { compileDuckQuery, createDuckKysekyQueryBuilder };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowblade/sqlduck",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
"types": "./dist/validation/valibot/index.d.mts",
|
|
21
21
|
"default": "./dist/validation/valibot/index.mjs"
|
|
22
22
|
},
|
|
23
|
+
"./kysely": {
|
|
24
|
+
"types": "./dist/integrations/kysely/index.d.mts",
|
|
25
|
+
"default": "./dist/integrations/kysely/index.mjs"
|
|
26
|
+
},
|
|
23
27
|
"./package.json": "./package.json"
|
|
24
28
|
},
|
|
25
29
|
"author": {
|
|
@@ -63,7 +67,7 @@
|
|
|
63
67
|
},
|
|
64
68
|
"dependencies": {
|
|
65
69
|
"@flowblade/core": "^0.2.29",
|
|
66
|
-
"@flowblade/source-duckdb": "^0.
|
|
70
|
+
"@flowblade/source-duckdb": "^0.23.0",
|
|
67
71
|
"@flowblade/sql-tag": "^0.3.4",
|
|
68
72
|
"@httpx/assert": "^0.17.1",
|
|
69
73
|
"@httpx/dsn-parser": "^1.9.11",
|
|
@@ -76,16 +80,20 @@
|
|
|
76
80
|
},
|
|
77
81
|
"peerDependencies": {
|
|
78
82
|
"@duckdb/node-api": "^1.5.3-r.2",
|
|
83
|
+
"kysely": "^0.29.0",
|
|
79
84
|
"valibot": "^1.3.1"
|
|
80
85
|
},
|
|
81
86
|
"peerDependenciesMeta": {
|
|
87
|
+
"kysely": {
|
|
88
|
+
"optional": true
|
|
89
|
+
},
|
|
82
90
|
"valibot": {
|
|
83
91
|
"optional": true
|
|
84
92
|
}
|
|
85
93
|
},
|
|
86
94
|
"devDependencies": {
|
|
87
95
|
"@belgattitude/eslint-config-bases": "8.15.0",
|
|
88
|
-
"@dotenvx/dotenvx": "1.
|
|
96
|
+
"@dotenvx/dotenvx": "1.69.1",
|
|
89
97
|
"@duckdb/node-api": "1.5.3-r.2",
|
|
90
98
|
"@faker-js/faker": "10.4.0",
|
|
91
99
|
"@flowblade/source-kysely": "^1.4.1",
|
|
@@ -98,7 +106,7 @@
|
|
|
98
106
|
"@types/node": "25.9.1",
|
|
99
107
|
"@typescript-eslint/eslint-plugin": "8.60.0",
|
|
100
108
|
"@typescript-eslint/parser": "8.60.0",
|
|
101
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
109
|
+
"@typescript/native-preview": "7.0.0-dev.20260526.1",
|
|
102
110
|
"@vitest/coverage-v8": "4.1.7",
|
|
103
111
|
"@vitest/ui": "4.1.7",
|
|
104
112
|
"ansis": "4.3.0",
|