@prisma/adapter-libsql 6.15.0-dev.3 → 6.15.0-dev.4
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/index-node.js +28 -4
- package/dist/index-node.mjs +28 -4
- package/dist/index-web.js +28 -4
- package/dist/index-web.mjs +28 -4
- package/package.json +2 -2
package/dist/index-node.js
CHANGED
|
@@ -170,6 +170,30 @@ function mapRow(row, columnTypes) {
|
|
|
170
170
|
}
|
|
171
171
|
return result;
|
|
172
172
|
}
|
|
173
|
+
function mapArg(arg, argType) {
|
|
174
|
+
if (arg === null) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
if (typeof arg === "string" && argType.scalarType === "bigint") {
|
|
178
|
+
return BigInt(arg);
|
|
179
|
+
}
|
|
180
|
+
if (typeof arg === "string" && argType.scalarType === "decimal") {
|
|
181
|
+
return Number.parseFloat(arg);
|
|
182
|
+
}
|
|
183
|
+
if (typeof arg === "string" && argType.scalarType === "datetime") {
|
|
184
|
+
arg = new Date(arg);
|
|
185
|
+
}
|
|
186
|
+
if (arg instanceof Date) {
|
|
187
|
+
return arg.toISOString().replace("Z", "+00:00");
|
|
188
|
+
}
|
|
189
|
+
if (typeof arg === "string" && argType.scalarType === "bytes") {
|
|
190
|
+
return Buffer.from(arg, "base64");
|
|
191
|
+
}
|
|
192
|
+
if (Array.isArray(arg) && argType.scalarType === "bytes") {
|
|
193
|
+
return new Uint8Array(arg);
|
|
194
|
+
}
|
|
195
|
+
return arg;
|
|
196
|
+
}
|
|
173
197
|
|
|
174
198
|
// src/errors.ts
|
|
175
199
|
var SQLITE_BUSY = 5;
|
|
@@ -281,11 +305,11 @@ var LibSqlQueryable = class {
|
|
|
281
305
|
*/
|
|
282
306
|
async performIO(query) {
|
|
283
307
|
const release = await this[LOCK_TAG].acquire();
|
|
284
|
-
if (query.args.some((arg) => Array.isArray(arg))) {
|
|
285
|
-
throw new Error("Attempted to pass an array argument to the LibSQL client, which is not supported");
|
|
286
|
-
}
|
|
287
308
|
try {
|
|
288
|
-
const result = await this.client.execute(
|
|
309
|
+
const result = await this.client.execute({
|
|
310
|
+
sql: query.sql,
|
|
311
|
+
args: query.args.map((arg, i) => mapArg(arg, query.argTypes[i]))
|
|
312
|
+
});
|
|
289
313
|
return result;
|
|
290
314
|
} catch (e) {
|
|
291
315
|
this.onError(e);
|
package/dist/index-node.mjs
CHANGED
|
@@ -144,6 +144,30 @@ function mapRow(row, columnTypes) {
|
|
|
144
144
|
}
|
|
145
145
|
return result;
|
|
146
146
|
}
|
|
147
|
+
function mapArg(arg, argType) {
|
|
148
|
+
if (arg === null) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
if (typeof arg === "string" && argType.scalarType === "bigint") {
|
|
152
|
+
return BigInt(arg);
|
|
153
|
+
}
|
|
154
|
+
if (typeof arg === "string" && argType.scalarType === "decimal") {
|
|
155
|
+
return Number.parseFloat(arg);
|
|
156
|
+
}
|
|
157
|
+
if (typeof arg === "string" && argType.scalarType === "datetime") {
|
|
158
|
+
arg = new Date(arg);
|
|
159
|
+
}
|
|
160
|
+
if (arg instanceof Date) {
|
|
161
|
+
return arg.toISOString().replace("Z", "+00:00");
|
|
162
|
+
}
|
|
163
|
+
if (typeof arg === "string" && argType.scalarType === "bytes") {
|
|
164
|
+
return Buffer.from(arg, "base64");
|
|
165
|
+
}
|
|
166
|
+
if (Array.isArray(arg) && argType.scalarType === "bytes") {
|
|
167
|
+
return new Uint8Array(arg);
|
|
168
|
+
}
|
|
169
|
+
return arg;
|
|
170
|
+
}
|
|
147
171
|
|
|
148
172
|
// src/errors.ts
|
|
149
173
|
var SQLITE_BUSY = 5;
|
|
@@ -255,11 +279,11 @@ var LibSqlQueryable = class {
|
|
|
255
279
|
*/
|
|
256
280
|
async performIO(query) {
|
|
257
281
|
const release = await this[LOCK_TAG].acquire();
|
|
258
|
-
if (query.args.some((arg) => Array.isArray(arg))) {
|
|
259
|
-
throw new Error("Attempted to pass an array argument to the LibSQL client, which is not supported");
|
|
260
|
-
}
|
|
261
282
|
try {
|
|
262
|
-
const result = await this.client.execute(
|
|
283
|
+
const result = await this.client.execute({
|
|
284
|
+
sql: query.sql,
|
|
285
|
+
args: query.args.map((arg, i) => mapArg(arg, query.argTypes[i]))
|
|
286
|
+
});
|
|
263
287
|
return result;
|
|
264
288
|
} catch (e) {
|
|
265
289
|
this.onError(e);
|
package/dist/index-web.js
CHANGED
|
@@ -170,6 +170,30 @@ function mapRow(row, columnTypes) {
|
|
|
170
170
|
}
|
|
171
171
|
return result;
|
|
172
172
|
}
|
|
173
|
+
function mapArg(arg, argType) {
|
|
174
|
+
if (arg === null) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
if (typeof arg === "string" && argType.scalarType === "bigint") {
|
|
178
|
+
return BigInt(arg);
|
|
179
|
+
}
|
|
180
|
+
if (typeof arg === "string" && argType.scalarType === "decimal") {
|
|
181
|
+
return Number.parseFloat(arg);
|
|
182
|
+
}
|
|
183
|
+
if (typeof arg === "string" && argType.scalarType === "datetime") {
|
|
184
|
+
arg = new Date(arg);
|
|
185
|
+
}
|
|
186
|
+
if (arg instanceof Date) {
|
|
187
|
+
return arg.toISOString().replace("Z", "+00:00");
|
|
188
|
+
}
|
|
189
|
+
if (typeof arg === "string" && argType.scalarType === "bytes") {
|
|
190
|
+
return Buffer.from(arg, "base64");
|
|
191
|
+
}
|
|
192
|
+
if (Array.isArray(arg) && argType.scalarType === "bytes") {
|
|
193
|
+
return new Uint8Array(arg);
|
|
194
|
+
}
|
|
195
|
+
return arg;
|
|
196
|
+
}
|
|
173
197
|
|
|
174
198
|
// src/errors.ts
|
|
175
199
|
var SQLITE_BUSY = 5;
|
|
@@ -281,11 +305,11 @@ var LibSqlQueryable = class {
|
|
|
281
305
|
*/
|
|
282
306
|
async performIO(query) {
|
|
283
307
|
const release = await this[LOCK_TAG].acquire();
|
|
284
|
-
if (query.args.some((arg) => Array.isArray(arg))) {
|
|
285
|
-
throw new Error("Attempted to pass an array argument to the LibSQL client, which is not supported");
|
|
286
|
-
}
|
|
287
308
|
try {
|
|
288
|
-
const result = await this.client.execute(
|
|
309
|
+
const result = await this.client.execute({
|
|
310
|
+
sql: query.sql,
|
|
311
|
+
args: query.args.map((arg, i) => mapArg(arg, query.argTypes[i]))
|
|
312
|
+
});
|
|
289
313
|
return result;
|
|
290
314
|
} catch (e) {
|
|
291
315
|
this.onError(e);
|
package/dist/index-web.mjs
CHANGED
|
@@ -144,6 +144,30 @@ function mapRow(row, columnTypes) {
|
|
|
144
144
|
}
|
|
145
145
|
return result;
|
|
146
146
|
}
|
|
147
|
+
function mapArg(arg, argType) {
|
|
148
|
+
if (arg === null) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
if (typeof arg === "string" && argType.scalarType === "bigint") {
|
|
152
|
+
return BigInt(arg);
|
|
153
|
+
}
|
|
154
|
+
if (typeof arg === "string" && argType.scalarType === "decimal") {
|
|
155
|
+
return Number.parseFloat(arg);
|
|
156
|
+
}
|
|
157
|
+
if (typeof arg === "string" && argType.scalarType === "datetime") {
|
|
158
|
+
arg = new Date(arg);
|
|
159
|
+
}
|
|
160
|
+
if (arg instanceof Date) {
|
|
161
|
+
return arg.toISOString().replace("Z", "+00:00");
|
|
162
|
+
}
|
|
163
|
+
if (typeof arg === "string" && argType.scalarType === "bytes") {
|
|
164
|
+
return Buffer.from(arg, "base64");
|
|
165
|
+
}
|
|
166
|
+
if (Array.isArray(arg) && argType.scalarType === "bytes") {
|
|
167
|
+
return new Uint8Array(arg);
|
|
168
|
+
}
|
|
169
|
+
return arg;
|
|
170
|
+
}
|
|
147
171
|
|
|
148
172
|
// src/errors.ts
|
|
149
173
|
var SQLITE_BUSY = 5;
|
|
@@ -255,11 +279,11 @@ var LibSqlQueryable = class {
|
|
|
255
279
|
*/
|
|
256
280
|
async performIO(query) {
|
|
257
281
|
const release = await this[LOCK_TAG].acquire();
|
|
258
|
-
if (query.args.some((arg) => Array.isArray(arg))) {
|
|
259
|
-
throw new Error("Attempted to pass an array argument to the LibSQL client, which is not supported");
|
|
260
|
-
}
|
|
261
282
|
try {
|
|
262
|
-
const result = await this.client.execute(
|
|
283
|
+
const result = await this.client.execute({
|
|
284
|
+
sql: query.sql,
|
|
285
|
+
args: query.args.map((arg, i) => mapArg(arg, query.argTypes[i]))
|
|
286
|
+
});
|
|
263
287
|
return result;
|
|
264
288
|
} catch (e) {
|
|
265
289
|
this.onError(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-libsql",
|
|
3
|
-
"version": "6.15.0-dev.
|
|
3
|
+
"version": "6.15.0-dev.4",
|
|
4
4
|
"description": "Prisma's driver adapter for libSQL and Turso",
|
|
5
5
|
"main": "dist/index-node.js",
|
|
6
6
|
"module": "dist/index-node.mjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@libsql/client": "^0.3.5 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0",
|
|
45
45
|
"async-mutex": "0.5.0",
|
|
46
|
-
"@prisma/driver-adapter-utils": "6.15.0-dev.
|
|
46
|
+
"@prisma/driver-adapter-utils": "6.15.0-dev.4"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"jest": "29.7.0",
|