@prisma/param-graph-builder 7.3.0-integration-parameterization.7 → 7.3.0-integration-parameterization.8

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.
@@ -31,11 +31,8 @@ class ParamGraphBuilder {
31
31
  inputNodes = [];
32
32
  outputNodes = [];
33
33
  roots = {};
34
- // Cache for input type nodes to avoid rebuilding
35
34
  inputTypeNodeCache = /* @__PURE__ */ new Map();
36
- // Cache for union nodes keyed by sorted type names
37
35
  unionNodeCache = /* @__PURE__ */ new Map();
38
- // Cache for output type nodes
39
36
  outputTypeNodeCache = /* @__PURE__ */ new Map();
40
37
  /**
41
38
  * Interns a string into the string table, returning its index.
@@ -143,7 +140,7 @@ class ParamGraphBuilder {
143
140
  build() {
144
141
  return {
145
142
  s: this.stringTable,
146
- en: this.enumNames,
143
+ e: this.enumNames,
147
144
  i: this.inputNodes,
148
145
  o: this.outputNodes,
149
146
  r: this.roots
@@ -159,16 +156,16 @@ function buildParamGraph(dmmf) {
159
156
  userEnumNames.add(e.name);
160
157
  }
161
158
  for (const inputType of dmmf.schema.inputObjectTypes.prisma ?? []) {
162
- inputTypeMap.set(inputType.name, inputType);
159
+ inputTypeMap.set(getTypeName(inputType.name, "prisma"), inputType);
163
160
  }
164
161
  for (const inputType of dmmf.schema.inputObjectTypes.model ?? []) {
165
- inputTypeMap.set(inputType.name, inputType);
162
+ inputTypeMap.set(getTypeName(inputType.name, "model"), inputType);
166
163
  }
167
164
  for (const outputType of dmmf.schema.outputObjectTypes.prisma) {
168
- outputTypeMap.set(outputType.name, outputType);
165
+ outputTypeMap.set(getTypeName(outputType.name, "prisma"), outputType);
169
166
  }
170
167
  for (const outputType of dmmf.schema.outputObjectTypes.model) {
171
- outputTypeMap.set(outputType.name, outputType);
168
+ outputTypeMap.set(getTypeName(outputType.name, "model"), outputType);
172
169
  }
173
170
  function buildInputNodeFromArgs(args) {
174
171
  const fields = {};
@@ -189,83 +186,7 @@ function buildParamGraph(dmmf) {
189
186
  return nodeId;
190
187
  }
191
188
  function buildInputEdge(arg) {
192
- let flags = 0;
193
- let scalarMask = 0;
194
- let childNodeId;
195
- let enumNameId;
196
- const scalarTypes = [];
197
- const enumTypes = [];
198
- const inputObjectTypes = [];
199
- for (const inputType of arg.inputTypes) {
200
- switch (inputType.location) {
201
- case "scalar":
202
- scalarTypes.push(inputType);
203
- break;
204
- case "enumTypes":
205
- enumTypes.push(inputType);
206
- break;
207
- case "inputObjectTypes":
208
- inputObjectTypes.push(inputType);
209
- break;
210
- case "fieldRefTypes":
211
- break;
212
- }
213
- }
214
- for (const st of scalarTypes) {
215
- scalarMask |= (0, import_param_graph.scalarTypeToMask)(st.type);
216
- }
217
- const hasStringScalar = (scalarMask & import_param_graph.ScalarMask.String) !== 0;
218
- for (const et of enumTypes) {
219
- const isUserEnum = userEnumNames.has(et.type);
220
- const isPrismaEnum = et.namespace === "prisma";
221
- if (isUserEnum) {
222
- if (!hasStringScalar) {
223
- enumNameId = builder.registerEnum(et.type);
224
- }
225
- scalarMask |= import_param_graph.ScalarMask.String;
226
- } else if (!isPrismaEnum) {
227
- scalarMask |= import_param_graph.ScalarMask.String;
228
- }
229
- }
230
- const canParamScalar = arg.isParameterizable && scalarMask !== 0;
231
- if (canParamScalar) {
232
- const hasScalarList = scalarTypes.some((st) => st.isList) || enumTypes.some((et) => et.isList && (userEnumNames.has(et.type) || et.namespace !== "prisma"));
233
- if (hasScalarList) {
234
- flags |= import_param_graph.EdgeFlag.ListScalar;
235
- } else {
236
- flags |= import_param_graph.EdgeFlag.ParamScalar;
237
- }
238
- }
239
- if (inputObjectTypes.length > 0) {
240
- const hasObjectList = inputObjectTypes.some((iot) => iot.isList);
241
- if (hasObjectList) {
242
- flags |= import_param_graph.EdgeFlag.ListObject;
243
- } else {
244
- flags |= import_param_graph.EdgeFlag.Object;
245
- }
246
- if (inputObjectTypes.length === 1) {
247
- childNodeId = buildInputTypeNode(inputObjectTypes[0].type);
248
- } else {
249
- childNodeId = buildUnionNode(inputObjectTypes.map((iot) => iot.type));
250
- }
251
- }
252
- if (arg.isNullable) {
253
- flags |= import_param_graph.EdgeFlag.Nullable;
254
- }
255
- if (flags === 0 && childNodeId === void 0) {
256
- return void 0;
257
- }
258
- const edge = { k: flags };
259
- if (childNodeId !== void 0) {
260
- edge.c = childNodeId;
261
- }
262
- if (scalarMask !== 0 && canParamScalar) {
263
- edge.m = scalarMask;
264
- }
265
- if (enumNameId !== void 0) {
266
- edge.e = enumNameId;
267
- }
268
- return edge;
189
+ return mergeFieldVariants([arg]);
269
190
  }
270
191
  function buildInputTypeNode(typeName) {
271
192
  if (builder.hasInputTypeNode(typeName)) {
@@ -318,7 +239,7 @@ function buildParamGraph(dmmf) {
318
239
  const mergedFields = {};
319
240
  let hasAnyField = false;
320
241
  for (const [fieldName, variantFields] of fieldsByName) {
321
- const mergedEdge = mergeFieldVariants(variantFields, typeNames.length);
242
+ const mergedEdge = mergeFieldVariants(variantFields);
322
243
  if (mergedEdge) {
323
244
  const stringIndex = builder.internString(fieldName);
324
245
  mergedFields[stringIndex] = mergedEdge;
@@ -330,75 +251,83 @@ function buildParamGraph(dmmf) {
330
251
  }
331
252
  return nodeId;
332
253
  }
333
- function mergeFieldVariants(variants, _totalVariants) {
334
- const parameterizableCount = variants.filter((v) => v.isParameterizable).length;
335
- const allAgreeOnParam = parameterizableCount === 0 || parameterizableCount === variants.length;
336
- if (!allAgreeOnParam) {
337
- }
338
- let combinedMask = 0;
339
- const masks = [];
340
- for (const variant of variants) {
341
- let variantMask = 0;
342
- for (const inputType of variant.inputTypes) {
343
- if (inputType.location === "scalar") {
344
- variantMask |= (0, import_param_graph.scalarTypeToMask)(inputType.type);
345
- }
346
- }
347
- masks.push(variantMask);
348
- combinedMask |= variantMask;
349
- }
350
- const allAgreeOnScalars = masks.every((m) => m === masks[0]);
351
- const allObjectTypes = /* @__PURE__ */ new Set();
352
- let hasObjectList = false;
353
- let hasObject = false;
254
+ function mergeFieldVariants(variants) {
255
+ let flags = 0;
256
+ let scalarMask = 0;
257
+ let childNodeId;
258
+ let enumNameId;
259
+ const scalarTypes = [];
260
+ const enumTypes = [];
261
+ const inputObjectTypes = [];
354
262
  for (const variant of variants) {
355
263
  for (const inputType of variant.inputTypes) {
356
- if (inputType.location === "inputObjectTypes") {
357
- allObjectTypes.add(inputType.type);
358
- if (inputType.isList) {
359
- hasObjectList = true;
360
- } else {
361
- hasObject = true;
362
- }
264
+ switch (inputType.location) {
265
+ case "scalar":
266
+ if (variant.isParameterizable) {
267
+ scalarTypes.push(inputType);
268
+ }
269
+ break;
270
+ case "enumTypes":
271
+ if (variant.isParameterizable) {
272
+ enumTypes.push(inputType);
273
+ }
274
+ break;
275
+ case "inputObjectTypes":
276
+ if (!inputObjectTypes.some((ot) => ot.type === inputType.type && ot.namespace === inputType.namespace)) {
277
+ inputObjectTypes.push(inputType);
278
+ }
279
+ break;
280
+ case "fieldRefTypes":
281
+ break;
282
+ default:
283
+ inputType.location;
363
284
  }
364
285
  }
365
286
  }
366
- let flags = 0;
367
- let childNodeId;
368
- const canParamScalar = allAgreeOnParam && allAgreeOnScalars && variants.every((v) => v.isParameterizable) && combinedMask !== 0;
369
- if (canParamScalar) {
370
- const hasScalarList = variants.some((v) => v.inputTypes.some((it) => it.location === "scalar" && it.isList));
371
- if (hasScalarList) {
372
- flags |= import_param_graph.EdgeFlag.ListScalar;
287
+ for (const st of scalarTypes) {
288
+ scalarMask |= (0, import_param_graph.scalarTypeToMask)(st.type);
289
+ if (st.isList) {
290
+ flags |= import_param_graph.EdgeFlag.ParamListScalar;
373
291
  } else {
374
292
  flags |= import_param_graph.EdgeFlag.ParamScalar;
375
293
  }
376
294
  }
377
- if (allObjectTypes.size > 0) {
295
+ for (const et of enumTypes) {
296
+ if (et.namespace === "model") {
297
+ enumNameId = builder.registerEnum(et.type);
298
+ if (et.isList) {
299
+ flags |= import_param_graph.EdgeFlag.ParamListEnum;
300
+ } else {
301
+ flags |= import_param_graph.EdgeFlag.ParamEnum;
302
+ }
303
+ break;
304
+ }
305
+ }
306
+ if (inputObjectTypes.length > 0) {
307
+ const hasObjectList = inputObjectTypes.some((iot) => iot.isList);
378
308
  if (hasObjectList) {
379
309
  flags |= import_param_graph.EdgeFlag.ListObject;
380
- } else if (hasObject) {
310
+ } else {
381
311
  flags |= import_param_graph.EdgeFlag.Object;
382
312
  }
383
- const objectTypeArray = [...allObjectTypes];
384
- if (objectTypeArray.length === 1) {
385
- childNodeId = buildInputTypeNode(objectTypeArray[0]);
313
+ if (inputObjectTypes.length === 1) {
314
+ childNodeId = buildInputTypeNode(getTypeName(inputObjectTypes[0].type, inputObjectTypes[0].namespace));
386
315
  } else {
387
- childNodeId = buildUnionNode(objectTypeArray);
316
+ childNodeId = buildUnionNode(inputObjectTypes.map((iot) => getTypeName(iot.type, iot.namespace)));
388
317
  }
389
318
  }
390
- if (variants.some((v) => v.isNullable)) {
391
- flags |= import_param_graph.EdgeFlag.Nullable;
392
- }
393
- if (flags === 0 && childNodeId === void 0) {
319
+ if (flags === 0) {
394
320
  return void 0;
395
321
  }
396
322
  const edge = { k: flags };
397
323
  if (childNodeId !== void 0) {
398
324
  edge.c = childNodeId;
399
325
  }
400
- if (canParamScalar && combinedMask !== 0) {
401
- edge.m = combinedMask;
326
+ if (scalarMask !== 0) {
327
+ edge.m = scalarMask;
328
+ }
329
+ if (enumNameId !== void 0) {
330
+ edge.e = enumNameId;
402
331
  }
403
332
  return edge;
404
333
  }
@@ -436,7 +365,7 @@ function buildParamGraph(dmmf) {
436
365
  argsNodeId = buildInputNodeFromArgs(field.args);
437
366
  }
438
367
  if (field.outputType.location === "outputObjectTypes") {
439
- childOutputNodeId = buildOutputTypeNode(field.outputType.type);
368
+ childOutputNodeId = buildOutputTypeNode(getTypeName(field.outputType.type, field.outputType.namespace));
440
369
  }
441
370
  if (argsNodeId === void 0 && childOutputNodeId === void 0) {
442
371
  return void 0;
@@ -457,12 +386,12 @@ function buildParamGraph(dmmf) {
457
386
  const fieldName = mapping[action];
458
387
  if (!fieldName) continue;
459
388
  let rootField;
460
- const queryType = outputTypeMap.get("Query");
389
+ const queryType = outputTypeMap.get("prisma.Query");
461
390
  if (queryType) {
462
391
  rootField = queryType.fields.find((f) => f.name === fieldName);
463
392
  }
464
393
  if (!rootField) {
465
- const mutationType = outputTypeMap.get("Mutation");
394
+ const mutationType = outputTypeMap.get("prisma.Mutation");
466
395
  if (mutationType) {
467
396
  rootField = mutationType.fields.find((f) => f.name === fieldName);
468
397
  }
@@ -471,7 +400,7 @@ function buildParamGraph(dmmf) {
471
400
  const argsNodeId = buildInputNodeFromArgs(rootField.args);
472
401
  let outputNodeId;
473
402
  if (rootField.outputType.location === "outputObjectTypes") {
474
- outputNodeId = buildOutputTypeNode(rootField.outputType.type);
403
+ outputNodeId = buildOutputTypeNode(getTypeName(rootField.outputType.type, rootField.outputType.namespace));
475
404
  }
476
405
  const dmmfActionToJsonAction = {
477
406
  create: "createOne",
@@ -486,6 +415,12 @@ function buildParamGraph(dmmf) {
486
415
  }
487
416
  return builder.build();
488
417
  }
418
+ function getTypeName(name, namespace) {
419
+ if (namespace === void 0) {
420
+ return name;
421
+ }
422
+ return `${namespace}.${name}`;
423
+ }
489
424
  // Annotate the CommonJS export names for ESM import in node:
490
425
  0 && (module.exports = {
491
426
  buildParamGraph
@@ -1,7 +1,6 @@
1
1
  import { ModelAction } from "@prisma/dmmf";
2
2
  import {
3
3
  EdgeFlag,
4
- ScalarMask,
5
4
  scalarTypeToMask
6
5
  } from "@prisma/param-graph";
7
6
  class ParamGraphBuilder {
@@ -12,11 +11,8 @@ class ParamGraphBuilder {
12
11
  inputNodes = [];
13
12
  outputNodes = [];
14
13
  roots = {};
15
- // Cache for input type nodes to avoid rebuilding
16
14
  inputTypeNodeCache = /* @__PURE__ */ new Map();
17
- // Cache for union nodes keyed by sorted type names
18
15
  unionNodeCache = /* @__PURE__ */ new Map();
19
- // Cache for output type nodes
20
16
  outputTypeNodeCache = /* @__PURE__ */ new Map();
21
17
  /**
22
18
  * Interns a string into the string table, returning its index.
@@ -124,7 +120,7 @@ class ParamGraphBuilder {
124
120
  build() {
125
121
  return {
126
122
  s: this.stringTable,
127
- en: this.enumNames,
123
+ e: this.enumNames,
128
124
  i: this.inputNodes,
129
125
  o: this.outputNodes,
130
126
  r: this.roots
@@ -140,16 +136,16 @@ function buildParamGraph(dmmf) {
140
136
  userEnumNames.add(e.name);
141
137
  }
142
138
  for (const inputType of dmmf.schema.inputObjectTypes.prisma ?? []) {
143
- inputTypeMap.set(inputType.name, inputType);
139
+ inputTypeMap.set(getTypeName(inputType.name, "prisma"), inputType);
144
140
  }
145
141
  for (const inputType of dmmf.schema.inputObjectTypes.model ?? []) {
146
- inputTypeMap.set(inputType.name, inputType);
142
+ inputTypeMap.set(getTypeName(inputType.name, "model"), inputType);
147
143
  }
148
144
  for (const outputType of dmmf.schema.outputObjectTypes.prisma) {
149
- outputTypeMap.set(outputType.name, outputType);
145
+ outputTypeMap.set(getTypeName(outputType.name, "prisma"), outputType);
150
146
  }
151
147
  for (const outputType of dmmf.schema.outputObjectTypes.model) {
152
- outputTypeMap.set(outputType.name, outputType);
148
+ outputTypeMap.set(getTypeName(outputType.name, "model"), outputType);
153
149
  }
154
150
  function buildInputNodeFromArgs(args) {
155
151
  const fields = {};
@@ -170,83 +166,7 @@ function buildParamGraph(dmmf) {
170
166
  return nodeId;
171
167
  }
172
168
  function buildInputEdge(arg) {
173
- let flags = 0;
174
- let scalarMask = 0;
175
- let childNodeId;
176
- let enumNameId;
177
- const scalarTypes = [];
178
- const enumTypes = [];
179
- const inputObjectTypes = [];
180
- for (const inputType of arg.inputTypes) {
181
- switch (inputType.location) {
182
- case "scalar":
183
- scalarTypes.push(inputType);
184
- break;
185
- case "enumTypes":
186
- enumTypes.push(inputType);
187
- break;
188
- case "inputObjectTypes":
189
- inputObjectTypes.push(inputType);
190
- break;
191
- case "fieldRefTypes":
192
- break;
193
- }
194
- }
195
- for (const st of scalarTypes) {
196
- scalarMask |= scalarTypeToMask(st.type);
197
- }
198
- const hasStringScalar = (scalarMask & ScalarMask.String) !== 0;
199
- for (const et of enumTypes) {
200
- const isUserEnum = userEnumNames.has(et.type);
201
- const isPrismaEnum = et.namespace === "prisma";
202
- if (isUserEnum) {
203
- if (!hasStringScalar) {
204
- enumNameId = builder.registerEnum(et.type);
205
- }
206
- scalarMask |= ScalarMask.String;
207
- } else if (!isPrismaEnum) {
208
- scalarMask |= ScalarMask.String;
209
- }
210
- }
211
- const canParamScalar = arg.isParameterizable && scalarMask !== 0;
212
- if (canParamScalar) {
213
- const hasScalarList = scalarTypes.some((st) => st.isList) || enumTypes.some((et) => et.isList && (userEnumNames.has(et.type) || et.namespace !== "prisma"));
214
- if (hasScalarList) {
215
- flags |= EdgeFlag.ListScalar;
216
- } else {
217
- flags |= EdgeFlag.ParamScalar;
218
- }
219
- }
220
- if (inputObjectTypes.length > 0) {
221
- const hasObjectList = inputObjectTypes.some((iot) => iot.isList);
222
- if (hasObjectList) {
223
- flags |= EdgeFlag.ListObject;
224
- } else {
225
- flags |= EdgeFlag.Object;
226
- }
227
- if (inputObjectTypes.length === 1) {
228
- childNodeId = buildInputTypeNode(inputObjectTypes[0].type);
229
- } else {
230
- childNodeId = buildUnionNode(inputObjectTypes.map((iot) => iot.type));
231
- }
232
- }
233
- if (arg.isNullable) {
234
- flags |= EdgeFlag.Nullable;
235
- }
236
- if (flags === 0 && childNodeId === void 0) {
237
- return void 0;
238
- }
239
- const edge = { k: flags };
240
- if (childNodeId !== void 0) {
241
- edge.c = childNodeId;
242
- }
243
- if (scalarMask !== 0 && canParamScalar) {
244
- edge.m = scalarMask;
245
- }
246
- if (enumNameId !== void 0) {
247
- edge.e = enumNameId;
248
- }
249
- return edge;
169
+ return mergeFieldVariants([arg]);
250
170
  }
251
171
  function buildInputTypeNode(typeName) {
252
172
  if (builder.hasInputTypeNode(typeName)) {
@@ -299,7 +219,7 @@ function buildParamGraph(dmmf) {
299
219
  const mergedFields = {};
300
220
  let hasAnyField = false;
301
221
  for (const [fieldName, variantFields] of fieldsByName) {
302
- const mergedEdge = mergeFieldVariants(variantFields, typeNames.length);
222
+ const mergedEdge = mergeFieldVariants(variantFields);
303
223
  if (mergedEdge) {
304
224
  const stringIndex = builder.internString(fieldName);
305
225
  mergedFields[stringIndex] = mergedEdge;
@@ -311,75 +231,83 @@ function buildParamGraph(dmmf) {
311
231
  }
312
232
  return nodeId;
313
233
  }
314
- function mergeFieldVariants(variants, _totalVariants) {
315
- const parameterizableCount = variants.filter((v) => v.isParameterizable).length;
316
- const allAgreeOnParam = parameterizableCount === 0 || parameterizableCount === variants.length;
317
- if (!allAgreeOnParam) {
318
- }
319
- let combinedMask = 0;
320
- const masks = [];
321
- for (const variant of variants) {
322
- let variantMask = 0;
323
- for (const inputType of variant.inputTypes) {
324
- if (inputType.location === "scalar") {
325
- variantMask |= scalarTypeToMask(inputType.type);
326
- }
327
- }
328
- masks.push(variantMask);
329
- combinedMask |= variantMask;
330
- }
331
- const allAgreeOnScalars = masks.every((m) => m === masks[0]);
332
- const allObjectTypes = /* @__PURE__ */ new Set();
333
- let hasObjectList = false;
334
- let hasObject = false;
234
+ function mergeFieldVariants(variants) {
235
+ let flags = 0;
236
+ let scalarMask = 0;
237
+ let childNodeId;
238
+ let enumNameId;
239
+ const scalarTypes = [];
240
+ const enumTypes = [];
241
+ const inputObjectTypes = [];
335
242
  for (const variant of variants) {
336
243
  for (const inputType of variant.inputTypes) {
337
- if (inputType.location === "inputObjectTypes") {
338
- allObjectTypes.add(inputType.type);
339
- if (inputType.isList) {
340
- hasObjectList = true;
341
- } else {
342
- hasObject = true;
343
- }
244
+ switch (inputType.location) {
245
+ case "scalar":
246
+ if (variant.isParameterizable) {
247
+ scalarTypes.push(inputType);
248
+ }
249
+ break;
250
+ case "enumTypes":
251
+ if (variant.isParameterizable) {
252
+ enumTypes.push(inputType);
253
+ }
254
+ break;
255
+ case "inputObjectTypes":
256
+ if (!inputObjectTypes.some((ot) => ot.type === inputType.type && ot.namespace === inputType.namespace)) {
257
+ inputObjectTypes.push(inputType);
258
+ }
259
+ break;
260
+ case "fieldRefTypes":
261
+ break;
262
+ default:
263
+ inputType.location;
344
264
  }
345
265
  }
346
266
  }
347
- let flags = 0;
348
- let childNodeId;
349
- const canParamScalar = allAgreeOnParam && allAgreeOnScalars && variants.every((v) => v.isParameterizable) && combinedMask !== 0;
350
- if (canParamScalar) {
351
- const hasScalarList = variants.some((v) => v.inputTypes.some((it) => it.location === "scalar" && it.isList));
352
- if (hasScalarList) {
353
- flags |= EdgeFlag.ListScalar;
267
+ for (const st of scalarTypes) {
268
+ scalarMask |= scalarTypeToMask(st.type);
269
+ if (st.isList) {
270
+ flags |= EdgeFlag.ParamListScalar;
354
271
  } else {
355
272
  flags |= EdgeFlag.ParamScalar;
356
273
  }
357
274
  }
358
- if (allObjectTypes.size > 0) {
275
+ for (const et of enumTypes) {
276
+ if (et.namespace === "model") {
277
+ enumNameId = builder.registerEnum(et.type);
278
+ if (et.isList) {
279
+ flags |= EdgeFlag.ParamListEnum;
280
+ } else {
281
+ flags |= EdgeFlag.ParamEnum;
282
+ }
283
+ break;
284
+ }
285
+ }
286
+ if (inputObjectTypes.length > 0) {
287
+ const hasObjectList = inputObjectTypes.some((iot) => iot.isList);
359
288
  if (hasObjectList) {
360
289
  flags |= EdgeFlag.ListObject;
361
- } else if (hasObject) {
290
+ } else {
362
291
  flags |= EdgeFlag.Object;
363
292
  }
364
- const objectTypeArray = [...allObjectTypes];
365
- if (objectTypeArray.length === 1) {
366
- childNodeId = buildInputTypeNode(objectTypeArray[0]);
293
+ if (inputObjectTypes.length === 1) {
294
+ childNodeId = buildInputTypeNode(getTypeName(inputObjectTypes[0].type, inputObjectTypes[0].namespace));
367
295
  } else {
368
- childNodeId = buildUnionNode(objectTypeArray);
296
+ childNodeId = buildUnionNode(inputObjectTypes.map((iot) => getTypeName(iot.type, iot.namespace)));
369
297
  }
370
298
  }
371
- if (variants.some((v) => v.isNullable)) {
372
- flags |= EdgeFlag.Nullable;
373
- }
374
- if (flags === 0 && childNodeId === void 0) {
299
+ if (flags === 0) {
375
300
  return void 0;
376
301
  }
377
302
  const edge = { k: flags };
378
303
  if (childNodeId !== void 0) {
379
304
  edge.c = childNodeId;
380
305
  }
381
- if (canParamScalar && combinedMask !== 0) {
382
- edge.m = combinedMask;
306
+ if (scalarMask !== 0) {
307
+ edge.m = scalarMask;
308
+ }
309
+ if (enumNameId !== void 0) {
310
+ edge.e = enumNameId;
383
311
  }
384
312
  return edge;
385
313
  }
@@ -417,7 +345,7 @@ function buildParamGraph(dmmf) {
417
345
  argsNodeId = buildInputNodeFromArgs(field.args);
418
346
  }
419
347
  if (field.outputType.location === "outputObjectTypes") {
420
- childOutputNodeId = buildOutputTypeNode(field.outputType.type);
348
+ childOutputNodeId = buildOutputTypeNode(getTypeName(field.outputType.type, field.outputType.namespace));
421
349
  }
422
350
  if (argsNodeId === void 0 && childOutputNodeId === void 0) {
423
351
  return void 0;
@@ -438,12 +366,12 @@ function buildParamGraph(dmmf) {
438
366
  const fieldName = mapping[action];
439
367
  if (!fieldName) continue;
440
368
  let rootField;
441
- const queryType = outputTypeMap.get("Query");
369
+ const queryType = outputTypeMap.get("prisma.Query");
442
370
  if (queryType) {
443
371
  rootField = queryType.fields.find((f) => f.name === fieldName);
444
372
  }
445
373
  if (!rootField) {
446
- const mutationType = outputTypeMap.get("Mutation");
374
+ const mutationType = outputTypeMap.get("prisma.Mutation");
447
375
  if (mutationType) {
448
376
  rootField = mutationType.fields.find((f) => f.name === fieldName);
449
377
  }
@@ -452,7 +380,7 @@ function buildParamGraph(dmmf) {
452
380
  const argsNodeId = buildInputNodeFromArgs(rootField.args);
453
381
  let outputNodeId;
454
382
  if (rootField.outputType.location === "outputObjectTypes") {
455
- outputNodeId = buildOutputTypeNode(rootField.outputType.type);
383
+ outputNodeId = buildOutputTypeNode(getTypeName(rootField.outputType.type, rootField.outputType.namespace));
456
384
  }
457
385
  const dmmfActionToJsonAction = {
458
386
  create: "createOne",
@@ -467,6 +395,12 @@ function buildParamGraph(dmmf) {
467
395
  }
468
396
  return builder.build();
469
397
  }
398
+ function getTypeName(name, namespace) {
399
+ if (namespace === void 0) {
400
+ return name;
401
+ }
402
+ return `${namespace}.${name}`;
403
+ }
470
404
  export {
471
405
  buildParamGraph
472
406
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/param-graph-builder",
3
- "version": "7.3.0-integration-parameterization.7",
3
+ "version": "7.3.0-integration-parameterization.8",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@prisma/dmmf": "7.3.0-integration-parameterization.7",
28
- "@prisma/param-graph": "7.3.0-integration-parameterization.7"
27
+ "@prisma/dmmf": "7.3.0-integration-parameterization.8",
28
+ "@prisma/param-graph": "7.3.0-integration-parameterization.8"
29
29
  },
30
30
  "files": [
31
31
  "dist"