prisma 5.19.0-integration-feat-typed-sql.1 → 5.19.0-integration-feat-typed-sql.2
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/build/index.js +305 -305
- package/package.json +10 -11
- package/preinstall/index.js +1 -1
- package/prisma-client/generator-build/index.js +157 -197
- package/prisma-client/package.json +1 -2
- package/prisma-client/runtime/binary.js +1 -1
- package/prisma-client/runtime/edge-esm.js +1 -1
- package/prisma-client/runtime/edge.js +1 -1
- package/prisma-client/runtime/library.js +1 -1
- package/prisma-client/runtime/react-native.js +1 -1
- package/prisma-client/scripts/default-index.js +1 -1
|
@@ -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(context, queue2) {
|
|
537
|
+
Object.defineProperty(context, 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 regex2 = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
|
|
2384
|
+
return string.replace(regex2, 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.19.0-integration-feat-typed-sql.
|
|
2998
|
+
version: "5.19.0-integration-feat-typed-sql.2",
|
|
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",
|
|
@@ -3230,7 +3230,6 @@ var require_package2 = __commonJS({
|
|
|
3230
3230
|
"get-stream": "6.0.1",
|
|
3231
3231
|
globby: "11.1.0",
|
|
3232
3232
|
"indent-string": "4.0.0",
|
|
3233
|
-
"is-identifier": "1.0.1",
|
|
3234
3233
|
jest: "29.7.0",
|
|
3235
3234
|
"jest-extended": "4.0.2",
|
|
3236
3235
|
"jest-junit": "16.0.0",
|
|
@@ -4387,6 +4386,85 @@ function hasOwnProperty(object, key) {
|
|
|
4387
4386
|
return Object.prototype.hasOwnProperty.call(object, key);
|
|
4388
4387
|
}
|
|
4389
4388
|
|
|
4389
|
+
// ../../node_modules/.pnpm/reserved-identifiers@1.0.0/node_modules/reserved-identifiers/index.js
|
|
4390
|
+
var identifiers = [
|
|
4391
|
+
// Keywords
|
|
4392
|
+
"await",
|
|
4393
|
+
"break",
|
|
4394
|
+
"case",
|
|
4395
|
+
"catch",
|
|
4396
|
+
"class",
|
|
4397
|
+
"const",
|
|
4398
|
+
"continue",
|
|
4399
|
+
"debugger",
|
|
4400
|
+
"default",
|
|
4401
|
+
"delete",
|
|
4402
|
+
"do",
|
|
4403
|
+
"else",
|
|
4404
|
+
"enum",
|
|
4405
|
+
"export",
|
|
4406
|
+
"extends",
|
|
4407
|
+
"false",
|
|
4408
|
+
"finally",
|
|
4409
|
+
"for",
|
|
4410
|
+
"function",
|
|
4411
|
+
"if",
|
|
4412
|
+
"import",
|
|
4413
|
+
"in",
|
|
4414
|
+
"instanceof",
|
|
4415
|
+
"new",
|
|
4416
|
+
"null",
|
|
4417
|
+
"return",
|
|
4418
|
+
"super",
|
|
4419
|
+
"switch",
|
|
4420
|
+
"this",
|
|
4421
|
+
"throw",
|
|
4422
|
+
"true",
|
|
4423
|
+
"try",
|
|
4424
|
+
"typeof",
|
|
4425
|
+
"var",
|
|
4426
|
+
"void",
|
|
4427
|
+
"while",
|
|
4428
|
+
"with",
|
|
4429
|
+
"yield",
|
|
4430
|
+
// Future reserved keywords
|
|
4431
|
+
"implements",
|
|
4432
|
+
"interface",
|
|
4433
|
+
"package",
|
|
4434
|
+
"private",
|
|
4435
|
+
"protected",
|
|
4436
|
+
"public",
|
|
4437
|
+
// Not keywords, but still restricted
|
|
4438
|
+
"arguments",
|
|
4439
|
+
"eval"
|
|
4440
|
+
];
|
|
4441
|
+
var globalProperties = [
|
|
4442
|
+
"globalThis",
|
|
4443
|
+
"Infinity",
|
|
4444
|
+
"NaN",
|
|
4445
|
+
"undefined"
|
|
4446
|
+
];
|
|
4447
|
+
function reservedIdentifiers({ includeGlobalProperties = false } = {}) {
|
|
4448
|
+
return /* @__PURE__ */ new Set([
|
|
4449
|
+
...identifiers,
|
|
4450
|
+
...includeGlobalProperties ? globalProperties : []
|
|
4451
|
+
]);
|
|
4452
|
+
}
|
|
4453
|
+
|
|
4454
|
+
// ../../node_modules/.pnpm/identifier-regex@1.0.0/node_modules/identifier-regex/index.js
|
|
4455
|
+
var baseRegex = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*/u;
|
|
4456
|
+
var basePattern = `(?!${[...reservedIdentifiers({ includeGlobalProperties: true })].join("|")})${baseRegex.source}`;
|
|
4457
|
+
var regex = new RegExp(basePattern, "u");
|
|
4458
|
+
var regexExact = new RegExp(`^${basePattern}$`, "u");
|
|
4459
|
+
function identifierRegex({ exact = true } = {}) {
|
|
4460
|
+
return exact ? regexExact : regex;
|
|
4461
|
+
}
|
|
4462
|
+
|
|
4463
|
+
// ../internals/src/utils/isValidJsIdentifier.ts
|
|
4464
|
+
function isValidJsIdentifier(str) {
|
|
4465
|
+
return identifierRegex().test(str);
|
|
4466
|
+
}
|
|
4467
|
+
|
|
4390
4468
|
// ../internals/src/utils/setClassName.ts
|
|
4391
4469
|
function setClassName(classObject, name) {
|
|
4392
4470
|
Object.defineProperty(classObject, "name", {
|
|
@@ -5255,124 +5333,6 @@ function parameter(name, type) {
|
|
|
5255
5333
|
return new Parameter(name, type);
|
|
5256
5334
|
}
|
|
5257
5335
|
|
|
5258
|
-
// ../../node_modules/.pnpm/reserved-identifiers@1.0.0/node_modules/reserved-identifiers/index.js
|
|
5259
|
-
var identifiers = [
|
|
5260
|
-
// Keywords
|
|
5261
|
-
"await",
|
|
5262
|
-
"break",
|
|
5263
|
-
"case",
|
|
5264
|
-
"catch",
|
|
5265
|
-
"class",
|
|
5266
|
-
"const",
|
|
5267
|
-
"continue",
|
|
5268
|
-
"debugger",
|
|
5269
|
-
"default",
|
|
5270
|
-
"delete",
|
|
5271
|
-
"do",
|
|
5272
|
-
"else",
|
|
5273
|
-
"enum",
|
|
5274
|
-
"export",
|
|
5275
|
-
"extends",
|
|
5276
|
-
"false",
|
|
5277
|
-
"finally",
|
|
5278
|
-
"for",
|
|
5279
|
-
"function",
|
|
5280
|
-
"if",
|
|
5281
|
-
"import",
|
|
5282
|
-
"in",
|
|
5283
|
-
"instanceof",
|
|
5284
|
-
"new",
|
|
5285
|
-
"null",
|
|
5286
|
-
"return",
|
|
5287
|
-
"super",
|
|
5288
|
-
"switch",
|
|
5289
|
-
"this",
|
|
5290
|
-
"throw",
|
|
5291
|
-
"true",
|
|
5292
|
-
"try",
|
|
5293
|
-
"typeof",
|
|
5294
|
-
"var",
|
|
5295
|
-
"void",
|
|
5296
|
-
"while",
|
|
5297
|
-
"with",
|
|
5298
|
-
"yield",
|
|
5299
|
-
// Future reserved keywords
|
|
5300
|
-
"implements",
|
|
5301
|
-
"interface",
|
|
5302
|
-
"package",
|
|
5303
|
-
"private",
|
|
5304
|
-
"protected",
|
|
5305
|
-
"public",
|
|
5306
|
-
// Not keywords, but still restricted
|
|
5307
|
-
"arguments",
|
|
5308
|
-
"eval"
|
|
5309
|
-
];
|
|
5310
|
-
var globalProperties = [
|
|
5311
|
-
"globalThis",
|
|
5312
|
-
"Infinity",
|
|
5313
|
-
"NaN",
|
|
5314
|
-
"undefined"
|
|
5315
|
-
];
|
|
5316
|
-
function reservedIdentifiers({ includeGlobalProperties = false } = {}) {
|
|
5317
|
-
return /* @__PURE__ */ new Set([
|
|
5318
|
-
...identifiers,
|
|
5319
|
-
...includeGlobalProperties ? globalProperties : []
|
|
5320
|
-
]);
|
|
5321
|
-
}
|
|
5322
|
-
|
|
5323
|
-
// ../../node_modules/.pnpm/identifier-regex@1.0.0/node_modules/identifier-regex/index.js
|
|
5324
|
-
var baseRegex = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*/u;
|
|
5325
|
-
var basePattern = `(?!${[...reservedIdentifiers({ includeGlobalProperties: true })].join("|")})${baseRegex.source}`;
|
|
5326
|
-
var regex = new RegExp(basePattern, "u");
|
|
5327
|
-
var regexExact = new RegExp(`^${basePattern}$`, "u");
|
|
5328
|
-
function identifierRegex({ exact = true } = {}) {
|
|
5329
|
-
return exact ? regexExact : regex;
|
|
5330
|
-
}
|
|
5331
|
-
|
|
5332
|
-
// ../../node_modules/.pnpm/function-timeout@1.0.2/node_modules/function-timeout/index.js
|
|
5333
|
-
var import_node_vm = __toESM(require("vm"), 1);
|
|
5334
|
-
var script = new import_node_vm.default.Script("returnValue = functionToRun()");
|
|
5335
|
-
function functionTimeout(function_, { timeout, context: context2 = import_node_vm.default.createContext() } = {}) {
|
|
5336
|
-
const wrappedFunction = (...arguments_) => {
|
|
5337
|
-
context2.functionToRun = () => function_(...arguments_);
|
|
5338
|
-
script.runInNewContext(context2, { timeout });
|
|
5339
|
-
return context2.returnValue;
|
|
5340
|
-
};
|
|
5341
|
-
Object.defineProperty(wrappedFunction, "name", {
|
|
5342
|
-
value: `functionTimeout(${function_.name || "<anonymous>"})`,
|
|
5343
|
-
configurable: true
|
|
5344
|
-
});
|
|
5345
|
-
return wrappedFunction;
|
|
5346
|
-
}
|
|
5347
|
-
function isTimeoutError(error) {
|
|
5348
|
-
return error?.code === "ERR_SCRIPT_EXECUTION_TIMEOUT";
|
|
5349
|
-
}
|
|
5350
|
-
|
|
5351
|
-
// ../../node_modules/.pnpm/super-regex@1.0.0/node_modules/super-regex/index.js
|
|
5352
|
-
var context = {};
|
|
5353
|
-
function isMatch(regex3, string, { timeout } = {}) {
|
|
5354
|
-
try {
|
|
5355
|
-
return functionTimeout(() => structuredClone(regex3).test(string), { timeout, context })();
|
|
5356
|
-
} catch (error) {
|
|
5357
|
-
if (isTimeoutError(error)) {
|
|
5358
|
-
return false;
|
|
5359
|
-
}
|
|
5360
|
-
throw error;
|
|
5361
|
-
}
|
|
5362
|
-
}
|
|
5363
|
-
|
|
5364
|
-
// ../../node_modules/.pnpm/is-identifier@1.0.1/node_modules/is-identifier/index.js
|
|
5365
|
-
var regex2 = identifierRegex();
|
|
5366
|
-
function isIdentifier(value) {
|
|
5367
|
-
if (typeof value !== "string") {
|
|
5368
|
-
throw new TypeError(`Expected a string, got \`${typeof value}\`.`);
|
|
5369
|
-
}
|
|
5370
|
-
if (value.length > 1e5) {
|
|
5371
|
-
return false;
|
|
5372
|
-
}
|
|
5373
|
-
return isMatch(regex2, value, { timeout: 1e3 });
|
|
5374
|
-
}
|
|
5375
|
-
|
|
5376
5336
|
// src/generation/ts-builders/Property.ts
|
|
5377
5337
|
var Property = class {
|
|
5378
5338
|
constructor(name, type) {
|
|
@@ -5400,7 +5360,7 @@ var Property = class {
|
|
|
5400
5360
|
if (this.isReadonly) {
|
|
5401
5361
|
writer.write("readonly ");
|
|
5402
5362
|
}
|
|
5403
|
-
if (
|
|
5363
|
+
if (isValidJsIdentifier(this.name)) {
|
|
5404
5364
|
writer.write(this.name);
|
|
5405
5365
|
} else {
|
|
5406
5366
|
writer.write("[").write(JSON.stringify(this.name)).write("]");
|
|
@@ -5418,8 +5378,8 @@ function property(name, type) {
|
|
|
5418
5378
|
// src/generation/ts-builders/Writer.ts
|
|
5419
5379
|
var INDENT_SIZE = 2;
|
|
5420
5380
|
var Writer = class {
|
|
5421
|
-
constructor(startingIndent = 0,
|
|
5422
|
-
this.context =
|
|
5381
|
+
constructor(startingIndent = 0, context) {
|
|
5382
|
+
this.context = context;
|
|
5423
5383
|
this.lines = [];
|
|
5424
5384
|
this.currentLine = "";
|
|
5425
5385
|
this.currentIndent = 0;
|
|
@@ -6462,9 +6422,9 @@ function escapeJson(str) {
|
|
|
6462
6422
|
|
|
6463
6423
|
// src/generation/TSClient/Args.ts
|
|
6464
6424
|
var ArgsTypeBuilder = class {
|
|
6465
|
-
constructor(type,
|
|
6425
|
+
constructor(type, context, action) {
|
|
6466
6426
|
this.type = type;
|
|
6467
|
-
this.context =
|
|
6427
|
+
this.context = context;
|
|
6468
6428
|
this.action = action;
|
|
6469
6429
|
this.hasDefaultName = true;
|
|
6470
6430
|
this.moduleExport = moduleExport(
|
|
@@ -6633,20 +6593,20 @@ function enumTypeName(ref) {
|
|
|
6633
6593
|
}
|
|
6634
6594
|
|
|
6635
6595
|
// src/generation/TSClient/Payload.ts
|
|
6636
|
-
function buildModelPayload(model,
|
|
6637
|
-
const isComposite =
|
|
6596
|
+
function buildModelPayload(model, context) {
|
|
6597
|
+
const isComposite = context.dmmf.isComposite(model.name);
|
|
6638
6598
|
const objects = objectType();
|
|
6639
6599
|
const scalars = objectType();
|
|
6640
6600
|
const composites = objectType();
|
|
6641
6601
|
for (const field of model.fields) {
|
|
6642
6602
|
if (field.kind === "object") {
|
|
6643
|
-
if (
|
|
6644
|
-
composites.add(buildModelOutputProperty(field,
|
|
6603
|
+
if (context.dmmf.isComposite(field.type)) {
|
|
6604
|
+
composites.add(buildModelOutputProperty(field, context.dmmf));
|
|
6645
6605
|
} else {
|
|
6646
|
-
objects.add(buildModelOutputProperty(field,
|
|
6606
|
+
objects.add(buildModelOutputProperty(field, context.dmmf));
|
|
6647
6607
|
}
|
|
6648
6608
|
} else if (field.kind === "enum" || field.kind === "scalar") {
|
|
6649
|
-
scalars.add(buildModelOutputProperty(field,
|
|
6609
|
+
scalars.add(buildModelOutputProperty(field, context.dmmf));
|
|
6650
6610
|
}
|
|
6651
6611
|
}
|
|
6652
6612
|
const scalarsType = isComposite ? scalars : namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(namedType("ExtArgs").subKey("result").subKey(lowerCase(model.name)));
|
|
@@ -6734,11 +6694,11 @@ function getModelActions(dmmf, name) {
|
|
|
6734
6694
|
|
|
6735
6695
|
// src/generation/TSClient/Model.ts
|
|
6736
6696
|
var Model = class {
|
|
6737
|
-
constructor(model,
|
|
6697
|
+
constructor(model, context) {
|
|
6738
6698
|
this.model = model;
|
|
6739
|
-
this.context =
|
|
6740
|
-
this.dmmf =
|
|
6741
|
-
this.genericsInfo =
|
|
6699
|
+
this.context = context;
|
|
6700
|
+
this.dmmf = context.dmmf;
|
|
6701
|
+
this.genericsInfo = context.genericArgsInfo;
|
|
6742
6702
|
this.type = this.context.dmmf.outputTypeMap.model[model.name];
|
|
6743
6703
|
this.createManyAndReturnType = this.context.dmmf.outputTypeMap.model[getCreateManyAndReturnOutputType(model.name)];
|
|
6744
6704
|
this.mapping = this.context.dmmf.mappings.modelOperations.find((m) => m.model === model.name);
|
|
@@ -7006,9 +6966,9 @@ ${this.argsTypes.map((type) => stringify(type)).join("\n\n")}
|
|
|
7006
6966
|
}
|
|
7007
6967
|
};
|
|
7008
6968
|
var ModelDelegate = class {
|
|
7009
|
-
constructor(outputType,
|
|
6969
|
+
constructor(outputType, context) {
|
|
7010
6970
|
this.outputType = outputType;
|
|
7011
|
-
this.context =
|
|
6971
|
+
this.context = context;
|
|
7012
6972
|
}
|
|
7013
6973
|
/**
|
|
7014
6974
|
* Returns all available non-aggregate or group actions
|
|
@@ -7142,10 +7102,10 @@ ${stringify(buildFluentWrapperDefinition(name, this.outputType, this.context))}
|
|
|
7142
7102
|
`;
|
|
7143
7103
|
}
|
|
7144
7104
|
};
|
|
7145
|
-
function buildModelDelegateMethod(modelName, actionName,
|
|
7146
|
-
const mapping =
|
|
7147
|
-
const modelOrType =
|
|
7148
|
-
const method2 = method(actionName).setDocComment(docComment(getMethodJSDocBody(actionName, mapping, modelOrType))).addParameter(getNonAggregateMethodArgs(modelName, actionName)).setReturnType(getReturnType({ modelName, actionName, context
|
|
7105
|
+
function buildModelDelegateMethod(modelName, actionName, context) {
|
|
7106
|
+
const mapping = context.dmmf.mappingsMap[modelName] ?? { model: modelName, plural: `${modelName}s` };
|
|
7107
|
+
const modelOrType = context.dmmf.typeAndModelMap[modelName];
|
|
7108
|
+
const method2 = method(actionName).setDocComment(docComment(getMethodJSDocBody(actionName, mapping, modelOrType))).addParameter(getNonAggregateMethodArgs(modelName, actionName)).setReturnType(getReturnType({ modelName, actionName, context }));
|
|
7149
7109
|
const generic = getNonAggregateMethodGenericParam(modelName, actionName);
|
|
7150
7110
|
if (generic) {
|
|
7151
7111
|
method2.addGenericParameter(generic);
|
|
@@ -7187,7 +7147,7 @@ function getNonAggregateMethodGenericParam(modelName, actionName) {
|
|
|
7187
7147
|
function getReturnType({
|
|
7188
7148
|
modelName,
|
|
7189
7149
|
actionName,
|
|
7190
|
-
context
|
|
7150
|
+
context,
|
|
7191
7151
|
isChaining = false,
|
|
7192
7152
|
isNullable = false
|
|
7193
7153
|
}) {
|
|
@@ -7205,7 +7165,7 @@ function getReturnType({
|
|
|
7205
7165
|
}
|
|
7206
7166
|
const isList = actionName === DMMF.ModelAction.findMany || actionName === DMMF.ModelAction.createManyAndReturn;
|
|
7207
7167
|
if (isList) {
|
|
7208
|
-
let result = getResultType(modelName, actionName,
|
|
7168
|
+
let result = getResultType(modelName, actionName, context);
|
|
7209
7169
|
if (isChaining) {
|
|
7210
7170
|
result = unionType(result).addVariant(namedType("Null"));
|
|
7211
7171
|
}
|
|
@@ -7213,39 +7173,39 @@ function getReturnType({
|
|
|
7213
7173
|
}
|
|
7214
7174
|
if (isChaining && actionName === DMMF.ModelAction.findUniqueOrThrow) {
|
|
7215
7175
|
const nullType2 = isNullable ? nullType : namedType("Null");
|
|
7216
|
-
const result = unionType(getResultType(modelName, actionName,
|
|
7217
|
-
return getFluentWrapper(modelName,
|
|
7176
|
+
const result = unionType(getResultType(modelName, actionName, context)).addVariant(nullType2);
|
|
7177
|
+
return getFluentWrapper(modelName, context, result, nullType2);
|
|
7218
7178
|
}
|
|
7219
7179
|
if (actionName === DMMF.ModelAction.findFirst || actionName === DMMF.ModelAction.findUnique) {
|
|
7220
|
-
const result = unionType(getResultType(modelName, actionName,
|
|
7221
|
-
return getFluentWrapper(modelName,
|
|
7180
|
+
const result = unionType(getResultType(modelName, actionName, context)).addVariant(nullType);
|
|
7181
|
+
return getFluentWrapper(modelName, context, result, nullType);
|
|
7222
7182
|
}
|
|
7223
|
-
return getFluentWrapper(modelName,
|
|
7183
|
+
return getFluentWrapper(modelName, context, getResultType(modelName, actionName, context));
|
|
7224
7184
|
}
|
|
7225
|
-
function getFluentWrapper(modelName,
|
|
7185
|
+
function getFluentWrapper(modelName, context, resultType, nullType2 = neverType) {
|
|
7226
7186
|
const result = namedType(fluentWrapperName(modelName)).addGenericArgument(resultType).addGenericArgument(nullType2).addGenericArgument(extArgsParam.toArgument());
|
|
7227
|
-
if (
|
|
7187
|
+
if (context.isPreviewFeatureOn("omitApi")) {
|
|
7228
7188
|
result.addGenericArgument(namedType("ClientOptions"));
|
|
7229
7189
|
}
|
|
7230
7190
|
return result;
|
|
7231
7191
|
}
|
|
7232
|
-
function getResultType(modelName, actionName,
|
|
7192
|
+
function getResultType(modelName, actionName, context) {
|
|
7233
7193
|
const result = namedType("$Result.GetResult").addGenericArgument(namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument())).addGenericArgument(namedType("T")).addGenericArgument(stringLiteral(actionName));
|
|
7234
|
-
if (
|
|
7194
|
+
if (context.isPreviewFeatureOn("omitApi")) {
|
|
7235
7195
|
result.addGenericArgument(namedType("ClientOptions"));
|
|
7236
7196
|
}
|
|
7237
7197
|
return result;
|
|
7238
7198
|
}
|
|
7239
|
-
function buildFluentWrapperDefinition(modelName, outputType,
|
|
7199
|
+
function buildFluentWrapperDefinition(modelName, outputType, context) {
|
|
7240
7200
|
const definition = interfaceDeclaration(fluentWrapperName(modelName));
|
|
7241
7201
|
definition.addGenericParameter(genericParameter("T")).addGenericParameter(genericParameter("Null").default(neverType)).addGenericParameter(extArgsParam).extends(prismaPromise(namedType("T")));
|
|
7242
|
-
if (
|
|
7202
|
+
if (context.isPreviewFeatureOn("omitApi")) {
|
|
7243
7203
|
definition.addGenericParameter(genericParameter("ClientOptions").default(objectType()));
|
|
7244
7204
|
}
|
|
7245
7205
|
definition.add(property("[Symbol.toStringTag]", stringLiteral("PrismaPromise")).readonly());
|
|
7246
7206
|
definition.addMultiple(
|
|
7247
7207
|
outputType.fields.filter(
|
|
7248
|
-
(field) => field.outputType.location === "outputObjectTypes" && !
|
|
7208
|
+
(field) => field.outputType.location === "outputObjectTypes" && !context.dmmf.isComposite(field.outputType.type) && field.name !== "_count"
|
|
7249
7209
|
).map((field) => {
|
|
7250
7210
|
const fieldArgType = namedType(getFieldArgName(field, modelName)).addGenericArgument(extArgsParam.toArgument());
|
|
7251
7211
|
const argsParam = genericParameter("T").extends(fieldArgType).default(objectType());
|
|
@@ -7254,7 +7214,7 @@ function buildFluentWrapperDefinition(modelName, outputType, context2) {
|
|
|
7254
7214
|
modelName: field.outputType.type,
|
|
7255
7215
|
actionName: field.outputType.isList ? DMMF.ModelAction.findMany : DMMF.ModelAction.findUniqueOrThrow,
|
|
7256
7216
|
isChaining: true,
|
|
7257
|
-
context
|
|
7217
|
+
context,
|
|
7258
7218
|
isNullable: field.isNullable
|
|
7259
7219
|
})
|
|
7260
7220
|
);
|
|
@@ -8314,9 +8274,9 @@ class ${name} {
|
|
|
8314
8274
|
// src/generation/TSClient/Count.ts
|
|
8315
8275
|
var import_indent_string5 = __toESM(require_indent_string());
|
|
8316
8276
|
var Count = class {
|
|
8317
|
-
constructor(type,
|
|
8277
|
+
constructor(type, context) {
|
|
8318
8278
|
this.type = type;
|
|
8319
|
-
this.context =
|
|
8279
|
+
this.context = context;
|
|
8320
8280
|
}
|
|
8321
8281
|
get argsTypes() {
|
|
8322
8282
|
const argsTypes = [];
|
|
@@ -8468,15 +8428,15 @@ function globalOmitConfig(dmmf) {
|
|
|
8468
8428
|
}
|
|
8469
8429
|
|
|
8470
8430
|
// src/generation/TSClient/PrismaClient.ts
|
|
8471
|
-
function clientTypeMapModelsDefinition(
|
|
8431
|
+
function clientTypeMapModelsDefinition(context) {
|
|
8472
8432
|
const meta = objectType();
|
|
8473
|
-
const modelNames =
|
|
8433
|
+
const modelNames = context.dmmf.datamodel.models.map((m) => m.name);
|
|
8474
8434
|
if (modelNames.length === 0) {
|
|
8475
8435
|
meta.add(property("modelProps", neverType));
|
|
8476
8436
|
} else {
|
|
8477
8437
|
meta.add(property("modelProps", unionType(modelNames.map((name) => stringLiteral(lowerCase(name))))));
|
|
8478
8438
|
}
|
|
8479
|
-
const isolationLevel =
|
|
8439
|
+
const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? namedType("Prisma.TransactionIsolationLevel") : neverType;
|
|
8480
8440
|
meta.add(property("txIsolationLevel", isolationLevel));
|
|
8481
8441
|
const model = objectType();
|
|
8482
8442
|
model.addMultiple(
|
|
@@ -8486,7 +8446,7 @@ function clientTypeMapModelsDefinition(context2) {
|
|
|
8486
8446
|
property("payload", namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument()))
|
|
8487
8447
|
);
|
|
8488
8448
|
entry.add(property("fields", namedType(`Prisma.${getFieldRefsTypeName(modelName)}`)));
|
|
8489
|
-
const actions = getModelActions(
|
|
8449
|
+
const actions = getModelActions(context.dmmf, modelName);
|
|
8490
8450
|
const operations = objectType();
|
|
8491
8451
|
operations.addMultiple(
|
|
8492
8452
|
actions.map((action) => {
|
|
@@ -8528,13 +8488,13 @@ function clientTypeMapModelsResultDefinition(modelName, action) {
|
|
|
8528
8488
|
function payloadToResult(modelName) {
|
|
8529
8489
|
return namedType("$Utils.PayloadToResult").addGenericArgument(namedType(getPayloadName(modelName)));
|
|
8530
8490
|
}
|
|
8531
|
-
function clientTypeMapOthersDefinition(
|
|
8532
|
-
const otherOperationsNames =
|
|
8491
|
+
function clientTypeMapOthersDefinition(context) {
|
|
8492
|
+
const otherOperationsNames = context.dmmf.getOtherOperationNames().flatMap((name) => {
|
|
8533
8493
|
const results = [`$${name}`];
|
|
8534
8494
|
if (name === "executeRaw" || name === "queryRaw") {
|
|
8535
8495
|
results.push(`$${name}Unsafe`);
|
|
8536
8496
|
}
|
|
8537
|
-
if (name === "queryRaw" &&
|
|
8497
|
+
if (name === "queryRaw" && context.isPreviewFeatureOn("typedSql")) {
|
|
8538
8498
|
results.push(`$queryRawTyped`);
|
|
8539
8499
|
}
|
|
8540
8500
|
return results;
|
|
@@ -8561,8 +8521,8 @@ function clientTypeMapOthersDefinition(context2) {
|
|
|
8561
8521
|
}
|
|
8562
8522
|
}`;
|
|
8563
8523
|
}
|
|
8564
|
-
function clientTypeMapDefinition(
|
|
8565
|
-
const typeMap = `${stringify(clientTypeMapModelsDefinition(
|
|
8524
|
+
function clientTypeMapDefinition(context) {
|
|
8525
|
+
const typeMap = `${stringify(clientTypeMapModelsDefinition(context))} & ${clientTypeMapOthersDefinition(context)}`;
|
|
8566
8526
|
return `
|
|
8567
8527
|
interface TypeMapCb extends $Utils.Fn<{extArgs: $Extensions.InternalArgs, clientOptions: PrismaClientOptions }, $Utils.Record<string, any>> {
|
|
8568
8528
|
returns: Prisma.TypeMap<this['params']['extArgs'], this['params']['clientOptions']>
|
|
@@ -8570,8 +8530,8 @@ interface TypeMapCb extends $Utils.Fn<{extArgs: $Extensions.InternalArgs, client
|
|
|
8570
8530
|
|
|
8571
8531
|
export type TypeMap<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs, ClientOptions = {}> = ${typeMap}`;
|
|
8572
8532
|
}
|
|
8573
|
-
function clientExtensionsDefinitions(
|
|
8574
|
-
const typeMap = clientTypeMapDefinition(
|
|
8533
|
+
function clientExtensionsDefinitions(context) {
|
|
8534
|
+
const typeMap = clientTypeMapDefinition(context);
|
|
8575
8535
|
const define2 = moduleExport(
|
|
8576
8536
|
constDeclaration(
|
|
8577
8537
|
"defineExtension",
|
|
@@ -8580,16 +8540,16 @@ function clientExtensionsDefinitions(context2) {
|
|
|
8580
8540
|
);
|
|
8581
8541
|
return [typeMap, stringify(define2)].join("\n");
|
|
8582
8542
|
}
|
|
8583
|
-
function extendsPropertyDefinition(
|
|
8543
|
+
function extendsPropertyDefinition(context) {
|
|
8584
8544
|
const extendsDefinition = namedType("$Extensions.ExtendsHook").addGenericArgument(stringLiteral("extends")).addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(namedType("ExtArgs"));
|
|
8585
|
-
if (
|
|
8545
|
+
if (context.isPreviewFeatureOn("omitApi")) {
|
|
8586
8546
|
extendsDefinition.addGenericArgument(
|
|
8587
8547
|
namedType("$Utils.Call").addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(objectType().add(property("extArgs", namedType("ExtArgs"))))
|
|
8588
8548
|
).addGenericArgument(namedType("ClientOptions"));
|
|
8589
8549
|
}
|
|
8590
8550
|
return stringify(property("$extends", extendsDefinition), { indentLevel: 1 });
|
|
8591
8551
|
}
|
|
8592
|
-
function batchingTransactionDefinition(
|
|
8552
|
+
function batchingTransactionDefinition(context) {
|
|
8593
8553
|
const method2 = method("$transaction").setDocComment(
|
|
8594
8554
|
docComment`
|
|
8595
8555
|
Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.
|
|
@@ -8605,15 +8565,15 @@ function batchingTransactionDefinition(context2) {
|
|
|
8605
8565
|
Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).
|
|
8606
8566
|
`
|
|
8607
8567
|
).addGenericParameter(genericParameter("P").extends(array(prismaPromise(anyType)))).addParameter(parameter("arg", arraySpread(namedType("P")))).setReturnType(promise(namedType("runtime.Types.Utils.UnwrapTuple").addGenericArgument(namedType("P"))));
|
|
8608
|
-
if (
|
|
8568
|
+
if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
|
|
8609
8569
|
const options = objectType().formatInline().add(property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional());
|
|
8610
8570
|
method2.addParameter(parameter("options", options).optional());
|
|
8611
8571
|
}
|
|
8612
8572
|
return stringify(method2, { indentLevel: 1, newLine: "leading" });
|
|
8613
8573
|
}
|
|
8614
|
-
function interactiveTransactionDefinition(
|
|
8574
|
+
function interactiveTransactionDefinition(context) {
|
|
8615
8575
|
const options = objectType().formatInline().add(property("maxWait", numberType).optional()).add(property("timeout", numberType).optional());
|
|
8616
|
-
if (
|
|
8576
|
+
if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
|
|
8617
8577
|
const isolationLevel = property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional();
|
|
8618
8578
|
options.add(isolationLevel);
|
|
8619
8579
|
}
|
|
@@ -8624,8 +8584,8 @@ function interactiveTransactionDefinition(context2) {
|
|
|
8624
8584
|
const method2 = method("$transaction").addGenericParameter(genericParameter("R")).addParameter(parameter("fn", callbackType)).addParameter(parameter("options", options).optional()).setReturnType(returnType);
|
|
8625
8585
|
return stringify(method2, { indentLevel: 1, newLine: "leading" });
|
|
8626
8586
|
}
|
|
8627
|
-
function queryRawDefinition(
|
|
8628
|
-
if (!
|
|
8587
|
+
function queryRawDefinition(context) {
|
|
8588
|
+
if (!context.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
|
|
8629
8589
|
return "";
|
|
8630
8590
|
}
|
|
8631
8591
|
return `
|
|
@@ -8652,8 +8612,8 @@ function queryRawDefinition(context2) {
|
|
|
8652
8612
|
*/
|
|
8653
8613
|
$queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;`;
|
|
8654
8614
|
}
|
|
8655
|
-
function executeRawDefinition(
|
|
8656
|
-
if (!
|
|
8615
|
+
function executeRawDefinition(context) {
|
|
8616
|
+
if (!context.dmmf.mappings.otherOperations.write.includes("executeRaw")) {
|
|
8657
8617
|
return "";
|
|
8658
8618
|
}
|
|
8659
8619
|
return `
|
|
@@ -8680,11 +8640,11 @@ function executeRawDefinition(context2) {
|
|
|
8680
8640
|
*/
|
|
8681
8641
|
$executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;`;
|
|
8682
8642
|
}
|
|
8683
|
-
function queryRawTypedDefinition(
|
|
8684
|
-
if (!
|
|
8643
|
+
function queryRawTypedDefinition(context) {
|
|
8644
|
+
if (!context.isPreviewFeatureOn("typedSql")) {
|
|
8685
8645
|
return "";
|
|
8686
8646
|
}
|
|
8687
|
-
if (!
|
|
8647
|
+
if (!context.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
|
|
8688
8648
|
return "";
|
|
8689
8649
|
}
|
|
8690
8650
|
const param = genericParameter("T");
|
|
@@ -8706,8 +8666,8 @@ function queryRawTypedDefinition(context2) {
|
|
|
8706
8666
|
).setReturnType(prismaPromise(array(param.toArgument())));
|
|
8707
8667
|
return stringify(method2, { indentLevel: 1, newLine: "leading" });
|
|
8708
8668
|
}
|
|
8709
|
-
function metricDefinition(
|
|
8710
|
-
if (!
|
|
8669
|
+
function metricDefinition(context) {
|
|
8670
|
+
if (!context.isPreviewFeatureOn("metrics")) {
|
|
8711
8671
|
return "";
|
|
8712
8672
|
}
|
|
8713
8673
|
const property2 = property("$metrics", namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
|
|
@@ -8724,8 +8684,8 @@ function metricDefinition(context2) {
|
|
|
8724
8684
|
).readonly();
|
|
8725
8685
|
return stringify(property2, { indentLevel: 1, newLine: "leading" });
|
|
8726
8686
|
}
|
|
8727
|
-
function runCommandRawDefinition(
|
|
8728
|
-
if (!
|
|
8687
|
+
function runCommandRawDefinition(context) {
|
|
8688
|
+
if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
|
|
8729
8689
|
return "";
|
|
8730
8690
|
}
|
|
8731
8691
|
const method2 = method("$runCommandRaw").addParameter(parameter("command", namedType("Prisma.InputJsonObject"))).setReturnType(prismaPromise(namedType("Prisma.JsonObject"))).setDocComment(docComment`
|
|
@@ -8760,8 +8720,8 @@ function eventRegistrationMethodDeclaration(runtimeNameTs) {
|
|
|
8760
8720
|
}
|
|
8761
8721
|
}
|
|
8762
8722
|
var PrismaClientClass = class {
|
|
8763
|
-
constructor(
|
|
8764
|
-
this.context =
|
|
8723
|
+
constructor(context, internalDatasources, outputDir, runtimeNameTs, browser) {
|
|
8724
|
+
this.context = context;
|
|
8765
8725
|
this.internalDatasources = internalDatasources;
|
|
8766
8726
|
this.outputDir = outputDir;
|
|
8767
8727
|
this.runtimeNameTs = runtimeNameTs;
|
|
@@ -9106,14 +9066,14 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
|
|
|
9106
9066
|
const topExports = moduleExportFrom(`./${reusedTs}`);
|
|
9107
9067
|
return stringify(topExports);
|
|
9108
9068
|
}
|
|
9109
|
-
const
|
|
9069
|
+
const context = new GenerateContext({
|
|
9110
9070
|
dmmf: this.dmmf,
|
|
9111
9071
|
genericArgsInfo: this.genericsInfo,
|
|
9112
9072
|
generator: this.options.generator,
|
|
9113
9073
|
defaultArgsAliases: new DefaultArgsAliases()
|
|
9114
9074
|
});
|
|
9115
9075
|
const prismaClientClass = new PrismaClientClass(
|
|
9116
|
-
|
|
9076
|
+
context,
|
|
9117
9077
|
this.options.datasources,
|
|
9118
9078
|
this.options.outputDir,
|
|
9119
9079
|
this.options.runtimeNameTs,
|
|
@@ -9122,7 +9082,7 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
|
|
|
9122
9082
|
const commonCode = commonCodeTS(this.options);
|
|
9123
9083
|
const modelAndTypes = Object.values(this.dmmf.typeAndModelMap).reduce((acc, modelOrType) => {
|
|
9124
9084
|
if (this.dmmf.outputTypeMap.model[modelOrType.name]) {
|
|
9125
|
-
acc.push(new Model(modelOrType,
|
|
9085
|
+
acc.push(new Model(modelOrType, context));
|
|
9126
9086
|
}
|
|
9127
9087
|
return acc;
|
|
9128
9088
|
}, []);
|
|
@@ -9139,7 +9099,7 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
|
|
|
9139
9099
|
);
|
|
9140
9100
|
}
|
|
9141
9101
|
const fieldRefs = this.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
|
|
9142
|
-
const countTypes = this.dmmf.schema.outputObjectTypes.prisma?.filter((t) => t.name.endsWith("CountOutputType")).map((t) => new Count(t,
|
|
9102
|
+
const countTypes = this.dmmf.schema.outputObjectTypes.prisma?.filter((t) => t.name.endsWith("CountOutputType")).map((t) => new Count(t, context));
|
|
9143
9103
|
const code = `
|
|
9144
9104
|
/**
|
|
9145
9105
|
* Client
|
|
@@ -9226,7 +9186,7 @@ ${this.dmmf.inputObjectTypes.model?.map((inputType) => new InputType(inputType,
|
|
|
9226
9186
|
/**
|
|
9227
9187
|
* Aliases for legacy arg types
|
|
9228
9188
|
*/
|
|
9229
|
-
${
|
|
9189
|
+
${context.defaultArgsAliases.generateAliases()}
|
|
9230
9190
|
|
|
9231
9191
|
/**
|
|
9232
9192
|
* Batch Payload for updateMany & deleteMany & createMany
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client",
|
|
3
|
-
"version": "5.19.0-integration-feat-typed-sql.
|
|
3
|
+
"version": "5.19.0-integration-feat-typed-sql.2",
|
|
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",
|
|
@@ -235,7 +235,6 @@
|
|
|
235
235
|
"get-stream": "6.0.1",
|
|
236
236
|
"globby": "11.1.0",
|
|
237
237
|
"indent-string": "4.0.0",
|
|
238
|
-
"is-identifier": "1.0.1",
|
|
239
238
|
"jest": "29.7.0",
|
|
240
239
|
"jest-extended": "4.0.2",
|
|
241
240
|
"jest-junit": "16.0.0",
|