@prisma/client 5.18.0-integration-feat-typed-sql.6 → 5.18.0-integration-feat-typed-sql.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 +210 -80
- package/package.json +28 -20
- package/runtime/binary.js +1 -1
- package/runtime/edge-esm.js +13 -13
- package/runtime/edge.js +13 -13
- package/runtime/library.js +1 -1
- package/runtime/react-native.js +16 -16
- package/runtime/wasm.js +1 -1
- package/scripts/default-index.js +1 -1
package/generator-build/index.js
CHANGED
|
@@ -533,8 +533,8 @@ var require_graceful_fs = __commonJS({
|
|
|
533
533
|
}
|
|
534
534
|
function noop() {
|
|
535
535
|
}
|
|
536
|
-
function publishQueue(
|
|
537
|
-
Object.defineProperty(
|
|
536
|
+
function publishQueue(context2, queue2) {
|
|
537
|
+
Object.defineProperty(context2, gracefulQueue, {
|
|
538
538
|
get: function() {
|
|
539
539
|
return queue2;
|
|
540
540
|
}
|
|
@@ -2380,8 +2380,8 @@ var require_indent_string = __commonJS({
|
|
|
2380
2380
|
if (count === 0) {
|
|
2381
2381
|
return string;
|
|
2382
2382
|
}
|
|
2383
|
-
const
|
|
2384
|
-
return string.replace(
|
|
2383
|
+
const regex3 = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
|
|
2384
|
+
return string.replace(regex3, options.indent.repeat(count));
|
|
2385
2385
|
};
|
|
2386
2386
|
}
|
|
2387
2387
|
});
|
|
@@ -2995,7 +2995,7 @@ var require_package2 = __commonJS({
|
|
|
2995
2995
|
"package.json"(exports2, module2) {
|
|
2996
2996
|
module2.exports = {
|
|
2997
2997
|
name: "@prisma/client",
|
|
2998
|
-
version: "5.18.0-integration-feat-typed-sql.
|
|
2998
|
+
version: "5.18.0-integration-feat-typed-sql.8",
|
|
2999
2999
|
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.",
|
|
3000
3000
|
keywords: [
|
|
3001
3001
|
"ORM",
|
|
@@ -3103,9 +3103,16 @@ var require_package2 = __commonJS({
|
|
|
3103
3103
|
default: "./generator-build/index.js"
|
|
3104
3104
|
},
|
|
3105
3105
|
"./sql": {
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3106
|
+
require: {
|
|
3107
|
+
types: "./sql.d.ts",
|
|
3108
|
+
node: "./sql.js",
|
|
3109
|
+
default: "./sql.js"
|
|
3110
|
+
},
|
|
3111
|
+
import: {
|
|
3112
|
+
types: "./sql.d.ts",
|
|
3113
|
+
node: "./sql.mjs",
|
|
3114
|
+
default: "./sql.mjs"
|
|
3115
|
+
},
|
|
3109
3116
|
default: "./sql.js"
|
|
3110
3117
|
},
|
|
3111
3118
|
"./*": "./*"
|
|
@@ -3220,6 +3227,7 @@ var require_package2 = __commonJS({
|
|
|
3220
3227
|
"get-stream": "6.0.1",
|
|
3221
3228
|
globby: "11.1.0",
|
|
3222
3229
|
"indent-string": "4.0.0",
|
|
3230
|
+
"is-identifier": "1.0.1",
|
|
3223
3231
|
jest: "29.7.0",
|
|
3224
3232
|
"jest-extended": "4.0.2",
|
|
3225
3233
|
"jest-junit": "16.0.0",
|
|
@@ -5203,6 +5211,124 @@ function parameter(name, type) {
|
|
|
5203
5211
|
return new Parameter(name, type);
|
|
5204
5212
|
}
|
|
5205
5213
|
|
|
5214
|
+
// ../../node_modules/.pnpm/reserved-identifiers@1.0.0/node_modules/reserved-identifiers/index.js
|
|
5215
|
+
var identifiers = [
|
|
5216
|
+
// Keywords
|
|
5217
|
+
"await",
|
|
5218
|
+
"break",
|
|
5219
|
+
"case",
|
|
5220
|
+
"catch",
|
|
5221
|
+
"class",
|
|
5222
|
+
"const",
|
|
5223
|
+
"continue",
|
|
5224
|
+
"debugger",
|
|
5225
|
+
"default",
|
|
5226
|
+
"delete",
|
|
5227
|
+
"do",
|
|
5228
|
+
"else",
|
|
5229
|
+
"enum",
|
|
5230
|
+
"export",
|
|
5231
|
+
"extends",
|
|
5232
|
+
"false",
|
|
5233
|
+
"finally",
|
|
5234
|
+
"for",
|
|
5235
|
+
"function",
|
|
5236
|
+
"if",
|
|
5237
|
+
"import",
|
|
5238
|
+
"in",
|
|
5239
|
+
"instanceof",
|
|
5240
|
+
"new",
|
|
5241
|
+
"null",
|
|
5242
|
+
"return",
|
|
5243
|
+
"super",
|
|
5244
|
+
"switch",
|
|
5245
|
+
"this",
|
|
5246
|
+
"throw",
|
|
5247
|
+
"true",
|
|
5248
|
+
"try",
|
|
5249
|
+
"typeof",
|
|
5250
|
+
"var",
|
|
5251
|
+
"void",
|
|
5252
|
+
"while",
|
|
5253
|
+
"with",
|
|
5254
|
+
"yield",
|
|
5255
|
+
// Future reserved keywords
|
|
5256
|
+
"implements",
|
|
5257
|
+
"interface",
|
|
5258
|
+
"package",
|
|
5259
|
+
"private",
|
|
5260
|
+
"protected",
|
|
5261
|
+
"public",
|
|
5262
|
+
// Not keywords, but still restricted
|
|
5263
|
+
"arguments",
|
|
5264
|
+
"eval"
|
|
5265
|
+
];
|
|
5266
|
+
var globalProperties = [
|
|
5267
|
+
"globalThis",
|
|
5268
|
+
"Infinity",
|
|
5269
|
+
"NaN",
|
|
5270
|
+
"undefined"
|
|
5271
|
+
];
|
|
5272
|
+
function reservedIdentifiers({ includeGlobalProperties = false } = {}) {
|
|
5273
|
+
return /* @__PURE__ */ new Set([
|
|
5274
|
+
...identifiers,
|
|
5275
|
+
...includeGlobalProperties ? globalProperties : []
|
|
5276
|
+
]);
|
|
5277
|
+
}
|
|
5278
|
+
|
|
5279
|
+
// ../../node_modules/.pnpm/identifier-regex@1.0.0/node_modules/identifier-regex/index.js
|
|
5280
|
+
var baseRegex = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*/u;
|
|
5281
|
+
var basePattern = `(?!${[...reservedIdentifiers({ includeGlobalProperties: true })].join("|")})${baseRegex.source}`;
|
|
5282
|
+
var regex = new RegExp(basePattern, "u");
|
|
5283
|
+
var regexExact = new RegExp(`^${basePattern}$`, "u");
|
|
5284
|
+
function identifierRegex({ exact = true } = {}) {
|
|
5285
|
+
return exact ? regexExact : regex;
|
|
5286
|
+
}
|
|
5287
|
+
|
|
5288
|
+
// ../../node_modules/.pnpm/function-timeout@1.0.2/node_modules/function-timeout/index.js
|
|
5289
|
+
var import_node_vm = __toESM(require("vm"), 1);
|
|
5290
|
+
var script = new import_node_vm.default.Script("returnValue = functionToRun()");
|
|
5291
|
+
function functionTimeout(function_, { timeout, context: context2 = import_node_vm.default.createContext() } = {}) {
|
|
5292
|
+
const wrappedFunction = (...arguments_) => {
|
|
5293
|
+
context2.functionToRun = () => function_(...arguments_);
|
|
5294
|
+
script.runInNewContext(context2, { timeout });
|
|
5295
|
+
return context2.returnValue;
|
|
5296
|
+
};
|
|
5297
|
+
Object.defineProperty(wrappedFunction, "name", {
|
|
5298
|
+
value: `functionTimeout(${function_.name || "<anonymous>"})`,
|
|
5299
|
+
configurable: true
|
|
5300
|
+
});
|
|
5301
|
+
return wrappedFunction;
|
|
5302
|
+
}
|
|
5303
|
+
function isTimeoutError(error) {
|
|
5304
|
+
return error?.code === "ERR_SCRIPT_EXECUTION_TIMEOUT";
|
|
5305
|
+
}
|
|
5306
|
+
|
|
5307
|
+
// ../../node_modules/.pnpm/super-regex@1.0.0/node_modules/super-regex/index.js
|
|
5308
|
+
var context = {};
|
|
5309
|
+
function isMatch(regex3, string, { timeout } = {}) {
|
|
5310
|
+
try {
|
|
5311
|
+
return functionTimeout(() => structuredClone(regex3).test(string), { timeout, context })();
|
|
5312
|
+
} catch (error) {
|
|
5313
|
+
if (isTimeoutError(error)) {
|
|
5314
|
+
return false;
|
|
5315
|
+
}
|
|
5316
|
+
throw error;
|
|
5317
|
+
}
|
|
5318
|
+
}
|
|
5319
|
+
|
|
5320
|
+
// ../../node_modules/.pnpm/is-identifier@1.0.1/node_modules/is-identifier/index.js
|
|
5321
|
+
var regex2 = identifierRegex();
|
|
5322
|
+
function isIdentifier(value) {
|
|
5323
|
+
if (typeof value !== "string") {
|
|
5324
|
+
throw new TypeError(`Expected a string, got \`${typeof value}\`.`);
|
|
5325
|
+
}
|
|
5326
|
+
if (value.length > 1e5) {
|
|
5327
|
+
return false;
|
|
5328
|
+
}
|
|
5329
|
+
return isMatch(regex2, value, { timeout: 1e3 });
|
|
5330
|
+
}
|
|
5331
|
+
|
|
5206
5332
|
// src/generation/ts-builders/Property.ts
|
|
5207
5333
|
var Property = class {
|
|
5208
5334
|
constructor(name, type) {
|
|
@@ -5230,7 +5356,11 @@ var Property = class {
|
|
|
5230
5356
|
if (this.isReadonly) {
|
|
5231
5357
|
writer.write("readonly ");
|
|
5232
5358
|
}
|
|
5233
|
-
|
|
5359
|
+
if (isIdentifier(this.name)) {
|
|
5360
|
+
writer.write(this.name);
|
|
5361
|
+
} else {
|
|
5362
|
+
writer.write("[").write(JSON.stringify(this.name)).write("]");
|
|
5363
|
+
}
|
|
5234
5364
|
if (this.isOptional) {
|
|
5235
5365
|
writer.write("?");
|
|
5236
5366
|
}
|
|
@@ -5244,8 +5374,8 @@ function property(name, type) {
|
|
|
5244
5374
|
// src/generation/ts-builders/Writer.ts
|
|
5245
5375
|
var INDENT_SIZE = 2;
|
|
5246
5376
|
var Writer = class {
|
|
5247
|
-
constructor(startingIndent = 0,
|
|
5248
|
-
this.context =
|
|
5377
|
+
constructor(startingIndent = 0, context2) {
|
|
5378
|
+
this.context = context2;
|
|
5249
5379
|
this.lines = [];
|
|
5250
5380
|
this.currentLine = "";
|
|
5251
5381
|
this.currentIndent = 0;
|
|
@@ -6288,9 +6418,9 @@ function escapeJson(str) {
|
|
|
6288
6418
|
|
|
6289
6419
|
// src/generation/TSClient/Args.ts
|
|
6290
6420
|
var ArgsTypeBuilder = class {
|
|
6291
|
-
constructor(type,
|
|
6421
|
+
constructor(type, context2, action) {
|
|
6292
6422
|
this.type = type;
|
|
6293
|
-
this.context =
|
|
6423
|
+
this.context = context2;
|
|
6294
6424
|
this.action = action;
|
|
6295
6425
|
this.hasDefaultName = true;
|
|
6296
6426
|
this.moduleExport = moduleExport(
|
|
@@ -6459,20 +6589,20 @@ function enumTypeName(ref) {
|
|
|
6459
6589
|
}
|
|
6460
6590
|
|
|
6461
6591
|
// src/generation/TSClient/Payload.ts
|
|
6462
|
-
function buildModelPayload(model,
|
|
6463
|
-
const isComposite =
|
|
6592
|
+
function buildModelPayload(model, context2) {
|
|
6593
|
+
const isComposite = context2.dmmf.isComposite(model.name);
|
|
6464
6594
|
const objects = objectType();
|
|
6465
6595
|
const scalars = objectType();
|
|
6466
6596
|
const composites = objectType();
|
|
6467
6597
|
for (const field of model.fields) {
|
|
6468
6598
|
if (field.kind === "object") {
|
|
6469
|
-
if (
|
|
6470
|
-
composites.add(buildModelOutputProperty(field,
|
|
6599
|
+
if (context2.dmmf.isComposite(field.type)) {
|
|
6600
|
+
composites.add(buildModelOutputProperty(field, context2.dmmf));
|
|
6471
6601
|
} else {
|
|
6472
|
-
objects.add(buildModelOutputProperty(field,
|
|
6602
|
+
objects.add(buildModelOutputProperty(field, context2.dmmf));
|
|
6473
6603
|
}
|
|
6474
6604
|
} else if (field.kind === "enum" || field.kind === "scalar") {
|
|
6475
|
-
scalars.add(buildModelOutputProperty(field,
|
|
6605
|
+
scalars.add(buildModelOutputProperty(field, context2.dmmf));
|
|
6476
6606
|
}
|
|
6477
6607
|
}
|
|
6478
6608
|
const scalarsType = isComposite ? scalars : namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(namedType("ExtArgs").subKey("result").subKey(lowerCase(model.name)));
|
|
@@ -6560,11 +6690,11 @@ function getModelActions(dmmf, name) {
|
|
|
6560
6690
|
|
|
6561
6691
|
// src/generation/TSClient/Model.ts
|
|
6562
6692
|
var Model = class {
|
|
6563
|
-
constructor(model,
|
|
6693
|
+
constructor(model, context2) {
|
|
6564
6694
|
this.model = model;
|
|
6565
|
-
this.context =
|
|
6566
|
-
this.dmmf =
|
|
6567
|
-
this.genericsInfo =
|
|
6695
|
+
this.context = context2;
|
|
6696
|
+
this.dmmf = context2.dmmf;
|
|
6697
|
+
this.genericsInfo = context2.genericArgsInfo;
|
|
6568
6698
|
this.type = this.context.dmmf.outputTypeMap.model[model.name];
|
|
6569
6699
|
this.createManyAndReturnType = this.context.dmmf.outputTypeMap.model[getCreateManyAndReturnOutputType(model.name)];
|
|
6570
6700
|
this.mapping = this.context.dmmf.mappings.modelOperations.find((m) => m.model === model.name);
|
|
@@ -6832,9 +6962,9 @@ ${this.argsTypes.map((type) => stringify(type)).join("\n\n")}
|
|
|
6832
6962
|
}
|
|
6833
6963
|
};
|
|
6834
6964
|
var ModelDelegate = class {
|
|
6835
|
-
constructor(outputType,
|
|
6965
|
+
constructor(outputType, context2) {
|
|
6836
6966
|
this.outputType = outputType;
|
|
6837
|
-
this.context =
|
|
6967
|
+
this.context = context2;
|
|
6838
6968
|
}
|
|
6839
6969
|
/**
|
|
6840
6970
|
* Returns all available non-aggregate or group actions
|
|
@@ -6968,10 +7098,10 @@ ${stringify(buildFluentWrapperDefinition(name, this.outputType, this.context))}
|
|
|
6968
7098
|
`;
|
|
6969
7099
|
}
|
|
6970
7100
|
};
|
|
6971
|
-
function buildModelDelegateMethod(modelName, actionName,
|
|
6972
|
-
const mapping =
|
|
6973
|
-
const modelOrType =
|
|
6974
|
-
const method2 = method(actionName).setDocComment(docComment(getMethodJSDocBody(actionName, mapping, modelOrType))).addParameter(getNonAggregateMethodArgs(modelName, actionName)).setReturnType(getReturnType({ modelName, actionName, context }));
|
|
7101
|
+
function buildModelDelegateMethod(modelName, actionName, context2) {
|
|
7102
|
+
const mapping = context2.dmmf.mappingsMap[modelName] ?? { model: modelName, plural: `${modelName}s` };
|
|
7103
|
+
const modelOrType = context2.dmmf.typeAndModelMap[modelName];
|
|
7104
|
+
const method2 = method(actionName).setDocComment(docComment(getMethodJSDocBody(actionName, mapping, modelOrType))).addParameter(getNonAggregateMethodArgs(modelName, actionName)).setReturnType(getReturnType({ modelName, actionName, context: context2 }));
|
|
6975
7105
|
const generic = getNonAggregateMethodGenericParam(modelName, actionName);
|
|
6976
7106
|
if (generic) {
|
|
6977
7107
|
method2.addGenericParameter(generic);
|
|
@@ -7013,7 +7143,7 @@ function getNonAggregateMethodGenericParam(modelName, actionName) {
|
|
|
7013
7143
|
function getReturnType({
|
|
7014
7144
|
modelName,
|
|
7015
7145
|
actionName,
|
|
7016
|
-
context,
|
|
7146
|
+
context: context2,
|
|
7017
7147
|
isChaining = false,
|
|
7018
7148
|
isNullable = false
|
|
7019
7149
|
}) {
|
|
@@ -7031,7 +7161,7 @@ function getReturnType({
|
|
|
7031
7161
|
}
|
|
7032
7162
|
const isList = actionName === DMMF.ModelAction.findMany || actionName === DMMF.ModelAction.createManyAndReturn;
|
|
7033
7163
|
if (isList) {
|
|
7034
|
-
let result = getResultType(modelName, actionName,
|
|
7164
|
+
let result = getResultType(modelName, actionName, context2);
|
|
7035
7165
|
if (isChaining) {
|
|
7036
7166
|
result = unionType(result).addVariant(namedType("Null"));
|
|
7037
7167
|
}
|
|
@@ -7039,39 +7169,39 @@ function getReturnType({
|
|
|
7039
7169
|
}
|
|
7040
7170
|
if (isChaining && actionName === DMMF.ModelAction.findUniqueOrThrow) {
|
|
7041
7171
|
const nullType2 = isNullable ? nullType : namedType("Null");
|
|
7042
|
-
const result = unionType(getResultType(modelName, actionName,
|
|
7043
|
-
return getFluentWrapper(modelName,
|
|
7172
|
+
const result = unionType(getResultType(modelName, actionName, context2)).addVariant(nullType2);
|
|
7173
|
+
return getFluentWrapper(modelName, context2, result, nullType2);
|
|
7044
7174
|
}
|
|
7045
7175
|
if (actionName === DMMF.ModelAction.findFirst || actionName === DMMF.ModelAction.findUnique) {
|
|
7046
|
-
const result = unionType(getResultType(modelName, actionName,
|
|
7047
|
-
return getFluentWrapper(modelName,
|
|
7176
|
+
const result = unionType(getResultType(modelName, actionName, context2)).addVariant(nullType);
|
|
7177
|
+
return getFluentWrapper(modelName, context2, result, nullType);
|
|
7048
7178
|
}
|
|
7049
|
-
return getFluentWrapper(modelName,
|
|
7179
|
+
return getFluentWrapper(modelName, context2, getResultType(modelName, actionName, context2));
|
|
7050
7180
|
}
|
|
7051
|
-
function getFluentWrapper(modelName,
|
|
7181
|
+
function getFluentWrapper(modelName, context2, resultType, nullType2 = neverType) {
|
|
7052
7182
|
const result = namedType(fluentWrapperName(modelName)).addGenericArgument(resultType).addGenericArgument(nullType2).addGenericArgument(extArgsParam.toArgument());
|
|
7053
|
-
if (
|
|
7183
|
+
if (context2.isPreviewFeatureOn("omitApi")) {
|
|
7054
7184
|
result.addGenericArgument(namedType("ClientOptions"));
|
|
7055
7185
|
}
|
|
7056
7186
|
return result;
|
|
7057
7187
|
}
|
|
7058
|
-
function getResultType(modelName, actionName,
|
|
7188
|
+
function getResultType(modelName, actionName, context2) {
|
|
7059
7189
|
const result = namedType("$Result.GetResult").addGenericArgument(namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument())).addGenericArgument(namedType("T")).addGenericArgument(stringLiteral(actionName));
|
|
7060
|
-
if (
|
|
7190
|
+
if (context2.isPreviewFeatureOn("omitApi")) {
|
|
7061
7191
|
result.addGenericArgument(namedType("ClientOptions"));
|
|
7062
7192
|
}
|
|
7063
7193
|
return result;
|
|
7064
7194
|
}
|
|
7065
|
-
function buildFluentWrapperDefinition(modelName, outputType,
|
|
7195
|
+
function buildFluentWrapperDefinition(modelName, outputType, context2) {
|
|
7066
7196
|
const definition = interfaceDeclaration(fluentWrapperName(modelName));
|
|
7067
7197
|
definition.addGenericParameter(genericParameter("T")).addGenericParameter(genericParameter("Null").default(neverType)).addGenericParameter(extArgsParam).extends(prismaPromise(namedType("T")));
|
|
7068
|
-
if (
|
|
7198
|
+
if (context2.isPreviewFeatureOn("omitApi")) {
|
|
7069
7199
|
definition.addGenericParameter(genericParameter("ClientOptions").default(objectType()));
|
|
7070
7200
|
}
|
|
7071
7201
|
definition.add(property("[Symbol.toStringTag]", stringLiteral("PrismaPromise")).readonly());
|
|
7072
7202
|
definition.addMultiple(
|
|
7073
7203
|
outputType.fields.filter(
|
|
7074
|
-
(field) => field.outputType.location === "outputObjectTypes" && !
|
|
7204
|
+
(field) => field.outputType.location === "outputObjectTypes" && !context2.dmmf.isComposite(field.outputType.type) && field.name !== "_count"
|
|
7075
7205
|
).map((field) => {
|
|
7076
7206
|
const fieldArgType = namedType(getFieldArgName(field, modelName)).addGenericArgument(extArgsParam.toArgument());
|
|
7077
7207
|
const argsParam = genericParameter("T").extends(fieldArgType).default(objectType());
|
|
@@ -7080,7 +7210,7 @@ function buildFluentWrapperDefinition(modelName, outputType, context) {
|
|
|
7080
7210
|
modelName: field.outputType.type,
|
|
7081
7211
|
actionName: field.outputType.isList ? DMMF.ModelAction.findMany : DMMF.ModelAction.findUniqueOrThrow,
|
|
7082
7212
|
isChaining: true,
|
|
7083
|
-
context,
|
|
7213
|
+
context: context2,
|
|
7084
7214
|
isNullable: field.isNullable
|
|
7085
7215
|
})
|
|
7086
7216
|
);
|
|
@@ -8140,9 +8270,9 @@ class ${name} {
|
|
|
8140
8270
|
// src/generation/TSClient/Count.ts
|
|
8141
8271
|
var import_indent_string5 = __toESM(require_indent_string());
|
|
8142
8272
|
var Count = class {
|
|
8143
|
-
constructor(type,
|
|
8273
|
+
constructor(type, context2) {
|
|
8144
8274
|
this.type = type;
|
|
8145
|
-
this.context =
|
|
8275
|
+
this.context = context2;
|
|
8146
8276
|
}
|
|
8147
8277
|
get argsTypes() {
|
|
8148
8278
|
const argsTypes = [];
|
|
@@ -8294,15 +8424,15 @@ function globalOmitConfig(dmmf) {
|
|
|
8294
8424
|
}
|
|
8295
8425
|
|
|
8296
8426
|
// src/generation/TSClient/PrismaClient.ts
|
|
8297
|
-
function clientTypeMapModelsDefinition(
|
|
8427
|
+
function clientTypeMapModelsDefinition(context2) {
|
|
8298
8428
|
const meta = objectType();
|
|
8299
|
-
const modelNames =
|
|
8429
|
+
const modelNames = context2.dmmf.datamodel.models.map((m) => m.name);
|
|
8300
8430
|
if (modelNames.length === 0) {
|
|
8301
8431
|
meta.add(property("modelProps", neverType));
|
|
8302
8432
|
} else {
|
|
8303
8433
|
meta.add(property("modelProps", unionType(modelNames.map((name) => stringLiteral(lowerCase(name))))));
|
|
8304
8434
|
}
|
|
8305
|
-
const isolationLevel =
|
|
8435
|
+
const isolationLevel = context2.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? namedType("Prisma.TransactionIsolationLevel") : neverType;
|
|
8306
8436
|
meta.add(property("txIsolationLevel", isolationLevel));
|
|
8307
8437
|
const model = objectType();
|
|
8308
8438
|
model.addMultiple(
|
|
@@ -8312,7 +8442,7 @@ function clientTypeMapModelsDefinition(context) {
|
|
|
8312
8442
|
property("payload", namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument()))
|
|
8313
8443
|
);
|
|
8314
8444
|
entry.add(property("fields", namedType(`Prisma.${getFieldRefsTypeName(modelName)}`)));
|
|
8315
|
-
const actions = getModelActions(
|
|
8445
|
+
const actions = getModelActions(context2.dmmf, modelName);
|
|
8316
8446
|
const operations = objectType();
|
|
8317
8447
|
operations.addMultiple(
|
|
8318
8448
|
actions.map((action) => {
|
|
@@ -8354,8 +8484,8 @@ function clientTypeMapModelsResultDefinition(modelName, action) {
|
|
|
8354
8484
|
function payloadToResult(modelName) {
|
|
8355
8485
|
return namedType("$Utils.PayloadToResult").addGenericArgument(namedType(getPayloadName(modelName)));
|
|
8356
8486
|
}
|
|
8357
|
-
function clientTypeMapOthersDefinition(
|
|
8358
|
-
const otherOperationsNames =
|
|
8487
|
+
function clientTypeMapOthersDefinition(context2) {
|
|
8488
|
+
const otherOperationsNames = context2.dmmf.getOtherOperationNames().flatMap((name) => {
|
|
8359
8489
|
if (name === "executeRaw" || name === "queryRaw") {
|
|
8360
8490
|
return [`$${name}Unsafe`, `$${name}`];
|
|
8361
8491
|
}
|
|
@@ -8382,8 +8512,8 @@ function clientTypeMapOthersDefinition(context) {
|
|
|
8382
8512
|
}
|
|
8383
8513
|
}`;
|
|
8384
8514
|
}
|
|
8385
|
-
function clientTypeMapDefinition(
|
|
8386
|
-
const typeMap = `${stringify(clientTypeMapModelsDefinition(
|
|
8515
|
+
function clientTypeMapDefinition(context2) {
|
|
8516
|
+
const typeMap = `${stringify(clientTypeMapModelsDefinition(context2))} & ${clientTypeMapOthersDefinition(context2)}`;
|
|
8387
8517
|
return `
|
|
8388
8518
|
interface TypeMapCb extends $Utils.Fn<{extArgs: $Extensions.InternalArgs, clientOptions: PrismaClientOptions }, $Utils.Record<string, any>> {
|
|
8389
8519
|
returns: Prisma.TypeMap<this['params']['extArgs'], this['params']['clientOptions']>
|
|
@@ -8391,8 +8521,8 @@ interface TypeMapCb extends $Utils.Fn<{extArgs: $Extensions.InternalArgs, client
|
|
|
8391
8521
|
|
|
8392
8522
|
export type TypeMap<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs, ClientOptions = {}> = ${typeMap}`;
|
|
8393
8523
|
}
|
|
8394
|
-
function clientExtensionsDefinitions(
|
|
8395
|
-
const typeMap = clientTypeMapDefinition(
|
|
8524
|
+
function clientExtensionsDefinitions(context2) {
|
|
8525
|
+
const typeMap = clientTypeMapDefinition(context2);
|
|
8396
8526
|
const define2 = moduleExport(
|
|
8397
8527
|
constDeclaration(
|
|
8398
8528
|
"defineExtension",
|
|
@@ -8401,16 +8531,16 @@ function clientExtensionsDefinitions(context) {
|
|
|
8401
8531
|
);
|
|
8402
8532
|
return [typeMap, stringify(define2)].join("\n");
|
|
8403
8533
|
}
|
|
8404
|
-
function extendsPropertyDefinition(
|
|
8534
|
+
function extendsPropertyDefinition(context2) {
|
|
8405
8535
|
const extendsDefinition = namedType("$Extensions.ExtendsHook").addGenericArgument(stringLiteral("extends")).addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(namedType("ExtArgs"));
|
|
8406
|
-
if (
|
|
8536
|
+
if (context2.isPreviewFeatureOn("omitApi")) {
|
|
8407
8537
|
extendsDefinition.addGenericArgument(
|
|
8408
8538
|
namedType("$Utils.Call").addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(objectType().add(property("extArgs", namedType("ExtArgs"))))
|
|
8409
8539
|
).addGenericArgument(namedType("ClientOptions"));
|
|
8410
8540
|
}
|
|
8411
8541
|
return stringify(property("$extends", extendsDefinition), { indentLevel: 1 });
|
|
8412
8542
|
}
|
|
8413
|
-
function batchingTransactionDefinition(
|
|
8543
|
+
function batchingTransactionDefinition(context2) {
|
|
8414
8544
|
const method2 = method("$transaction").setDocComment(
|
|
8415
8545
|
docComment`
|
|
8416
8546
|
Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.
|
|
@@ -8426,15 +8556,15 @@ function batchingTransactionDefinition(context) {
|
|
|
8426
8556
|
Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).
|
|
8427
8557
|
`
|
|
8428
8558
|
).addGenericParameter(genericParameter("P").extends(array(prismaPromise(anyType)))).addParameter(parameter("arg", arraySpread(namedType("P")))).setReturnType(promise(namedType("runtime.Types.Utils.UnwrapTuple").addGenericArgument(namedType("P"))));
|
|
8429
|
-
if (
|
|
8559
|
+
if (context2.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
|
|
8430
8560
|
const options = objectType().formatInline().add(property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional());
|
|
8431
8561
|
method2.addParameter(parameter("options", options).optional());
|
|
8432
8562
|
}
|
|
8433
8563
|
return stringify(method2, { indentLevel: 1, newLine: "leading" });
|
|
8434
8564
|
}
|
|
8435
|
-
function interactiveTransactionDefinition(
|
|
8565
|
+
function interactiveTransactionDefinition(context2) {
|
|
8436
8566
|
const options = objectType().formatInline().add(property("maxWait", numberType).optional()).add(property("timeout", numberType).optional());
|
|
8437
|
-
if (
|
|
8567
|
+
if (context2.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
|
|
8438
8568
|
const isolationLevel = property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional();
|
|
8439
8569
|
options.add(isolationLevel);
|
|
8440
8570
|
}
|
|
@@ -8445,8 +8575,8 @@ function interactiveTransactionDefinition(context) {
|
|
|
8445
8575
|
const method2 = method("$transaction").addGenericParameter(genericParameter("R")).addParameter(parameter("fn", callbackType)).addParameter(parameter("options", options).optional()).setReturnType(returnType);
|
|
8446
8576
|
return stringify(method2, { indentLevel: 1, newLine: "leading" });
|
|
8447
8577
|
}
|
|
8448
|
-
function queryRawDefinition(
|
|
8449
|
-
if (!
|
|
8578
|
+
function queryRawDefinition(context2) {
|
|
8579
|
+
if (!context2.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
|
|
8450
8580
|
return "";
|
|
8451
8581
|
}
|
|
8452
8582
|
return `
|
|
@@ -8473,8 +8603,8 @@ function queryRawDefinition(context) {
|
|
|
8473
8603
|
*/
|
|
8474
8604
|
$queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;`;
|
|
8475
8605
|
}
|
|
8476
|
-
function executeRawDefinition(
|
|
8477
|
-
if (!
|
|
8606
|
+
function executeRawDefinition(context2) {
|
|
8607
|
+
if (!context2.dmmf.mappings.otherOperations.write.includes("executeRaw")) {
|
|
8478
8608
|
return "";
|
|
8479
8609
|
}
|
|
8480
8610
|
return `
|
|
@@ -8501,11 +8631,11 @@ function executeRawDefinition(context) {
|
|
|
8501
8631
|
*/
|
|
8502
8632
|
$executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;`;
|
|
8503
8633
|
}
|
|
8504
|
-
function queryRawTypedDefinition(
|
|
8505
|
-
if (!
|
|
8634
|
+
function queryRawTypedDefinition(context2) {
|
|
8635
|
+
if (!context2.isPreviewFeatureOn("typedSql")) {
|
|
8506
8636
|
return "";
|
|
8507
8637
|
}
|
|
8508
|
-
if (!
|
|
8638
|
+
if (!context2.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
|
|
8509
8639
|
return "";
|
|
8510
8640
|
}
|
|
8511
8641
|
const param = genericParameter("T");
|
|
@@ -8527,8 +8657,8 @@ function queryRawTypedDefinition(context) {
|
|
|
8527
8657
|
).setReturnType(prismaPromise(array(param.toArgument())));
|
|
8528
8658
|
return stringify(method2, { indentLevel: 1, newLine: "leading" });
|
|
8529
8659
|
}
|
|
8530
|
-
function metricDefinition(
|
|
8531
|
-
if (!
|
|
8660
|
+
function metricDefinition(context2) {
|
|
8661
|
+
if (!context2.isPreviewFeatureOn("metrics")) {
|
|
8532
8662
|
return "";
|
|
8533
8663
|
}
|
|
8534
8664
|
const property2 = property("$metrics", namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
|
|
@@ -8545,8 +8675,8 @@ function metricDefinition(context) {
|
|
|
8545
8675
|
).readonly();
|
|
8546
8676
|
return stringify(property2, { indentLevel: 1, newLine: "leading" });
|
|
8547
8677
|
}
|
|
8548
|
-
function runCommandRawDefinition(
|
|
8549
|
-
if (!
|
|
8678
|
+
function runCommandRawDefinition(context2) {
|
|
8679
|
+
if (!context2.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
|
|
8550
8680
|
return "";
|
|
8551
8681
|
}
|
|
8552
8682
|
const method2 = method("$runCommandRaw").addParameter(parameter("command", namedType("Prisma.InputJsonObject"))).setReturnType(prismaPromise(namedType("Prisma.JsonObject"))).setDocComment(docComment`
|
|
@@ -8581,8 +8711,8 @@ function eventRegistrationMethodDeclaration(runtimeNameTs) {
|
|
|
8581
8711
|
}
|
|
8582
8712
|
}
|
|
8583
8713
|
var PrismaClientClass = class {
|
|
8584
|
-
constructor(
|
|
8585
|
-
this.context =
|
|
8714
|
+
constructor(context2, internalDatasources, outputDir, runtimeNameTs, browser) {
|
|
8715
|
+
this.context = context2;
|
|
8586
8716
|
this.internalDatasources = internalDatasources;
|
|
8587
8717
|
this.outputDir = outputDir;
|
|
8588
8718
|
this.runtimeNameTs = runtimeNameTs;
|
|
@@ -8927,14 +9057,14 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
|
|
|
8927
9057
|
const topExports = moduleExportFrom("*", `./${reusedTs}`);
|
|
8928
9058
|
return stringify(topExports);
|
|
8929
9059
|
}
|
|
8930
|
-
const
|
|
9060
|
+
const context2 = new GenerateContext({
|
|
8931
9061
|
dmmf: this.dmmf,
|
|
8932
9062
|
genericArgsInfo: this.genericsInfo,
|
|
8933
9063
|
generator: this.options.generator,
|
|
8934
9064
|
defaultArgsAliases: new DefaultArgsAliases()
|
|
8935
9065
|
});
|
|
8936
9066
|
const prismaClientClass = new PrismaClientClass(
|
|
8937
|
-
|
|
9067
|
+
context2,
|
|
8938
9068
|
this.options.datasources,
|
|
8939
9069
|
this.options.outputDir,
|
|
8940
9070
|
this.options.runtimeNameTs,
|
|
@@ -8943,7 +9073,7 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
|
|
|
8943
9073
|
const commonCode = commonCodeTS(this.options);
|
|
8944
9074
|
const modelAndTypes = Object.values(this.dmmf.typeAndModelMap).reduce((acc, modelOrType) => {
|
|
8945
9075
|
if (this.dmmf.outputTypeMap.model[modelOrType.name]) {
|
|
8946
|
-
acc.push(new Model(modelOrType,
|
|
9076
|
+
acc.push(new Model(modelOrType, context2));
|
|
8947
9077
|
}
|
|
8948
9078
|
return acc;
|
|
8949
9079
|
}, []);
|
|
@@ -8960,7 +9090,7 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
|
|
|
8960
9090
|
);
|
|
8961
9091
|
}
|
|
8962
9092
|
const fieldRefs = this.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
|
|
8963
|
-
const countTypes = this.dmmf.schema.outputObjectTypes.prisma?.filter((t) => t.name.endsWith("CountOutputType")).map((t) => new Count(t,
|
|
9093
|
+
const countTypes = this.dmmf.schema.outputObjectTypes.prisma?.filter((t) => t.name.endsWith("CountOutputType")).map((t) => new Count(t, context2));
|
|
8964
9094
|
const code = `
|
|
8965
9095
|
/**
|
|
8966
9096
|
* Client
|
|
@@ -9047,7 +9177,7 @@ ${this.dmmf.inputObjectTypes.model?.map((inputType) => new InputType(inputType,
|
|
|
9047
9177
|
/**
|
|
9048
9178
|
* Aliases for legacy arg types
|
|
9049
9179
|
*/
|
|
9050
|
-
${
|
|
9180
|
+
${context2.defaultArgsAliases.generateAliases()}
|
|
9051
9181
|
|
|
9052
9182
|
/**
|
|
9053
9183
|
* Batch Payload for updateMany & deleteMany & createMany
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client",
|
|
3
|
-
"version": "5.18.0-integration-feat-typed-sql.
|
|
3
|
+
"version": "5.18.0-integration-feat-typed-sql.8",
|
|
4
4
|
"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.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ORM",
|
|
@@ -108,9 +108,16 @@
|
|
|
108
108
|
"default": "./generator-build/index.js"
|
|
109
109
|
},
|
|
110
110
|
"./sql": {
|
|
111
|
-
"
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
"require": {
|
|
112
|
+
"types": "./sql.d.ts",
|
|
113
|
+
"node": "./sql.js",
|
|
114
|
+
"default": "./sql.js"
|
|
115
|
+
},
|
|
116
|
+
"import": {
|
|
117
|
+
"types": "./sql.d.ts",
|
|
118
|
+
"node": "./sql.mjs",
|
|
119
|
+
"default": "./sql.mjs"
|
|
120
|
+
},
|
|
114
121
|
"default": "./sql.js"
|
|
115
122
|
},
|
|
116
123
|
"./*": "./*"
|
|
@@ -194,6 +201,7 @@
|
|
|
194
201
|
"get-stream": "6.0.1",
|
|
195
202
|
"globby": "11.1.0",
|
|
196
203
|
"indent-string": "4.0.0",
|
|
204
|
+
"is-identifier": "1.0.1",
|
|
197
205
|
"jest": "29.7.0",
|
|
198
206
|
"jest-extended": "4.0.2",
|
|
199
207
|
"jest-junit": "16.0.0",
|
|
@@ -227,22 +235,22 @@
|
|
|
227
235
|
"undici": "5.28.4",
|
|
228
236
|
"wrangler": "3.62.0",
|
|
229
237
|
"zx": "7.2.3",
|
|
230
|
-
"@prisma/adapter-d1": "5.18.0-integration-feat-typed-sql.
|
|
231
|
-
"@prisma/adapter-
|
|
232
|
-
"@prisma/adapter-
|
|
233
|
-
"@prisma/adapter-
|
|
234
|
-
"@prisma/adapter-
|
|
235
|
-
"@prisma/adapter-
|
|
236
|
-
"@prisma/
|
|
237
|
-
"@prisma/
|
|
238
|
-
"@prisma/engines": "5.18.0-integration-feat-typed-sql.
|
|
239
|
-
"@prisma/
|
|
240
|
-
"@prisma/
|
|
241
|
-
"@prisma/
|
|
242
|
-
"@prisma/instrumentation": "5.18.0-integration-feat-typed-sql.
|
|
243
|
-
"@prisma/
|
|
244
|
-
"@prisma/
|
|
245
|
-
"@prisma/
|
|
238
|
+
"@prisma/adapter-d1": "5.18.0-integration-feat-typed-sql.8",
|
|
239
|
+
"@prisma/adapter-neon": "5.18.0-integration-feat-typed-sql.8",
|
|
240
|
+
"@prisma/adapter-pg": "5.18.0-integration-feat-typed-sql.8",
|
|
241
|
+
"@prisma/adapter-libsql": "5.18.0-integration-feat-typed-sql.8",
|
|
242
|
+
"@prisma/adapter-planetscale": "5.18.0-integration-feat-typed-sql.8",
|
|
243
|
+
"@prisma/adapter-pg-worker": "5.18.0-integration-feat-typed-sql.8",
|
|
244
|
+
"@prisma/driver-adapter-utils": "5.18.0-integration-feat-typed-sql.8",
|
|
245
|
+
"@prisma/debug": "5.18.0-integration-feat-typed-sql.8",
|
|
246
|
+
"@prisma/engines": "5.18.0-integration-feat-typed-sql.8",
|
|
247
|
+
"@prisma/fetch-engine": "5.18.0-integration-feat-typed-sql.8",
|
|
248
|
+
"@prisma/get-platform": "5.18.0-integration-feat-typed-sql.8",
|
|
249
|
+
"@prisma/generator-helper": "5.18.0-integration-feat-typed-sql.8",
|
|
250
|
+
"@prisma/instrumentation": "5.18.0-integration-feat-typed-sql.8",
|
|
251
|
+
"@prisma/pg-worker": "5.18.0-integration-feat-typed-sql.8",
|
|
252
|
+
"@prisma/internals": "5.18.0-integration-feat-typed-sql.8",
|
|
253
|
+
"@prisma/migrate": "5.18.0-integration-feat-typed-sql.8"
|
|
246
254
|
},
|
|
247
255
|
"peerDependencies": {
|
|
248
256
|
"prisma": "*"
|