Skip to content

Commit 95d8846

Browse files
committed
Fix type error
1 parent d34e3b8 commit 95d8846

3 files changed

Lines changed: 48 additions & 49 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"@changesets/changelog-github": "^0.4.5",
2323
"@changesets/cli": "^2.23.2",
2424
"@tsconfig/node14": "^1.0.1",
25-
"@types/node": "^16.11.0",
26-
"kysely": "^0.19.3",
25+
"@types/node": "^18.14.2",
26+
"kysely": "^0.23.4",
2727
"perf_hooks": "^0.0.1",
2828
"vitest": "^0.18.1"
2929
},

pnpm-lock.yaml

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/data-api-driver.ts

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -53,58 +53,57 @@ class DataApiConnection implements DatabaseConnection {
5353
}
5454

5555
public async beginTransaction() {
56-
const r = await this.#config.client
57-
.beginTransaction({
58-
secretArn: this.#config.secretArn,
59-
resourceArn: this.#config.resourceArn,
60-
database: this.#config.database,
61-
});
56+
const r = await this.#config.client.beginTransaction({
57+
secretArn: this.#config.secretArn,
58+
resourceArn: this.#config.resourceArn,
59+
database: this.#config.database,
60+
});
6261
this.#transactionId = r.transactionId;
6362
}
6463

6564
public async commitTransaction() {
6665
if (!this.#transactionId)
6766
throw new Error("Cannot commit a transaction before creating it");
68-
await this.#config.client
69-
.commitTransaction({
70-
secretArn: this.#config.secretArn,
71-
resourceArn: this.#config.resourceArn,
72-
transactionId: this.#transactionId,
73-
});
67+
await this.#config.client.commitTransaction({
68+
secretArn: this.#config.secretArn,
69+
resourceArn: this.#config.resourceArn,
70+
transactionId: this.#transactionId,
71+
});
7472
}
7573

7674
public async rollbackTransaction() {
7775
if (!this.#transactionId)
7876
throw new Error("Cannot rollback a transaction before creating it");
79-
await this.#config.client
80-
.rollbackTransaction({
81-
secretArn: this.#config.secretArn,
82-
resourceArn: this.#config.resourceArn,
83-
transactionId: this.#transactionId,
84-
});
77+
await this.#config.client.rollbackTransaction({
78+
secretArn: this.#config.secretArn,
79+
resourceArn: this.#config.resourceArn,
80+
transactionId: this.#transactionId,
81+
});
8582
}
8683

8784
async executeQuery<O>(compiledQuery: CompiledQuery): Promise<QueryResult<O>> {
88-
const r = await this.#config.client
89-
.executeStatement({
90-
transactionId: this.#transactionId,
91-
secretArn: this.#config.secretArn,
92-
resourceArn: this.#config.resourceArn,
93-
sql: compiledQuery.sql,
94-
parameters: compiledQuery.parameters as SqlParameter[],
95-
database: this.#config.database,
96-
includeResultMetadata: true,
97-
});
85+
const r = await this.#config.client.executeStatement({
86+
transactionId: this.#transactionId,
87+
secretArn: this.#config.secretArn,
88+
resourceArn: this.#config.resourceArn,
89+
sql: compiledQuery.sql,
90+
parameters: compiledQuery.parameters as SqlParameter[],
91+
database: this.#config.database,
92+
includeResultMetadata: true,
93+
});
9894
if (!r.columnMetadata) {
99-
const numAffectedRows = BigInt(r.numberOfRecordsUpdated || 0)
95+
const numAffectedRows = BigInt(r.numberOfRecordsUpdated || 0);
10096

10197
return {
102-
// @ts-ignore replaces `QueryResult.numUpdatedOrDeletedRows` in kysely >= 0.23
98+
// @ts-ignore replaces `QueryResult.numUpdatedOrDeletedRows` in kysely >= 0.23
10399
// following https://github.com/koskimas/kysely/pull/188
104100
numAffectedRows,
105101
// deprecated in kysely >= 0.23, keep for backward compatibility.
106102
numUpdatedOrDeletedRows: numAffectedRows,
107-
insertId: r.generatedFields && r.generatedFields.length > 0 ? r.generatedFields[0].longValue : undefined
103+
insertId:
104+
r.generatedFields && r.generatedFields.length > 0
105+
? BigInt(r.generatedFields[0].longValue!)
106+
: undefined,
108107
rows: [],
109108
};
110109
}
@@ -121,16 +120,16 @@ class DataApiConnection implements DatabaseConnection {
121120
val.arrayValue ??
122121
val.doubleValue ??
123122
(val.isNull ? null : val.booleanValue),
124-
]),
125-
) as unknown as O,
123+
])
124+
) as unknown as O
126125
);
127126
const result: QueryResult<O> = {
128127
rows: rows || [],
129128
};
130129
return result;
131130
}
132-
133-
async *streamQuery<O>(
131+
132+
async *streamQuery<O>(
134133
_compiledQuery: CompiledQuery,
135134
_chunkSize: number
136135
): AsyncIterableIterator<QueryResult<O>> {

0 commit comments

Comments
 (0)