@pikku/kysely-bun-sqlite 0.12.10 → 0.12.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/dist/src/create-bun-sqlite-kysely.d.ts +2 -1
- package/dist/src/create-bun-sqlite-kysely.js +7 -1
- package/package.json +14 -9
- package/CHANGELOG.md +0 -173
- package/run-tests.sh +0 -68
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Kysely, type KyselyPlugin } from 'kysely';
|
|
2
|
+
import { type TraceDriverOptions } from '@pikku/kysely';
|
|
2
3
|
import type { SqliteFunctionMap } from '@pikku/kysely-sqlite';
|
|
3
|
-
export interface CreateBunSqliteKyselyOptions {
|
|
4
|
+
export interface CreateBunSqliteKyselyOptions extends Omit<TraceDriverOptions, 'system'> {
|
|
4
5
|
/** Path to the SQLite file. Use ':memory:' for an in-memory DB. */
|
|
5
6
|
filename: string;
|
|
6
7
|
/** Apply CamelCasePlugin so DB columns map to camelCase TS fields. Default true. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Database } from 'bun:sqlite';
|
|
2
2
|
import { Kysely, SqliteDialect, CamelCasePlugin, } from 'kysely';
|
|
3
|
+
import { traceDialect } from '@pikku/kysely';
|
|
3
4
|
import { BunSqliteDatabase } from './bun-sqlite-adapter.js';
|
|
4
5
|
import { registerSqliteFunctions } from './register-functions.js';
|
|
5
6
|
export function createBunSqliteKysely(options) {
|
|
@@ -14,7 +15,12 @@ export function createBunSqliteKysely(options) {
|
|
|
14
15
|
if (options.plugins)
|
|
15
16
|
plugins.push(...options.plugins);
|
|
16
17
|
return new Kysely({
|
|
17
|
-
dialect: new SqliteDialect({ database: new BunSqliteDatabase(db) }),
|
|
18
|
+
dialect: traceDialect(new SqliteDialect({ database: new BunSqliteDatabase(db) }), {
|
|
19
|
+
tracer: options.tracer,
|
|
20
|
+
currentTrace: options.currentTrace,
|
|
21
|
+
recordSqlText: options.recordSqlText,
|
|
22
|
+
system: 'sqlite',
|
|
23
|
+
}),
|
|
18
24
|
plugins,
|
|
19
25
|
});
|
|
20
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/kysely-bun-sqlite",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.12",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/pikkujs/pikku.git",
|
|
@@ -11,28 +11,33 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"module": "dist/src/index.js",
|
|
13
13
|
"main": "dist/src/index.js",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"!dist/**/*.tsbuildinfo"
|
|
17
|
+
],
|
|
14
18
|
"type": "module",
|
|
15
19
|
"scripts": {
|
|
16
20
|
"tsc": "tsc",
|
|
17
21
|
"ncu": "npx npm-check-updates",
|
|
18
|
-
"build": "tsc -b",
|
|
22
|
+
"build": "bun run clean && tsc -b",
|
|
19
23
|
"test": "bash run-tests.sh",
|
|
20
24
|
"test:coverage": "bash run-tests.sh --coverage",
|
|
21
|
-
"prepublishOnly": "bun run build"
|
|
25
|
+
"prepublishOnly": "bun run build",
|
|
26
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
22
27
|
},
|
|
23
28
|
"engines": {
|
|
24
29
|
"bun": ">=1.4.0"
|
|
25
30
|
},
|
|
26
31
|
"dependencies": {
|
|
27
|
-
"@pikku/kysely": "^0.13.
|
|
28
|
-
"@pikku/kysely-sqlite": "^0.12.
|
|
29
|
-
"kysely": "^0.29.
|
|
32
|
+
"@pikku/kysely": "^0.13.43",
|
|
33
|
+
"@pikku/kysely-sqlite": "^0.12.19",
|
|
34
|
+
"kysely": "^0.29.6"
|
|
30
35
|
},
|
|
31
36
|
"peerDependencies": {
|
|
32
|
-
"@pikku/core": "^0.12.
|
|
37
|
+
"@pikku/core": "^0.12.156"
|
|
33
38
|
},
|
|
34
39
|
"devDependencies": {
|
|
35
|
-
"@pikku/core": "^0.12.
|
|
36
|
-
"@types/bun": "^1.4.
|
|
40
|
+
"@pikku/core": "^0.12.156",
|
|
41
|
+
"@types/bun": "^1.4.3"
|
|
37
42
|
}
|
|
38
43
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
# @pikku/kysely-bun-sqlite
|
|
2
|
-
|
|
3
|
-
## 0.12.10
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- 1fe79bc: A standalone build of a SQLite app now ships its `db.sqliteExtensions` (sqlite-vec's vec0 by default) inside the artifact, so a migration or query that uses them works in production the way it does under `pikku dev`. The node bundle loads them from `sqlite-extensions/` beside itself; a compiled bun binary embeds them and writes them out under `$PIKKU_DATA_DIR/.pikku-sqlite-extensions/` on start. The libraries are the build machine's, so an extension that cannot be resolved there fails the build; `[]` builds without them.
|
|
8
|
-
|
|
9
|
-
`createNodeSqliteKysely` and `createBunSqliteKysely` take an `extensions` list of library paths to load into the connection.
|
|
10
|
-
|
|
11
|
-
- Updated dependencies [1394385]
|
|
12
|
-
- Updated dependencies [7740547]
|
|
13
|
-
- @pikku/core@0.12.124
|
|
14
|
-
- @pikku/kysely-sqlite@0.12.15
|
|
15
|
-
|
|
16
|
-
## 0.12.9
|
|
17
|
-
|
|
18
|
-
### Patch Changes
|
|
19
|
-
|
|
20
|
-
- 1ab831e: Add `openBunSqliteDatabase`, which opens a `bun:sqlite` database as the `SqliteDatabase` Kysely's `SqliteDialect` binds to.
|
|
21
|
-
|
|
22
|
-
`createBunSqliteKysely` builds one Kysely over one database, so it cannot express several Kysely instances — differing only in their plugins — sharing a single underlying database. That combination is what lets a plugin-free instance (Better Auth needs unmangled column names) and a CamelCase one address the same tables, and until now an app that needed it had to reach for `better-sqlite3` instead.
|
|
23
|
-
|
|
24
|
-
Under Bun that fallback is not survivable: `better-sqlite3` ships a Node-ABI addon which Bun cannot load, and rather than throwing it aborts the process with `NAPI FATAL ERROR: Error::New napi_get_last_error_info`. In a `pikku dev --watch` this killed the dev server after codegen but before it ever listened, with no error naming the driver.
|
|
25
|
-
|
|
26
|
-
- Updated dependencies [1ab831e]
|
|
27
|
-
- @pikku/core@0.12.105
|
|
28
|
-
|
|
29
|
-
## 0.12.8
|
|
30
|
-
|
|
31
|
-
### Patch Changes
|
|
32
|
-
|
|
33
|
-
- 6ff72d3: Raise the supported Bun version to 1.4.
|
|
34
|
-
|
|
35
|
-
`@pikku/bun-server` and `@pikku/kysely-bun-sqlite` now declare `engines.bun: >=1.4.0`
|
|
36
|
-
and build against `@types/bun@^1.4.0`. `create-pikku` scaffolds
|
|
37
|
-
`"packageManager": "bun@1.4.0"`, and the fabric `smoke`/`validate` commands default to
|
|
38
|
-
and recommend the same version. CI pins `oven-sh/setup-bun` to 1.4.0 instead of
|
|
39
|
-
tracking `latest`.
|
|
40
|
-
|
|
41
|
-
## 0.12.7
|
|
42
|
-
|
|
43
|
-
### Patch Changes
|
|
44
|
-
|
|
45
|
-
- 746ed6a: fix: one coercion plugin, not three
|
|
46
|
-
|
|
47
|
-
The Kysely coercion plugin existed in three copies — the CLI's local database,
|
|
48
|
-
`@pikku/kysely-node-sqlite` and `@pikku/kysely-bun-sqlite` — and all three had
|
|
49
|
-
drifted apart. Only the CLI's resolved a column against the tables the query
|
|
50
|
-
actually named, so two tables that disagree on the kind of a same-named column
|
|
51
|
-
coerced correctly in local development and silently did not at runtime; only
|
|
52
|
-
bun's dropped a genuinely ambiguous column instead of letting the last table
|
|
53
|
-
processed win.
|
|
54
|
-
|
|
55
|
-
The single implementation now lives in `@pikku/kysely`, which all three already
|
|
56
|
-
depended on, and keeps both behaviours: table-qualified resolution first, an
|
|
57
|
-
ambiguity-safe bare-name fallback second.
|
|
58
|
-
|
|
59
|
-
`ColumnKind` — the value type of the generated `coercion.gen.ts` — is
|
|
60
|
-
`'date' | 'bool' | 'json'`. The CLI's fourth member, `uuid`, was never a
|
|
61
|
-
coercion kind: the codegen excludes it from the map by construction, because a
|
|
62
|
-
UUID is a string in both Postgres and SQLite. It is now `AnnotationKind` in the
|
|
63
|
-
CLI, the union a column may declare in `db/annotations.ts`, of which
|
|
64
|
-
`ColumnKind` is the coercible subset.
|
|
65
|
-
|
|
66
|
-
`@pikku/cli` also drops its unused dependency on the Node-only
|
|
67
|
-
`@pikku/kysely-node-sqlite`.
|
|
68
|
-
|
|
69
|
-
- Updated dependencies [5a1a962]
|
|
70
|
-
- Updated dependencies [746ed6a]
|
|
71
|
-
- @pikku/core@0.12.86
|
|
72
|
-
- @pikku/kysely@0.13.18
|
|
73
|
-
|
|
74
|
-
## 0.12.6
|
|
75
|
-
|
|
76
|
-
### Patch Changes
|
|
77
|
-
|
|
78
|
-
- 6eef0a0: Bump every dependency to its latest compatible minor/patch across the monorepo.
|
|
79
|
-
- Updated dependencies [7722ceb]
|
|
80
|
-
- Updated dependencies [375c1ff]
|
|
81
|
-
- Updated dependencies [02a70cd]
|
|
82
|
-
- Updated dependencies [aeef159]
|
|
83
|
-
- Updated dependencies [a281de6]
|
|
84
|
-
- Updated dependencies [266e3bc]
|
|
85
|
-
- Updated dependencies [02a70cd]
|
|
86
|
-
- Updated dependencies [786dae5]
|
|
87
|
-
- Updated dependencies [6eef0a0]
|
|
88
|
-
- Updated dependencies [3561d67]
|
|
89
|
-
- Updated dependencies [a91c433]
|
|
90
|
-
- Updated dependencies [02a70cd]
|
|
91
|
-
- Updated dependencies [9537f74]
|
|
92
|
-
- Updated dependencies [2b57ca8]
|
|
93
|
-
- Updated dependencies [266e3bc]
|
|
94
|
-
- Updated dependencies [9fce0f1]
|
|
95
|
-
- Updated dependencies [83683a0]
|
|
96
|
-
- Updated dependencies [456c88b]
|
|
97
|
-
- Updated dependencies [456c88b]
|
|
98
|
-
- Updated dependencies [c127273]
|
|
99
|
-
- @pikku/core@0.12.85
|
|
100
|
-
- @pikku/kysely@0.13.17
|
|
101
|
-
- @pikku/kysely-sqlite@0.12.13
|
|
102
|
-
|
|
103
|
-
## 0.12.5
|
|
104
|
-
|
|
105
|
-
### Patch Changes
|
|
106
|
-
|
|
107
|
-
- 0686513: Declare `@pikku/core` as a peer dependency, matching `@pikku/kysely-sqlite`.
|
|
108
|
-
|
|
109
|
-
The package depends on `@pikku/kysely-sqlite`, which requires `@pikku/core` as a
|
|
110
|
-
peer, but never declared that requirement itself — so an install resolved
|
|
111
|
-
without complaint and the missing peer only surfaced at runtime. It is now
|
|
112
|
-
declared the same way its sibling declares it.
|
|
113
|
-
|
|
114
|
-
- Updated dependencies [7406bfe]
|
|
115
|
-
- Updated dependencies [6794681]
|
|
116
|
-
- Updated dependencies [a7fcd2e]
|
|
117
|
-
- @pikku/core@0.12.84
|
|
118
|
-
- @pikku/kysely@0.13.16
|
|
119
|
-
- @pikku/kysely-sqlite@0.12.12
|
|
120
|
-
|
|
121
|
-
## 0.12.4
|
|
122
|
-
|
|
123
|
-
### Patch Changes
|
|
124
|
-
|
|
125
|
-
- fd9d834: Stop publishing internals that only their own package or file used. The declarations stay; only the entrypoint re-export is removed, so nothing that imported a name from where it is declared is affected.
|
|
126
|
-
- Updated dependencies [fd9d834]
|
|
127
|
-
- @pikku/kysely@0.13.15
|
|
128
|
-
- @pikku/kysely-sqlite@0.12.11
|
|
129
|
-
|
|
130
|
-
## 0.12.3
|
|
131
|
-
|
|
132
|
-
### Patch Changes
|
|
133
|
-
|
|
134
|
-
- 9d62571: Make user-defined SQL functions an explicit, checked capability of the SQLite drivers.
|
|
135
|
-
|
|
136
|
-
`node:sqlite` can register scalar UDFs (`db.function()`); `bun:sqlite` cannot. Until now
|
|
137
|
-
neither driver mentioned that, so an app that registered a UDF by reaching for the raw
|
|
138
|
-
connection worked on Node and, on bun, failed as `no such function: …` from whichever
|
|
139
|
-
query used it — typically one endpoint breaking in production while everything else
|
|
140
|
-
looked healthy.
|
|
141
|
-
|
|
142
|
-
Both drivers now export `registerSqliteFunctions(db, functions)` and accept a
|
|
143
|
-
`functions` option on `createNodeSqliteKysely` / `createBunSqliteKysely`. The Node
|
|
144
|
-
implementation registers them as deterministic; the bun implementation throws
|
|
145
|
-
`SqliteFunctionsUnsupportedError` — exported from `@pikku/kysely-sqlite`, and naming
|
|
146
|
-
every function requested — so the incompatibility surfaces at wiring time with a message
|
|
147
|
-
saying what to do about it.
|
|
148
|
-
|
|
149
|
-
- Updated dependencies [cabd9dc]
|
|
150
|
-
- Updated dependencies [9d62571]
|
|
151
|
-
- @pikku/kysely@0.13.8
|
|
152
|
-
- @pikku/kysely-sqlite@0.12.10
|
|
153
|
-
|
|
154
|
-
## 0.12.2
|
|
155
|
-
|
|
156
|
-
### Patch Changes
|
|
157
|
-
|
|
158
|
-
- 41ce2cb: Upgrade to TypeScript 6 and raise the minimum Node.js version to 22.
|
|
159
|
-
|
|
160
|
-
All packages now build against `typescript@^6.0.3` and declare `engines.node >= 22`. Internal tooling (`ts-json-schema-generator`, `zod-to-ts`) was bumped to TypeScript 6-compatible releases.
|
|
161
|
-
|
|
162
|
-
- Updated dependencies [241e6cf]
|
|
163
|
-
- Updated dependencies [41ce2cb]
|
|
164
|
-
- @pikku/kysely@0.13.0
|
|
165
|
-
- @pikku/kysely-sqlite@0.12.7
|
|
166
|
-
|
|
167
|
-
## 0.12.1
|
|
168
|
-
|
|
169
|
-
### Patch Changes
|
|
170
|
-
|
|
171
|
-
- d5c3c85: feat: bun first-class support — new `@pikku/bun-server` runtime and `@pikku/kysely-bun-sqlite` dialect, bun template, CI matrix with `package-manager: [yarn, bun]`, and bun verifier.
|
|
172
|
-
- Updated dependencies [92cd5b1]
|
|
173
|
-
- @pikku/kysely@0.12.17
|
package/run-tests.sh
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Enable nullglob to handle cases where no files match the pattern
|
|
4
|
-
shopt -s nullglob
|
|
5
|
-
|
|
6
|
-
# Initialize variables for options
|
|
7
|
-
watch_mode=false
|
|
8
|
-
coverage_mode=false
|
|
9
|
-
|
|
10
|
-
# Parse command-line options
|
|
11
|
-
while [[ $# -gt 0 ]]; do
|
|
12
|
-
case $1 in
|
|
13
|
-
--watch)
|
|
14
|
-
watch_mode=true
|
|
15
|
-
shift
|
|
16
|
-
;;
|
|
17
|
-
--coverage)
|
|
18
|
-
coverage_mode=true
|
|
19
|
-
shift
|
|
20
|
-
;;
|
|
21
|
-
*)
|
|
22
|
-
echo "Unknown option: $1"
|
|
23
|
-
exit 1
|
|
24
|
-
;;
|
|
25
|
-
esac
|
|
26
|
-
done
|
|
27
|
-
|
|
28
|
-
# Define the pattern to match your test files
|
|
29
|
-
pattern="src/*.test.ts"
|
|
30
|
-
|
|
31
|
-
# Expand the pattern into an array of files
|
|
32
|
-
files=($(find src -type f -name "*.test.ts"))
|
|
33
|
-
|
|
34
|
-
# Check if any files matched the pattern
|
|
35
|
-
if [ ${#files[@]} -eq 0 ]; then
|
|
36
|
-
echo "No test files found matching pattern: $pattern"
|
|
37
|
-
if [ "${STRICT_TEST_DISCOVERY}" = "1" ]; then
|
|
38
|
-
exit 1
|
|
39
|
-
fi
|
|
40
|
-
exit 0
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
# Construct the bun command
|
|
44
|
-
#
|
|
45
|
-
# --parallel gives every test file its own worker process, which is what node's
|
|
46
|
-
# `--test` did. Several suites keep module-level caches (a TypeScript program, a
|
|
47
|
-
# temp fixture directory) that a shared process would leak between files.
|
|
48
|
-
#
|
|
49
|
-
# --timeout because bun caps a test at 5s by default where node had no cap, and
|
|
50
|
-
# the suites that build real TypeScript programs run well past that.
|
|
51
|
-
bun_cmd=(bun test --parallel --timeout 120000)
|
|
52
|
-
|
|
53
|
-
# Append options based on flags
|
|
54
|
-
if [ "$watch_mode" = true ]; then
|
|
55
|
-
# --watch reruns in one process; parallel workers have nothing to watch.
|
|
56
|
-
bun_cmd=(bun test --watch --timeout 120000)
|
|
57
|
-
fi
|
|
58
|
-
|
|
59
|
-
if [ "$coverage_mode" = true ]; then
|
|
60
|
-
# --coverage-dir=. keeps lcov.info at the package root: CI merges every
|
|
61
|
-
# package's report by prefixing its SF paths with the file's own directory,
|
|
62
|
-
# so a nested coverage/ directory would re-root them one level too deep.
|
|
63
|
-
bun_cmd+=(--coverage --coverage-reporter=lcov --coverage-reporter=text --coverage-dir=.)
|
|
64
|
-
export PIKKU_TEST_COVERAGE=1
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
# Execute the bun command with the expanded list of files
|
|
68
|
-
"${bun_cmd[@]}" "${files[@]}"
|