@prisma/client 7.4.0-dev.21 → 7.4.0-dev.22

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.
@@ -4573,7 +4573,7 @@ var import_path4 = __toESM(require("path"));
4573
4573
  // package.json
4574
4574
  var package_default = {
4575
4575
  name: "@prisma/client",
4576
- version: "7.4.0-dev.21",
4576
+ version: "7.4.0-dev.22",
4577
4577
  description: "Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.",
4578
4578
  keywords: [
4579
4579
  "ORM",
@@ -4783,6 +4783,8 @@ var package_default = {
4783
4783
  "@prisma/json-protocol": "workspace:*",
4784
4784
  "@prisma/migrate": "workspace:*",
4785
4785
  "@prisma/query-compiler-wasm": "7.4.0-18.2997580c8cb38878f73e100453e7b27119e8faeb",
4786
+ "@prisma/param-graph": "workspace:*",
4787
+ "@prisma/param-graph-builder": "workspace:*",
4786
4788
  "@prisma/query-plan-executor": "workspace:*",
4787
4789
  "@prisma/sqlcommenter": "workspace:*",
4788
4790
  "@prisma/sqlcommenter-trace-context": "workspace:*",
@@ -7870,6 +7872,674 @@ function fluentWrapperName(modelName) {
7870
7872
  return `Prisma__${modelName}Client`;
7871
7873
  }
7872
7874
 
7875
+ // ../param-graph/src/serialization.ts
7876
+ function serializeParamGraph(data) {
7877
+ return new Serializer(data).serialize();
7878
+ }
7879
+ function encodeBase64url(bytes) {
7880
+ return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString("base64url");
7881
+ }
7882
+ function varuintSize(value) {
7883
+ let size = 1;
7884
+ while (value >= 128) {
7885
+ size++;
7886
+ value >>>= 7;
7887
+ }
7888
+ return size;
7889
+ }
7890
+ var Serializer = class {
7891
+ #data;
7892
+ #buffer;
7893
+ #view;
7894
+ #offset = 0;
7895
+ #rootKeys;
7896
+ constructor(data) {
7897
+ this.#data = data;
7898
+ this.#rootKeys = Object.keys(data.roots);
7899
+ const size = this.#calculateBufferSize();
7900
+ this.#buffer = new ArrayBuffer(size);
7901
+ this.#view = new DataView(this.#buffer);
7902
+ }
7903
+ serialize() {
7904
+ this.#writeHeader();
7905
+ this.#writeInputNodes();
7906
+ this.#writeOutputNodes();
7907
+ this.#writeRoots();
7908
+ return {
7909
+ strings: this.#data.strings,
7910
+ graph: encodeBase64url(new Uint8Array(this.#buffer, 0, this.#offset))
7911
+ };
7912
+ }
7913
+ #writeVaruint(value) {
7914
+ while (value >= 128) {
7915
+ this.#view.setUint8(this.#offset++, value & 127 | 128);
7916
+ value >>>= 7;
7917
+ }
7918
+ this.#view.setUint8(this.#offset++, value);
7919
+ }
7920
+ #writeOptionalVaruint(value) {
7921
+ this.#writeVaruint(value === void 0 ? 0 : value + 1);
7922
+ }
7923
+ #writeByte(value) {
7924
+ this.#view.setUint8(this.#offset, value);
7925
+ this.#offset += 1;
7926
+ }
7927
+ #writeU16(value) {
7928
+ this.#view.setUint16(this.#offset, value, true);
7929
+ this.#offset += 2;
7930
+ }
7931
+ #calculateBufferSize() {
7932
+ let size = 0;
7933
+ size += varuintSize(this.#data.inputNodes.length);
7934
+ size += varuintSize(this.#data.outputNodes.length);
7935
+ size += varuintSize(this.#rootKeys.length);
7936
+ for (const node of this.#data.inputNodes) {
7937
+ const fieldIndices = Object.keys(node.edges).map(Number);
7938
+ size += varuintSize(fieldIndices.length);
7939
+ for (const fieldIndex of fieldIndices) {
7940
+ const edge = node.edges[fieldIndex];
7941
+ size += varuintSize(fieldIndex);
7942
+ size += 2;
7943
+ size += varuintSize(edge.childNodeId === void 0 ? 0 : edge.childNodeId + 1);
7944
+ size += varuintSize(edge.enumNameIndex === void 0 ? 0 : edge.enumNameIndex + 1);
7945
+ size += 1;
7946
+ }
7947
+ }
7948
+ for (const node of this.#data.outputNodes) {
7949
+ const fieldIndices = Object.keys(node.edges).map(Number);
7950
+ size += varuintSize(fieldIndices.length);
7951
+ for (const fieldIndex of fieldIndices) {
7952
+ const edge = node.edges[fieldIndex];
7953
+ size += varuintSize(fieldIndex);
7954
+ size += varuintSize(edge.argsNodeId === void 0 ? 0 : edge.argsNodeId + 1);
7955
+ size += varuintSize(edge.outputNodeId === void 0 ? 0 : edge.outputNodeId + 1);
7956
+ }
7957
+ }
7958
+ for (const key of this.#rootKeys) {
7959
+ const root = this.#data.roots[key];
7960
+ const keyIndex = this.#data.strings.indexOf(key);
7961
+ size += varuintSize(keyIndex);
7962
+ size += varuintSize(root.argsNodeId === void 0 ? 0 : root.argsNodeId + 1);
7963
+ size += varuintSize(root.outputNodeId === void 0 ? 0 : root.outputNodeId + 1);
7964
+ }
7965
+ return size;
7966
+ }
7967
+ #writeHeader() {
7968
+ this.#writeVaruint(this.#data.inputNodes.length);
7969
+ this.#writeVaruint(this.#data.outputNodes.length);
7970
+ this.#writeVaruint(this.#rootKeys.length);
7971
+ }
7972
+ #writeInputNodes() {
7973
+ for (const node of this.#data.inputNodes) {
7974
+ const fieldIndices = Object.keys(node.edges).map(Number);
7975
+ this.#writeVaruint(fieldIndices.length);
7976
+ for (const fieldIndex of fieldIndices) {
7977
+ const edge = node.edges[fieldIndex];
7978
+ this.#writeVaruint(fieldIndex);
7979
+ this.#writeU16(edge.scalarMask ?? 0);
7980
+ this.#writeOptionalVaruint(edge.childNodeId);
7981
+ this.#writeOptionalVaruint(edge.enumNameIndex);
7982
+ this.#writeByte(edge.flags);
7983
+ }
7984
+ }
7985
+ }
7986
+ #writeOutputNodes() {
7987
+ for (const node of this.#data.outputNodes) {
7988
+ const fieldIndices = Object.keys(node.edges).map(Number);
7989
+ this.#writeVaruint(fieldIndices.length);
7990
+ for (const fieldIndex of fieldIndices) {
7991
+ const edge = node.edges[fieldIndex];
7992
+ this.#writeVaruint(fieldIndex);
7993
+ this.#writeOptionalVaruint(edge.argsNodeId);
7994
+ this.#writeOptionalVaruint(edge.outputNodeId);
7995
+ }
7996
+ }
7997
+ }
7998
+ #writeRoots() {
7999
+ for (const key of this.#rootKeys) {
8000
+ const root = this.#data.roots[key];
8001
+ const keyIndex = this.#data.strings.indexOf(key);
8002
+ if (keyIndex === -1) {
8003
+ throw new Error(`Root key "${key}" not found in strings table`);
8004
+ }
8005
+ this.#writeVaruint(keyIndex);
8006
+ this.#writeOptionalVaruint(root.argsNodeId);
8007
+ this.#writeOptionalVaruint(root.outputNodeId);
8008
+ }
8009
+ }
8010
+ };
8011
+
8012
+ // ../param-graph/src/param-graph.ts
8013
+ var EdgeFlag = {
8014
+ /**
8015
+ * Field may be parameterized as a scalar value.
8016
+ * Check ScalarMask to validate the value type.
8017
+ */
8018
+ ParamScalar: 1,
8019
+ /**
8020
+ * Field may be parameterized as an enum.
8021
+ * Check enum ID to validate the value type.
8022
+ */
8023
+ ParamEnum: 2,
8024
+ /**
8025
+ * Field accepts list-of-scalar values.
8026
+ * Parameterize the whole list if all elements match ScalarMask.
8027
+ */
8028
+ ParamListScalar: 4,
8029
+ /**
8030
+ * Field accepts list-of-enum values.
8031
+ * Parameterize the whole list if all elements match enum ID.
8032
+ */
8033
+ ParamListEnum: 8,
8034
+ /**
8035
+ * Field accepts list-of-object values.
8036
+ * Recurse into each element using the child node.
8037
+ */
8038
+ ListObject: 16,
8039
+ /**
8040
+ * Field accepts object values.
8041
+ * Recurse into child input node.
8042
+ */
8043
+ Object: 32
8044
+ };
8045
+ var ScalarMask = {
8046
+ String: 1,
8047
+ Int: 2,
8048
+ BigInt: 4,
8049
+ Float: 8,
8050
+ Decimal: 16,
8051
+ Boolean: 32,
8052
+ DateTime: 64,
8053
+ Json: 128,
8054
+ Bytes: 256
8055
+ };
8056
+ function scalarTypeToMask(typeName) {
8057
+ switch (typeName) {
8058
+ case "String":
8059
+ case "UUID":
8060
+ return ScalarMask.String;
8061
+ case "Int":
8062
+ return ScalarMask.Int;
8063
+ case "BigInt":
8064
+ return ScalarMask.BigInt;
8065
+ case "Float":
8066
+ return ScalarMask.Float;
8067
+ case "Decimal":
8068
+ return ScalarMask.Decimal;
8069
+ case "Boolean":
8070
+ return ScalarMask.Boolean;
8071
+ case "DateTime":
8072
+ return ScalarMask.DateTime;
8073
+ case "Json":
8074
+ return ScalarMask.Json;
8075
+ case "Bytes":
8076
+ return ScalarMask.Bytes;
8077
+ default:
8078
+ return 0;
8079
+ }
8080
+ }
8081
+
8082
+ // ../param-graph-builder/src/dmmf-traverser.ts
8083
+ var DMMFTraverser = class {
8084
+ #builder;
8085
+ #inputTypeMap;
8086
+ #outputTypeMap;
8087
+ #pendingInputNodes = [];
8088
+ #pendingUnionNodes = [];
8089
+ constructor(builder, dmmf) {
8090
+ this.#builder = builder;
8091
+ this.#inputTypeMap = /* @__PURE__ */ new Map();
8092
+ this.#outputTypeMap = /* @__PURE__ */ new Map();
8093
+ for (const inputType of dmmf.schema.inputObjectTypes.prisma ?? []) {
8094
+ this.#inputTypeMap.set(getTypeName(inputType.name, "prisma"), inputType);
8095
+ }
8096
+ for (const inputType of dmmf.schema.inputObjectTypes.model ?? []) {
8097
+ this.#inputTypeMap.set(getTypeName(inputType.name, "model"), inputType);
8098
+ }
8099
+ for (const outputType of dmmf.schema.outputObjectTypes.prisma ?? []) {
8100
+ this.#outputTypeMap.set(getTypeName(outputType.name, "prisma"), outputType);
8101
+ }
8102
+ for (const outputType of dmmf.schema.outputObjectTypes.model ?? []) {
8103
+ this.#outputTypeMap.set(getTypeName(outputType.name, "model"), outputType);
8104
+ }
8105
+ }
8106
+ /**
8107
+ * Process all root operations from model mappings.
8108
+ */
8109
+ processRoots(mappings) {
8110
+ for (const mapping of mappings) {
8111
+ const modelName = mapping.model;
8112
+ const actions = Object.keys(ModelAction);
8113
+ for (const action2 of actions) {
8114
+ const fieldName = mapping[action2];
8115
+ if (!fieldName) continue;
8116
+ const rootField = this.#findRootField(fieldName);
8117
+ if (!rootField) continue;
8118
+ const argsNodeId = this.buildInputNodeFromArgs(rootField.args);
8119
+ let outputNodeId;
8120
+ if (rootField.outputType.location === "outputObjectTypes") {
8121
+ outputNodeId = this.buildOutputTypeNode(
8122
+ getTypeName(rootField.outputType.type, rootField.outputType.namespace)
8123
+ );
8124
+ }
8125
+ const dmmfActionToJsonAction = {
8126
+ create: "createOne",
8127
+ update: "updateOne",
8128
+ delete: "deleteOne",
8129
+ upsert: "upsertOne"
8130
+ };
8131
+ const jsonAction = dmmfActionToJsonAction[action2] ?? action2;
8132
+ const rootKey = `${modelName}.${jsonAction}`;
8133
+ this.#builder.setRoot(rootKey, {
8134
+ argsNodeId,
8135
+ outputNodeId
8136
+ });
8137
+ }
8138
+ }
8139
+ this.#drainPendingWork();
8140
+ }
8141
+ /**
8142
+ * Iteratively processes all pending input and union nodes.
8143
+ * This avoids deep recursion that can cause stack overflow on complex schemas.
8144
+ */
8145
+ #drainPendingWork() {
8146
+ while (this.#pendingInputNodes.length > 0 || this.#pendingUnionNodes.length > 0) {
8147
+ while (this.#pendingInputNodes.length > 0) {
8148
+ const pending = this.#pendingInputNodes.pop();
8149
+ this.#processInputNodeFields(pending.nodeId, pending.fields);
8150
+ }
8151
+ while (this.#pendingUnionNodes.length > 0) {
8152
+ const pending = this.#pendingUnionNodes.pop();
8153
+ this.#processUnionNodeFields(pending.nodeId, pending.typeNames);
8154
+ }
8155
+ }
8156
+ }
8157
+ #findRootField(fieldName) {
8158
+ const queryType = this.#outputTypeMap.get("prisma.Query");
8159
+ if (queryType) {
8160
+ const field = queryType.fields.find((f) => f.name === fieldName);
8161
+ if (field) return field;
8162
+ }
8163
+ const mutationType = this.#outputTypeMap.get("prisma.Mutation");
8164
+ if (mutationType) {
8165
+ const field = mutationType.fields.find((f) => f.name === fieldName);
8166
+ if (field) return field;
8167
+ }
8168
+ return void 0;
8169
+ }
8170
+ /**
8171
+ * Builds an input node from schema arguments.
8172
+ */
8173
+ buildInputNodeFromArgs(args) {
8174
+ const edges = {};
8175
+ let hasAnyEdge = false;
8176
+ for (const arg of args) {
8177
+ const edge = this.#mergeFieldVariants([arg]);
8178
+ if (edge) {
8179
+ const stringIndex = this.#builder.internString(arg.name);
8180
+ edges[stringIndex] = edge;
8181
+ hasAnyEdge = true;
8182
+ }
8183
+ }
8184
+ if (!hasAnyEdge) {
8185
+ return void 0;
8186
+ }
8187
+ const nodeId = this.#builder.allocateInputNode();
8188
+ this.#builder.setInputNodeEdges(nodeId, edges);
8189
+ return nodeId;
8190
+ }
8191
+ /**
8192
+ * Builds an input node for a named input type.
8193
+ * Node allocation happens immediately, but field processing is deferred
8194
+ * to avoid deep recursion.
8195
+ */
8196
+ buildInputTypeNode(typeName) {
8197
+ if (this.#builder.hasInputTypeNode(typeName)) {
8198
+ return this.#builder.getInputTypeNode(typeName);
8199
+ }
8200
+ const inputType = this.#inputTypeMap.get(typeName);
8201
+ if (!inputType) {
8202
+ this.#builder.setInputTypeNode(typeName, void 0);
8203
+ return void 0;
8204
+ }
8205
+ const nodeId = this.#builder.allocateInputNode();
8206
+ this.#builder.setInputTypeNode(typeName, nodeId);
8207
+ this.#pendingInputNodes.push({ nodeId, fields: inputType.fields });
8208
+ return nodeId;
8209
+ }
8210
+ /**
8211
+ * Process fields for an input node (called from drainPendingWork).
8212
+ */
8213
+ #processInputNodeFields(nodeId, fields) {
8214
+ const edges = {};
8215
+ let hasAnyEdge = false;
8216
+ for (const field of fields) {
8217
+ const edge = this.#mergeFieldVariants([field]);
8218
+ if (edge) {
8219
+ const stringIndex = this.#builder.internString(field.name);
8220
+ edges[stringIndex] = edge;
8221
+ hasAnyEdge = true;
8222
+ }
8223
+ }
8224
+ if (hasAnyEdge) {
8225
+ this.#builder.setInputNodeEdges(nodeId, edges);
8226
+ }
8227
+ }
8228
+ /**
8229
+ * Builds a union node for multiple input types.
8230
+ * Node allocation happens immediately, but field processing is deferred
8231
+ * to avoid deep recursion.
8232
+ */
8233
+ buildUnionNode(typeNames) {
8234
+ const sortedNames = [...typeNames].sort();
8235
+ const cacheKey = sortedNames.join("|");
8236
+ if (this.#builder.hasUnionNode(cacheKey)) {
8237
+ return this.#builder.getUnionNode(cacheKey);
8238
+ }
8239
+ const nodeId = this.#builder.allocateInputNode();
8240
+ this.#builder.setUnionNode(cacheKey, nodeId);
8241
+ this.#pendingUnionNodes.push({ nodeId, typeNames });
8242
+ return nodeId;
8243
+ }
8244
+ /**
8245
+ * Process fields for a union node (called from drainPendingWork).
8246
+ */
8247
+ #processUnionNodeFields(nodeId, typeNames) {
8248
+ const fieldsByName = /* @__PURE__ */ new Map();
8249
+ for (const typeName of typeNames) {
8250
+ const inputType = this.#inputTypeMap.get(typeName);
8251
+ if (!inputType) continue;
8252
+ for (const field of inputType.fields) {
8253
+ let fieldsForName = fieldsByName.get(field.name);
8254
+ if (!fieldsForName) {
8255
+ fieldsForName = [];
8256
+ fieldsByName.set(field.name, fieldsForName);
8257
+ }
8258
+ fieldsForName.push(field);
8259
+ }
8260
+ }
8261
+ const mergedEdges = {};
8262
+ let hasAnyEdge = false;
8263
+ for (const [fieldName, variantFields] of fieldsByName) {
8264
+ const mergedEdge = this.#mergeFieldVariants(variantFields);
8265
+ if (mergedEdge) {
8266
+ const stringIndex = this.#builder.internString(fieldName);
8267
+ mergedEdges[stringIndex] = mergedEdge;
8268
+ hasAnyEdge = true;
8269
+ }
8270
+ }
8271
+ if (hasAnyEdge) {
8272
+ this.#builder.setInputNodeEdges(nodeId, mergedEdges);
8273
+ }
8274
+ }
8275
+ /**
8276
+ * Merges field variants to produce a single edge descriptor.
8277
+ * This is the most complex part of the traversal - it handles
8278
+ * union types and determines what kinds of values a field accepts.
8279
+ */
8280
+ #mergeFieldVariants(variants) {
8281
+ let flags = 0;
8282
+ let scalarMask = 0;
8283
+ let childNodeId;
8284
+ let enumNameIndex;
8285
+ const scalarTypes = [];
8286
+ const enumTypes = [];
8287
+ const inputObjectTypes = [];
8288
+ for (const variant of variants) {
8289
+ for (const inputType of variant.inputTypes) {
8290
+ switch (inputType.location) {
8291
+ case "scalar":
8292
+ if (variant.isParameterizable) {
8293
+ scalarTypes.push(inputType);
8294
+ }
8295
+ break;
8296
+ case "enumTypes":
8297
+ if (variant.isParameterizable) {
8298
+ enumTypes.push(inputType);
8299
+ }
8300
+ break;
8301
+ case "inputObjectTypes":
8302
+ if (!inputObjectTypes.some(
8303
+ (ot) => ot.type === inputType.type && ot.namespace === inputType.namespace && ot.isList === inputType.isList
8304
+ )) {
8305
+ inputObjectTypes.push(inputType);
8306
+ }
8307
+ break;
8308
+ case "fieldRefTypes":
8309
+ break;
8310
+ default:
8311
+ throw new Error(`Invalid location ${inputType.location}`);
8312
+ }
8313
+ }
8314
+ }
8315
+ for (const st of scalarTypes) {
8316
+ scalarMask |= scalarTypeToMask(st.type);
8317
+ if (st.isList) {
8318
+ flags |= EdgeFlag.ParamListScalar;
8319
+ } else {
8320
+ flags |= EdgeFlag.ParamScalar;
8321
+ }
8322
+ }
8323
+ for (const et of enumTypes) {
8324
+ if (et.namespace === "model") {
8325
+ enumNameIndex = this.#builder.internString(et.type);
8326
+ if (et.isList) {
8327
+ flags |= EdgeFlag.ParamListEnum;
8328
+ } else {
8329
+ flags |= EdgeFlag.ParamEnum;
8330
+ }
8331
+ break;
8332
+ }
8333
+ }
8334
+ if (inputObjectTypes.length > 0) {
8335
+ const hasObjectList = inputObjectTypes.some((iot) => iot.isList);
8336
+ const hasSingleObject = inputObjectTypes.some((iot) => !iot.isList);
8337
+ if (hasObjectList) {
8338
+ flags |= EdgeFlag.ListObject;
8339
+ }
8340
+ if (hasSingleObject) {
8341
+ flags |= EdgeFlag.Object;
8342
+ }
8343
+ if (inputObjectTypes.length === 1) {
8344
+ childNodeId = this.buildInputTypeNode(getTypeName(inputObjectTypes[0].type, inputObjectTypes[0].namespace));
8345
+ } else {
8346
+ childNodeId = this.buildUnionNode(inputObjectTypes.map((iot) => getTypeName(iot.type, iot.namespace)));
8347
+ }
8348
+ }
8349
+ if (flags === 0) {
8350
+ return void 0;
8351
+ }
8352
+ const edge = { flags };
8353
+ if (childNodeId !== void 0) {
8354
+ edge.childNodeId = childNodeId;
8355
+ }
8356
+ if (scalarMask !== 0) {
8357
+ edge.scalarMask = scalarMask;
8358
+ }
8359
+ if (enumNameIndex !== void 0) {
8360
+ edge.enumNameIndex = enumNameIndex;
8361
+ }
8362
+ return edge;
8363
+ }
8364
+ /**
8365
+ * Builds an output node for a named output type.
8366
+ */
8367
+ buildOutputTypeNode(typeName) {
8368
+ if (this.#builder.hasOutputTypeNode(typeName)) {
8369
+ return this.#builder.getOutputTypeNode(typeName);
8370
+ }
8371
+ const outputType = this.#outputTypeMap.get(typeName);
8372
+ if (!outputType) {
8373
+ this.#builder.setOutputTypeNode(typeName, void 0);
8374
+ return void 0;
8375
+ }
8376
+ const nodeId = this.#builder.allocateOutputNode();
8377
+ this.#builder.setOutputTypeNode(typeName, nodeId);
8378
+ const edges = {};
8379
+ let hasAnyEdge = false;
8380
+ for (const field of outputType.fields) {
8381
+ const edge = this.#buildOutputEdge(field);
8382
+ if (edge) {
8383
+ const stringIndex = this.#builder.internString(field.name);
8384
+ edges[stringIndex] = edge;
8385
+ hasAnyEdge = true;
8386
+ }
8387
+ }
8388
+ if (hasAnyEdge) {
8389
+ this.#builder.setOutputNodeEdges(nodeId, edges);
8390
+ }
8391
+ return nodeId;
8392
+ }
8393
+ #buildOutputEdge(field) {
8394
+ let argsNodeId;
8395
+ let outputNodeId;
8396
+ if (field.args.length > 0) {
8397
+ argsNodeId = this.buildInputNodeFromArgs(field.args);
8398
+ }
8399
+ if (field.outputType.location === "outputObjectTypes") {
8400
+ outputNodeId = this.buildOutputTypeNode(getTypeName(field.outputType.type, field.outputType.namespace));
8401
+ }
8402
+ if (argsNodeId === void 0 && outputNodeId === void 0) {
8403
+ return void 0;
8404
+ }
8405
+ const edge = {};
8406
+ if (argsNodeId !== void 0) {
8407
+ edge.argsNodeId = argsNodeId;
8408
+ }
8409
+ if (outputNodeId !== void 0) {
8410
+ edge.outputNodeId = outputNodeId;
8411
+ }
8412
+ return edge;
8413
+ }
8414
+ };
8415
+ function getTypeName(name, namespace2) {
8416
+ if (namespace2 === void 0) {
8417
+ return name;
8418
+ }
8419
+ return `${namespace2}.${name}`;
8420
+ }
8421
+
8422
+ // ../param-graph-builder/src/param-graph-builder.ts
8423
+ var ParamGraphBuilder = class {
8424
+ #stringTable = [];
8425
+ #stringToIndex = /* @__PURE__ */ new Map();
8426
+ #inputNodes = [];
8427
+ #outputNodes = [];
8428
+ #roots = {};
8429
+ #inputTypeNodeCache = /* @__PURE__ */ new Map();
8430
+ #unionNodeCache = /* @__PURE__ */ new Map();
8431
+ #outputTypeNodeCache = /* @__PURE__ */ new Map();
8432
+ /**
8433
+ * Interns a string into the string table, returning its index.
8434
+ * Both field names and enum names go through this method.
8435
+ */
8436
+ internString(str) {
8437
+ let index = this.#stringToIndex.get(str);
8438
+ if (index === void 0) {
8439
+ index = this.#stringTable.length;
8440
+ this.#stringTable.push(str);
8441
+ this.#stringToIndex.set(str, index);
8442
+ }
8443
+ return index;
8444
+ }
8445
+ /**
8446
+ * Allocates a new input node and returns its ID.
8447
+ */
8448
+ allocateInputNode() {
8449
+ const id = this.#inputNodes.length;
8450
+ this.#inputNodes.push({ edges: {} });
8451
+ return id;
8452
+ }
8453
+ /**
8454
+ * Sets edges on an input node.
8455
+ */
8456
+ setInputNodeEdges(nodeId, edges) {
8457
+ if (Object.keys(edges).length > 0) {
8458
+ this.#inputNodes[nodeId].edges = edges;
8459
+ }
8460
+ }
8461
+ /**
8462
+ * Allocates a new output node and returns its ID.
8463
+ */
8464
+ allocateOutputNode() {
8465
+ const id = this.#outputNodes.length;
8466
+ this.#outputNodes.push({ edges: {} });
8467
+ return id;
8468
+ }
8469
+ /**
8470
+ * Sets edges on an output node.
8471
+ */
8472
+ setOutputNodeEdges(nodeId, edges) {
8473
+ if (Object.keys(edges).length > 0) {
8474
+ this.#outputNodes[nodeId].edges = edges;
8475
+ }
8476
+ }
8477
+ /**
8478
+ * Records a root entry for an operation.
8479
+ */
8480
+ setRoot(key, entry) {
8481
+ if (entry.argsNodeId !== void 0 || entry.outputNodeId !== void 0) {
8482
+ this.internString(key);
8483
+ this.#roots[key] = entry;
8484
+ }
8485
+ }
8486
+ // Cache methods for input type nodes
8487
+ getInputTypeNode(typeName) {
8488
+ return this.#inputTypeNodeCache.get(typeName);
8489
+ }
8490
+ setInputTypeNode(typeName, nodeId) {
8491
+ this.#inputTypeNodeCache.set(typeName, nodeId);
8492
+ }
8493
+ hasInputTypeNode(typeName) {
8494
+ return this.#inputTypeNodeCache.has(typeName);
8495
+ }
8496
+ // Cache methods for union nodes
8497
+ getUnionNode(key) {
8498
+ return this.#unionNodeCache.get(key);
8499
+ }
8500
+ setUnionNode(key, nodeId) {
8501
+ this.#unionNodeCache.set(key, nodeId);
8502
+ }
8503
+ hasUnionNode(key) {
8504
+ return this.#unionNodeCache.has(key);
8505
+ }
8506
+ // Cache methods for output type nodes
8507
+ getOutputTypeNode(typeName) {
8508
+ return this.#outputTypeNodeCache.get(typeName);
8509
+ }
8510
+ setOutputTypeNode(typeName, nodeId) {
8511
+ this.#outputTypeNodeCache.set(typeName, nodeId);
8512
+ }
8513
+ hasOutputTypeNode(typeName) {
8514
+ return this.#outputTypeNodeCache.has(typeName);
8515
+ }
8516
+ /**
8517
+ * Builds the final ParamGraphData structure.
8518
+ */
8519
+ build() {
8520
+ return {
8521
+ strings: this.#stringTable,
8522
+ inputNodes: this.#inputNodes,
8523
+ outputNodes: this.#outputNodes,
8524
+ roots: this.#roots
8525
+ };
8526
+ }
8527
+ /**
8528
+ * Builds and serializes to the compact binary format.
8529
+ */
8530
+ buildAndSerialize() {
8531
+ return serializeParamGraph(this.build());
8532
+ }
8533
+ };
8534
+
8535
+ // ../param-graph-builder/src/build-param-graph.ts
8536
+ function buildAndSerializeParamGraph(dmmf) {
8537
+ const builder = new ParamGraphBuilder();
8538
+ const traverser = new DMMFTraverser(builder, dmmf);
8539
+ traverser.processRoots(dmmf.mappings.modelOperations);
8540
+ return builder.buildAndSerialize();
8541
+ }
8542
+
7873
8543
  // ../client-generator-js/src/TSClient/TSClient.ts
