@prisma/client-engine-runtime 6.12.0-dev.18 → 6.12.0-dev.2

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 CHANGED
@@ -175,13 +175,12 @@ export declare type QueryEvent = {
175
175
 
176
176
  export declare class QueryInterpreter {
177
177
  #private;
178
- constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, provider, }: QueryInterpreterOptions);
178
+ constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, }: QueryInterpreterOptions);
179
179
  static forSql(options: {
180
180
  transactionManager: QueryInterpreterTransactionManager;
181
181
  placeholderValues: Record<string, unknown>;
182
182
  onQuery?: (event: QueryEvent) => void;
183
183
  tracingHelper: TracingHelper;
184
- provider?: SchemaProvider;
185
184
  }): QueryInterpreter;
186
185
  run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
187
186
  private interpretNode;
@@ -194,7 +193,6 @@ export declare type QueryInterpreterOptions = {
194
193
  tracingHelper: TracingHelper;
195
194
  serializer: (results: SqlResultSet) => Value;
196
195
  rawSerializer?: (results: SqlResultSet) => Value;
197
- provider?: SchemaProvider;
198
196
  };
199
197
 
200
198
  export declare type QueryInterpreterTransactionManager = {
@@ -351,11 +349,6 @@ export declare type ResultNode = {
351
349
  */
352
350
  export declare function safeJsonStringify(obj: unknown): string;
353
351
 
354
- /**
355
- * `provider` property as defined in Prisma Schema (may differ from {@link @prisma/driver-adapter-utils#Provider}).
356
- */
357
- export declare type SchemaProvider = 'cockroachdb' | 'mongodb' | 'mysql' | 'postgres' | 'postgresql' | 'prisma+postgres' | 'sqlite' | 'sqlserver';
358
-
359
352
  declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
360
353
 
361
354
  export declare interface TracingHelper {
@@ -373,12 +366,11 @@ export declare class TransactionManager {
373
366
  private readonly driverAdapter;
374
367
  private readonly transactionOptions;
375
368
  private readonly tracingHelper;
376
- constructor({ driverAdapter, transactionOptions, tracingHelper, onQuery, provider, }: {
369
+ constructor({ driverAdapter, transactionOptions, tracingHelper, onQuery, }: {
377
370
  driverAdapter: SqlDriverAdapter;
378
371
  transactionOptions: TransactionOptions;
379
372
  tracingHelper: TracingHelper;
380
373
  onQuery?: (event: QueryEvent) => void;
381
- provider?: SchemaProvider;
382
374
  });
383
375
  startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
384
376
  commitTransaction(transactionId: string): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -175,13 +175,12 @@ export declare type QueryEvent = {
175
175
 
176
176
  export declare class QueryInterpreter {
177
177
  #private;
178
- constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, provider, }: QueryInterpreterOptions);
178
+ constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, }: QueryInterpreterOptions);
179
179
  static forSql(options: {
180
180
  transactionManager: QueryInterpreterTransactionManager;
181
181
  placeholderValues: Record<string, unknown>;
182
182
  onQuery?: (event: QueryEvent) => void;
183
183
  tracingHelper: TracingHelper;
184
- provider?: SchemaProvider;
185
184
  }): QueryInterpreter;
186
185
  run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
187
186
  private interpretNode;
@@ -194,7 +193,6 @@ export declare type QueryInterpreterOptions = {
194
193
  tracingHelper: TracingHelper;
195
194
  serializer: (results: SqlResultSet) => Value;
196
195
  rawSerializer?: (results: SqlResultSet) => Value;
197
- provider?: SchemaProvider;
198
196
  };
199
197
 
200
198
  export declare type QueryInterpreterTransactionManager = {
@@ -351,11 +349,6 @@ export declare type ResultNode = {
351
349
  */
352
350
  export declare function safeJsonStringify(obj: unknown): string;
353
351
 
354
- /**
355
- * `provider` property as defined in Prisma Schema (may differ from {@link @prisma/driver-adapter-utils#Provider}).
356
- */
357
- export declare type SchemaProvider = 'cockroachdb' | 'mongodb' | 'mysql' | 'postgres' | 'postgresql' | 'prisma+postgres' | 'sqlite' | 'sqlserver';
358
-
359
352
  declare type SpanCallback<R> = (span?: Span, context?: Context) => R;
360
353
 
361
354
  export declare interface TracingHelper {
@@ -373,12 +366,11 @@ export declare class TransactionManager {
373
366
  private readonly driverAdapter;
374
367
  private readonly transactionOptions;
375
368
  private readonly tracingHelper;
376
- constructor({ driverAdapter, transactionOptions, tracingHelper, onQuery, provider, }: {
369
+ constructor({ driverAdapter, transactionOptions, tracingHelper, onQuery, }: {
377
370
  driverAdapter: SqlDriverAdapter;
378
371
  transactionOptions: TransactionOptions;
379
372
  tracingHelper: TracingHelper;
380
373
  onQuery?: (event: QueryEvent) => void;
381
- provider?: SchemaProvider;
382
374
  });
383
375
  startTransaction(options?: TransactionOptions): Promise<TransactionInfo>;
384
376
  commitTransaction(transactionId: string): Promise<void>;
package/dist/index.js CHANGED
@@ -62,74 +62,20 @@ function doKeysMatch(lhs, rhs) {
62
62
  const rhsKeys = Object.keys(rhs);
63
63
  const smallerKeyList = lhsKeys.length < rhsKeys.length ? lhsKeys : rhsKeys;
64
64
  return smallerKeyList.every((key) => {
65
- if (typeof lhs[key] === typeof rhs[key] && typeof lhs[key] !== "object") {
66
- return lhs[key] === rhs[key];
67
- }
68
- if (import_decimal.default.isDecimal(lhs[key]) || import_decimal.default.isDecimal(rhs[key])) {
69
- const lhsDecimal = asDecimal(lhs[key]);
70
- const rhsDecimal = asDecimal(rhs[key]);
71
- return lhsDecimal && rhsDecimal && lhsDecimal.equals(rhsDecimal);
72
- } else if (lhs[key] instanceof Uint8Array || rhs[key] instanceof Uint8Array) {
73
- const lhsBuffer = asBuffer(lhs[key]);
74
- const rhsBuffer = asBuffer(rhs[key]);
75
- return lhsBuffer && rhsBuffer && lhsBuffer.equals(rhsBuffer);
76
- } else if (lhs[key] instanceof Date || rhs[key] instanceof Date) {
77
- return asDate(lhs[key])?.getTime() === asDate(rhs[key])?.getTime();
78
- } else if (typeof lhs[key] === "bigint" || typeof rhs[key] === "bigint") {
79
- return asBigInt(lhs[key]) === asBigInt(rhs[key]);
80
- } else if (typeof lhs[key] === "number" || typeof rhs[key] === "number") {
81
- return asNumber(lhs[key]) === asNumber(rhs[key]);
65
+ if (typeof lhs[key] !== typeof rhs[key]) {
66
+ if (typeof lhs[key] === "number" || typeof rhs[key] === "number") {
67
+ return `${lhs[key]}` === `${rhs[key]}`;
68
+ } else if (typeof lhs[key] === "bigint" || typeof rhs[key] === "bigint") {
69
+ return BigInt(`${lhs[key]}`.replace(/n$/, "")) === BigInt(`${rhs[key]}`.replace(/n$/, ""));
70
+ } else if (lhs[key] instanceof Date || rhs[key] instanceof Date) {
71
+ return (/* @__PURE__ */ new Date(`${lhs[key]}`)).getTime() === (/* @__PURE__ */ new Date(`${rhs[key]}`)).getTime();
72
+ } else if (import_decimal.default.isDecimal(lhs[key]) || import_decimal.default.isDecimal(rhs[key])) {
73
+ return new import_decimal.default(`${lhs[key]}`).equals(new import_decimal.default(`${rhs[key]}`));
74
+ }
82
75
  }
83
76
  return isDeepStrictEqual(lhs[key], rhs[key]);
84
77
  });
85
78
  }
86
- function asDecimal(value) {
87
- if (import_decimal.default.isDecimal(value)) {
88
- return value;
89
- } else if (typeof value === "number" || typeof value === "string") {
90
- return new import_decimal.default(value);
91
- } else {
92
- return;
93
- }
94
- }
95
- function asBuffer(value) {
96
- if (Buffer.isBuffer(value)) {
97
- return value;
98
- } else if (value instanceof Uint8Array) {
99
- return Buffer.from(value.buffer, value.byteOffset, value.byteLength);
100
- } else if (typeof value === "string") {
101
- return Buffer.from(value, "base64");
102
- } else {
103
- return;
104
- }
105
- }
106
- function asDate(value) {
107
- if (value instanceof Date) {
108
- return value;
109
- } else if (typeof value === "string" || typeof value === "number") {
110
- return new Date(value);
111
- } else {
112
- return;
113
- }
114
- }
115
- function asBigInt(value) {
116
- if (typeof value === "bigint") {
117
- return value;
118
- } else if (typeof value === "number" || typeof value === "string") {
119
- return BigInt(value);
120
- } else {
121
- return;
122
- }
123
- }
124
- function asNumber(value) {
125
- if (typeof value === "number") {
126
- return value;
127
- } else if (typeof value === "string") {
128
- return Number(value);
129
- } else {
130
- return;
131
- }
132
- }
133
79
  function safeJsonStringify(obj) {
134
80
  return JSON.stringify(obj, (_key, val) => {
135
81
  if (typeof val === "bigint") {
@@ -368,25 +314,22 @@ var noopTracingHelper = {
368
314
  };
369
315
  function providerToOtelSystem(provider) {
370
316
  switch (provider) {
371
- case "postgresql":
372
317
  case "postgres":
373
- case "prisma+postgres":
374
318
  return "postgresql";
375
- case "sqlserver":
376
- return "mssql";
377
319
  case "mysql":
320
+ return "mysql";
378
321
  case "sqlite":
379
- case "cockroachdb":
380
- case "mongodb":
381
- return provider;
322
+ return "sqlite";
323
+ case "sqlserver":
324
+ return "mssql";
382
325
  default:
383
326
  assertNever(provider, `Unknown provider: ${provider}`);
384
327
  }
385
328
  }
386
329
  async function withQuerySpanAndEvent({
387
330
  query,
331
+ queryable,
388
332
  tracingHelper,
389
- provider,
390
333
  onQuery,
391
334
  execute
392
335
  }) {
@@ -396,7 +339,7 @@ async function withQuerySpanAndEvent({
396
339
  kind: import_api.SpanKind.CLIENT,
397
340
  attributes: {
398
341
  "db.query.text": query.sql,
399
- "db.system.name": providerToOtelSystem(provider)
342
+ "db.system.name": providerToOtelSystem(queryable.provider)
400
343
  }
401
344
  },
402
345
  async () => {
@@ -1034,15 +977,13 @@ var QueryInterpreter = class _QueryInterpreter {
1034
977
  #tracingHelper;
1035
978
  #serializer;
1036
979
  #rawSerializer;
1037
- #provider;
1038
980
  constructor({
1039
981
  transactionManager,
1040
982
  placeholderValues,
1041
983
  onQuery,
1042
984
  tracingHelper,
1043
985
  serializer,
1044
- rawSerializer,
1045
- provider
986
+ rawSerializer
1046
987
  }) {
1047
988
  this.#transactionManager = transactionManager;
1048
989
  this.#placeholderValues = placeholderValues;
@@ -1050,7 +991,6 @@ var QueryInterpreter = class _QueryInterpreter {
1050
991
  this.#tracingHelper = tracingHelper;
1051
992
  this.#serializer = serializer;
1052
993
  this.#rawSerializer = rawSerializer ?? serializer;
1053
- this.#provider = provider;
1054
994
  }
1055
995
  static forSql(options) {
1056
996
  return new _QueryInterpreter({
@@ -1059,8 +999,7 @@ var QueryInterpreter = class _QueryInterpreter {
1059
999
  onQuery: options.onQuery,
1060
1000
  tracingHelper: options.tracingHelper,
1061
1001
  serializer: serializeSql,
1062
- rawSerializer: serializeRawSql,
1063
- provider: options.provider
1002
+ rawSerializer: serializeRawSql
1064
1003
  });
1065
1004
  }
1066
1005
  async run(queryPlan, queryable) {
@@ -1117,7 +1056,7 @@ var QueryInterpreter = class _QueryInterpreter {
1117
1056
  node.args.map((arg) => this.interpretNode(arg, queryable, scope, generators).then((res) => res.value))
1118
1057
  );
1119
1058
  return {
1120
- value: parts.length > 0 ? parts.reduce((acc, part) => asNumber2(acc) + asNumber2(part)) : 0
1059
+ value: parts.length > 0 ? parts.reduce((acc, part) => asNumber(acc) + asNumber(part)) : 0
1121
1060
  };
1122
1061
  }
1123
1062
  case "execute": {
@@ -1275,8 +1214,8 @@ var QueryInterpreter = class _QueryInterpreter {
1275
1214
  #withQuerySpanAndEvent(query, queryable, execute) {
1276
1215
  return withQuerySpanAndEvent({
1277
1216
  query,
1217
+ queryable,
1278
1218
  execute,
1279
- provider: this.#provider ?? queryable.provider,
1280
1219
  tracingHelper: this.#tracingHelper,
1281
1220
  onQuery: this.#onQuery
1282
1221
  });
@@ -1291,7 +1230,7 @@ function isEmpty(value) {
1291
1230
  function asList(value) {
1292
1231
  return Array.isArray(value) ? value : [value];
1293
1232
  }
1294
- function asNumber2(value) {
1233
+ function asNumber(value) {
1295
1234
  if (typeof value === "number") {
1296
1235
  return value;
1297
1236
  }
@@ -1376,14 +1315,14 @@ function evalFieldOperation(op, value, scope, generators) {
1376
1315
  case "set":
1377
1316
  return evaluateParam(op.value, scope, generators);
1378
1317
  case "add":
1379
- return asNumber2(value) + asNumber2(evaluateParam(op.value, scope, generators));
1318
+ return asNumber(value) + asNumber(evaluateParam(op.value, scope, generators));
1380
1319
  case "subtract":
1381
- return asNumber2(value) - asNumber2(evaluateParam(op.value, scope, generators));
1320
+ return asNumber(value) - asNumber(evaluateParam(op.value, scope, generators));
1382
1321
  case "multiply":
1383
- return asNumber2(value) * asNumber2(evaluateParam(op.value, scope, generators));
1322
+ return asNumber(value) * asNumber(evaluateParam(op.value, scope, generators));
1384
1323
  case "divide": {
1385
- const lhs = asNumber2(value);
1386
- const rhs = asNumber2(evaluateParam(op.value, scope, generators));
1324
+ const lhs = asNumber(value);
1325
+ const rhs = asNumber(evaluateParam(op.value, scope, generators));
1387
1326
  if (rhs === 0) {
1388
1327
  return null;
1389
1328
  }
@@ -1479,19 +1418,16 @@ var TransactionManager = class {
1479
1418
  transactionOptions;
1480
1419
  tracingHelper;
1481
1420
  #onQuery;
1482
- #provider;
1483
1421
  constructor({
1484
1422
  driverAdapter,
1485
1423
  transactionOptions,
1486
1424
  tracingHelper,
1487
- onQuery,
1488
- provider
1425
+ onQuery
1489
1426
  }) {
1490
1427
  this.driverAdapter = driverAdapter;
1491
1428
  this.transactionOptions = transactionOptions;
1492
1429
  this.tracingHelper = tracingHelper;
1493
1430
  this.#onQuery = onQuery;
1494
- this.#provider = provider;
1495
1431
  }
1496
1432
  async startTransaction(options) {
1497
1433
  return await this.tracingHelper.runInChildSpan("start_transaction", () => this.#startTransactionImpl(options));
@@ -1634,8 +1570,8 @@ var TransactionManager = class {
1634
1570
  #withQuerySpanAndEvent(query, queryable, execute) {
1635
1571
  return withQuerySpanAndEvent({
1636
1572
  query,
1573
+ queryable,
1637
1574
  execute,
1638
- provider: this.#provider ?? queryable.provider,
1639
1575
  tracingHelper: this.tracingHelper,
1640
1576
  onQuery: this.#onQuery
1641
1577
  });
package/dist/index.mjs CHANGED
@@ -14,74 +14,20 @@ function doKeysMatch(lhs, rhs) {
14
14
  const rhsKeys = Object.keys(rhs);
15
15
  const smallerKeyList = lhsKeys.length < rhsKeys.length ? lhsKeys : rhsKeys;
16
16
  return smallerKeyList.every((key) => {
17
- if (typeof lhs[key] === typeof rhs[key] && typeof lhs[key] !== "object") {
18
- return lhs[key] === rhs[key];
19
- }
20
- if (Decimal.isDecimal(lhs[key]) || Decimal.isDecimal(rhs[key])) {
21
- const lhsDecimal = asDecimal(lhs[key]);
22
- const rhsDecimal = asDecimal(rhs[key]);
23
- return lhsDecimal && rhsDecimal && lhsDecimal.equals(rhsDecimal);
24
- } else if (lhs[key] instanceof Uint8Array || rhs[key] instanceof Uint8Array) {
25
- const lhsBuffer = asBuffer(lhs[key]);
26
- const rhsBuffer = asBuffer(rhs[key]);
27
- return lhsBuffer && rhsBuffer && lhsBuffer.equals(rhsBuffer);
28
- } else if (lhs[key] instanceof Date || rhs[key] instanceof Date) {
29
- return asDate(lhs[key])?.getTime() === asDate(rhs[key])?.getTime();
30
- } else if (typeof lhs[key] === "bigint" || typeof rhs[key] === "bigint") {
31
- return asBigInt(lhs[key]) === asBigInt(rhs[key]);
32
- } else if (typeof lhs[key] === "number" || typeof rhs[key] === "number") {
33
- return asNumber(lhs[key]) === asNumber(rhs[key]);
17
+ if (typeof lhs[key] !== typeof rhs[key]) {
18
+ if (typeof lhs[key] === "number" || typeof rhs[key] === "number") {
19
+ return `${lhs[key]}` === `${rhs[key]}`;
20
+ } else if (typeof lhs[key] === "bigint" || typeof rhs[key] === "bigint") {
21
+ return BigInt(`${lhs[key]}`.replace(/n$/, "")) === BigInt(`${rhs[key]}`.replace(/n$/, ""));
22
+ } else if (lhs[key] instanceof Date || rhs[key] instanceof Date) {
23
+ return (/* @__PURE__ */ new Date(`${lhs[key]}`)).getTime() === (/* @__PURE__ */ new Date(`${rhs[key]}`)).getTime();
24
+ } else if (Decimal.isDecimal(lhs[key]) || Decimal.isDecimal(rhs[key])) {
25
+ return new Decimal(`${lhs[key]}`).equals(new Decimal(`${rhs[key]}`));
26
+ }
34
27
  }
35
28
  return isDeepStrictEqual(lhs[key], rhs[key]);
36
29
  });
37
30
  }
38
- function asDecimal(value) {
39
- if (Decimal.isDecimal(value)) {
40
- return value;
41
- } else if (typeof value === "number" || typeof value === "string") {
42
- return new Decimal(value);
43
- } else {
44
- return;
45
- }
46
- }
47
- function asBuffer(value) {
48
- if (Buffer.isBuffer(value)) {
49
- return value;
50
- } else if (value instanceof Uint8Array) {
51
- return Buffer.from(value.buffer, value.byteOffset, value.byteLength);
52
- } else if (typeof value === "string") {
53
- return Buffer.from(value, "base64");
54
- } else {
55
- return;
56
- }
57
- }
58
- function asDate(value) {
59
- if (value instanceof Date) {
60
- return value;
61
- } else if (typeof value === "string" || typeof value === "number") {
62
- return new Date(value);
63
- } else {
64
- return;
65
- }
66
- }
67
- function asBigInt(value) {
68
- if (typeof value === "bigint") {
69
- return value;
70
- } else if (typeof value === "number" || typeof value === "string") {
71
- return BigInt(value);
72
- } else {
73
- return;
74
- }
75
- }
76
- function asNumber(value) {
77
- if (typeof value === "number") {
78
- return value;
79
- } else if (typeof value === "string") {
80
- return Number(value);
81
- } else {
82
- return;
83
- }
84
- }
85
31
  function safeJsonStringify(obj) {
86
32
  return JSON.stringify(obj, (_key, val) => {
87
33
  if (typeof val === "bigint") {
@@ -320,25 +266,22 @@ var noopTracingHelper = {
320
266
  };
321
267
  function providerToOtelSystem(provider) {
322
268
  switch (provider) {
323
- case "postgresql":
324
269
  case "postgres":
325
- case "prisma+postgres":
326
270
  return "postgresql";
327
- case "sqlserver":
328
- return "mssql";
329
271
  case "mysql":
272
+ return "mysql";
330
273
  case "sqlite":
331
- case "cockroachdb":
332
- case "mongodb":
333
- return provider;
274
+ return "sqlite";
275
+ case "sqlserver":
276
+ return "mssql";
334
277
  default:
335
278
  assertNever(provider, `Unknown provider: ${provider}`);
336
279
  }
337
280
  }
338
281
  async function withQuerySpanAndEvent({
339
282
  query,
283
+ queryable,
340
284
  tracingHelper,
341
- provider,
342
285
  onQuery,
343
286
  execute
344
287
  }) {
@@ -348,7 +291,7 @@ async function withQuerySpanAndEvent({
348
291
  kind: SpanKind.CLIENT,
349
292
  attributes: {
350
293
  "db.query.text": query.sql,
351
- "db.system.name": providerToOtelSystem(provider)
294
+ "db.system.name": providerToOtelSystem(queryable.provider)
352
295
  }
353
296
  },
354
297
  async () => {
@@ -986,15 +929,13 @@ var QueryInterpreter = class _QueryInterpreter {
986
929
  #tracingHelper;
987
930
  #serializer;
988
931
  #rawSerializer;
989
- #provider;
990
932
  constructor({
991
933
  transactionManager,
992
934
  placeholderValues,
993
935
  onQuery,
994
936
  tracingHelper,
995
937
  serializer,
996
- rawSerializer,
997
- provider
938
+ rawSerializer
998
939
  }) {
999
940
  this.#transactionManager = transactionManager;
1000
941
  this.#placeholderValues = placeholderValues;
@@ -1002,7 +943,6 @@ var QueryInterpreter = class _QueryInterpreter {
1002
943
  this.#tracingHelper = tracingHelper;
1003
944
  this.#serializer = serializer;
1004
945
  this.#rawSerializer = rawSerializer ?? serializer;
1005
- this.#provider = provider;
1006
946
  }
1007
947
  static forSql(options) {
1008
948
  return new _QueryInterpreter({
@@ -1011,8 +951,7 @@ var QueryInterpreter = class _QueryInterpreter {
1011
951
  onQuery: options.onQuery,
1012
952
  tracingHelper: options.tracingHelper,
1013
953
  serializer: serializeSql,
1014
- rawSerializer: serializeRawSql,
1015
- provider: options.provider
954
+ rawSerializer: serializeRawSql
1016
955
  });
1017
956
  }
1018
957
  async run(queryPlan, queryable) {
@@ -1069,7 +1008,7 @@ var QueryInterpreter = class _QueryInterpreter {
1069
1008
  node.args.map((arg) => this.interpretNode(arg, queryable, scope, generators).then((res) => res.value))
1070
1009
  );
1071
1010
  return {
1072
- value: parts.length > 0 ? parts.reduce((acc, part) => asNumber2(acc) + asNumber2(part)) : 0
1011
+ value: parts.length > 0 ? parts.reduce((acc, part) => asNumber(acc) + asNumber(part)) : 0
1073
1012
  };
1074
1013
  }
1075
1014
  case "execute": {
@@ -1227,8 +1166,8 @@ var QueryInterpreter = class _QueryInterpreter {
1227
1166
  #withQuerySpanAndEvent(query, queryable, execute) {
1228
1167
  return withQuerySpanAndEvent({
1229
1168
  query,
1169
+ queryable,
1230
1170
  execute,
1231
- provider: this.#provider ?? queryable.provider,
1232
1171
  tracingHelper: this.#tracingHelper,
1233
1172
  onQuery: this.#onQuery
1234
1173
  });
@@ -1243,7 +1182,7 @@ function isEmpty(value) {
1243
1182
  function asList(value) {
1244
1183
  return Array.isArray(value) ? value : [value];
1245
1184
  }
1246
- function asNumber2(value) {
1185
+ function asNumber(value) {
1247
1186
  if (typeof value === "number") {
1248
1187
  return value;
1249
1188
  }
@@ -1328,14 +1267,14 @@ function evalFieldOperation(op, value, scope, generators) {
1328
1267
  case "set":
1329
1268
  return evaluateParam(op.value, scope, generators);
1330
1269
  case "add":
1331
- return asNumber2(value) + asNumber2(evaluateParam(op.value, scope, generators));
1270
+ return asNumber(value) + asNumber(evaluateParam(op.value, scope, generators));
1332
1271
  case "subtract":
1333
- return asNumber2(value) - asNumber2(evaluateParam(op.value, scope, generators));
1272
+ return asNumber(value) - asNumber(evaluateParam(op.value, scope, generators));
1334
1273
  case "multiply":
1335
- return asNumber2(value) * asNumber2(evaluateParam(op.value, scope, generators));
1274
+ return asNumber(value) * asNumber(evaluateParam(op.value, scope, generators));
1336
1275
  case "divide": {
1337
- const lhs = asNumber2(value);
1338
- const rhs = asNumber2(evaluateParam(op.value, scope, generators));
1276
+ const lhs = asNumber(value);
1277
+ const rhs = asNumber(evaluateParam(op.value, scope, generators));
1339
1278
  if (rhs === 0) {
1340
1279
  return null;
1341
1280
  }
@@ -1431,19 +1370,16 @@ var TransactionManager = class {
1431
1370
  transactionOptions;
1432
1371
  tracingHelper;
1433
1372
  #onQuery;
1434
- #provider;
1435
1373
  constructor({
1436
1374
  driverAdapter,
1437
1375
  transactionOptions,
1438
1376
  tracingHelper,
1439
- onQuery,
1440
- provider
1377
+ onQuery
1441
1378
  }) {
1442
1379
  this.driverAdapter = driverAdapter;
1443
1380
  this.transactionOptions = transactionOptions;
1444
1381
  this.tracingHelper = tracingHelper;
1445
1382
  this.#onQuery = onQuery;
1446
- this.#provider = provider;
1447
1383
  }
1448
1384
  async startTransaction(options) {
1449
1385
  return await this.tracingHelper.runInChildSpan("start_transaction", () => this.#startTransactionImpl(options));
@@ -1586,8 +1522,8 @@ var TransactionManager = class {
1586
1522
  #withQuerySpanAndEvent(query, queryable, execute) {
1587
1523
  return withQuerySpanAndEvent({
1588
1524
  query,
1525
+ queryable,
1589
1526
  execute,
1590
- provider: this.#provider ?? queryable.provider,
1591
1527
  tracingHelper: this.tracingHelper,
1592
1528
  onQuery: this.#onQuery
1593
1529
  });
@@ -1,7 +1,6 @@
1
1
  import { SqlQueryable, SqlResultSet } from '@prisma/driver-adapter-utils';
2
2
  import { QueryEvent } from '../events';
3
3
  import { QueryPlanNode } from '../QueryPlan';
4
- import { type SchemaProvider } from '../schema';
5
4
  import { type TracingHelper } from '../tracing';
6
5
  import { type TransactionManager } from '../transactionManager/TransactionManager';
7
6
  import { Value } from './scope';
@@ -18,17 +17,15 @@ export type QueryInterpreterOptions = {
18
17
  tracingHelper: TracingHelper;
19
18
  serializer: (results: SqlResultSet) => Value;
20
19
  rawSerializer?: (results: SqlResultSet) => Value;
21
- provider?: SchemaProvider;
22
20
  };
23
21
  export declare class QueryInterpreter {
24
22
  #private;
25
- constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, provider, }: QueryInterpreterOptions);
23
+ constructor({ transactionManager, placeholderValues, onQuery, tracingHelper, serializer, rawSerializer, }: QueryInterpreterOptions);
26
24
  static forSql(options: {
27
25
  transactionManager: QueryInterpreterTransactionManager;
28
26
  placeholderValues: Record<string, unknown>;
29
27
  onQuery?: (event: QueryEvent) => void;
30
28
  tracingHelper: TracingHelper;
31
- provider?: SchemaProvider;
32
29
  }): QueryInterpreter;
33
30
  run(queryPlan: QueryPlanNode, queryable: SqlQueryable): Promise<unknown>;
34
31
  private interpretNode;
package/dist/tracing.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { type Context, type Span, type SpanOptions } from '@opentelemetry/api';
2
- import type { SqlQuery } from '@prisma/driver-adapter-utils';
2
+ import type { Provider, SqlQuery, SqlQueryable } from '@prisma/driver-adapter-utils';
3
3
  import { QueryEvent } from './events';
4
- import type { SchemaProvider } from './schema';
5
4
  export type SpanCallback<R> = (span?: Span, context?: Context) => R;
6
5
  export type ExtendedSpanOptions = SpanOptions & {
7
6
  name: string;
@@ -10,11 +9,11 @@ export interface TracingHelper {
10
9
  runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions, callback: SpanCallback<R>): R;
11
10
  }
12
11
  export declare const noopTracingHelper: TracingHelper;
13
- export declare function providerToOtelSystem(provider: SchemaProvider): string;
14
- export declare function withQuerySpanAndEvent<T>({ query, tracingHelper, provider, onQuery, execute, }: {
12
+ export declare function providerToOtelSystem(provider: Provider): string;
13
+ export declare function withQuerySpanAndEvent<T>({ query, queryable, tracingHelper, onQuery, execute, }: {
15
14
  query: SqlQuery;
15
+ queryable: SqlQueryable;
16
16
  tracingHelper: TracingHelper;
17
- provider: SchemaProvider;
18
17
  onQuery?: (event: QueryEvent) => void;
19
18
  execute: () => Promise<T>;
20
19
  }): Promise<T>;
@@ -1,6 +1,5 @@
1
1
  import { SqlDriverAdapter, Transaction } from '@prisma/driver-adapter-utils';
2
2
  import { QueryEvent } from '../events';
3
- import type { SchemaProvider } from '../schema';
4
3
  import { TracingHelper } from '../tracing';
5
4
  import { Options, TransactionInfo } from './Transaction';
6
5
  export declare class TransactionManager {
@@ -10,12 +9,11 @@ export declare class TransactionManager {
10
9
  private readonly driverAdapter;
11
10
  private readonly transactionOptions;
12
11
  private readonly tracingHelper;
13
- constructor({ driverAdapter, transactionOptions, tracingHelper, onQuery, provider, }: {
12
+ constructor({ driverAdapter, transactionOptions, tracingHelper, onQuery, }: {
14
13
  driverAdapter: SqlDriverAdapter;
15
14
  transactionOptions: Options;
16
15
  tracingHelper: TracingHelper;
17
16
  onQuery?: (event: QueryEvent) => void;
18
- provider?: SchemaProvider;
19
17
  });
20
18
  startTransaction(options?: Options): Promise<TransactionInfo>;
21
19
  commitTransaction(transactionId: string): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-engine-runtime",
3
- "version": "6.12.0-dev.18",
3
+ "version": "6.12.0-dev.2",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -31,8 +31,8 @@
31
31
  "nanoid": "5.1.5",
32
32
  "ulid": "3.0.0",
33
33
  "uuid": "11.1.0",
34
- "@prisma/debug": "6.12.0-dev.18",
35
- "@prisma/driver-adapter-utils": "6.12.0-dev.18"
34
+ "@prisma/driver-adapter-utils": "6.12.0-dev.2",
35
+ "@prisma/debug": "6.12.0-dev.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/jest": "29.5.14",
package/dist/schema.d.ts DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * `provider` property as defined in Prisma Schema (may differ from {@link @prisma/driver-adapter-utils#Provider}).
3
- */
4
- export type SchemaProvider = 'cockroachdb' | 'mongodb' | 'mysql' | 'postgres' | 'postgresql' | 'prisma+postgres' | 'sqlite' | 'sqlserver';