@prisma/adapter-libsql 6.7.0-integration-push-sunrovnkrkpv.1 → 6.7.0
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 +60 -10
- package/dist/index-node.mjs +60 -10
- package/dist/index-web.js +60 -10
- package/dist/index-web.mjs +60 -10
- package/package.json +2 -2
package/dist/index-node.js
CHANGED
|
@@ -171,6 +171,64 @@ function mapRow(row, columnTypes) {
|
|
|
171
171
|
return result;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
// src/errors.ts
|
|
175
|
+
var SQLITE_BUSY = 5;
|
|
176
|
+
var PRIMARY_ERROR_CODE_MASK = 255;
|
|
177
|
+
function convertDriverError(error) {
|
|
178
|
+
if (!isDbError(error)) {
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
const rawCode = error.rawCode ?? error.cause?.["rawCode"];
|
|
182
|
+
switch (rawCode) {
|
|
183
|
+
case 2067:
|
|
184
|
+
case 1555:
|
|
185
|
+
return {
|
|
186
|
+
kind: "UniqueConstraintViolation",
|
|
187
|
+
fields: error.message.split("constraint failed: ").at(1)?.split(", ").map((field) => field.split(".").pop()) ?? []
|
|
188
|
+
};
|
|
189
|
+
case 1299:
|
|
190
|
+
return {
|
|
191
|
+
kind: "NullConstraintViolation",
|
|
192
|
+
fields: error.message.split("constraint failed: ").at(1)?.split(", ").map((field) => field.split(".").pop()) ?? []
|
|
193
|
+
};
|
|
194
|
+
case 787:
|
|
195
|
+
case 1811:
|
|
196
|
+
return {
|
|
197
|
+
kind: "ForeignKeyConstraintViolation",
|
|
198
|
+
constraint: { foreignKey: {} }
|
|
199
|
+
};
|
|
200
|
+
default:
|
|
201
|
+
if (rawCode && (rawCode & PRIMARY_ERROR_CODE_MASK) === SQLITE_BUSY) {
|
|
202
|
+
return {
|
|
203
|
+
kind: "SocketTimeout"
|
|
204
|
+
};
|
|
205
|
+
} else if (error.message.startsWith("no such table")) {
|
|
206
|
+
return {
|
|
207
|
+
kind: "TableDoesNotExist",
|
|
208
|
+
table: error.message.split(": ").pop()
|
|
209
|
+
};
|
|
210
|
+
} else if (error.message.startsWith("no such column")) {
|
|
211
|
+
return {
|
|
212
|
+
kind: "ColumnNotFound",
|
|
213
|
+
column: error.message.split(": ").pop()
|
|
214
|
+
};
|
|
215
|
+
} else if (error.message.includes("has no column named ")) {
|
|
216
|
+
return {
|
|
217
|
+
kind: "ColumnNotFound",
|
|
218
|
+
column: error.message.split("has no column named ").pop()
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
kind: "sqlite",
|
|
223
|
+
extendedCode: rawCode,
|
|
224
|
+
message: error.message
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function isDbError(error) {
|
|
229
|
+
return typeof error.code === "string" && typeof error.message === "string" && (typeof error.rawCode === "number" || error.rawCode === void 0);
|
|
230
|
+
}
|
|
231
|
+
|
|
174
232
|
// src/libsql.ts
|
|
175
233
|
var debug2 = (0, import_driver_adapter_utils2.Debug)("prisma:driver-adapter:libsql");
|
|
176
234
|
var LOCK_TAG = Symbol();
|
|
@@ -223,15 +281,7 @@ var LibSqlQueryable = class {
|
|
|
223
281
|
}
|
|
224
282
|
onError(error) {
|
|
225
283
|
debug2("Error in performIO: %O", error);
|
|
226
|
-
|
|
227
|
-
if (typeof rawCode === "number") {
|
|
228
|
-
throw new import_driver_adapter_utils2.DriverAdapterError({
|
|
229
|
-
kind: "sqlite",
|
|
230
|
-
extendedCode: rawCode,
|
|
231
|
-
message: error.message
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
throw error;
|
|
284
|
+
throw new import_driver_adapter_utils2.DriverAdapterError(convertDriverError(error));
|
|
235
285
|
}
|
|
236
286
|
};
|
|
237
287
|
var LibSqlTransaction = class extends LibSqlQueryable {
|
|
@@ -291,7 +341,7 @@ var PrismaLibSQLAdapter = class extends LibSqlQueryable {
|
|
|
291
341
|
return new LibSqlTransaction(tx, options, release);
|
|
292
342
|
} catch (e) {
|
|
293
343
|
release();
|
|
294
|
-
|
|
344
|
+
this.onError(e);
|
|
295
345
|
}
|
|
296
346
|
}
|
|
297
347
|
dispose() {
|
package/dist/index-node.mjs
CHANGED
|
@@ -145,6 +145,64 @@ function mapRow(row, columnTypes) {
|
|
|
145
145
|
return result;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
// src/errors.ts
|
|
149
|
+
var SQLITE_BUSY = 5;
|
|
150
|
+
var PRIMARY_ERROR_CODE_MASK = 255;
|
|
151
|
+
function convertDriverError(error) {
|
|
152
|
+
if (!isDbError(error)) {
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
const rawCode = error.rawCode ?? error.cause?.["rawCode"];
|
|
156
|
+
switch (rawCode) {
|
|
157
|
+
case 2067:
|
|
158
|
+
case 1555:
|
|
159
|
+
return {
|
|
160
|
+
kind: "UniqueConstraintViolation",
|
|
161
|
+
fields: error.message.split("constraint failed: ").at(1)?.split(", ").map((field) => field.split(".").pop()) ?? []
|
|
162
|
+
};
|
|
163
|
+
case 1299:
|
|
164
|
+
return {
|
|
165
|
+
kind: "NullConstraintViolation",
|
|
166
|
+
fields: error.message.split("constraint failed: ").at(1)?.split(", ").map((field) => field.split(".").pop()) ?? []
|
|
167
|
+
};
|
|
168
|
+
case 787:
|
|
169
|
+
case 1811:
|
|
170
|
+
return {
|
|
171
|
+
kind: "ForeignKeyConstraintViolation",
|
|
172
|
+
constraint: { foreignKey: {} }
|
|
173
|
+
};
|
|
174
|
+
default:
|
|
175
|
+
if (rawCode && (rawCode & PRIMARY_ERROR_CODE_MASK) === SQLITE_BUSY) {
|
|
176
|
+
return {
|
|
177
|
+
kind: "SocketTimeout"
|
|
178
|
+
};
|
|
179
|
+
} else if (error.message.startsWith("no such table")) {
|
|
180
|
+
return {
|
|
181
|
+
kind: "TableDoesNotExist",
|
|
182
|
+
table: error.message.split(": ").pop()
|
|
183
|
+
};
|
|
184
|
+
} else if (error.message.startsWith("no such column")) {
|
|
185
|
+
return {
|
|
186
|
+
kind: "ColumnNotFound",
|
|
187
|
+
column: error.message.split(": ").pop()
|
|
188
|
+
};
|
|
189
|
+
} else if (error.message.includes("has no column named ")) {
|
|
190
|
+
return {
|
|
191
|
+
kind: "ColumnNotFound",
|
|
192
|
+
column: error.message.split("has no column named ").pop()
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
kind: "sqlite",
|
|
197
|
+
extendedCode: rawCode,
|
|
198
|
+
message: error.message
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function isDbError(error) {
|
|
203
|
+
return typeof error.code === "string" && typeof error.message === "string" && (typeof error.rawCode === "number" || error.rawCode === void 0);
|
|
204
|
+
}
|
|
205
|
+
|
|
148
206
|
// src/libsql.ts
|
|
149
207
|
var debug2 = Debug2("prisma:driver-adapter:libsql");
|
|
150
208
|
var LOCK_TAG = Symbol();
|
|
@@ -197,15 +255,7 @@ var LibSqlQueryable = class {
|
|
|
197
255
|
}
|
|
198
256
|
onError(error) {
|
|
199
257
|
debug2("Error in performIO: %O", error);
|
|
200
|
-
|
|
201
|
-
if (typeof rawCode === "number") {
|
|
202
|
-
throw new DriverAdapterError({
|
|
203
|
-
kind: "sqlite",
|
|
204
|
-
extendedCode: rawCode,
|
|
205
|
-
message: error.message
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
throw error;
|
|
258
|
+
throw new DriverAdapterError(convertDriverError(error));
|
|
209
259
|
}
|
|
210
260
|
};
|
|
211
261
|
var LibSqlTransaction = class extends LibSqlQueryable {
|
|
@@ -265,7 +315,7 @@ var PrismaLibSQLAdapter = class extends LibSqlQueryable {
|
|
|
265
315
|
return new LibSqlTransaction(tx, options, release);
|
|
266
316
|
} catch (e) {
|
|
267
317
|
release();
|
|
268
|
-
|
|
318
|
+
this.onError(e);
|
|
269
319
|
}
|
|
270
320
|
}
|
|
271
321
|
dispose() {
|
package/dist/index-web.js
CHANGED
|
@@ -171,6 +171,64 @@ function mapRow(row, columnTypes) {
|
|
|
171
171
|
return result;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
// src/errors.ts
|
|
175
|
+
var SQLITE_BUSY = 5;
|
|
176
|
+
var PRIMARY_ERROR_CODE_MASK = 255;
|
|
177
|
+
function convertDriverError(error) {
|
|
178
|
+
if (!isDbError(error)) {
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
const rawCode = error.rawCode ?? error.cause?.["rawCode"];
|
|
182
|
+
switch (rawCode) {
|
|
183
|
+
case 2067:
|
|
184
|
+
case 1555:
|
|
185
|
+
return {
|
|
186
|
+
kind: "UniqueConstraintViolation",
|
|
187
|
+
fields: error.message.split("constraint failed: ").at(1)?.split(", ").map((field) => field.split(".").pop()) ?? []
|
|
188
|
+
};
|
|
189
|
+
case 1299:
|
|
190
|
+
return {
|
|
191
|
+
kind: "NullConstraintViolation",
|
|
192
|
+
fields: error.message.split("constraint failed: ").at(1)?.split(", ").map((field) => field.split(".").pop()) ?? []
|
|
193
|
+
};
|
|
194
|
+
case 787:
|
|
195
|
+
case 1811:
|
|
196
|
+
return {
|
|
197
|
+
kind: "ForeignKeyConstraintViolation",
|
|
198
|
+
constraint: { foreignKey: {} }
|
|
199
|
+
};
|
|
200
|
+
default:
|
|
201
|
+
if (rawCode && (rawCode & PRIMARY_ERROR_CODE_MASK) === SQLITE_BUSY) {
|
|
202
|
+
return {
|
|
203
|
+
kind: "SocketTimeout"
|
|
204
|
+
};
|
|
205
|
+
} else if (error.message.startsWith("no such table")) {
|
|
206
|
+
return {
|
|
207
|
+
kind: "TableDoesNotExist",
|
|
208
|
+
table: error.message.split(": ").pop()
|
|
209
|
+
};
|
|
210
|
+
} else if (error.message.startsWith("no such column")) {
|
|
211
|
+
return {
|
|
212
|
+
kind: "ColumnNotFound",
|
|
213
|
+
column: error.message.split(": ").pop()
|
|
214
|
+
};
|
|
215
|
+
} else if (error.message.includes("has no column named ")) {
|
|
216
|
+
return {
|
|
217
|
+
kind: "ColumnNotFound",
|
|
218
|
+
column: error.message.split("has no column named ").pop()
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
kind: "sqlite",
|
|
223
|
+
extendedCode: rawCode,
|
|
224
|
+
message: error.message
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function isDbError(error) {
|
|
229
|
+
return typeof error.code === "string" && typeof error.message === "string" && (typeof error.rawCode === "number" || error.rawCode === void 0);
|
|
230
|
+
}
|
|
231
|
+
|
|
174
232
|
// src/libsql.ts
|
|
175
233
|
var debug2 = (0, import_driver_adapter_utils2.Debug)("prisma:driver-adapter:libsql");
|
|
176
234
|
var LOCK_TAG = Symbol();
|
|
@@ -223,15 +281,7 @@ var LibSqlQueryable = class {
|
|
|
223
281
|
}
|
|
224
282
|
onError(error) {
|
|
225
283
|
debug2("Error in performIO: %O", error);
|
|
226
|
-
|
|
227
|
-
if (typeof rawCode === "number") {
|
|
228
|
-
throw new import_driver_adapter_utils2.DriverAdapterError({
|
|
229
|
-
kind: "sqlite",
|
|
230
|
-
extendedCode: rawCode,
|
|
231
|
-
message: error.message
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
throw error;
|
|
284
|
+
throw new import_driver_adapter_utils2.DriverAdapterError(convertDriverError(error));
|
|
235
285
|
}
|
|
236
286
|
};
|
|
237
287
|
var LibSqlTransaction = class extends LibSqlQueryable {
|
|
@@ -291,7 +341,7 @@ var PrismaLibSQLAdapter = class extends LibSqlQueryable {
|
|
|
291
341
|
return new LibSqlTransaction(tx, options, release);
|
|
292
342
|
} catch (e) {
|
|
293
343
|
release();
|
|
294
|
-
|
|
344
|
+
this.onError(e);
|
|
295
345
|
}
|
|
296
346
|
}
|
|
297
347
|
dispose() {
|
package/dist/index-web.mjs
CHANGED
|
@@ -145,6 +145,64 @@ function mapRow(row, columnTypes) {
|
|
|
145
145
|
return result;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
// src/errors.ts
|
|
149
|
+
var SQLITE_BUSY = 5;
|
|
150
|
+
var PRIMARY_ERROR_CODE_MASK = 255;
|
|
151
|
+
function convertDriverError(error) {
|
|
152
|
+
if (!isDbError(error)) {
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
const rawCode = error.rawCode ?? error.cause?.["rawCode"];
|
|
156
|
+
switch (rawCode) {
|
|
157
|
+
case 2067:
|
|
158
|
+
case 1555:
|
|
159
|
+
return {
|
|
160
|
+
kind: "UniqueConstraintViolation",
|
|
161
|
+
fields: error.message.split("constraint failed: ").at(1)?.split(", ").map((field) => field.split(".").pop()) ?? []
|
|
162
|
+
};
|
|
163
|
+
case 1299:
|
|
164
|
+
return {
|
|
165
|
+
kind: "NullConstraintViolation",
|
|
166
|
+
fields: error.message.split("constraint failed: ").at(1)?.split(", ").map((field) => field.split(".").pop()) ?? []
|
|
167
|
+
};
|
|
168
|
+
case 787:
|
|
169
|
+
case 1811:
|
|
170
|
+
return {
|
|
171
|
+
kind: "ForeignKeyConstraintViolation",
|
|
172
|
+
constraint: { foreignKey: {} }
|
|
173
|
+
};
|
|
174
|
+
default:
|
|
175
|
+
if (rawCode && (rawCode & PRIMARY_ERROR_CODE_MASK) === SQLITE_BUSY) {
|
|
176
|
+
return {
|
|
177
|
+
kind: "SocketTimeout"
|
|
178
|
+
};
|
|
179
|
+
} else if (error.message.startsWith("no such table")) {
|
|
180
|
+
return {
|
|
181
|
+
kind: "TableDoesNotExist",
|
|
182
|
+
table: error.message.split(": ").pop()
|
|
183
|
+
};
|
|
184
|
+
} else if (error.message.startsWith("no such column")) {
|
|
185
|
+
return {
|
|
186
|
+
kind: "ColumnNotFound",
|
|
187
|
+
column: error.message.split(": ").pop()
|
|
188
|
+
};
|
|
189
|
+
} else if (error.message.includes("has no column named ")) {
|
|
190
|
+
return {
|
|
191
|
+
kind: "ColumnNotFound",
|
|
192
|
+
column: error.message.split("has no column named ").pop()
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
kind: "sqlite",
|
|
197
|
+
extendedCode: rawCode,
|
|
198
|
+
message: error.message
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function isDbError(error) {
|
|
203
|
+
return typeof error.code === "string" && typeof error.message === "string" && (typeof error.rawCode === "number" || error.rawCode === void 0);
|
|
204
|
+
}
|
|
205
|
+
|
|
148
206
|
// src/libsql.ts
|
|
149
207
|
var debug2 = Debug2("prisma:driver-adapter:libsql");
|
|
150
208
|
var LOCK_TAG = Symbol();
|
|
@@ -197,15 +255,7 @@ var LibSqlQueryable = class {
|
|
|
197
255
|
}
|
|
198
256
|
onError(error) {
|
|
199
257
|
debug2("Error in performIO: %O", error);
|
|
200
|
-
|
|
201
|
-
if (typeof rawCode === "number") {
|
|
202
|
-
throw new DriverAdapterError({
|
|
203
|
-
kind: "sqlite",
|
|
204
|
-
extendedCode: rawCode,
|
|
205
|
-
message: error.message
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
throw error;
|
|
258
|
+
throw new DriverAdapterError(convertDriverError(error));
|
|
209
259
|
}
|
|
210
260
|
};
|
|
211
261
|
var LibSqlTransaction = class extends LibSqlQueryable {
|
|
@@ -265,7 +315,7 @@ var PrismaLibSQLAdapter = class extends LibSqlQueryable {
|
|
|
265
315
|
return new LibSqlTransaction(tx, options, release);
|
|
266
316
|
} catch (e) {
|
|
267
317
|
release();
|
|
268
|
-
|
|
318
|
+
this.onError(e);
|
|
269
319
|
}
|
|
270
320
|
}
|
|
271
321
|
dispose() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-libsql",
|
|
3
|
-
"version": "6.7.0
|
|
3
|
+
"version": "6.7.0",
|
|
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.7.0
|
|
46
|
+
"@prisma/driver-adapter-utils": "6.7.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"jest": "29.7.0",
|