@libsql/client
Advanced tools
Comparing version 0.3.5-pre.1 to 0.3.5-pre.2
@@ -276,2 +276,3 @@ "use strict"; | ||
const columns = hranaRows.columnNames.map(c => c ?? ""); | ||
const columnTypes = hranaRows.columnDecltypes.map(c => c ?? ""); | ||
const rows = hranaRows.rows; | ||
@@ -281,3 +282,3 @@ const rowsAffected = hranaRows.affectedRowCount; | ||
? hranaRows.lastInsertRowid : undefined; | ||
return new util_js_1.ResultSetImpl(columns, rows, rowsAffected, lastInsertRowid); | ||
return new util_js_1.ResultSetImpl(columns, columnTypes, rows, rowsAffected, lastInsertRowid); | ||
} | ||
@@ -284,0 +285,0 @@ exports.resultSetFromHrana = resultSetFromHrana; |
@@ -221,2 +221,3 @@ "use strict"; | ||
const columns = Array.from(sqlStmt.columns().map(col => col.name)); | ||
const columnTypes = Array.from(sqlStmt.columns().map(col => col.type ?? "")); | ||
const rows = sqlStmt.all(args).map((sqlRow) => { | ||
@@ -228,3 +229,3 @@ return rowFromSql(sqlRow, columns, intMode); | ||
const lastInsertRowid = undefined; | ||
return new util_js_1.ResultSetImpl(columns, rows, rowsAffected, lastInsertRowid); | ||
return new util_js_1.ResultSetImpl(columns, columnTypes, rows, rowsAffected, lastInsertRowid); | ||
} | ||
@@ -235,3 +236,3 @@ else { | ||
const lastInsertRowid = BigInt(info.lastInsertRowid); | ||
return new util_js_1.ResultSetImpl([], [], rowsAffected, lastInsertRowid); | ||
return new util_js_1.ResultSetImpl([], [], [], rowsAffected, lastInsertRowid); | ||
} | ||
@@ -238,0 +239,0 @@ } |
@@ -23,7 +23,9 @@ "use strict"; | ||
columns; | ||
columnTypes; | ||
rows; | ||
rowsAffected; | ||
lastInsertRowid; | ||
constructor(columns, rows, rowsAffected, lastInsertRowid) { | ||
constructor(columns, columnTypes, rows, rowsAffected, lastInsertRowid) { | ||
this.columns = columns; | ||
this.columnTypes = columnTypes; | ||
this.rows = rows; | ||
@@ -36,2 +38,3 @@ this.rowsAffected = rowsAffected; | ||
"columns": this.columns, | ||
"columnTypes": this.columnTypes, | ||
"rows": this.rows.map(rowToJson), | ||
@@ -38,0 +41,0 @@ "rowsAffected": this.rowsAffected, |
@@ -329,2 +329,9 @@ /** Configuration object for {@link createClient}. */ | ||
columns: Array<string>; | ||
/** Types of columns. | ||
* | ||
* The types are currently shown for types declared in a SQL table. For | ||
* column types of function calls, for example, an empty string is | ||
* returned. | ||
*/ | ||
columnTypes: Array<string>; | ||
/** Rows produced by the statement. */ | ||
@@ -331,0 +338,0 @@ rows: Array<Row>; |
@@ -247,2 +247,3 @@ import * as hrana from "@libsql/hrana-client"; | ||
const columns = hranaRows.columnNames.map(c => c ?? ""); | ||
const columnTypes = hranaRows.columnDecltypes.map(c => c ?? ""); | ||
const rows = hranaRows.rows; | ||
@@ -252,3 +253,3 @@ const rowsAffected = hranaRows.affectedRowCount; | ||
? hranaRows.lastInsertRowid : undefined; | ||
return new ResultSetImpl(columns, rows, rowsAffected, lastInsertRowid); | ||
return new ResultSetImpl(columns, columnTypes, rows, rowsAffected, lastInsertRowid); | ||
} | ||
@@ -255,0 +256,0 @@ export function mapHranaError(e) { |
@@ -197,2 +197,3 @@ import Database from "libsql"; | ||
const columns = Array.from(sqlStmt.columns().map(col => col.name)); | ||
const columnTypes = Array.from(sqlStmt.columns().map(col => col.type ?? "")); | ||
const rows = sqlStmt.all(args).map((sqlRow) => { | ||
@@ -204,3 +205,3 @@ return rowFromSql(sqlRow, columns, intMode); | ||
const lastInsertRowid = undefined; | ||
return new ResultSetImpl(columns, rows, rowsAffected, lastInsertRowid); | ||
return new ResultSetImpl(columns, columnTypes, rows, rowsAffected, lastInsertRowid); | ||
} | ||
@@ -211,3 +212,3 @@ else { | ||
const lastInsertRowid = BigInt(info.lastInsertRowid); | ||
return new ResultSetImpl([], [], rowsAffected, lastInsertRowid); | ||
return new ResultSetImpl([], [], [], rowsAffected, lastInsertRowid); | ||
} | ||
@@ -214,0 +215,0 @@ } |
@@ -6,7 +6,8 @@ import { ResultSet, Row, TransactionMode } from "./api.js"; | ||
columns: Array<string>; | ||
columnTypes: Array<string>; | ||
rows: Array<Row>; | ||
rowsAffected: number; | ||
lastInsertRowid: bigint | undefined; | ||
constructor(columns: Array<string>, rows: Array<Row>, rowsAffected: number, lastInsertRowid: bigint | undefined); | ||
constructor(columns: Array<string>, columnTypes: Array<string>, rows: Array<Row>, rowsAffected: number, lastInsertRowid: bigint | undefined); | ||
toJSON(): any; | ||
} |
@@ -19,7 +19,9 @@ import { Base64 } from "js-base64"; | ||
columns; | ||
columnTypes; | ||
rows; | ||
rowsAffected; | ||
lastInsertRowid; | ||
constructor(columns, rows, rowsAffected, lastInsertRowid) { | ||
constructor(columns, columnTypes, rows, rowsAffected, lastInsertRowid) { | ||
this.columns = columns; | ||
this.columnTypes = columnTypes; | ||
this.rows = rows; | ||
@@ -32,2 +34,3 @@ this.rowsAffected = rowsAffected; | ||
"columns": this.columns, | ||
"columnTypes": this.columnTypes, | ||
"rows": this.rows.map(rowToJson), | ||
@@ -34,0 +37,0 @@ "rowsAffected": this.rowsAffected, |
{ | ||
"name": "@libsql/client", | ||
"version": "0.3.5-pre.1", | ||
"version": "0.3.5-pre.2", | ||
"keywords": [ | ||
@@ -103,3 +103,3 @@ "libsql", | ||
"js-base64": "^3.7.5", | ||
"libsql": "^0.1.4" | ||
"libsql": "^0.1.9" | ||
}, | ||
@@ -106,0 +106,0 @@ "devDependencies": { |
@@ -21,2 +21,16 @@ # JavaScript & TypeScript SDK for libSQL | ||
### Using the library with Next.js | ||
To use `libsql-client`, you need to add the following to your Next configuration: | ||
```javascript | ||
const nextConfig = { | ||
experimental: { | ||
serverComponentsExternalPackages: ["libsql"], | ||
}, | ||
} | ||
module.exports = nextConfig | ||
``` | ||
## Create a database client object | ||
@@ -23,0 +37,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
145990
3536
153
Updatedlibsql@^0.1.9