@prisma/client 7.4.0-integration-parameterization.6 → 7.4.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.
- package/generator-build/index.js +443 -251
- package/package.json +34 -34
- package/runtime/client.d.mts +12 -121
- package/runtime/client.d.ts +12 -121
- package/runtime/client.js +20 -20
- package/runtime/client.js.map +4 -4
- package/runtime/client.mjs +20 -20
- package/runtime/client.mjs.map +4 -4
- package/runtime/wasm-compiler-edge.js +20 -20
- package/runtime/wasm-compiler-edge.js.map +4 -4
- package/runtime/wasm-compiler-edge.mjs +20 -20
- package/runtime/wasm-compiler-edge.mjs.map +4 -4
- package/scripts/default-index.js +1 -1
package/generator-build/index.js
CHANGED
|
@@ -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-integration-parameterization.
|
|
4576
|
+
version: "7.4.0-integration-parameterization.8",
|
|
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",
|
|
@@ -7872,6 +7872,167 @@ function fluentWrapperName(modelName) {
|
|
|
7872
7872
|
return `Prisma__${modelName}Client`;
|
|
7873
7873
|
}
|
|
7874
7874
|
|
|
7875
|
+
// ../param-graph/src/serialization.ts
|
|
7876
|
+
var FORMAT_COMPACT = 0;
|
|
7877
|
+
var FORMAT_WIDE = 1;
|
|
7878
|
+
var NONE_16 = 65535;
|
|
7879
|
+
var NONE_32 = 4294967295;
|
|
7880
|
+
var MAX_COMPACT_INDEX = 65534;
|
|
7881
|
+
var BASE64URL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
7882
|
+
function encodeBase64url(bytes) {
|
|
7883
|
+
let result = "";
|
|
7884
|
+
const len = bytes.length;
|
|
7885
|
+
let i = 0;
|
|
7886
|
+
while (i < len) {
|
|
7887
|
+
const b0 = bytes[i++];
|
|
7888
|
+
const hasB1 = i < len;
|
|
7889
|
+
const b1 = hasB1 ? bytes[i++] : 0;
|
|
7890
|
+
const hasB2 = i < len;
|
|
7891
|
+
const b2 = hasB2 ? bytes[i++] : 0;
|
|
7892
|
+
result += BASE64URL_CHARS[b0 >> 2 & 63];
|
|
7893
|
+
result += BASE64URL_CHARS[(b0 << 4 | b1 >> 4) & 63];
|
|
7894
|
+
if (hasB1) {
|
|
7895
|
+
result += BASE64URL_CHARS[(b1 << 2 | b2 >> 6) & 63];
|
|
7896
|
+
}
|
|
7897
|
+
if (hasB2) {
|
|
7898
|
+
result += BASE64URL_CHARS[b2 & 63];
|
|
7899
|
+
}
|
|
7900
|
+
}
|
|
7901
|
+
return result;
|
|
7902
|
+
}
|
|
7903
|
+
function serializeParamGraph(data) {
|
|
7904
|
+
const rootKeys = Object.keys(data.roots);
|
|
7905
|
+
const maxIndex = Math.max(
|
|
7906
|
+
data.strings.length,
|
|
7907
|
+
data.inputNodes.length,
|
|
7908
|
+
data.outputNodes.length,
|
|
7909
|
+
rootKeys.length
|
|
7910
|
+
);
|
|
7911
|
+
const useWide = maxIndex > MAX_COMPACT_INDEX;
|
|
7912
|
+
let size = 1;
|
|
7913
|
+
size += useWide ? 12 : 6;
|
|
7914
|
+
for (const node of data.inputNodes) {
|
|
7915
|
+
size += useWide ? 4 : 2;
|
|
7916
|
+
const edgeCount = Object.keys(node.edges).length;
|
|
7917
|
+
size += edgeCount * (useWide ? 20 : 10);
|
|
7918
|
+
}
|
|
7919
|
+
for (const node of data.outputNodes) {
|
|
7920
|
+
size += useWide ? 4 : 2;
|
|
7921
|
+
const edgeCount = Object.keys(node.edges).length;
|
|
7922
|
+
size += edgeCount * (useWide ? 12 : 6);
|
|
7923
|
+
}
|
|
7924
|
+
size += rootKeys.length * (useWide ? 12 : 6);
|
|
7925
|
+
const buffer = new ArrayBuffer(size);
|
|
7926
|
+
const view = new DataView(buffer);
|
|
7927
|
+
let offset = 0;
|
|
7928
|
+
view.setUint8(offset++, useWide ? FORMAT_WIDE : FORMAT_COMPACT);
|
|
7929
|
+
if (useWide) {
|
|
7930
|
+
view.setUint32(offset, data.inputNodes.length, true);
|
|
7931
|
+
offset += 4;
|
|
7932
|
+
view.setUint32(offset, data.outputNodes.length, true);
|
|
7933
|
+
offset += 4;
|
|
7934
|
+
view.setUint32(offset, rootKeys.length, true);
|
|
7935
|
+
offset += 4;
|
|
7936
|
+
} else {
|
|
7937
|
+
view.setUint16(offset, data.inputNodes.length, true);
|
|
7938
|
+
offset += 2;
|
|
7939
|
+
view.setUint16(offset, data.outputNodes.length, true);
|
|
7940
|
+
offset += 2;
|
|
7941
|
+
view.setUint16(offset, rootKeys.length, true);
|
|
7942
|
+
offset += 2;
|
|
7943
|
+
}
|
|
7944
|
+
for (const node of data.inputNodes) {
|
|
7945
|
+
const fieldIndices = Object.keys(node.edges).map(Number);
|
|
7946
|
+
if (useWide) {
|
|
7947
|
+
view.setUint32(offset, fieldIndices.length, true);
|
|
7948
|
+
offset += 4;
|
|
7949
|
+
} else {
|
|
7950
|
+
view.setUint16(offset, fieldIndices.length, true);
|
|
7951
|
+
offset += 2;
|
|
7952
|
+
}
|
|
7953
|
+
for (const fieldIndex of fieldIndices) {
|
|
7954
|
+
const edge = node.edges[fieldIndex];
|
|
7955
|
+
if (useWide) {
|
|
7956
|
+
view.setUint32(offset, fieldIndex, true);
|
|
7957
|
+
offset += 4;
|
|
7958
|
+
view.setUint16(offset, edge.scalarMask ?? 0, true);
|
|
7959
|
+
offset += 2;
|
|
7960
|
+
offset += 2;
|
|
7961
|
+
view.setUint32(offset, edge.childNodeId ?? NONE_32, true);
|
|
7962
|
+
offset += 4;
|
|
7963
|
+
view.setUint32(offset, edge.enumNameIndex ?? NONE_32, true);
|
|
7964
|
+
offset += 4;
|
|
7965
|
+
view.setUint8(offset, edge.flags);
|
|
7966
|
+
offset += 1;
|
|
7967
|
+
offset += 3;
|
|
7968
|
+
} else {
|
|
7969
|
+
view.setUint16(offset, fieldIndex, true);
|
|
7970
|
+
offset += 2;
|
|
7971
|
+
view.setUint16(offset, edge.scalarMask ?? 0, true);
|
|
7972
|
+
offset += 2;
|
|
7973
|
+
view.setUint16(offset, edge.childNodeId ?? NONE_16, true);
|
|
7974
|
+
offset += 2;
|
|
7975
|
+
view.setUint16(offset, edge.enumNameIndex ?? NONE_16, true);
|
|
7976
|
+
offset += 2;
|
|
7977
|
+
view.setUint8(offset, edge.flags);
|
|
7978
|
+
offset += 1;
|
|
7979
|
+
offset += 1;
|
|
7980
|
+
}
|
|
7981
|
+
}
|
|
7982
|
+
}
|
|
7983
|
+
for (const node of data.outputNodes) {
|
|
7984
|
+
const fieldIndices = Object.keys(node.edges).map(Number);
|
|
7985
|
+
if (useWide) {
|
|
7986
|
+
view.setUint32(offset, fieldIndices.length, true);
|
|
7987
|
+
offset += 4;
|
|
7988
|
+
} else {
|
|
7989
|
+
view.setUint16(offset, fieldIndices.length, true);
|
|
7990
|
+
offset += 2;
|
|
7991
|
+
}
|
|
7992
|
+
for (const fieldIndex of fieldIndices) {
|
|
7993
|
+
const edge = node.edges[fieldIndex];
|
|
7994
|
+
if (useWide) {
|
|
7995
|
+
view.setUint32(offset, fieldIndex, true);
|
|
7996
|
+
offset += 4;
|
|
7997
|
+
view.setUint32(offset, edge.argsNodeId ?? NONE_32, true);
|
|
7998
|
+
offset += 4;
|
|
7999
|
+
view.setUint32(offset, edge.outputNodeId ?? NONE_32, true);
|
|
8000
|
+
offset += 4;
|
|
8001
|
+
} else {
|
|
8002
|
+
view.setUint16(offset, fieldIndex, true);
|
|
8003
|
+
offset += 2;
|
|
8004
|
+
view.setUint16(offset, edge.argsNodeId ?? NONE_16, true);
|
|
8005
|
+
offset += 2;
|
|
8006
|
+
view.setUint16(offset, edge.outputNodeId ?? NONE_16, true);
|
|
8007
|
+
offset += 2;
|
|
8008
|
+
}
|
|
8009
|
+
}
|
|
8010
|
+
}
|
|
8011
|
+
for (const key of rootKeys) {
|
|
8012
|
+
const root = data.roots[key];
|
|
8013
|
+
const keyIndex = data.strings.indexOf(key);
|
|
8014
|
+
if (useWide) {
|
|
8015
|
+
view.setUint32(offset, keyIndex, true);
|
|
8016
|
+
offset += 4;
|
|
8017
|
+
view.setUint32(offset, root.argsNodeId ?? NONE_32, true);
|
|
8018
|
+
offset += 4;
|
|
8019
|
+
view.setUint32(offset, root.outputNodeId ?? NONE_32, true);
|
|
8020
|
+
offset += 4;
|
|
8021
|
+
} else {
|
|
8022
|
+
view.setUint16(offset, keyIndex, true);
|
|
8023
|
+
offset += 2;
|
|
8024
|
+
view.setUint16(offset, root.argsNodeId ?? NONE_16, true);
|
|
8025
|
+
offset += 2;
|
|
8026
|
+
view.setUint16(offset, root.outputNodeId ?? NONE_16, true);
|
|
8027
|
+
offset += 2;
|
|
8028
|
+
}
|
|
8029
|
+
}
|
|
8030
|
+
return {
|
|
8031
|
+
strings: data.strings,
|
|
8032
|
+
graph: encodeBase64url(new Uint8Array(buffer))
|
|
8033
|
+
};
|
|
8034
|
+
}
|
|
8035
|
+
|
|
7875
8036
|
// ../param-graph/src/param-graph.ts
|
|
7876
8037
|
var EdgeFlag = {
|
|
7877
8038
|
/**
|
|
@@ -7942,210 +8103,139 @@ function scalarTypeToMask(typeName) {
|
|
|
7942
8103
|
}
|
|
7943
8104
|
}
|
|
7944
8105
|
|
|
7945
|
-
// ../param-graph-builder/src/
|
|
7946
|
-
var
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
outputTypeNodeCache = /* @__PURE__ */ new Map();
|
|
7957
|
-
/**
|
|
7958
|
-
* Interns a string into the string table, returning its index.
|
|
7959
|
-
*/
|
|
7960
|
-
internString(str) {
|
|
7961
|
-
let index = this.stringToIndex.get(str);
|
|
7962
|
-
if (index === void 0) {
|
|
7963
|
-
index = this.stringTable.length;
|
|
7964
|
-
this.stringTable.push(str);
|
|
7965
|
-
this.stringToIndex.set(str, index);
|
|
8106
|
+
// ../param-graph-builder/src/dmmf-traverser.ts
|
|
8107
|
+
var DMMFTraverser = class {
|
|
8108
|
+
#builder;
|
|
8109
|
+
#inputTypeMap;
|
|
8110
|
+
#outputTypeMap;
|
|
8111
|
+
constructor(builder, dmmf) {
|
|
8112
|
+
this.#builder = builder;
|
|
8113
|
+
this.#inputTypeMap = /* @__PURE__ */ new Map();
|
|
8114
|
+
this.#outputTypeMap = /* @__PURE__ */ new Map();
|
|
8115
|
+
for (const inputType of dmmf.schema.inputObjectTypes.prisma ?? []) {
|
|
8116
|
+
this.#inputTypeMap.set(getTypeName(inputType.name, "prisma"), inputType);
|
|
7966
8117
|
}
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
/**
|
|
7970
|
-
* Registers a user enum name, returning its index.
|
|
7971
|
-
*/
|
|
7972
|
-
registerEnum(enumName) {
|
|
7973
|
-
let index = this.enumToIndex.get(enumName);
|
|
7974
|
-
if (index === void 0) {
|
|
7975
|
-
index = this.enumNames.length;
|
|
7976
|
-
this.enumNames.push(enumName);
|
|
7977
|
-
this.enumToIndex.set(enumName, index);
|
|
8118
|
+
for (const inputType of dmmf.schema.inputObjectTypes.model ?? []) {
|
|
8119
|
+
this.#inputTypeMap.set(getTypeName(inputType.name, "model"), inputType);
|
|
7978
8120
|
}
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
/**
|
|
7982
|
-
* Allocates a new input node and returns its ID.
|
|
7983
|
-
*/
|
|
7984
|
-
allocateInputNode() {
|
|
7985
|
-
const id = this.inputNodes.length;
|
|
7986
|
-
this.inputNodes.push({});
|
|
7987
|
-
return id;
|
|
7988
|
-
}
|
|
7989
|
-
/**
|
|
7990
|
-
* Sets fields on an input node.
|
|
7991
|
-
*/
|
|
7992
|
-
setInputNodeFields(nodeId, fields) {
|
|
7993
|
-
if (Object.keys(fields).length > 0) {
|
|
7994
|
-
this.inputNodes[nodeId].f = fields;
|
|
8121
|
+
for (const outputType of dmmf.schema.outputObjectTypes.prisma ?? []) {
|
|
8122
|
+
this.#outputTypeMap.set(getTypeName(outputType.name, "prisma"), outputType);
|
|
7995
8123
|
}
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
* Allocates a new output node and returns its ID.
|
|
7999
|
-
*/
|
|
8000
|
-
allocateOutputNode() {
|
|
8001
|
-
const id = this.outputNodes.length;
|
|
8002
|
-
this.outputNodes.push({});
|
|
8003
|
-
return id;
|
|
8004
|
-
}
|
|
8005
|
-
/**
|
|
8006
|
-
* Sets fields on an output node.
|
|
8007
|
-
*/
|
|
8008
|
-
setOutputNodeFields(nodeId, fields) {
|
|
8009
|
-
if (Object.keys(fields).length > 0) {
|
|
8010
|
-
this.outputNodes[nodeId].f = fields;
|
|
8124
|
+
for (const outputType of dmmf.schema.outputObjectTypes.model ?? []) {
|
|
8125
|
+
this.#outputTypeMap.set(getTypeName(outputType.name, "model"), outputType);
|
|
8011
8126
|
}
|
|
8012
8127
|
}
|
|
8013
8128
|
/**
|
|
8014
|
-
*
|
|
8129
|
+
* Process all root operations from model mappings.
|
|
8015
8130
|
*/
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8131
|
+
processRoots(mappings) {
|
|
8132
|
+
for (const mapping of mappings) {
|
|
8133
|
+
const modelName = mapping.model;
|
|
8134
|
+
const actions = Object.keys(ModelAction);
|
|
8135
|
+
for (const action2 of actions) {
|
|
8136
|
+
const fieldName = mapping[action2];
|
|
8137
|
+
if (!fieldName) continue;
|
|
8138
|
+
const rootField = this.#findRootField(fieldName);
|
|
8139
|
+
if (!rootField) continue;
|
|
8140
|
+
const argsNodeId = this.buildInputNodeFromArgs(rootField.args);
|
|
8141
|
+
let outputNodeId;
|
|
8142
|
+
if (rootField.outputType.location === "outputObjectTypes") {
|
|
8143
|
+
outputNodeId = this.buildOutputTypeNode(
|
|
8144
|
+
getTypeName(rootField.outputType.type, rootField.outputType.namespace)
|
|
8145
|
+
);
|
|
8146
|
+
}
|
|
8147
|
+
const dmmfActionToJsonAction = {
|
|
8148
|
+
create: "createOne",
|
|
8149
|
+
update: "updateOne",
|
|
8150
|
+
delete: "deleteOne",
|
|
8151
|
+
upsert: "upsertOne"
|
|
8152
|
+
};
|
|
8153
|
+
const jsonAction = dmmfActionToJsonAction[action2] ?? action2;
|
|
8154
|
+
const rootKey = `${modelName}.${jsonAction}`;
|
|
8155
|
+
this.#builder.setRoot(rootKey, {
|
|
8156
|
+
argsNodeId,
|
|
8157
|
+
outputNodeId
|
|
8158
|
+
});
|
|
8159
|
+
}
|
|
8019
8160
|
}
|
|
8020
8161
|
}
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
/**
|
|
8034
|
-
* Gets or sets a cached union node ID.
|
|
8035
|
-
*/
|
|
8036
|
-
getUnionNode(key) {
|
|
8037
|
-
return this.unionNodeCache.get(key);
|
|
8038
|
-
}
|
|
8039
|
-
setUnionNode(key, nodeId) {
|
|
8040
|
-
this.unionNodeCache.set(key, nodeId);
|
|
8041
|
-
}
|
|
8042
|
-
hasUnionNode(key) {
|
|
8043
|
-
return this.unionNodeCache.has(key);
|
|
8044
|
-
}
|
|
8045
|
-
/**
|
|
8046
|
-
* Gets or sets a cached output type node ID.
|
|
8047
|
-
*/
|
|
8048
|
-
getOutputTypeNode(typeName) {
|
|
8049
|
-
return this.outputTypeNodeCache.get(typeName);
|
|
8050
|
-
}
|
|
8051
|
-
setOutputTypeNode(typeName, nodeId) {
|
|
8052
|
-
this.outputTypeNodeCache.set(typeName, nodeId);
|
|
8053
|
-
}
|
|
8054
|
-
hasOutputTypeNode(typeName) {
|
|
8055
|
-
return this.outputTypeNodeCache.has(typeName);
|
|
8162
|
+
#findRootField(fieldName) {
|
|
8163
|
+
const queryType = this.#outputTypeMap.get("prisma.Query");
|
|
8164
|
+
if (queryType) {
|
|
8165
|
+
const field = queryType.fields.find((f) => f.name === fieldName);
|
|
8166
|
+
if (field) return field;
|
|
8167
|
+
}
|
|
8168
|
+
const mutationType = this.#outputTypeMap.get("prisma.Mutation");
|
|
8169
|
+
if (mutationType) {
|
|
8170
|
+
const field = mutationType.fields.find((f) => f.name === fieldName);
|
|
8171
|
+
if (field) return field;
|
|
8172
|
+
}
|
|
8173
|
+
return void 0;
|
|
8056
8174
|
}
|
|
8057
8175
|
/**
|
|
8058
|
-
* Builds
|
|
8176
|
+
* Builds an input node from schema arguments.
|
|
8059
8177
|
*/
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
e: this.enumNames,
|
|
8064
|
-
i: this.inputNodes,
|
|
8065
|
-
o: this.outputNodes,
|
|
8066
|
-
r: this.roots
|
|
8067
|
-
};
|
|
8068
|
-
}
|
|
8069
|
-
};
|
|
8070
|
-
function buildParamGraph(dmmf) {
|
|
8071
|
-
const builder = new ParamGraphBuilder();
|
|
8072
|
-
const inputTypeMap = /* @__PURE__ */ new Map();
|
|
8073
|
-
const outputTypeMap = /* @__PURE__ */ new Map();
|
|
8074
|
-
const userEnumNames = /* @__PURE__ */ new Set();
|
|
8075
|
-
for (const e of dmmf.datamodel.enums) {
|
|
8076
|
-
userEnumNames.add(e.name);
|
|
8077
|
-
}
|
|
8078
|
-
for (const inputType of dmmf.schema.inputObjectTypes.prisma ?? []) {
|
|
8079
|
-
inputTypeMap.set(getTypeName(inputType.name, "prisma"), inputType);
|
|
8080
|
-
}
|
|
8081
|
-
for (const inputType of dmmf.schema.inputObjectTypes.model ?? []) {
|
|
8082
|
-
inputTypeMap.set(getTypeName(inputType.name, "model"), inputType);
|
|
8083
|
-
}
|
|
8084
|
-
for (const outputType of dmmf.schema.outputObjectTypes.prisma ?? []) {
|
|
8085
|
-
outputTypeMap.set(getTypeName(outputType.name, "prisma"), outputType);
|
|
8086
|
-
}
|
|
8087
|
-
for (const outputType of dmmf.schema.outputObjectTypes.model ?? []) {
|
|
8088
|
-
outputTypeMap.set(getTypeName(outputType.name, "model"), outputType);
|
|
8089
|
-
}
|
|
8090
|
-
function buildInputNodeFromArgs(args) {
|
|
8091
|
-
const fields = {};
|
|
8092
|
-
let hasAnyField = false;
|
|
8178
|
+
buildInputNodeFromArgs(args) {
|
|
8179
|
+
const edges = {};
|
|
8180
|
+
let hasAnyEdge = false;
|
|
8093
8181
|
for (const arg of args) {
|
|
8094
|
-
const edge =
|
|
8182
|
+
const edge = this.#mergeFieldVariants([arg]);
|
|
8095
8183
|
if (edge) {
|
|
8096
|
-
const stringIndex = builder.internString(arg.name);
|
|
8097
|
-
|
|
8098
|
-
|
|
8184
|
+
const stringIndex = this.#builder.internString(arg.name);
|
|
8185
|
+
edges[stringIndex] = edge;
|
|
8186
|
+
hasAnyEdge = true;
|
|
8099
8187
|
}
|
|
8100
8188
|
}
|
|
8101
|
-
if (!
|
|
8189
|
+
if (!hasAnyEdge) {
|
|
8102
8190
|
return void 0;
|
|
8103
8191
|
}
|
|
8104
|
-
const nodeId = builder.allocateInputNode();
|
|
8105
|
-
builder.
|
|
8192
|
+
const nodeId = this.#builder.allocateInputNode();
|
|
8193
|
+
this.#builder.setInputNodeEdges(nodeId, edges);
|
|
8106
8194
|
return nodeId;
|
|
8107
8195
|
}
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
if (builder.hasInputTypeNode(typeName)) {
|
|
8113
|
-
return builder.getInputTypeNode(typeName);
|
|
8196
|
+
/**
|
|
8197
|
+
* Builds an input node for a named input type.
|
|
8198
|
+
*/
|
|
8199
|
+
buildInputTypeNode(typeName) {
|
|
8200
|
+
if (this.#builder.hasInputTypeNode(typeName)) {
|
|
8201
|
+
return this.#builder.getInputTypeNode(typeName);
|
|
8114
8202
|
}
|
|
8115
|
-
const inputType = inputTypeMap.get(typeName);
|
|
8203
|
+
const inputType = this.#inputTypeMap.get(typeName);
|
|
8116
8204
|
if (!inputType) {
|
|
8117
|
-
builder.setInputTypeNode(typeName, void 0);
|
|
8205
|
+
this.#builder.setInputTypeNode(typeName, void 0);
|
|
8118
8206
|
return void 0;
|
|
8119
8207
|
}
|
|
8120
|
-
const nodeId = builder.allocateInputNode();
|
|
8121
|
-
builder.setInputTypeNode(typeName, nodeId);
|
|
8122
|
-
const
|
|
8123
|
-
let
|
|
8208
|
+
const nodeId = this.#builder.allocateInputNode();
|
|
8209
|
+
this.#builder.setInputTypeNode(typeName, nodeId);
|
|
8210
|
+
const edges = {};
|
|
8211
|
+
let hasAnyEdge = false;
|
|
8124
8212
|
for (const field of inputType.fields) {
|
|
8125
|
-
const edge =
|
|
8213
|
+
const edge = this.#mergeFieldVariants([field]);
|
|
8126
8214
|
if (edge) {
|
|
8127
|
-
const stringIndex = builder.internString(field.name);
|
|
8128
|
-
|
|
8129
|
-
|
|
8215
|
+
const stringIndex = this.#builder.internString(field.name);
|
|
8216
|
+
edges[stringIndex] = edge;
|
|
8217
|
+
hasAnyEdge = true;
|
|
8130
8218
|
}
|
|
8131
8219
|
}
|
|
8132
|
-
if (
|
|
8133
|
-
builder.
|
|
8134
|
-
return nodeId;
|
|
8220
|
+
if (hasAnyEdge) {
|
|
8221
|
+
this.#builder.setInputNodeEdges(nodeId, edges);
|
|
8135
8222
|
}
|
|
8136
8223
|
return nodeId;
|
|
8137
8224
|
}
|
|
8138
|
-
|
|
8225
|
+
/**
|
|
8226
|
+
* Builds a union node for multiple input types.
|
|
8227
|
+
*/
|
|
8228
|
+
buildUnionNode(typeNames) {
|
|
8139
8229
|
const sortedNames = [...typeNames].sort();
|
|
8140
8230
|
const cacheKey = sortedNames.join("|");
|
|
8141
|
-
if (builder.hasUnionNode(cacheKey)) {
|
|
8142
|
-
return builder.getUnionNode(cacheKey);
|
|
8231
|
+
if (this.#builder.hasUnionNode(cacheKey)) {
|
|
8232
|
+
return this.#builder.getUnionNode(cacheKey);
|
|
8143
8233
|
}
|
|
8144
|
-
const nodeId = builder.allocateInputNode();
|
|
8145
|
-
builder.setUnionNode(cacheKey, nodeId);
|
|
8234
|
+
const nodeId = this.#builder.allocateInputNode();
|
|
8235
|
+
this.#builder.setUnionNode(cacheKey, nodeId);
|
|
8146
8236
|
const fieldsByName = /* @__PURE__ */ new Map();
|
|
8147
8237
|
for (const typeName of typeNames) {
|
|
8148
|
-
const inputType = inputTypeMap.get(typeName);
|
|
8238
|
+
const inputType = this.#inputTypeMap.get(typeName);
|
|
8149
8239
|
if (!inputType) continue;
|
|
8150
8240
|
for (const field of inputType.fields) {
|
|
8151
8241
|
let fieldsForName = fieldsByName.get(field.name);
|
|
@@ -8156,26 +8246,31 @@ function buildParamGraph(dmmf) {
|
|
|
8156
8246
|
fieldsForName.push(field);
|
|
8157
8247
|
}
|
|
8158
8248
|
}
|
|
8159
|
-
const
|
|
8160
|
-
let
|
|
8249
|
+
const mergedEdges = {};
|
|
8250
|
+
let hasAnyEdge = false;
|
|
8161
8251
|
for (const [fieldName, variantFields] of fieldsByName) {
|
|
8162
|
-
const mergedEdge = mergeFieldVariants(variantFields);
|
|
8252
|
+
const mergedEdge = this.#mergeFieldVariants(variantFields);
|
|
8163
8253
|
if (mergedEdge) {
|
|
8164
|
-
const stringIndex = builder.internString(fieldName);
|
|
8165
|
-
|
|
8166
|
-
|
|
8254
|
+
const stringIndex = this.#builder.internString(fieldName);
|
|
8255
|
+
mergedEdges[stringIndex] = mergedEdge;
|
|
8256
|
+
hasAnyEdge = true;
|
|
8167
8257
|
}
|
|
8168
8258
|
}
|
|
8169
|
-
if (
|
|
8170
|
-
builder.
|
|
8259
|
+
if (hasAnyEdge) {
|
|
8260
|
+
this.#builder.setInputNodeEdges(nodeId, mergedEdges);
|
|
8171
8261
|
}
|
|
8172
8262
|
return nodeId;
|
|
8173
8263
|
}
|
|
8174
|
-
|
|
8264
|
+
/**
|
|
8265
|
+
* Merges field variants to produce a single edge descriptor.
|
|
8266
|
+
* This is the most complex part of the traversal - it handles
|
|
8267
|
+
* union types and determines what kinds of values a field accepts.
|
|
8268
|
+
*/
|
|
8269
|
+
#mergeFieldVariants(variants) {
|
|
8175
8270
|
let flags = 0;
|
|
8176
8271
|
let scalarMask = 0;
|
|
8177
8272
|
let childNodeId;
|
|
8178
|
-
let
|
|
8273
|
+
let enumNameIndex;
|
|
8179
8274
|
const scalarTypes = [];
|
|
8180
8275
|
const enumTypes = [];
|
|
8181
8276
|
const inputObjectTypes = [];
|
|
@@ -8216,7 +8311,7 @@ function buildParamGraph(dmmf) {
|
|
|
8216
8311
|
}
|
|
8217
8312
|
for (const et of enumTypes) {
|
|
8218
8313
|
if (et.namespace === "model") {
|
|
8219
|
-
|
|
8314
|
+
enumNameIndex = this.#builder.internString(et.type);
|
|
8220
8315
|
if (et.isList) {
|
|
8221
8316
|
flags |= EdgeFlag.ParamListEnum;
|
|
8222
8317
|
} else {
|
|
@@ -8235,110 +8330,83 @@ function buildParamGraph(dmmf) {
|
|
|
8235
8330
|
flags |= EdgeFlag.Object;
|
|
8236
8331
|
}
|
|
8237
8332
|
if (inputObjectTypes.length === 1) {
|
|
8238
|
-
childNodeId = buildInputTypeNode(
|
|
8333
|
+
childNodeId = this.buildInputTypeNode(
|
|
8334
|
+
getTypeName(inputObjectTypes[0].type, inputObjectTypes[0].namespace)
|
|
8335
|
+
);
|
|
8239
8336
|
} else {
|
|
8240
|
-
childNodeId = buildUnionNode(
|
|
8337
|
+
childNodeId = this.buildUnionNode(
|
|
8338
|
+
inputObjectTypes.map((iot) => getTypeName(iot.type, iot.namespace))
|
|
8339
|
+
);
|
|
8241
8340
|
}
|
|
8242
8341
|
}
|
|
8243
8342
|
if (flags === 0) {
|
|
8244
8343
|
return void 0;
|
|
8245
8344
|
}
|
|
8246
|
-
const edge = {
|
|
8345
|
+
const edge = { flags };
|
|
8247
8346
|
if (childNodeId !== void 0) {
|
|
8248
|
-
edge.
|
|
8347
|
+
edge.childNodeId = childNodeId;
|
|
8249
8348
|
}
|
|
8250
8349
|
if (scalarMask !== 0) {
|
|
8251
|
-
edge.
|
|
8350
|
+
edge.scalarMask = scalarMask;
|
|
8252
8351
|
}
|
|
8253
|
-
if (
|
|
8254
|
-
edge.
|
|
8352
|
+
if (enumNameIndex !== void 0) {
|
|
8353
|
+
edge.enumNameIndex = enumNameIndex;
|
|
8255
8354
|
}
|
|
8256
8355
|
return edge;
|
|
8257
8356
|
}
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8357
|
+
/**
|
|
8358
|
+
* Builds an output node for a named output type.
|
|
8359
|
+
*/
|
|
8360
|
+
buildOutputTypeNode(typeName) {
|
|
8361
|
+
if (this.#builder.hasOutputTypeNode(typeName)) {
|
|
8362
|
+
return this.#builder.getOutputTypeNode(typeName);
|
|
8261
8363
|
}
|
|
8262
|
-
const outputType = outputTypeMap.get(typeName);
|
|
8364
|
+
const outputType = this.#outputTypeMap.get(typeName);
|
|
8263
8365
|
if (!outputType) {
|
|
8264
|
-
builder.setOutputTypeNode(typeName, void 0);
|
|
8366
|
+
this.#builder.setOutputTypeNode(typeName, void 0);
|
|
8265
8367
|
return void 0;
|
|
8266
8368
|
}
|
|
8267
|
-
const nodeId = builder.allocateOutputNode();
|
|
8268
|
-
builder.setOutputTypeNode(typeName, nodeId);
|
|
8269
|
-
const
|
|
8270
|
-
let
|
|
8369
|
+
const nodeId = this.#builder.allocateOutputNode();
|
|
8370
|
+
this.#builder.setOutputTypeNode(typeName, nodeId);
|
|
8371
|
+
const edges = {};
|
|
8372
|
+
let hasAnyEdge = false;
|
|
8271
8373
|
for (const field of outputType.fields) {
|
|
8272
|
-
const edge = buildOutputEdge(field);
|
|
8374
|
+
const edge = this.#buildOutputEdge(field);
|
|
8273
8375
|
if (edge) {
|
|
8274
|
-
const stringIndex = builder.internString(field.name);
|
|
8275
|
-
|
|
8276
|
-
|
|
8376
|
+
const stringIndex = this.#builder.internString(field.name);
|
|
8377
|
+
edges[stringIndex] = edge;
|
|
8378
|
+
hasAnyEdge = true;
|
|
8277
8379
|
}
|
|
8278
8380
|
}
|
|
8279
|
-
if (
|
|
8280
|
-
builder.
|
|
8281
|
-
return nodeId;
|
|
8381
|
+
if (hasAnyEdge) {
|
|
8382
|
+
this.#builder.setOutputNodeEdges(nodeId, edges);
|
|
8282
8383
|
}
|
|
8283
8384
|
return nodeId;
|
|
8284
8385
|
}
|
|
8285
|
-
|
|
8386
|
+
#buildOutputEdge(field) {
|
|
8286
8387
|
let argsNodeId;
|
|
8287
|
-
let
|
|
8388
|
+
let outputNodeId;
|
|
8288
8389
|
if (field.args.length > 0) {
|
|
8289
|
-
argsNodeId = buildInputNodeFromArgs(field.args);
|
|
8390
|
+
argsNodeId = this.buildInputNodeFromArgs(field.args);
|
|
8290
8391
|
}
|
|
8291
8392
|
if (field.outputType.location === "outputObjectTypes") {
|
|
8292
|
-
|
|
8393
|
+
outputNodeId = this.buildOutputTypeNode(
|
|
8394
|
+
getTypeName(field.outputType.type, field.outputType.namespace)
|
|
8395
|
+
);
|
|
8293
8396
|
}
|
|
8294
|
-
if (argsNodeId === void 0 &&
|
|
8397
|
+
if (argsNodeId === void 0 && outputNodeId === void 0) {
|
|
8295
8398
|
return void 0;
|
|
8296
8399
|
}
|
|
8297
8400
|
const edge = {};
|
|
8298
8401
|
if (argsNodeId !== void 0) {
|
|
8299
|
-
edge.
|
|
8402
|
+
edge.argsNodeId = argsNodeId;
|
|
8300
8403
|
}
|
|
8301
|
-
if (
|
|
8302
|
-
edge.
|
|
8404
|
+
if (outputNodeId !== void 0) {
|
|
8405
|
+
edge.outputNodeId = outputNodeId;
|
|
8303
8406
|
}
|
|
8304
8407
|
return edge;
|
|
8305
8408
|
}
|
|
8306
|
-
|
|
8307
|
-
const modelName = mapping.model;
|
|
8308
|
-
const actions = Object.keys(ModelAction);
|
|
8309
|
-
for (const action2 of actions) {
|
|
8310
|
-
const fieldName = mapping[action2];
|
|
8311
|
-
if (!fieldName) continue;
|
|
8312
|
-
let rootField;
|
|
8313
|
-
const queryType = outputTypeMap.get("prisma.Query");
|
|
8314
|
-
if (queryType) {
|
|
8315
|
-
rootField = queryType.fields.find((f) => f.name === fieldName);
|
|
8316
|
-
}
|
|
8317
|
-
if (!rootField) {
|
|
8318
|
-
const mutationType = outputTypeMap.get("prisma.Mutation");
|
|
8319
|
-
if (mutationType) {
|
|
8320
|
-
rootField = mutationType.fields.find((f) => f.name === fieldName);
|
|
8321
|
-
}
|
|
8322
|
-
}
|
|
8323
|
-
if (!rootField) continue;
|
|
8324
|
-
const argsNodeId = buildInputNodeFromArgs(rootField.args);
|
|
8325
|
-
let outputNodeId;
|
|
8326
|
-
if (rootField.outputType.location === "outputObjectTypes") {
|
|
8327
|
-
outputNodeId = buildOutputTypeNode(getTypeName(rootField.outputType.type, rootField.outputType.namespace));
|
|
8328
|
-
}
|
|
8329
|
-
const dmmfActionToJsonAction = {
|
|
8330
|
-
create: "createOne",
|
|
8331
|
-
update: "updateOne",
|
|
8332
|
-
delete: "deleteOne",
|
|
8333
|
-
upsert: "upsertOne"
|
|
8334
|
-
};
|
|
8335
|
-
const jsonAction = dmmfActionToJsonAction[action2] ?? action2;
|
|
8336
|
-
const rootKey = `${modelName}.${jsonAction}`;
|
|
8337
|
-
builder.setRoot(rootKey, { a: argsNodeId, o: outputNodeId });
|
|
8338
|
-
}
|
|
8339
|
-
}
|
|
8340
|
-
return builder.build();
|
|
8341
|
-
}
|
|
8409
|
+
};
|
|
8342
8410
|
function getTypeName(name, namespace2) {
|
|
8343
8411
|
if (namespace2 === void 0) {
|
|
8344
8412
|
return name;
|
|
@@ -8346,6 +8414,127 @@ function getTypeName(name, namespace2) {
|
|
|
8346
8414
|
return `${namespace2}.${name}`;
|
|
8347
8415
|
}
|
|
8348
8416
|
|
|
8417
|
+
// ../param-graph-builder/src/param-graph-builder.ts
|
|
8418
|
+
var ParamGraphBuilder = class {
|
|
8419
|
+
#stringTable = [];
|
|
8420
|
+
#stringToIndex = /* @__PURE__ */ new Map();
|
|
8421
|
+
#inputNodes = [];
|
|
8422
|
+
#outputNodes = [];
|
|
8423
|
+
#roots = {};
|
|
8424
|
+
#inputTypeNodeCache = /* @__PURE__ */ new Map();
|
|
8425
|
+
#unionNodeCache = /* @__PURE__ */ new Map();
|
|
8426
|
+
#outputTypeNodeCache = /* @__PURE__ */ new Map();
|
|
8427
|
+
/**
|
|
8428
|
+
* Interns a string into the string table, returning its index.
|
|
8429
|
+
* Both field names and enum names go through this method.
|
|
8430
|
+
*/
|
|
8431
|
+
internString(str) {
|
|
8432
|
+
let index = this.#stringToIndex.get(str);
|
|
8433
|
+
if (index === void 0) {
|
|
8434
|
+
index = this.#stringTable.length;
|
|
8435
|
+
this.#stringTable.push(str);
|
|
8436
|
+
this.#stringToIndex.set(str, index);
|
|
8437
|
+
}
|
|
8438
|
+
return index;
|
|
8439
|
+
}
|
|
8440
|
+
/**
|
|
8441
|
+
* Allocates a new input node and returns its ID.
|
|
8442
|
+
*/
|
|
8443
|
+
allocateInputNode() {
|
|
8444
|
+
const id = this.#inputNodes.length;
|
|
8445
|
+
this.#inputNodes.push({ edges: {} });
|
|
8446
|
+
return id;
|
|
8447
|
+
}
|
|
8448
|
+
/**
|
|
8449
|
+
* Sets edges on an input node.
|
|
8450
|
+
*/
|
|
8451
|
+
setInputNodeEdges(nodeId, edges) {
|
|
8452
|
+
if (Object.keys(edges).length > 0) {
|
|
8453
|
+
this.#inputNodes[nodeId].edges = edges;
|
|
8454
|
+
}
|
|
8455
|
+
}
|
|
8456
|
+
/**
|
|
8457
|
+
* Allocates a new output node and returns its ID.
|
|
8458
|
+
*/
|
|
8459
|
+
allocateOutputNode() {
|
|
8460
|
+
const id = this.#outputNodes.length;
|
|
8461
|
+
this.#outputNodes.push({ edges: {} });
|
|
8462
|
+
return id;
|
|
8463
|
+
}
|
|
8464
|
+
/**
|
|
8465
|
+
* Sets edges on an output node.
|
|
8466
|
+
*/
|
|
8467
|
+
setOutputNodeEdges(nodeId, edges) {
|
|
8468
|
+
if (Object.keys(edges).length > 0) {
|
|
8469
|
+
this.#outputNodes[nodeId].edges = edges;
|
|
8470
|
+
}
|
|
8471
|
+
}
|
|
8472
|
+
/**
|
|
8473
|
+
* Records a root entry for an operation.
|
|
8474
|
+
*/
|
|
8475
|
+
setRoot(key, entry) {
|
|
8476
|
+
if (entry.argsNodeId !== void 0 || entry.outputNodeId !== void 0) {
|
|
8477
|
+
this.internString(key);
|
|
8478
|
+
this.#roots[key] = entry;
|
|
8479
|
+
}
|
|
8480
|
+
}
|
|
8481
|
+
// Cache methods for input type nodes
|
|
8482
|
+
getInputTypeNode(typeName) {
|
|
8483
|
+
return this.#inputTypeNodeCache.get(typeName);
|
|
8484
|
+
}
|
|
8485
|
+
setInputTypeNode(typeName, nodeId) {
|
|
8486
|
+
this.#inputTypeNodeCache.set(typeName, nodeId);
|
|
8487
|
+
}
|
|
8488
|
+
hasInputTypeNode(typeName) {
|
|
8489
|
+
return this.#inputTypeNodeCache.has(typeName);
|
|
8490
|
+
}
|
|
8491
|
+
// Cache methods for union nodes
|
|
8492
|
+
getUnionNode(key) {
|
|
8493
|
+
return this.#unionNodeCache.get(key);
|
|
8494
|
+
}
|
|
8495
|
+
setUnionNode(key, nodeId) {
|
|
8496
|
+
this.#unionNodeCache.set(key, nodeId);
|
|
8497
|
+
}
|
|
8498
|
+
hasUnionNode(key) {
|
|
8499
|
+
return this.#unionNodeCache.has(key);
|
|
8500
|
+
}
|
|
8501
|
+
// Cache methods for output type nodes
|
|
8502
|
+
getOutputTypeNode(typeName) {
|
|
8503
|
+
return this.#outputTypeNodeCache.get(typeName);
|
|
8504
|
+
}
|
|
8505
|
+
setOutputTypeNode(typeName, nodeId) {
|
|
8506
|
+
this.#outputTypeNodeCache.set(typeName, nodeId);
|
|
8507
|
+
}
|
|
8508
|
+
hasOutputTypeNode(typeName) {
|
|
8509
|
+
return this.#outputTypeNodeCache.has(typeName);
|
|
8510
|
+
}
|
|
8511
|
+
/**
|
|
8512
|
+
* Builds the final ParamGraphData structure.
|
|
8513
|
+
*/
|
|
8514
|
+
build() {
|
|
8515
|
+
return {
|
|
8516
|
+
strings: this.#stringTable,
|
|
8517
|
+
inputNodes: this.#inputNodes,
|
|
8518
|
+
outputNodes: this.#outputNodes,
|
|
8519
|
+
roots: this.#roots
|
|
8520
|
+
};
|
|
8521
|
+
}
|
|
8522
|
+
/**
|
|
8523
|
+
* Builds and serializes to the compact binary format.
|
|
8524
|
+
*/
|
|
8525
|
+
buildAndSerialize() {
|
|
8526
|
+
return serializeParamGraph(this.build());
|
|
8527
|
+
}
|
|
8528
|
+
};
|
|
8529
|
+
|
|
8530
|
+
// ../param-graph-builder/src/build-param-graph.ts
|
|
8531
|
+
function buildAndSerializeParamGraph(dmmf) {
|
|
8532
|
+
const builder = new ParamGraphBuilder();
|
|
8533
|
+
const traverser = new DMMFTraverser(builder, dmmf);
|
|
8534
|
+
traverser.processRoots(dmmf.mappings.modelOperations);
|
|
8535
|
+
return builder.buildAndSerialize();
|
|
8536
|
+
}
|
|
8537
|
+
|
|
8349
8538
|
// ../client-generator-js/src/TSClient/TSClient.ts
|
|
8350
8539
|
var import_indent_string7 = __toESM(require_indent_string());
|
|
8351
8540
|
|
|
@@ -9804,9 +9993,12 @@ var TSClient = class {
|
|
|
9804
9993
|
dmmf;
|
|
9805
9994
|
genericsInfo;
|
|
9806
9995
|
buildParamGraphConfig() {
|
|
9807
|
-
const
|
|
9808
|
-
const
|
|
9809
|
-
return `config.parameterizationSchema =
|
|
9996
|
+
const serialized = buildAndSerializeParamGraph(this.options.dmmf);
|
|
9997
|
+
const stringsJson = JSON.stringify(JSON.stringify(serialized.strings));
|
|
9998
|
+
return `config.parameterizationSchema = {
|
|
9999
|
+
strings: JSON.parse(${stringsJson}),
|
|
10000
|
+
graph: "${serialized.graph}"
|
|
10001
|
+
}`;
|
|
9810
10002
|
}
|
|
9811
10003
|
toJS() {
|
|
9812
10004
|
const { edge, wasm, generator, datamodel: inlineSchema, runtimeName, reusedJs, compilerBuild } = this.options;
|
|
@@ -10808,7 +11000,7 @@ var import_node_path4 = __toESM(require("node:path"));
|
|
|
10808
11000
|
var import_engines_version = __toESM(require_engines_version());
|
|
10809
11001
|
|
|
10810
11002
|
// ../client-generator-js/package.json
|
|
10811
|
-
var version = "7.4.0-integration-parameterization.
|
|
11003
|
+
var version = "7.4.0-integration-parameterization.8";
|
|
10812
11004
|
|
|
10813
11005
|
// ../client-generator-js/src/resolvePrismaClient.ts
|
|
10814
11006
|
var import_promises5 = __toESM(require("node:fs/promises"));
|