7874
8544
  var import_indent_string7 = __toESM(require_indent_string());
7875
8545
 
@@ -9327,6 +9997,14 @@ var TSClient = class {
9327
9997
  }
9328
9998
  dmmf;
9329
9999
  genericsInfo;
10000
+ buildParamGraphConfig() {
10001
+ const serialized = buildAndSerializeParamGraph(this.options.dmmf);
10002
+ const stringsJson = JSON.stringify(JSON.stringify(serialized.strings));
10003
+ return `config.parameterizationSchema = {
10004
+ strings: JSON.parse(${stringsJson}),
10005
+ graph: "${serialized.graph}"
10006
+ }`;
10007
+ }
9330
10008
  toJS() {
9331
10009
  const { edge, wasm, generator, datamodel: inlineSchema, runtimeName, reusedJs, compilerBuild } = this.options;
9332
10010
  if (reusedJs) {
@@ -9360,6 +10038,7 @@ ${new Enum(
9360
10038
  */
9361
10039
  const config = ${JSON.stringify(config, null, 2)}
9362
10040
  ${buildRuntimeDataModel(this.dmmf.datamodel, runtimeName)}
10041
+ ${this.buildParamGraphConfig()}
9363
10042
  ${buildQueryCompilerWasmModule(wasm, runtimeName, compilerBuild)}
9364
10043
  ${buildDebugInitialization(edge)}
9365
10044
  const PrismaClient = getPrismaClient(config)
@@ -10326,7 +11005,7 @@ var import_node_path4 = __toESM(require("node:path"));
10326
11005
  var import_engines_version = __toESM(require_engines_version());
10327
11006
 
10328
11007
  // ../client-generator-js/package.json
10329
- var version = "7.4.0-dev.21";
11008
+ var version = "7.4.0-dev.22";
10330
11009
 
10331
11010
  // ../client-generator-js/src/resolvePrismaClient.ts
10332
11011
  var import_promises5 = __toESM(require("node:fs/promises"));
@@ -12691,7 +13370,7 @@ var supportsColor_1 = {
12691
13370
  stderr: translateLevel(supportsColor$1(true, tty.isatty(2)))
12692
13371
  };
12693
13372
  var supportsColor = supportsColor_1;
12694
- var hasFlag = hasFlag$2;
13373
+ var hasFlag2 = hasFlag$2;
12695
13374
  function parseVersion(versionString) {
12696
13375
  if (/^\d{3,4}$/.test(versionString)) {
12697
13376
  const m = /(\d{1,2})(\d{2})/.exec(versionString);
@@ -12713,10 +13392,10 @@ function supportsHyperlink(stream) {
12713
13392
  if ("FORCE_HYPERLINK" in env2) {
12714
13393
  return !(env2.FORCE_HYPERLINK.length > 0 && parseInt(env2.FORCE_HYPERLINK, 10) === 0);
12715
13394
  }
12716
- if (hasFlag("no-hyperlink") || hasFlag("no-hyperlinks") || hasFlag("hyperlink=false") || hasFlag("hyperlink=never")) {
13395
+ if (hasFlag2("no-hyperlink") || hasFlag2("no-hyperlinks") || hasFlag2("hyperlink=false") || hasFlag2("hyperlink=never")) {
12717
13396
  return false;
12718
13397
  }
12719
- if (hasFlag("hyperlink=true") || hasFlag("hyperlink=always")) {
13398
+ if (hasFlag2("hyperlink=true") || hasFlag2("hyperlink=always")) {
12720
13399
  return true;
12721
13400
  }
12722
13401
  if (!supportsColor.supportsColor(stream)) {