Repository navigation
Conversation
Code Review by Qodo 1.
|
1 similar comment
|
Not sure why qodo still references old code. |
|
@qodo-free-for-open-source-projects review |
| @@ -51,6 +51,7 @@ | |||
| "./browser/connection/options-reader/ConnectionOptionsYmlReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", | |||
| "./browser/driver/aurora-data-api/AuroraDataApiDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", | |||
There was a problem hiding this comment.
do we need a bunsqlite entry on BrowserDisabledDriversDummy.template?
| const raw = stmt | ||
| .all(...normalizedParameters) | ||
| .map((row: Record<string, unknown>) => | ||
| Object.fromEntries( |
There was a problem hiding this comment.
isn't a stopper but this probably carries overhead on blob queries, not sure if we can do something like this to just skip when no blobs:
const raw = stmt.all(...normalizedParameters)
if (raw.length > 0) {
const blobKeys = Object.keys(raw[0]).filter(
(k) => raw[0][k] instanceof Uint8Array,
)
if (blobKeys.length > 0) {
for (const row of raw) {
for (const k of blobKeys) {
if (row[k] instanceof Uint8Array) {
(row as any)[k] = Buffer.from(row[k] as Uint8Array)
}
}
}
}
}| path.dirname(attachFilepathAbsolute), | ||
| ) | ||
| await this.dataSource.query( | ||
| `ATTACH "${attachFilepathAbsolute}" AS "${attachHandle}"`, |
There was a problem hiding this comment.
we probably need to safe guard this better from sqli - not a blocker, you're matching what better sqlite3 already does
| @@ -2,13 +2,13 @@ import "chai/register-should" | |||
| import "source-map-support/register" | |||
| import "reflect-metadata" | |||
|
|
|||
| import chai from "chai" | |||
| import { should, use } from "chai" | |||
There was a problem hiding this comment.
is this for Bun compatibility?
There was a problem hiding this comment.
Yes.
When running TypeORM's test suite with Bun as the JavaScript runtime, using a default import of chai causes a runtime crash:
TypeScript compiles import chai from "chai" into const chai_1 = require("chai") and then accesses chai_1.default. In Node.js this works because its CJS interop sets .default to the module exports. Bun's CJS interop does not — chai_1.default is undefined, so calling [chai_1.default.should()] throws immediately before any tests run:
TypeError: undefined is not an object (evaluating 'chai_1.default.should')]
The fix is to use named imports instead
|
This repository was recently restructured into a pnpm workspace, and the If your branch has diverged enough that a full rebase isn't worth it, Sorry for the disruption, and thanks for your patience. |
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
e2aba48 to
97d6e56
Compare
Description of change
Adds a new
bun-sqlitedriver that uses Bun's built-inbun:sqlitemodule.Why this is needed
The existing
better-sqlite3driver requires compiling a native Node.js addon (better_sqlite3.node), which fails in environments without build tools (MSVC on Windows,node-gypon Linux/macOS). The Bun runtime ships SQLite as a first-class built-in — no native compilation, no extra dependencies.What was added
AbstractSqliteDriverAbstractSqliteQueryRunnertype: "bun-sqlite"options type"bun-sqlite"toisSQLiteFamily()(required so TypeORM usesNULLinstead of unsupportedDEFAULTin SQLite INSERT statements)"bun-sqlite"to the unionBunSqliteDataSourceOptionsto the union"bun:sqlite"case toload()bun-sqliteentry withskip: true(opt-in; requires Bun runtime)bun-sqlitetestsKey implementation differences from
better-sqlite3stmt.readerstmt.columnNames.length > 0db.pragma("key = val")db.prepare("PRAGMA key = val").run()db.pragma("key")→ arraydb.prepare("PRAGMA key").all()How it was verified
51 tests passing under the Bun runtime, covering: WAL mode, column types, generated columns, views, UUID generation, JSON/JSONB, transactions, query builder, schema builder, SQL tags, bulk saves, and more. See DEVELOPER.md for how to run them.
Pull-Request Checklist
masterbranchtest/functional/driver/bun-sqlite/*.test.ts)