@prisma/query-plan-executor 7.3.0-dev.8 → 7.3.0-dev.9

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.ts CHANGED
@@ -3216,10 +3216,12 @@ declare interface TraceState {
3216
3216
  declare class TracingHandler implements TracingHelper {
3217
3217
  #private;
3218
3218
  constructor(tracer: Tracer);
3219
+ isEnabled(): boolean;
3219
3220
  runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions_2, callback: (span?: Span, context?: Context) => R): R;
3220
3221
  }
3221
3222
 
3222
3223
  declare interface TracingHelper {
3224
+ isEnabled(): boolean;
3223
3225
  runInChildSpan<R>(nameOrOptions: string | ExtendedSpanOptions, callback: SpanCallback<R>): R;
3224
3226
  }
3225
3227
 
package/dist/index.js CHANGED
@@ -97773,7 +97773,7 @@ __export(index_exports, {
97773
97773
  module.exports = __toCommonJS(index_exports);
97774
97774
 
97775
97775
  // package.json
97776
- var version = "7.3.0-dev.8";
97776
+ var version = "7.3.0-dev.9";
97777
97777
 
97778
97778
  // ../../node_modules/.pnpm/temporal-polyfill@0.3.0/node_modules/temporal-polyfill/chunks/internal.js
97779
97779
  function clampProp(e2, n2, t2, o2, r2) {
@@ -106411,6 +106411,15 @@ var DataMapperError = class extends UserFacingError {
106411
106411
  super(message, "P2023", options);
106412
106412
  }
106413
106413
  };
106414
+ var fieldEntriesCache = /* @__PURE__ */ new WeakMap();
106415
+ function getFieldEntries(fields) {
106416
+ let entries = fieldEntriesCache.get(fields);
106417
+ if (!entries) {
106418
+ entries = Object.entries(fields);
106419
+ fieldEntriesCache.set(fields, entries);
106420
+ }
106421
+ return entries;
106422
+ }
106414
106423
  function applyDataMap(data, structure, enums) {
106415
106424
  switch (structure.type) {
106416
106425
  case "affectedRows":
@@ -106457,19 +106466,20 @@ function mapObject(data, fields, enums) {
106457
106466
  throw new DataMapperError(`Expected an object, but got '${typeof data}'`);
106458
106467
  }
106459
106468
  const result = {};
106460
- for (const [name6, node] of Object.entries(fields)) {
106469
+ for (const [name6, node] of getFieldEntries(fields)) {
106461
106470
  switch (node.type) {
106462
106471
  case "affectedRows": {
106463
106472
  throw new DataMapperError(`Unexpected 'AffectedRows' node in data mapping for field '${name6}'`);
106464
106473
  }
106465
106474
  case "object": {
106466
- if (node.serializedName !== null && !Object.hasOwn(data, node.serializedName)) {
106475
+ const { serializedName, fields: nodeFields, skipNulls } = node;
106476
+ if (serializedName !== null && !Object.hasOwn(data, serializedName)) {
106467
106477
  throw new DataMapperError(
106468
106478
  `Missing data field (Object): '${name6}'; node: ${JSON.stringify(node)}; data: ${JSON.stringify(data)}`
106469
106479
  );
106470
106480
  }
106471
- const target = node.serializedName !== null ? data[node.serializedName] : data;
106472
- result[name6] = mapArrayOrObject(target, node.fields, enums, node.skipNulls);
106481
+ const target = serializedName !== null ? data[serializedName] : data;
106482
+ result[name6] = mapArrayOrObject(target, nodeFields, enums, skipNulls);
106473
106483
  break;
106474
106484
  }
106475
106485
  case "field":
@@ -106713,6 +106723,22 @@ async function withQuerySpanAndEvent({
106713
106723
  onQuery,
106714
106724
  execute
106715
106725
  }) {
106726
+ const callback = onQuery === void 0 ? execute : async () => {
106727
+ const timestamp = /* @__PURE__ */ new Date();
106728
+ const startInstant = performance.now();
106729
+ const result = await execute();
106730
+ const endInstant = performance.now();
106731
+ onQuery({
106732
+ timestamp,
106733
+ duration: endInstant - startInstant,
106734
+ query: query2.sql,
106735
+ params: query2.args
106736
+ });
106737
+ return result;
106738
+ };
106739
+ if (!tracingHelper.isEnabled()) {
106740
+ return callback();
106741
+ }
106716
106742
  return await tracingHelper.runInChildSpan(
106717
106743
  {
106718
106744
  name: "db_query",
@@ -106722,19 +106748,7 @@ async function withQuerySpanAndEvent({
106722
106748
  "db.system.name": providerToOtelSystem(provider)
106723
106749
  }
106724
106750
  },
106725
- async () => {
106726
- const timestamp = /* @__PURE__ */ new Date();
106727
- const startInstant = performance.now();
106728
- const result = await execute();
106729
- const endInstant = performance.now();
106730
- onQuery?.({
106731
- timestamp,
106732
- duration: endInstant - startInstant,
106733
- query: query2.sql,
106734
- params: query2.args
106735
- });
106736
- return result;
106737
- }
106751
+ callback
106738
106752
  );
106739
106753
  }
106740
106754
  var GeneratorRegistry = class {
@@ -109603,6 +109617,9 @@ var TracingHandler = class {
109603
109617
  constructor(tracer2) {
109604
109618
  this.#tracer = tracer2;
109605
109619
  }
109620
+ isEnabled() {
109621
+ return true;
109622
+ }
109606
109623
  runInChildSpan(nameOrOptions, callback) {
109607
109624
  const options = normalizeSpanOptions(nameOrOptions);
109608
109625
  return new SpanScope(options, this.#tracer).run(callback);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/query-plan-executor",
3
- "version": "7.3.0-dev.8",
3
+ "version": "7.3.0-dev.9",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,11 +20,11 @@
20
20
  "temporal-polyfill": "0.3.0",
21
21
  "vitest": "3.2.4",
22
22
  "zod": "4.1.3",
23
- "@prisma/adapter-pg": "7.3.0-dev.8",
24
- "@prisma/adapter-mssql": "7.3.0-dev.8",
25
- "@prisma/adapter-mariadb": "7.3.0-dev.8",
26
- "@prisma/client-engine-runtime": "7.3.0-dev.8",
27
- "@prisma/driver-adapter-utils": "7.3.0-dev.8"
23
+ "@prisma/adapter-pg": "7.3.0-dev.9",
24
+ "@prisma/adapter-mariadb": "7.3.0-dev.9",
25
+ "@prisma/adapter-mssql": "7.3.0-dev.9",
26
+ "@prisma/client-engine-runtime": "7.3.0-dev.9",
27
+ "@prisma/driver-adapter-utils": "7.3.0-dev.9"
28
28
  },
29
29
  "files": [
30
30
  "dist"