@prisma/client-engine-runtime 6.4.0-dev.52 → 6.4.0-integration-renovate-configure.1
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.d.mts +213 -21
- package/dist/index.d.ts +213 -21
- package/dist/index.js +310 -100
- package/package.json +4 -26
- package/dist/QueryPlan.d.ts +0 -75
- package/dist/events.d.ts +0 -6
- package/dist/index.mjs +0 -652
- package/dist/interpreter/QueryInterpreter.d.ts +0 -14
- package/dist/interpreter/renderQuery.d.ts +0 -4
- package/dist/interpreter/renderQueryTemplate.d.ts +0 -10
- package/dist/interpreter/renderQueryTemplate.test.d.ts +0 -1
- package/dist/interpreter/scope.d.ts +0 -13
- package/dist/interpreter/serialize.d.ts +0 -2
- package/dist/interpreter/serialize.test.d.ts +0 -1
- package/dist/transactionManager/Transaction.d.ts +0 -15
- package/dist/transactionManager/TransactionManager.d.ts +0 -20
- package/dist/transactionManager/TransactionManager.test.d.ts +0 -1
- package/dist/transactionManager/TransactionManagerErrors.d.ts +0 -35
- package/dist/utils.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
1
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
2
|
var __typeError = (msg) => {
|
|
9
3
|
throw TypeError(msg);
|
|
10
4
|
};
|
|
@@ -12,46 +6,28 @@ var __export = (target, all) => {
|
|
|
12
6
|
for (var name in all)
|
|
13
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
8
|
};
|
|
15
|
-
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let key of __getOwnPropNames(from))
|
|
18
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
-
mod
|
|
30
|
-
));
|
|
31
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
9
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
33
10
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
34
11
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
35
12
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
36
13
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
37
14
|
|
|
38
|
-
// src/
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
47
|
-
module.exports = __toCommonJS(index_exports);
|
|
15
|
+
// src/runtime/core/engines/common/types/Transaction.ts
|
|
16
|
+
var IsolationLevel = /* @__PURE__ */ ((IsolationLevel2) => {
|
|
17
|
+
IsolationLevel2["ReadUncommitted"] = "ReadUncommitted";
|
|
18
|
+
IsolationLevel2["ReadCommitted"] = "ReadCommitted";
|
|
19
|
+
IsolationLevel2["RepeatableRead"] = "RepeatableRead";
|
|
20
|
+
IsolationLevel2["Snapshot"] = "Snapshot";
|
|
21
|
+
IsolationLevel2["Serializable"] = "Serializable";
|
|
22
|
+
return IsolationLevel2;
|
|
23
|
+
})(IsolationLevel || {});
|
|
48
24
|
|
|
49
|
-
// src/QueryPlan.ts
|
|
25
|
+
// src/runtime/core/engines/client/QueryPlan.ts
|
|
50
26
|
function isPrismaValuePlaceholder(value) {
|
|
51
27
|
return typeof value === "object" && value !== null && value["prisma__type"] === "param";
|
|
52
28
|
}
|
|
53
29
|
|
|
54
|
-
// src/interpreter/renderQueryTemplate.ts
|
|
30
|
+
// src/runtime/core/engines/client/interpreter/renderQueryTemplate.ts
|
|
55
31
|
var BEGIN_REPEAT = "/* prisma-comma-repeatable-start */";
|
|
56
32
|
var END_REPEAT = "/* prisma-comma-repeatable-end */";
|
|
57
33
|
function renderQueryTemplate({
|
|
@@ -149,7 +125,7 @@ function renderQueryTemplate({
|
|
|
149
125
|
};
|
|
150
126
|
}
|
|
151
127
|
|
|
152
|
-
// src/interpreter/renderQuery.ts
|
|
128
|
+
// src/runtime/core/engines/client/interpreter/renderQuery.ts
|
|
153
129
|
function renderQuery({ query, params }, scope) {
|
|
154
130
|
const substitutedParams = params.map((param) => {
|
|
155
131
|
if (!isPrismaValuePlaceholder(param)) {
|
|
@@ -211,7 +187,7 @@ function placeholderTypeToArgType(type) {
|
|
|
211
187
|
return mappedType;
|
|
212
188
|
}
|
|
213
189
|
|
|
214
|
-
// src/interpreter/
|
|
190
|
+
// src/runtime/core/engines/client/interpreter/serializer.ts
|
|
215
191
|
function serialize(resultSet) {
|
|
216
192
|
return resultSet.rows.map(
|
|
217
193
|
(row) => row.reduce((acc, value, index) => {
|
|
@@ -233,7 +209,7 @@ function serialize(resultSet) {
|
|
|
233
209
|
);
|
|
234
210
|
}
|
|
235
211
|
|
|
236
|
-
// src/interpreter/QueryInterpreter.ts
|
|
212
|
+
// src/runtime/core/engines/client/interpreter/QueryInterpreter.ts
|
|
237
213
|
var _queryable, _placeholderValues, _onQuery, _QueryInterpreter_instances, withQueryEvent_fn;
|
|
238
214
|
var QueryInterpreter = class {
|
|
239
215
|
constructor({ queryable, placeholderValues, onQuery }) {
|
|
@@ -367,7 +343,16 @@ withQueryEvent_fn = async function(query, execute) {
|
|
|
367
343
|
timestamp,
|
|
368
344
|
duration: endInstant - startInstant,
|
|
369
345
|
query: query.sql,
|
|
370
|
-
|
|
346
|
+
// TODO: we should probably change the interface to contain a proper array in the next major version.
|
|
347
|
+
params: JSON.stringify(query.args),
|
|
348
|
+
// TODO: this field only exists for historical reasons as we grandfathered it from the time
|
|
349
|
+
// when we emitted `tracing` events to stdout in the engine unchanged, and then described
|
|
350
|
+
// them in the public API as TS types. Thus this field used to contain the name of the Rust
|
|
351
|
+
// module in which an event originated. When using library engine, which uses a different
|
|
352
|
+
// mechanism with a JavaScript callback for logs, it's normally just an empty string instead.
|
|
353
|
+
// This field is definitely not useful and should be removed from the public types (but it's
|
|
354
|
+
// technically a breaking change, even if a tiny and inconsequential one).
|
|
355
|
+
target: "QueryInterpreter"
|
|
371
356
|
});
|
|
372
357
|
return result;
|
|
373
358
|
};
|
|
@@ -427,80 +412,292 @@ function childRecordMatchesParent(childRecord, parentRecord, joinExpr) {
|
|
|
427
412
|
return true;
|
|
428
413
|
}
|
|
429
414
|
|
|
430
|
-
//
|
|
431
|
-
var
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
415
|
+
// ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs
|
|
416
|
+
var colors_exports = {};
|
|
417
|
+
__export(colors_exports, {
|
|
418
|
+
$: () => $,
|
|
419
|
+
bgBlack: () => bgBlack,
|
|
420
|
+
bgBlue: () => bgBlue,
|
|
421
|
+
bgCyan: () => bgCyan,
|
|
422
|
+
bgGreen: () => bgGreen,
|
|
423
|
+
bgMagenta: () => bgMagenta,
|
|
424
|
+
bgRed: () => bgRed,
|
|
425
|
+
bgWhite: () => bgWhite,
|
|
426
|
+
bgYellow: () => bgYellow,
|
|
427
|
+
black: () => black,
|
|
428
|
+
blue: () => blue,
|
|
429
|
+
bold: () => bold,
|
|
430
|
+
cyan: () => cyan,
|
|
431
|
+
dim: () => dim,
|
|
432
|
+
gray: () => gray,
|
|
433
|
+
green: () => green,
|
|
434
|
+
grey: () => grey,
|
|
435
|
+
hidden: () => hidden,
|
|
436
|
+
inverse: () => inverse,
|
|
437
|
+
italic: () => italic,
|
|
438
|
+
magenta: () => magenta,
|
|
439
|
+
red: () => red,
|
|
440
|
+
reset: () => reset,
|
|
441
|
+
strikethrough: () => strikethrough,
|
|
442
|
+
underline: () => underline,
|
|
443
|
+
white: () => white,
|
|
444
|
+
yellow: () => yellow
|
|
445
|
+
});
|
|
446
|
+
var FORCE_COLOR;
|
|
447
|
+
var NODE_DISABLE_COLORS;
|
|
448
|
+
var NO_COLOR;
|
|
449
|
+
var TERM;
|
|
450
|
+
var isTTY = true;
|
|
451
|
+
if (typeof process !== "undefined") {
|
|
452
|
+
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
453
|
+
isTTY = process.stdout && process.stdout.isTTY;
|
|
454
|
+
}
|
|
455
|
+
var $ = {
|
|
456
|
+
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
|
|
457
|
+
};
|
|
458
|
+
function init(x, y) {
|
|
459
|
+
let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
|
|
460
|
+
let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
|
|
461
|
+
return function(txt) {
|
|
462
|
+
if (!$.enabled || txt == null) return txt;
|
|
463
|
+
return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
var reset = init(0, 0);
|
|
467
|
+
var bold = init(1, 22);
|
|
468
|
+
var dim = init(2, 22);
|
|
469
|
+
var italic = init(3, 23);
|
|
470
|
+
var underline = init(4, 24);
|
|
471
|
+
var inverse = init(7, 27);
|
|
472
|
+
var hidden = init(8, 28);
|
|
473
|
+
var strikethrough = init(9, 29);
|
|
474
|
+
var black = init(30, 39);
|
|
475
|
+
var red = init(31, 39);
|
|
476
|
+
var green = init(32, 39);
|
|
477
|
+
var yellow = init(33, 39);
|
|
478
|
+
var blue = init(34, 39);
|
|
479
|
+
var magenta = init(35, 39);
|
|
480
|
+
var cyan = init(36, 39);
|
|
481
|
+
var white = init(37, 39);
|
|
482
|
+
var gray = init(90, 39);
|
|
483
|
+
var grey = init(90, 39);
|
|
484
|
+
var bgBlack = init(40, 49);
|
|
485
|
+
var bgRed = init(41, 49);
|
|
486
|
+
var bgGreen = init(42, 49);
|
|
487
|
+
var bgYellow = init(43, 49);
|
|
488
|
+
var bgBlue = init(44, 49);
|
|
489
|
+
var bgMagenta = init(45, 49);
|
|
490
|
+
var bgCyan = init(46, 49);
|
|
491
|
+
var bgWhite = init(47, 49);
|
|
492
|
+
|
|
493
|
+
// ../debug/src/index.ts
|
|
494
|
+
var MAX_ARGS_HISTORY = 100;
|
|
495
|
+
var COLORS = ["green", "yellow", "blue", "magenta", "cyan", "red"];
|
|
496
|
+
var argsHistory = [];
|
|
497
|
+
var lastTimestamp = Date.now();
|
|
498
|
+
var lastColor = 0;
|
|
499
|
+
var processEnv = typeof process !== "undefined" ? process.env : {};
|
|
500
|
+
globalThis.DEBUG ??= processEnv.DEBUG ?? "";
|
|
501
|
+
globalThis.DEBUG_COLORS ??= processEnv.DEBUG_COLORS ? processEnv.DEBUG_COLORS === "true" : true;
|
|
502
|
+
var topProps = {
|
|
503
|
+
enable(namespace) {
|
|
504
|
+
if (typeof namespace === "string") {
|
|
505
|
+
globalThis.DEBUG = namespace;
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
disable() {
|
|
509
|
+
const prev = globalThis.DEBUG;
|
|
510
|
+
globalThis.DEBUG = "";
|
|
511
|
+
return prev;
|
|
512
|
+
},
|
|
513
|
+
// this is the core logic to check if logging should happen or not
|
|
514
|
+
enabled(namespace) {
|
|
515
|
+
const listenedNamespaces = globalThis.DEBUG.split(",").map((s) => {
|
|
516
|
+
return s.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|
|
517
|
+
});
|
|
518
|
+
const isListened = listenedNamespaces.some((listenedNamespace) => {
|
|
519
|
+
if (listenedNamespace === "" || listenedNamespace[0] === "-") return false;
|
|
520
|
+
return namespace.match(RegExp(listenedNamespace.split("*").join(".*") + "$"));
|
|
521
|
+
});
|
|
522
|
+
const isExcluded = listenedNamespaces.some((listenedNamespace) => {
|
|
523
|
+
if (listenedNamespace === "" || listenedNamespace[0] !== "-") return false;
|
|
524
|
+
return namespace.match(RegExp(listenedNamespace.slice(1).split("*").join(".*") + "$"));
|
|
525
|
+
});
|
|
526
|
+
return isListened && !isExcluded;
|
|
527
|
+
},
|
|
528
|
+
log: (...args) => {
|
|
529
|
+
const [namespace, format, ...rest] = args;
|
|
530
|
+
const logWithFormatting = console.warn ?? console.log;
|
|
531
|
+
logWithFormatting(`${namespace} ${format}`, ...rest);
|
|
532
|
+
},
|
|
533
|
+
formatters: {}
|
|
534
|
+
// not implemented
|
|
535
|
+
};
|
|
536
|
+
function debugCreate(namespace) {
|
|
537
|
+
const instanceProps = {
|
|
538
|
+
color: COLORS[lastColor++ % COLORS.length],
|
|
539
|
+
enabled: topProps.enabled(namespace),
|
|
540
|
+
namespace,
|
|
541
|
+
log: topProps.log,
|
|
542
|
+
extend: () => {
|
|
543
|
+
}
|
|
544
|
+
// not implemented
|
|
545
|
+
};
|
|
546
|
+
const debugCall = (...args) => {
|
|
547
|
+
const { enabled, namespace: namespace2, color, log } = instanceProps;
|
|
548
|
+
if (args.length !== 0) {
|
|
549
|
+
argsHistory.push([namespace2, ...args]);
|
|
550
|
+
}
|
|
551
|
+
if (argsHistory.length > MAX_ARGS_HISTORY) {
|
|
552
|
+
argsHistory.shift();
|
|
553
|
+
}
|
|
554
|
+
if (topProps.enabled(namespace2) || enabled) {
|
|
555
|
+
const stringArgs = args.map((arg) => {
|
|
556
|
+
if (typeof arg === "string") {
|
|
557
|
+
return arg;
|
|
558
|
+
}
|
|
559
|
+
return safeStringify(arg);
|
|
560
|
+
});
|
|
561
|
+
const ms = `+${Date.now() - lastTimestamp}ms`;
|
|
562
|
+
lastTimestamp = Date.now();
|
|
563
|
+
if (globalThis.DEBUG_COLORS) {
|
|
564
|
+
log(colors_exports[color](bold(namespace2)), ...stringArgs, colors_exports[color](ms));
|
|
565
|
+
} else {
|
|
566
|
+
log(namespace2, ...stringArgs, ms);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
return new Proxy(debugCall, {
|
|
571
|
+
get: (_, prop) => instanceProps[prop],
|
|
572
|
+
set: (_, prop, value) => instanceProps[prop] = value
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
var Debug = new Proxy(debugCreate, {
|
|
576
|
+
get: (_, prop) => topProps[prop],
|
|
577
|
+
set: (_, prop, value) => topProps[prop] = value
|
|
578
|
+
});
|
|
579
|
+
function safeStringify(value, indent = 2) {
|
|
580
|
+
const cache = /* @__PURE__ */ new Set();
|
|
581
|
+
return JSON.stringify(
|
|
582
|
+
value,
|
|
583
|
+
(key, value2) => {
|
|
584
|
+
if (typeof value2 === "object" && value2 !== null) {
|
|
585
|
+
if (cache.has(value2)) {
|
|
586
|
+
return `[Circular *]`;
|
|
587
|
+
}
|
|
588
|
+
cache.add(value2);
|
|
589
|
+
} else if (typeof value2 === "bigint") {
|
|
590
|
+
return value2.toString();
|
|
591
|
+
}
|
|
592
|
+
return value2;
|
|
593
|
+
},
|
|
594
|
+
indent
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
var src_default = Debug;
|
|
439
598
|
|
|
440
|
-
// src/
|
|
441
|
-
|
|
442
|
-
|
|
599
|
+
// ../internals/src/utils/assertNever.ts
|
|
600
|
+
function assertNever(arg, errorMessage) {
|
|
601
|
+
throw new Error(errorMessage);
|
|
602
|
+
}
|
|
443
603
|
|
|
444
|
-
// src/utils.ts
|
|
445
|
-
function
|
|
446
|
-
|
|
604
|
+
// ../internals/src/utils/setClassName.ts
|
|
605
|
+
function setClassName(classObject, name) {
|
|
606
|
+
Object.defineProperty(classObject, "name", {
|
|
607
|
+
value: name,
|
|
608
|
+
configurable: true
|
|
609
|
+
});
|
|
447
610
|
}
|
|
448
611
|
|
|
449
|
-
// src/transactionManager/
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
612
|
+
// src/runtime/core/engines/client/transactionManager/TransactionManager.ts
|
|
613
|
+
import crypto from "crypto";
|
|
614
|
+
|
|
615
|
+
// src/runtime/core/errors/PrismaClientKnownRequestError.ts
|
|
616
|
+
var PrismaClientKnownRequestError = class extends Error {
|
|
617
|
+
constructor(message, { code, clientVersion, meta, batchRequestIdx }) {
|
|
618
|
+
super(message);
|
|
619
|
+
this.name = "PrismaClientKnownRequestError";
|
|
620
|
+
this.code = code;
|
|
621
|
+
this.clientVersion = clientVersion;
|
|
453
622
|
this.meta = meta;
|
|
454
|
-
this
|
|
623
|
+
Object.defineProperty(this, "batchRequestIdx", {
|
|
624
|
+
value: batchRequestIdx,
|
|
625
|
+
enumerable: false,
|
|
626
|
+
writable: true
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
get [Symbol.toStringTag]() {
|
|
630
|
+
return "PrismaClientKnownRequestError";
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
setClassName(PrismaClientKnownRequestError, "PrismaClientKnownRequestError");
|
|
634
|
+
|
|
635
|
+
// src/runtime/core/engines/client/transactionManager/TransactionManagerErrors.ts
|
|
636
|
+
var TransactionManagerError = class extends PrismaClientKnownRequestError {
|
|
637
|
+
constructor(message, {
|
|
638
|
+
clientVersion,
|
|
639
|
+
meta
|
|
640
|
+
}) {
|
|
641
|
+
super("Transaction API error: " + message, {
|
|
642
|
+
code: "P2028",
|
|
643
|
+
clientVersion,
|
|
644
|
+
meta
|
|
645
|
+
});
|
|
455
646
|
}
|
|
456
647
|
};
|
|
457
648
|
var TransactionDriverAdapterError = class extends TransactionManagerError {
|
|
458
649
|
constructor(message, errorParams) {
|
|
459
|
-
super(`Error from Driver Adapter: ${message}`, {
|
|
650
|
+
super(`Error from Driver Adapter: ${message}`, {
|
|
651
|
+
clientVersion: errorParams.clientVersion,
|
|
652
|
+
meta: {
|
|
653
|
+
...errorParams.driverAdapterError
|
|
654
|
+
}
|
|
655
|
+
});
|
|
460
656
|
}
|
|
461
657
|
};
|
|
462
658
|
var TransactionNotFoundError = class extends TransactionManagerError {
|
|
463
|
-
constructor() {
|
|
659
|
+
constructor(errorParams) {
|
|
464
660
|
super(
|
|
465
|
-
"Transaction not found. Transaction ID is invalid, refers to an old closed transaction Prisma doesn't have information about anymore, or was obtained before disconnecting."
|
|
661
|
+
"Transaction not found. Transaction ID is invalid, refers to an old closed transaction Prisma doesn't have information about anymore, or was obtained before disconnecting.",
|
|
662
|
+
errorParams
|
|
466
663
|
);
|
|
467
664
|
}
|
|
468
665
|
};
|
|
469
666
|
var TransactionClosedError = class extends TransactionManagerError {
|
|
470
|
-
constructor(operation) {
|
|
471
|
-
super(`Transaction already closed: A ${operation} cannot be executed on a committed transaction
|
|
667
|
+
constructor(operation, errorParams) {
|
|
668
|
+
super(`Transaction already closed: A ${operation} cannot be executed on a committed transaction`, errorParams);
|
|
472
669
|
}
|
|
473
670
|
};
|
|
474
671
|
var TransactionRolledBackError = class extends TransactionManagerError {
|
|
475
|
-
constructor(operation) {
|
|
476
|
-
super(`Transaction already closed: A ${operation} cannot be executed on a committed transaction
|
|
672
|
+
constructor(operation, errorParams) {
|
|
673
|
+
super(`Transaction already closed: A ${operation} cannot be executed on a committed transaction`, errorParams);
|
|
477
674
|
}
|
|
478
675
|
};
|
|
479
676
|
var TransactionStartTimoutError = class extends TransactionManagerError {
|
|
480
|
-
constructor() {
|
|
481
|
-
super("Unable to start a transaction in the given time.");
|
|
677
|
+
constructor(errorParams) {
|
|
678
|
+
super("Unable to start a transaction in the given time.", errorParams);
|
|
482
679
|
}
|
|
483
680
|
};
|
|
484
681
|
var TransactionExecutionTimeoutError = class extends TransactionManagerError {
|
|
485
|
-
constructor(operation, { timeout, timeTaken }) {
|
|
682
|
+
constructor(operation, { clientVersion, timeout, timeTaken }) {
|
|
486
683
|
super(
|
|
487
684
|
`A ${operation} cannot be executed on an expired transaction. The timeout for this transaction was ${timeout} ms, however ${timeTaken} ms passed since the start of the transaction. Consider increasing the interactive transaction timeout or doing less work in the transaction`,
|
|
488
|
-
{
|
|
685
|
+
{ clientVersion }
|
|
489
686
|
);
|
|
490
687
|
}
|
|
491
688
|
};
|
|
492
689
|
var TransactionInternalConsistencyError = class extends TransactionManagerError {
|
|
493
|
-
constructor(message) {
|
|
494
|
-
super(`Internal Consistency Error: ${message}
|
|
690
|
+
constructor(message, errorParams) {
|
|
691
|
+
super(`Internal Consistency Error: ${message}`, errorParams);
|
|
495
692
|
}
|
|
496
693
|
};
|
|
497
694
|
var InvalidTransactionIsolationLevelError = class extends TransactionManagerError {
|
|
498
|
-
constructor(isolationLevel) {
|
|
499
|
-
super(`Invalid isolation level: ${isolationLevel}`,
|
|
695
|
+
constructor(isolationLevel, errorParams) {
|
|
696
|
+
super(`Invalid isolation level: ${isolationLevel}`, errorParams);
|
|
500
697
|
}
|
|
501
698
|
};
|
|
502
699
|
|
|
503
|
-
// src/transactionManager/TransactionManager.ts
|
|
700
|
+
// src/runtime/core/engines/client/transactionManager/TransactionManager.ts
|
|
504
701
|
var MAX_CLOSED_TRANSACTIONS = 100;
|
|
505
702
|
var isolationLevelMap = {
|
|
506
703
|
ReadUncommitted: "READ UNCOMMITTED",
|
|
@@ -509,7 +706,7 @@ var isolationLevelMap = {
|
|
|
509
706
|
Snapshot: "SNAPSHOT",
|
|
510
707
|
Serializable: "SERIALIZABLE"
|
|
511
708
|
};
|
|
512
|
-
var debug = (
|
|
709
|
+
var debug = src_default("prisma:client:transactionManager");
|
|
513
710
|
var COMMIT_QUERY = () => ({ sql: "COMMIT", args: [], argTypes: [] });
|
|
514
711
|
var ROLLBACK_QUERY = () => ({ sql: "ROLLBACK", args: [], argTypes: [] });
|
|
515
712
|
var ISOLATION_LEVEL_QUERY = (isolationLevel) => ({
|
|
@@ -518,18 +715,19 @@ var ISOLATION_LEVEL_QUERY = (isolationLevel) => ({
|
|
|
518
715
|
argTypes: []
|
|
519
716
|
});
|
|
520
717
|
var TransactionManager = class {
|
|
521
|
-
constructor({ driverAdapter }) {
|
|
718
|
+
constructor({ driverAdapter, clientVersion }) {
|
|
522
719
|
// The map of active transactions.
|
|
523
720
|
this.transactions = /* @__PURE__ */ new Map();
|
|
524
721
|
// List of last closed transactions. Max MAX_CLOSED_TRANSACTIONS entries.
|
|
525
722
|
// Used to provide better error messages than a generic "transaction not found".
|
|
526
723
|
this.closedTransactions = [];
|
|
527
724
|
this.driverAdapter = driverAdapter;
|
|
725
|
+
this.clientVersion = clientVersion;
|
|
528
726
|
}
|
|
529
727
|
async startTransaction(options) {
|
|
530
728
|
const validatedOptions = this.validateOptions(options);
|
|
531
729
|
const transaction = {
|
|
532
|
-
id:
|
|
730
|
+
id: crypto.randomUUID(),
|
|
533
731
|
status: "waiting",
|
|
534
732
|
timer: void 0,
|
|
535
733
|
timeout: validatedOptions.timeout,
|
|
@@ -541,7 +739,8 @@ var TransactionManager = class {
|
|
|
541
739
|
const txContext = await this.driverAdapter.transactionContext();
|
|
542
740
|
if (!txContext.ok)
|
|
543
741
|
throw new TransactionDriverAdapterError("Failed to start transaction.", {
|
|
544
|
-
driverAdapterError: txContext.error
|
|
742
|
+
driverAdapterError: txContext.error,
|
|
743
|
+
clientVersion: this.clientVersion
|
|
545
744
|
});
|
|
546
745
|
if (this.requiresSettingIsolationLevelFirst() && validatedOptions.isolationLevel) {
|
|
547
746
|
await txContext.value.executeRaw(ISOLATION_LEVEL_QUERY(validatedOptions.isolationLevel));
|
|
@@ -549,7 +748,8 @@ var TransactionManager = class {
|
|
|
549
748
|
const startedTransaction = await txContext.value.startTransaction();
|
|
550
749
|
if (!startedTransaction.ok)
|
|
551
750
|
throw new TransactionDriverAdapterError("Failed to start transaction.", {
|
|
552
|
-
driverAdapterError: startedTransaction.error
|
|
751
|
+
driverAdapterError: startedTransaction.error,
|
|
752
|
+
clientVersion: this.clientVersion
|
|
553
753
|
});
|
|
554
754
|
if (!startedTransaction.value.options.usePhantomQuery) {
|
|
555
755
|
await startedTransaction.value.executeRaw({ sql: "BEGIN", args: [], argTypes: [] });
|
|
@@ -564,14 +764,17 @@ var TransactionManager = class {
|
|
|
564
764
|
transaction.timer = void 0;
|
|
565
765
|
transaction.status = "running";
|
|
566
766
|
transaction.timer = this.startTransactionTimeout(transaction.id, validatedOptions.timeout);
|
|
567
|
-
return { id: transaction.id };
|
|
767
|
+
return { id: transaction.id, payload: void 0 };
|
|
568
768
|
case "timed_out":
|
|
569
|
-
throw new TransactionStartTimoutError();
|
|
769
|
+
throw new TransactionStartTimoutError({ clientVersion: this.clientVersion });
|
|
570
770
|
case "running":
|
|
571
771
|
case "committed":
|
|
572
772
|
case "rolled_back":
|
|
573
773
|
throw new TransactionInternalConsistencyError(
|
|
574
|
-
`Transaction in invalid state ${transaction.status} although it just finished startup
|
|
774
|
+
`Transaction in invalid state ${transaction.status} although it just finished startup.`,
|
|
775
|
+
{
|
|
776
|
+
clientVersion: this.clientVersion
|
|
777
|
+
}
|
|
575
778
|
);
|
|
576
779
|
default:
|
|
577
780
|
assertNever(transaction.status, "Unknown transaction status.");
|
|
@@ -587,7 +790,7 @@ var TransactionManager = class {
|
|
|
587
790
|
}
|
|
588
791
|
getTransaction(txInfo, operation) {
|
|
589
792
|
const tx = this.getActiveTransaction(txInfo.id, operation);
|
|
590
|
-
if (!tx.transaction) throw new TransactionNotFoundError();
|
|
793
|
+
if (!tx.transaction) throw new TransactionNotFoundError({ clientVersion: this.clientVersion });
|
|
591
794
|
return tx.transaction;
|
|
592
795
|
}
|
|
593
796
|
getActiveTransaction(transactionId, operation) {
|
|
@@ -599,24 +802,29 @@ var TransactionManager = class {
|
|
|
599
802
|
switch (closedTransaction.status) {
|
|
600
803
|
case "waiting":
|
|
601
804
|
case "running":
|
|
602
|
-
throw new TransactionInternalConsistencyError("Active transaction found in closed transactions list."
|
|
805
|
+
throw new TransactionInternalConsistencyError("Active transaction found in closed transactions list.", {
|
|
806
|
+
clientVersion: this.clientVersion
|
|
807
|
+
});
|
|
603
808
|
case "committed":
|
|
604
|
-
throw new TransactionClosedError(operation);
|
|
809
|
+
throw new TransactionClosedError(operation, { clientVersion: this.clientVersion });
|
|
605
810
|
case "rolled_back":
|
|
606
|
-
throw new TransactionRolledBackError(operation);
|
|
811
|
+
throw new TransactionRolledBackError(operation, { clientVersion: this.clientVersion });
|
|
607
812
|
case "timed_out":
|
|
608
813
|
throw new TransactionExecutionTimeoutError(operation, {
|
|
609
814
|
timeout: closedTransaction.timeout,
|
|
610
|
-
timeTaken: Date.now() - closedTransaction.startedAt
|
|
815
|
+
timeTaken: Date.now() - closedTransaction.startedAt,
|
|
816
|
+
clientVersion: this.clientVersion
|
|
611
817
|
});
|
|
612
818
|
}
|
|
613
819
|
} else {
|
|
614
820
|
debug(`Transaction not found.`, transactionId);
|
|
615
|
-
throw new TransactionNotFoundError();
|
|
821
|
+
throw new TransactionNotFoundError({ clientVersion: this.clientVersion });
|
|
616
822
|
}
|
|
617
823
|
}
|
|
618
824
|
if (["committed", "rolled_back", "timed_out"].includes(transaction.status)) {
|
|
619
|
-
throw new TransactionInternalConsistencyError("Closed transaction found in active transactions map."
|
|
825
|
+
throw new TransactionInternalConsistencyError("Closed transaction found in active transactions map.", {
|
|
826
|
+
clientVersion: this.clientVersion
|
|
827
|
+
});
|
|
620
828
|
}
|
|
621
829
|
return transaction;
|
|
622
830
|
}
|
|
@@ -642,7 +850,8 @@ var TransactionManager = class {
|
|
|
642
850
|
const result = await tx.transaction.commit();
|
|
643
851
|
if (!result.ok)
|
|
644
852
|
throw new TransactionDriverAdapterError("Failed to commit transaction.", {
|
|
645
|
-
driverAdapterError: result.error
|
|
853
|
+
driverAdapterError: result.error,
|
|
854
|
+
clientVersion: this.clientVersion
|
|
646
855
|
});
|
|
647
856
|
if (!tx.transaction.options.usePhantomQuery) {
|
|
648
857
|
await tx.transaction.executeRaw(COMMIT_QUERY());
|
|
@@ -651,7 +860,8 @@ var TransactionManager = class {
|
|
|
651
860
|
const result = await tx.transaction.rollback();
|
|
652
861
|
if (!result.ok)
|
|
653
862
|
throw new TransactionDriverAdapterError("Failed to rollback transaction.", {
|
|
654
|
-
driverAdapterError: result.error
|
|
863
|
+
driverAdapterError: result.error,
|
|
864
|
+
clientVersion: this.clientVersion
|
|
655
865
|
});
|
|
656
866
|
if (!tx.transaction.options.usePhantomQuery) {
|
|
657
867
|
await tx.transaction.executeRaw(ROLLBACK_QUERY());
|
|
@@ -666,12 +876,14 @@ var TransactionManager = class {
|
|
|
666
876
|
}
|
|
667
877
|
}
|
|
668
878
|
validateOptions(options) {
|
|
669
|
-
if (!options.timeout)
|
|
670
|
-
|
|
879
|
+
if (!options.timeout)
|
|
880
|
+
throw new TransactionManagerError("timeout is required", { clientVersion: this.clientVersion });
|
|
881
|
+
if (!options.maxWait)
|
|
882
|
+
throw new TransactionManagerError("maxWait is required", { clientVersion: this.clientVersion });
|
|
671
883
|
if (options.isolationLevel === "Snapshot" /* Snapshot */)
|
|
672
|
-
throw new InvalidTransactionIsolationLevelError(options.isolationLevel);
|
|
884
|
+
throw new InvalidTransactionIsolationLevelError(options.isolationLevel, { clientVersion: this.clientVersion });
|
|
673
885
|
if (this.driverAdapter.provider === "sqlite" && options.isolationLevel && options.isolationLevel !== "Serializable" /* Serializable */)
|
|
674
|
-
throw new InvalidTransactionIsolationLevelError(options.isolationLevel);
|
|
886
|
+
throw new InvalidTransactionIsolationLevelError(options.isolationLevel, { clientVersion: this.clientVersion });
|
|
675
887
|
return {
|
|
676
888
|
...options,
|
|
677
889
|
timeout: options.timeout,
|
|
@@ -682,11 +894,9 @@ var TransactionManager = class {
|
|
|
682
894
|
return this.driverAdapter.provider === "mysql";
|
|
683
895
|
}
|
|
684
896
|
};
|
|
685
|
-
|
|
686
|
-
0 && (module.exports = {
|
|
897
|
+
export {
|
|
687
898
|
IsolationLevel,
|
|
688
899
|
QueryInterpreter,
|
|
689
900
|
TransactionManager,
|
|
690
|
-
TransactionManagerError,
|
|
691
901
|
isPrismaValuePlaceholder
|
|
692
|
-
}
|
|
902
|
+
};
|
package/package.json
CHANGED
|
@@ -1,45 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-engine-runtime",
|
|
3
|
-
"version": "6.4.0-
|
|
3
|
+
"version": "6.4.0-integration-renovate-configure.1",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"require": {
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"default": "./dist/index.js"
|
|
13
|
-
},
|
|
14
|
-
"import": {
|
|
15
|
-
"types": "./dist/index.d.mts",
|
|
16
|
-
"default": "./dist/index.mjs"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
8
|
"repository": {
|
|
21
9
|
"type": "git",
|
|
22
10
|
"url": "https://github.com/prisma/prisma.git",
|
|
23
11
|
"directory": "packages/accelerate-contract"
|
|
24
12
|
},
|
|
25
13
|
"license": "Apache-2.0",
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"@prisma/debug": "6.4.0-dev.52",
|
|
28
|
-
"@prisma/driver-adapter-utils": "6.4.0-dev.52"
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/jest": "29.5.14",
|
|
32
|
-
"@types/node": "18.19.31",
|
|
33
|
-
"jest": "29.7.0",
|
|
34
|
-
"jest-junit": "16.0.0"
|
|
35
|
-
},
|
|
14
|
+
"dependencies": {},
|
|
36
15
|
"files": [
|
|
37
16
|
"dist"
|
|
38
17
|
],
|
|
39
18
|
"sideEffects": false,
|
|
40
19
|
"scripts": {
|
|
41
20
|
"dev": "DEV=true tsx helpers/build.ts",
|
|
42
|
-
"build": "tsx helpers/build.ts"
|
|
43
|
-
"test": "jest"
|
|
21
|
+
"build": "tsx helpers/build.ts"
|
|
44
22
|
}
|
|
45
23
|
}
|