@prisma/client-generator-js 6.13.0-dev.3 → 6.13.0-dev.31
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/dist/TSClient/Args.d.ts +1 -0
- package/dist/index.js +132 -84
- package/dist/index.mjs +74 -26
- package/dist/utils.d.ts +0 -1
- package/package.json +10 -10
package/dist/TSClient/Args.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare class ArgsTypeBuilder {
|
|
|
23
23
|
isNullable: boolean;
|
|
24
24
|
isRequired: boolean;
|
|
25
25
|
inputTypes: DMMF.InputTypeRef[];
|
|
26
|
+
requiresOtherFields?: string[] | undefined;
|
|
26
27
|
deprecation?: import("@prisma/dmmf/dist/util").ReadonlyDeep<{
|
|
27
28
|
sinceVersion: string;
|
|
28
29
|
reason: string;
|
package/dist/index.js
CHANGED
|
@@ -4492,7 +4492,7 @@ var package_default = {
|
|
|
4492
4492
|
"@prisma/dmmf": "workspace:*",
|
|
4493
4493
|
"@prisma/driver-adapter-utils": "workspace:*",
|
|
4494
4494
|
"@prisma/engines": "workspace:*",
|
|
4495
|
-
"@prisma/engines-version": "6.
|
|
4495
|
+
"@prisma/engines-version": "6.13.0-35.361e86d0ea4987e9f53a565309b3eed797a6bcbd",
|
|
4496
4496
|
"@prisma/fetch-engine": "workspace:*",
|
|
4497
4497
|
"@prisma/generator": "workspace:*",
|
|
4498
4498
|
"@prisma/generator-helper": "workspace:*",
|
|
@@ -4501,8 +4501,8 @@ var package_default = {
|
|
|
4501
4501
|
"@prisma/internals": "workspace:*",
|
|
4502
4502
|
"@prisma/migrate": "workspace:*",
|
|
4503
4503
|
"@prisma/mini-proxy": "0.9.5",
|
|
4504
|
-
"@prisma/query-compiler-wasm": "6.
|
|
4505
|
-
"@prisma/query-engine-wasm": "6.
|
|
4504
|
+
"@prisma/query-compiler-wasm": "6.13.0-35.361e86d0ea4987e9f53a565309b3eed797a6bcbd",
|
|
4505
|
+
"@prisma/query-engine-wasm": "6.13.0-35.361e86d0ea4987e9f53a565309b3eed797a6bcbd",
|
|
4506
4506
|
"@prisma/ts-builders": "workspace:*",
|
|
4507
4507
|
"@snaplet/copycat": "6.0.0",
|
|
4508
4508
|
"@swc-node/register": "1.10.9",
|
|
@@ -4522,7 +4522,7 @@ var package_default = {
|
|
|
4522
4522
|
"decimal.js": "10.5.0",
|
|
4523
4523
|
esbuild: "0.25.5",
|
|
4524
4524
|
execa: "5.1.1",
|
|
4525
|
-
"expect-type": "1.2.
|
|
4525
|
+
"expect-type": "1.2.2",
|
|
4526
4526
|
"fs-extra": "11.3.0",
|
|
4527
4527
|
"get-stream": "6.0.1",
|
|
4528
4528
|
globby: "11.1.0",
|
|
@@ -4640,11 +4640,12 @@ function TS(gen) {
|
|
|
4640
4640
|
}
|
|
4641
4641
|
|
|
4642
4642
|
// src/TSClient/Input.ts
|
|
4643
|
-
var
|
|
4643
|
+
var import_client_common4 = require("@prisma/client-common");
|
|
4644
4644
|
var ts2 = __toESM(require("@prisma/ts-builders"));
|
|
4645
4645
|
var import_indent_string2 = __toESM(require("indent-string"));
|
|
4646
4646
|
|
|
4647
4647
|
// src/utils.ts
|
|
4648
|
+
var import_client_common3 = require("@prisma/client-common");
|
|
4648
4649
|
var DMMF = __toESM(require("@prisma/dmmf"));
|
|
4649
4650
|
var import_internals2 = require("@prisma/internals");
|
|
4650
4651
|
var ts = __toESM(require("@prisma/ts-builders"));
|
|
@@ -4676,28 +4677,28 @@ function getOmitName(modelName) {
|
|
|
4676
4677
|
return `${modelName}Omit`;
|
|
4677
4678
|
}
|
|
4678
4679
|
function getAggregateName(modelName) {
|
|
4679
|
-
return `Aggregate${
|
|
4680
|
+
return `Aggregate${(0, import_client_common3.capitalize)(modelName)}`;
|
|
4680
4681
|
}
|
|
4681
4682
|
function getGroupByName(modelName) {
|
|
4682
|
-
return `${
|
|
4683
|
+
return `${(0, import_client_common3.capitalize)(modelName)}GroupByOutputType`;
|
|
4683
4684
|
}
|
|
4684
4685
|
function getAvgAggregateName(modelName) {
|
|
4685
|
-
return `${
|
|
4686
|
+
return `${(0, import_client_common3.capitalize)(modelName)}AvgAggregateOutputType`;
|
|
4686
4687
|
}
|
|
4687
4688
|
function getSumAggregateName(modelName) {
|
|
4688
|
-
return `${
|
|
4689
|
+
return `${(0, import_client_common3.capitalize)(modelName)}SumAggregateOutputType`;
|
|
4689
4690
|
}
|
|
4690
4691
|
function getMinAggregateName(modelName) {
|
|
4691
|
-
return `${
|
|
4692
|
+
return `${(0, import_client_common3.capitalize)(modelName)}MinAggregateOutputType`;
|
|
4692
4693
|
}
|
|
4693
4694
|
function getMaxAggregateName(modelName) {
|
|
4694
|
-
return `${
|
|
4695
|
+
return `${(0, import_client_common3.capitalize)(modelName)}MaxAggregateOutputType`;
|
|
4695
4696
|
}
|
|
4696
4697
|
function getCountAggregateInputName(modelName) {
|
|
4697
|
-
return `${
|
|
4698
|
+
return `${(0, import_client_common3.capitalize)(modelName)}CountAggregateInputType`;
|
|
4698
4699
|
}
|
|
4699
4700
|
function getCountAggregateOutputName(modelName) {
|
|
4700
|
-
return `${
|
|
4701
|
+
return `${(0, import_client_common3.capitalize)(modelName)}CountAggregateOutputType`;
|
|
4701
4702
|
}
|
|
4702
4703
|
function getAggregateInputType(aggregateOutputType) {
|
|
4703
4704
|
return aggregateOutputType.replace(/OutputType$/, "InputType");
|
|
@@ -4706,13 +4707,13 @@ function getGroupByArgsName(modelName) {
|
|
|
4706
4707
|
return `${modelName}GroupByArgs`;
|
|
4707
4708
|
}
|
|
4708
4709
|
function getGroupByPayloadName(modelName) {
|
|
4709
|
-
return `Get${
|
|
4710
|
+
return `Get${(0, import_client_common3.capitalize)(modelName)}GroupByPayload`;
|
|
4710
4711
|
}
|
|
4711
4712
|
function getAggregateArgsName(modelName) {
|
|
4712
|
-
return `${
|
|
4713
|
+
return `${(0, import_client_common3.capitalize)(modelName)}AggregateArgs`;
|
|
4713
4714
|
}
|
|
4714
4715
|
function getAggregateGetName(modelName) {
|
|
4715
|
-
return `Get${
|
|
4716
|
+
return `Get${(0, import_client_common3.capitalize)(modelName)}AggregateType`;
|
|
4716
4717
|
}
|
|
4717
4718
|
function getFieldArgName(field, modelName) {
|
|
4718
4719
|
if (field.args.length) {
|
|
@@ -4779,9 +4780,6 @@ function getPayloadName(modelName, namespace3 = true) {
|
|
|
4779
4780
|
function getFieldRefsTypeName(name) {
|
|
4780
4781
|
return `${name}FieldRefs`;
|
|
4781
4782
|
}
|
|
4782
|
-
function capitalize2(str) {
|
|
4783
|
-
return str[0].toUpperCase() + str.slice(1);
|
|
4784
|
-
}
|
|
4785
4783
|
function getRefAllowedTypeName(type) {
|
|
4786
4784
|
let typeName = type.type;
|
|
4787
4785
|
if (type.isList) {
|
|
@@ -4912,7 +4910,7 @@ var InputType = class {
|
|
|
4912
4910
|
toTS() {
|
|
4913
4911
|
const { type } = this;
|
|
4914
4912
|
const source = type.meta?.source;
|
|
4915
|
-
const fields = (0,
|
|
4913
|
+
const fields = (0, import_client_common4.uniqueBy)(type.fields, (f) => f.name);
|
|
4916
4914
|
const body = `{
|
|
4917
4915
|
${(0, import_indent_string2.default)(
|
|
4918
4916
|
fields.map((arg) => {
|
|
@@ -4944,6 +4942,7 @@ function wrapWithAtLeast(body, input) {
|
|
|
4944
4942
|
}
|
|
4945
4943
|
|
|
4946
4944
|
// src/TSClient/Model.ts
|
|
4945
|
+
var import_client_common9 = require("@prisma/client-common");
|
|
4947
4946
|
var DMMF2 = __toESM(require("@prisma/dmmf"));
|
|
4948
4947
|
var ts7 = __toESM(require("@prisma/ts-builders"));
|
|
4949
4948
|
var import_indent_string3 = __toESM(require("indent-string"));
|
|
@@ -4953,11 +4952,11 @@ var import_klona = require("klona");
|
|
|
4953
4952
|
var ts3 = __toESM(require("@prisma/ts-builders"));
|
|
4954
4953
|
|
|
4955
4954
|
// src/TSClient/helpers.ts
|
|
4956
|
-
var
|
|
4955
|
+
var import_client_common6 = require("@prisma/client-common");
|
|
4957
4956
|
var import_pluralize2 = __toESM(require("pluralize"));
|
|
4958
4957
|
|
|
4959
4958
|
// src/TSClient/jsdoc.ts
|
|
4960
|
-
var
|
|
4959
|
+
var import_client_common5 = require("@prisma/client-common");
|
|
4961
4960
|
var Docs = {
|
|
4962
4961
|
cursor: `{@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}`,
|
|
4963
4962
|
pagination: `{@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}`,
|
|
@@ -5030,7 +5029,7 @@ const ${ctx.singular} = await ${ctx.method}({
|
|
|
5030
5029
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
5031
5030
|
@example
|
|
5032
5031
|
// Create many ${ctx.plural}
|
|
5033
|
-
const ${(0,
|
|
5032
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5034
5033
|
data: [
|
|
5035
5034
|
// ... provide data here
|
|
5036
5035
|
]
|
|
@@ -5044,7 +5043,7 @@ const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ct
|
|
|
5044
5043
|
body: (ctx) => {
|
|
5045
5044
|
const onlySelect = ctx.firstScalar ? `
|
|
5046
5045
|
// Create many ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
5047
|
-
const ${(0,
|
|
5046
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)}With${(0, import_client_common5.capitalize)(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
5048
5047
|
select: { ${ctx.firstScalar.name}: true },
|
|
5049
5048
|
data: [
|
|
5050
5049
|
// ... provide data here
|
|
@@ -5054,7 +5053,7 @@ const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)}With${(0, imp
|
|
|
5054
5053
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
5055
5054
|
@example
|
|
5056
5055
|
// Create many ${ctx.plural}
|
|
5057
|
-
const ${(0,
|
|
5056
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5058
5057
|
data: [
|
|
5059
5058
|
// ... provide data here
|
|
5060
5059
|
]
|
|
@@ -5072,7 +5071,7 @@ ${undefinedNote}
|
|
|
5072
5071
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
5073
5072
|
@example
|
|
5074
5073
|
// Get one ${ctx.singular}
|
|
5075
|
-
const ${(0,
|
|
5074
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5076
5075
|
where: {
|
|
5077
5076
|
// ... provide filter here
|
|
5078
5077
|
}
|
|
@@ -5087,7 +5086,7 @@ if no matches were found.
|
|
|
5087
5086
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
5088
5087
|
@example
|
|
5089
5088
|
// Get one ${ctx.singular}
|
|
5090
|
-
const ${(0,
|
|
5089
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5091
5090
|
where: {
|
|
5092
5091
|
// ... provide filter here
|
|
5093
5092
|
}
|
|
@@ -5102,7 +5101,7 @@ ${undefinedNote}
|
|
|
5102
5101
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
5103
5102
|
@example
|
|
5104
5103
|
// Get one ${ctx.singular}
|
|
5105
|
-
const ${(0,
|
|
5104
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5106
5105
|
where: {
|
|
5107
5106
|
// ... provide filter here
|
|
5108
5107
|
}
|
|
@@ -5123,7 +5122,7 @@ ${undefinedNote}
|
|
|
5123
5122
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
5124
5123
|
@example
|
|
5125
5124
|
// Get one ${ctx.singular}
|
|
5126
|
-
const ${(0,
|
|
5125
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5127
5126
|
where: {
|
|
5128
5127
|
// ... provide filter here
|
|
5129
5128
|
}
|
|
@@ -5141,7 +5140,7 @@ const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ct
|
|
|
5141
5140
|
body: (ctx) => {
|
|
5142
5141
|
const onlySelect = ctx.firstScalar ? `
|
|
5143
5142
|
// Only select the \`${ctx.firstScalar.name}\`
|
|
5144
|
-
const ${(0,
|
|
5143
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)}With${(0, import_client_common5.capitalize)(ctx.firstScalar.name)}Only = await ${ctx.method}({ select: { ${ctx.firstScalar.name}: true } })` : "";
|
|
5145
5144
|
return `Find zero or more ${ctx.plural} that matches the filter.
|
|
5146
5145
|
${undefinedNote}
|
|
5147
5146
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to filter and select certain fields only.
|
|
@@ -5167,7 +5166,7 @@ ${onlySelect}
|
|
|
5167
5166
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one ${ctx.singular}.
|
|
5168
5167
|
@example
|
|
5169
5168
|
// Update one ${ctx.singular}
|
|
5170
|
-
const ${(0,
|
|
5169
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5171
5170
|
where: {
|
|
5172
5171
|
// ... provide filter here
|
|
5173
5172
|
},
|
|
@@ -5186,7 +5185,7 @@ const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ct
|
|
|
5186
5185
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update or create a ${ctx.singular}.
|
|
5187
5186
|
@example
|
|
5188
5187
|
// Update or create a ${ctx.singular}
|
|
5189
|
-
const ${(0,
|
|
5188
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5190
5189
|
create: {
|
|
5191
5190
|
// ... data to create a ${ctx.singular}
|
|
5192
5191
|
},
|
|
@@ -5280,7 +5279,7 @@ ${undefinedNote}
|
|
|
5280
5279
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one or more rows.
|
|
5281
5280
|
@example
|
|
5282
5281
|
// Update many ${ctx.plural}
|
|
5283
|
-
const ${(0,
|
|
5282
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5284
5283
|
where: {
|
|
5285
5284
|
// ... provide filter here
|
|
5286
5285
|
},
|
|
@@ -5299,7 +5298,7 @@ const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ct
|
|
|
5299
5298
|
body: (ctx) => {
|
|
5300
5299
|
const onlySelect = ctx.firstScalar ? `
|
|
5301
5300
|
// Update zero or more ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
5302
|
-
const ${(0,
|
|
5301
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)}With${(0, import_client_common5.capitalize)(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
5303
5302
|
select: { ${ctx.firstScalar.name}: true },
|
|
5304
5303
|
where: {
|
|
5305
5304
|
// ... provide filter here
|
|
@@ -5312,7 +5311,7 @@ const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)}With${(0, imp
|
|
|
5312
5311
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update many ${ctx.plural}.
|
|
5313
5312
|
@example
|
|
5314
5313
|
// Update many ${ctx.plural}
|
|
5315
|
-
const ${(0,
|
|
5314
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5316
5315
|
where: {
|
|
5317
5316
|
// ... provide filter here
|
|
5318
5317
|
},
|
|
@@ -5350,7 +5349,7 @@ const { count } = await ${ctx.method}({
|
|
|
5350
5349
|
body: (ctx) => `Perform aggregation operations on a ${ctx.singular}.
|
|
5351
5350
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which aggregations you would like to apply.
|
|
5352
5351
|
@example
|
|
5353
|
-
const ${(0,
|
|
5352
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5354
5353
|
pipeline: [
|
|
5355
5354
|
{ $match: { status: "registered" } },
|
|
5356
5355
|
{ $group: { _id: "$country", total: { $sum: 1 } } }
|
|
@@ -5365,7 +5364,7 @@ const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ct
|
|
|
5365
5364
|
body: (ctx) => `Find zero or more ${ctx.plural} that matches the filter.
|
|
5366
5365
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which filters you would like to apply.
|
|
5367
5366
|
@example
|
|
5368
|
-
const ${(0,
|
|
5367
|
+
const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5369
5368
|
filter: { age: { $gt: 25 } }
|
|
5370
5369
|
})`,
|
|
5371
5370
|
fields: {
|
|
@@ -5378,10 +5377,10 @@ const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ct
|
|
|
5378
5377
|
// src/TSClient/helpers.ts
|
|
5379
5378
|
function getMethodJSDocBody(action, mapping, model) {
|
|
5380
5379
|
const ctx = {
|
|
5381
|
-
singular: (0,
|
|
5382
|
-
plural: (0,
|
|
5380
|
+
singular: (0, import_client_common6.capitalize)(mapping.model),
|
|
5381
|
+
plural: (0, import_client_common6.capitalize)(mapping.plural),
|
|
5383
5382
|
firstScalar: model.fields.find((f) => f.kind === "scalar"),
|
|
5384
|
-
method: `prisma.${(0,
|
|
5383
|
+
method: `prisma.${(0, import_client_common6.uncapitalize)(mapping.model)}.${action}`,
|
|
5385
5384
|
action,
|
|
5386
5385
|
mapping,
|
|
5387
5386
|
model
|
|
@@ -5578,7 +5577,7 @@ function enumTypeName(ref) {
|
|
|
5578
5577
|
}
|
|
5579
5578
|
|
|
5580
5579
|
// src/TSClient/Payload.ts
|
|
5581
|
-
var
|
|
5580
|
+
var import_client_common7 = require("@prisma/client-common");
|
|
5582
5581
|
var ts5 = __toESM(require("@prisma/ts-builders"));
|
|
5583
5582
|
function buildModelPayload(model, context) {
|
|
5584
5583
|
const isComposite = context.dmmf.isComposite(model.name);
|
|
@@ -5596,7 +5595,7 @@ function buildModelPayload(model, context) {
|
|
|
5596
5595
|
scalars.add(buildModelOutputProperty(field, context.dmmf));
|
|
5597
5596
|
}
|
|
5598
5597
|
}
|
|
5599
|
-
const scalarsType = isComposite ? scalars : ts5.namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts5.namedType("ExtArgs").subKey("result").subKey((0,
|
|
5598
|
+
const scalarsType = isComposite ? scalars : ts5.namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts5.namedType("ExtArgs").subKey("result").subKey((0, import_client_common7.uncapitalize)(model.name)));
|
|
5600
5599
|
const payloadTypeDeclaration = ts5.typeDeclaration(
|
|
5601
5600
|
getPayloadName(model.name, false),
|
|
5602
5601
|
ts5.objectType().add(ts5.property("name", ts5.stringLiteral(model.name))).add(ts5.property("objects", objects)).add(ts5.property("scalars", scalarsType)).add(ts5.property("composites", composites))
|
|
@@ -5608,7 +5607,7 @@ function buildModelPayload(model, context) {
|
|
|
5608
5607
|
}
|
|
5609
5608
|
|
|
5610
5609
|
// src/TSClient/SelectIncludeOmit.ts
|
|
5611
|
-
var
|
|
5610
|
+
var import_client_common8 = require("@prisma/client-common");
|
|
5612
5611
|
var ts6 = __toESM(require("@prisma/ts-builders"));
|
|
5613
5612
|
function buildIncludeType({
|
|
5614
5613
|
modelName,
|
|
@@ -5642,7 +5641,7 @@ function buildSelectType({
|
|
|
5642
5641
|
return buildExport(typeName, selectType);
|
|
5643
5642
|
}
|
|
5644
5643
|
function modelResultExtensionsType(modelName) {
|
|
5645
|
-
return extArgsParam.toArgument().subKey("result").subKey((0,
|
|
5644
|
+
return extArgsParam.toArgument().subKey("result").subKey((0, import_client_common8.uncapitalize)(modelName));
|
|
5646
5645
|
}
|
|
5647
5646
|
function buildScalarSelectType({ modelName, fields, context }) {
|
|
5648
5647
|
const object = buildSelectOrIncludeObject(
|
|
@@ -6149,15 +6148,24 @@ ${ts7.stringify(buildFluentWrapperDefinition(name, this.outputType, this.context
|
|
|
6149
6148
|
function buildModelDelegateMethod(modelName, actionName, context) {
|
|
6150
6149
|
const mapping = context.dmmf.mappingsMap[modelName] ?? { model: modelName, plural: `${modelName}s` };
|
|
6151
6150
|
const modelOrType = context.dmmf.typeAndModelMap[modelName];
|
|
6152
|
-
const
|
|
6151
|
+
const dependencyValidators = getNonAggregateMethodDependencyValidations(mapping, actionName, context);
|
|
6152
|
+
const method3 = ts7.method(actionName).setDocComment(ts7.docComment(getMethodJSDocBody(actionName, mapping, modelOrType))).addParameter(getNonAggregateMethodArgs(modelName, actionName, dependencyValidators)).setReturnType(getReturnType({ modelName, actionName }));
|
|
6153
6153
|
const generic = getNonAggregateMethodGenericParam(modelName, actionName);
|
|
6154
6154
|
if (generic) {
|
|
6155
6155
|
method3.addGenericParameter(generic);
|
|
6156
6156
|
}
|
|
6157
|
+
for (const validator of dependencyValidators) {
|
|
6158
|
+
method3.addGenericParameter(validator);
|
|
6159
|
+
}
|
|
6157
6160
|
return method3;
|
|
6158
6161
|
}
|
|
6159
|
-
function getNonAggregateMethodArgs(modelName, actionName) {
|
|
6160
|
-
const makeParameter = (type2) =>
|
|
6162
|
+
function getNonAggregateMethodArgs(modelName, actionName, dependencyValidators) {
|
|
6163
|
+
const makeParameter = (type2) => {
|
|
6164
|
+
if (dependencyValidators.length > 0) {
|
|
6165
|
+
type2 = ts7.intersectionType([type2, ...dependencyValidators.map((validator) => ts7.namedType(validator.name))]);
|
|
6166
|
+
}
|
|
6167
|
+
return ts7.parameter("args", type2);
|
|
6168
|
+
};
|
|
6161
6169
|
if (actionName === DMMF2.ModelAction.count) {
|
|
6162
6170
|
const type2 = ts7.omit(
|
|
6163
6171
|
ts7.namedType(getModelArgName(modelName, DMMF2.ModelAction.findMany)),
|
|
@@ -6187,6 +6195,32 @@ function getNonAggregateMethodGenericParam(modelName, actionName) {
|
|
|
6187
6195
|
}
|
|
6188
6196
|
return arg.extends(ts7.namedType(getModelArgName(modelName, actionName)));
|
|
6189
6197
|
}
|
|
6198
|
+
function getNonAggregateMethodDependencyValidations(modelMapping, actionName, context) {
|
|
6199
|
+
const outputFieldName = modelMapping[actionName];
|
|
6200
|
+
if (!outputFieldName) {
|
|
6201
|
+
throw new Error(`Missing mapping for ${modelMapping.model}.${actionName}`);
|
|
6202
|
+
}
|
|
6203
|
+
const outputField = context.dmmf.outputTypeMap.prisma["Query"].fields.find((f) => f.name === outputFieldName) ?? context.dmmf.outputTypeMap.prisma["Mutation"].fields.find((f) => f.name === outputFieldName);
|
|
6204
|
+
if (!outputField) {
|
|
6205
|
+
throw new Error(`Can't find output field ${outputFieldName} in the schema`);
|
|
6206
|
+
}
|
|
6207
|
+
const validators = [];
|
|
6208
|
+
for (const args of outputField.args) {
|
|
6209
|
+
if (args.requiresOtherFields === void 0) {
|
|
6210
|
+
continue;
|
|
6211
|
+
}
|
|
6212
|
+
const objectType9 = ts7.objectType();
|
|
6213
|
+
for (const reqArg of args.requiresOtherFields) {
|
|
6214
|
+
objectType9.add(ts7.property(reqArg, ts7.objectType()));
|
|
6215
|
+
}
|
|
6216
|
+
validators.push(
|
|
6217
|
+
ts7.genericParameter(`${(0, import_client_common9.capitalize)(args.name)}DependenciesValidator`).extends(
|
|
6218
|
+
ts7.conditionalType().check(ts7.stringLiteral(args.name)).extends(ts7.namedType("Prisma.Keys<T>")).then(objectType9).else(ts7.objectType())
|
|
6219
|
+
)
|
|
6220
|
+
);
|
|
6221
|
+
}
|
|
6222
|
+
return validators;
|
|
6223
|
+
}
|
|
6190
6224
|
function getReturnType({
|
|
6191
6225
|
modelName,
|
|
6192
6226
|
actionName,
|
|
@@ -6318,7 +6352,7 @@ var import_indent_string8 = __toESM(require("indent-string"));
|
|
|
6318
6352
|
var import_path2 = __toESM(require("path"));
|
|
6319
6353
|
|
|
6320
6354
|
// src/dmmf.ts
|
|
6321
|
-
var
|
|
6355
|
+
var import_client_common10 = require("@prisma/client-common");
|
|
6322
6356
|
var DMMFHelper = class {
|
|
6323
6357
|
constructor(document) {
|
|
6324
6358
|
this.document = document;
|
|
@@ -6384,33 +6418,33 @@ var DMMFHelper = class {
|
|
|
6384
6418
|
return this.outputObjectTypes[ref.namespace ?? "prisma"].find((outputObject) => outputObject.name === ref.type);
|
|
6385
6419
|
}
|
|
6386
6420
|
buildModelMap() {
|
|
6387
|
-
return (0,
|
|
6421
|
+
return (0, import_client_common10.keyBy)(this.datamodel.models, "name");
|
|
6388
6422
|
}
|
|
6389
6423
|
buildTypeMap() {
|
|
6390
|
-
return (0,
|
|
6424
|
+
return (0, import_client_common10.keyBy)(this.datamodel.types, "name");
|
|
6391
6425
|
}
|
|
6392
6426
|
buildTypeModelMap() {
|
|
6393
6427
|
return { ...this.buildTypeMap(), ...this.buildModelMap() };
|
|
6394
6428
|
}
|
|
6395
6429
|
buildMappingsMap() {
|
|
6396
|
-
return (0,
|
|
6430
|
+
return (0, import_client_common10.keyBy)(this.mappings.modelOperations, "model");
|
|
6397
6431
|
}
|
|
6398
6432
|
buildMergedOutputTypeMap() {
|
|
6399
6433
|
if (!this.schema.outputObjectTypes.prisma) {
|
|
6400
6434
|
return {
|
|
6401
|
-
model: (0,
|
|
6402
|
-
prisma: (0,
|
|
6435
|
+
model: (0, import_client_common10.keyBy)(this.schema.outputObjectTypes.model, "name"),
|
|
6436
|
+
prisma: (0, import_client_common10.keyBy)([], "name")
|
|
6403
6437
|
};
|
|
6404
6438
|
}
|
|
6405
6439
|
return {
|
|
6406
|
-
model: (0,
|
|
6407
|
-
prisma: (0,
|
|
6440
|
+
model: (0, import_client_common10.keyBy)(this.schema.outputObjectTypes.model, "name"),
|
|
6441
|
+
prisma: (0, import_client_common10.keyBy)(this.schema.outputObjectTypes.prisma, "name")
|
|
6408
6442
|
};
|
|
6409
6443
|
}
|
|
6410
6444
|
buildRootFieldMap() {
|
|
6411
6445
|
return {
|
|
6412
|
-
...(0,
|
|
6413
|
-
...(0,
|
|
6446
|
+
...(0, import_client_common10.keyBy)(this.outputTypeMap.prisma.Query.fields, "name"),
|
|
6447
|
+
...(0, import_client_common10.keyBy)(this.outputTypeMap.prisma.Mutation.fields, "name")
|
|
6414
6448
|
};
|
|
6415
6449
|
}
|
|
6416
6450
|
buildInputTypesMap() {
|
|
@@ -6435,12 +6469,12 @@ function fullyQualifiedName(typeName, namespace3) {
|
|
|
6435
6469
|
}
|
|
6436
6470
|
|
|
6437
6471
|
// src/GenericsArgsInfo.ts
|
|
6438
|
-
var
|
|
6472
|
+
var import_client_common11 = require("@prisma/client-common");
|
|
6439
6473
|
var GenericArgsInfo = class {
|
|
6440
6474
|
constructor(_dmmf) {
|
|
6441
6475
|
this._dmmf = _dmmf;
|
|
6442
6476
|
}
|
|
6443
|
-
_cache = new
|
|
6477
|
+
_cache = new import_client_common11.Cache();
|
|
6444
6478
|
/**
|
|
6445
6479
|
* Determines if arg types need generic <$PrismaModel> argument added.
|
|
6446
6480
|
* Essentially, performs breadth-first search for any fieldRefTypes that
|
|
@@ -6586,12 +6620,12 @@ function buildDirnameDefault() {
|
|
|
6586
6620
|
}
|
|
6587
6621
|
|
|
6588
6622
|
// src/utils/buildDMMF.ts
|
|
6589
|
-
var
|
|
6623
|
+
var import_client_common12 = require("@prisma/client-common");
|
|
6590
6624
|
function buildRuntimeDataModel(datamodel, runtimeNameJs) {
|
|
6591
|
-
const runtimeDataModel = (0,
|
|
6625
|
+
const runtimeDataModel = (0, import_client_common12.dmmfToRuntimeDataModel)(datamodel);
|
|
6592
6626
|
let prunedDataModel;
|
|
6593
6627
|
if (runtimeNameJs === "wasm-engine-edge" || runtimeNameJs === "wasm-compiler-edge" || runtimeNameJs === "client") {
|
|
6594
|
-
prunedDataModel = (0,
|
|
6628
|
+
prunedDataModel = (0, import_client_common12.pruneRuntimeDataModel)(runtimeDataModel);
|
|
6595
6629
|
} else {
|
|
6596
6630
|
prunedDataModel = runtimeDataModel;
|
|
6597
6631
|
}
|
|
@@ -7295,6 +7329,7 @@ Prisma.skip = skip
|
|
|
7295
7329
|
}
|
|
7296
7330
|
|
|
7297
7331
|
// src/TSClient/Count.ts
|
|
7332
|
+
var import_client_common13 = require("@prisma/client-common");
|
|
7298
7333
|
var ts8 = __toESM(require("@prisma/ts-builders"));
|
|
7299
7334
|
var import_indent_string5 = __toESM(require("indent-string"));
|
|
7300
7335
|
var Count = class {
|
|
@@ -7349,7 +7384,7 @@ ${this.argsTypes.map((typeExport) => ts8.stringify(typeExport)).join("\n\n")}
|
|
|
7349
7384
|
}
|
|
7350
7385
|
};
|
|
7351
7386
|
function getCountArgsType(typeName, fieldName) {
|
|
7352
|
-
return `${typeName}Count${
|
|
7387
|
+
return `${typeName}Count${(0, import_client_common13.capitalize)(fieldName)}Args`;
|
|
7353
7388
|
}
|
|
7354
7389
|
|
|
7355
7390
|
// src/TSClient/FieldRefInput.ts
|
|
@@ -7387,7 +7422,7 @@ var GenerateContext = class {
|
|
|
7387
7422
|
};
|
|
7388
7423
|
|
|
7389
7424
|
// src/TSClient/PrismaClient.ts
|
|
7390
|
-
var
|
|
7425
|
+
var import_client_common15 = require("@prisma/client-common");
|
|
7391
7426
|
var import_internals6 = require("@prisma/internals");
|
|
7392
7427
|
var ts11 = __toESM(require("@prisma/ts-builders"));
|
|
7393
7428
|
var import_indent_string7 = __toESM(require("indent-string"));
|
|
@@ -7416,13 +7451,13 @@ ${(0, import_indent_string6.default)(sources.map((s) => `${s.name}?: Datasource`
|
|
|
7416
7451
|
};
|
|
7417
7452
|
|
|
7418
7453
|
// src/TSClient/globalOmit.ts
|
|
7419
|
-
var
|
|
7454
|
+
var import_client_common14 = require("@prisma/client-common");
|
|
7420
7455
|
var ts10 = __toESM(require("@prisma/ts-builders"));
|
|
7421
7456
|
function globalOmitConfig(dmmf) {
|
|
7422
7457
|
const objectType9 = ts10.objectType().addMultiple(
|
|
7423
7458
|
dmmf.datamodel.models.map((model) => {
|
|
7424
7459
|
const type = ts10.namedType(getOmitName(model.name));
|
|
7425
|
-
return ts10.property((0,
|
|
7460
|
+
return ts10.property((0, import_client_common14.uncapitalize)(model.name), type).optional();
|
|
7426
7461
|
})
|
|
7427
7462
|
);
|
|
7428
7463
|
return ts10.moduleExport(ts10.typeDeclaration("GlobalOmitConfig", objectType9));
|
|
@@ -7435,7 +7470,7 @@ function clientTypeMapModelsDefinition(context) {
|
|
|
7435
7470
|
if (modelNames.length === 0) {
|
|
7436
7471
|
meta.add(ts11.property("modelProps", ts11.neverType));
|
|
7437
7472
|
} else {
|
|
7438
|
-
meta.add(ts11.property("modelProps", ts11.unionType(modelNames.map((name) => ts11.stringLiteral((0,
|
|
7473
|
+
meta.add(ts11.property("modelProps", ts11.unionType(modelNames.map((name) => ts11.stringLiteral((0, import_client_common15.uncapitalize)(name))))));
|
|
7439
7474
|
}
|
|
7440
7475
|
const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? ts11.namedType("Prisma.TransactionIsolationLevel") : ts11.neverType;
|
|
7441
7476
|
meta.add(ts11.property("txIsolationLevel", isolationLevel));
|
|
@@ -7744,8 +7779,8 @@ var PrismaClientClass = class {
|
|
|
7744
7779
|
* @example
|
|
7745
7780
|
* \`\`\`
|
|
7746
7781
|
* const prisma = new PrismaClient()
|
|
7747
|
-
* // Fetch zero or more ${
|
|
7748
|
-
* const ${(0,
|
|
7782
|
+
* // Fetch zero or more ${(0, import_client_common15.capitalize)(example.plural)}
|
|
7783
|
+
* const ${(0, import_client_common15.uncapitalize)(example.plural)} = await prisma.${(0, import_client_common15.uncapitalize)(example.model)}.findMany()
|
|
7749
7784
|
* \`\`\`
|
|
7750
7785
|
*
|
|
7751
7786
|
*
|
|
@@ -7757,7 +7792,7 @@ var PrismaClientClass = class {
|
|
|
7757
7792
|
return `${this.jsDoc}
|
|
7758
7793
|
export class PrismaClient<
|
|
7759
7794
|
ClientOptions extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
|
|
7760
|
-
U = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never,
|
|
7795
|
+
const U = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never,
|
|
7761
7796
|
ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs
|
|
7762
7797
|
> {
|
|
7763
7798
|
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
|
|
@@ -7798,7 +7833,7 @@ ${[
|
|
|
7798
7833
|
|
|
7799
7834
|
${(0, import_indent_string7.default)(
|
|
7800
7835
|
dmmf.mappings.modelOperations.filter((m) => m.findMany).map((m) => {
|
|
7801
|
-
let methodName = (0,
|
|
7836
|
+
let methodName = (0, import_client_common15.uncapitalize)(m.model);
|
|
7802
7837
|
if (methodName === "constructor") {
|
|
7803
7838
|
methodName = '["constructor"]';
|
|
7804
7839
|
}
|
|
@@ -7807,8 +7842,8 @@ ${[
|
|
|
7807
7842
|
* \`prisma.${methodName}\`: Exposes CRUD operations for the **${m.model}** model.
|
|
7808
7843
|
* Example usage:
|
|
7809
7844
|
* \`\`\`ts
|
|
7810
|
-
* // Fetch zero or more ${
|
|
7811
|
-
* const ${(0,
|
|
7845
|
+
* // Fetch zero or more ${(0, import_client_common15.capitalize)(m.plural)}
|
|
7846
|
+
* const ${(0, import_client_common15.uncapitalize)(m.plural)} = await prisma.${methodName}.findMany()
|
|
7812
7847
|
* \`\`\`
|
|
7813
7848
|
*/
|
|
7814
7849
|
get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
@@ -7833,10 +7868,15 @@ export type LogDefinition = {
|
|
|
7833
7868
|
emit: 'stdout' | 'event'
|
|
7834
7869
|
}
|
|
7835
7870
|
|
|
7836
|
-
export type
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
:
|
|
7871
|
+
export type CheckIsLogLevel<T> = T extends LogLevel ? T : never;
|
|
7872
|
+
|
|
7873
|
+
export type GetLogType<T> = CheckIsLogLevel<
|
|
7874
|
+
T extends LogDefinition ? T['level'] : T
|
|
7875
|
+
>;
|
|
7876
|
+
|
|
7877
|
+
export type GetEvents<T extends any[]> = T extends Array<LogLevel | LogDefinition>
|
|
7878
|
+
? GetLogType<T[number]>
|
|
7879
|
+
: never;
|
|
7840
7880
|
|
|
7841
7881
|
export type QueryEvent = {
|
|
7842
7882
|
timestamp: Date
|
|
@@ -7916,16 +7956,24 @@ export type TransactionClient = Omit<Prisma.DefaultPrismaClient, runtime.ITXClie
|
|
|
7916
7956
|
ts11.property("log", ts11.array(ts11.unionType([ts11.namedType("LogLevel"), ts11.namedType("LogDefinition")]))).optional().setDocComment(ts11.docComment`
|
|
7917
7957
|
@example
|
|
7918
7958
|
\`\`\`
|
|
7919
|
-
//
|
|
7959
|
+
// Shorthand for \`emit: 'stdout'\`
|
|
7920
7960
|
log: ['query', 'info', 'warn', 'error']
|
|
7921
7961
|
|
|
7922
|
-
// Emit as events
|
|
7962
|
+
// Emit as events only
|
|
7923
7963
|
log: [
|
|
7924
|
-
{ emit: '
|
|
7925
|
-
{ emit: '
|
|
7926
|
-
{ emit: '
|
|
7927
|
-
{ emit: '
|
|
7964
|
+
{ emit: 'event', level: 'query' },
|
|
7965
|
+
{ emit: 'event', level: 'info' },
|
|
7966
|
+
{ emit: 'event', level: 'warn' }
|
|
7967
|
+
{ emit: 'event', level: 'error' }
|
|
7928
7968
|
]
|
|
7969
|
+
|
|
7970
|
+
// Emit as events and log to stdout
|
|
7971
|
+
log: [
|
|
7972
|
+
{ emit: 'stdout', level: 'query' },
|
|
7973
|
+
{ emit: 'stdout', level: 'info' },
|
|
7974
|
+
{ emit: 'stdout', level: 'warn' }
|
|
7975
|
+
{ emit: 'stdout', level: 'error' }
|
|
7976
|
+
]
|
|
7929
7977
|
\`\`\`
|
|
7930
7978
|
Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).
|
|
7931
7979
|
`)
|
|
@@ -9132,7 +9180,7 @@ var import_internals12 = require("@prisma/internals");
|
|
|
9132
9180
|
var import_ts_pattern = require("ts-pattern");
|
|
9133
9181
|
|
|
9134
9182
|
// package.json
|
|
9135
|
-
var version = "6.13.0-dev.
|
|
9183
|
+
var version = "6.13.0-dev.31";
|
|
9136
9184
|
|
|
9137
9185
|
// src/resolvePrismaClient.ts
|
|
9138
9186
|
var import_promises2 = __toESM(require("node:fs/promises"));
|
package/dist/index.mjs
CHANGED
|
@@ -4487,7 +4487,7 @@ var package_default = {
|
|
|
4487
4487
|
"@prisma/dmmf": "workspace:*",
|
|
4488
4488
|
"@prisma/driver-adapter-utils": "workspace:*",
|
|
4489
4489
|
"@prisma/engines": "workspace:*",
|
|
4490
|
-
"@prisma/engines-version": "6.
|
|
4490
|
+
"@prisma/engines-version": "6.13.0-35.361e86d0ea4987e9f53a565309b3eed797a6bcbd",
|
|
4491
4491
|
"@prisma/fetch-engine": "workspace:*",
|
|
4492
4492
|
"@prisma/generator": "workspace:*",
|
|
4493
4493
|
"@prisma/generator-helper": "workspace:*",
|
|
@@ -4496,8 +4496,8 @@ var package_default = {
|
|
|
4496
4496
|
"@prisma/internals": "workspace:*",
|
|
4497
4497
|
"@prisma/migrate": "workspace:*",
|
|
4498
4498
|
"@prisma/mini-proxy": "0.9.5",
|
|
4499
|
-
"@prisma/query-compiler-wasm": "6.
|
|
4500
|
-
"@prisma/query-engine-wasm": "6.
|
|
4499
|
+
"@prisma/query-compiler-wasm": "6.13.0-35.361e86d0ea4987e9f53a565309b3eed797a6bcbd",
|
|
4500
|
+
"@prisma/query-engine-wasm": "6.13.0-35.361e86d0ea4987e9f53a565309b3eed797a6bcbd",
|
|
4501
4501
|
"@prisma/ts-builders": "workspace:*",
|
|
4502
4502
|
"@snaplet/copycat": "6.0.0",
|
|
4503
4503
|
"@swc-node/register": "1.10.9",
|
|
@@ -4517,7 +4517,7 @@ var package_default = {
|
|
|
4517
4517
|
"decimal.js": "10.5.0",
|
|
4518
4518
|
esbuild: "0.25.5",
|
|
4519
4519
|
execa: "5.1.1",
|
|
4520
|
-
"expect-type": "1.2.
|
|
4520
|
+
"expect-type": "1.2.2",
|
|
4521
4521
|
"fs-extra": "11.3.0",
|
|
4522
4522
|
"get-stream": "6.0.1",
|
|
4523
4523
|
globby: "11.1.0",
|
|
@@ -4640,6 +4640,7 @@ import * as ts2 from "@prisma/ts-builders";
|
|
|
4640
4640
|
import indent2 from "indent-string";
|
|
4641
4641
|
|
|
4642
4642
|
// src/utils.ts
|
|
4643
|
+
import { capitalize as capitalize2 } from "@prisma/client-common";
|
|
4643
4644
|
import * as DMMF from "@prisma/dmmf";
|
|
4644
4645
|
import { assertNever } from "@prisma/internals";
|
|
4645
4646
|
import * as ts from "@prisma/ts-builders";
|
|
@@ -4774,9 +4775,6 @@ function getPayloadName(modelName, namespace3 = true) {
|
|
|
4774
4775
|
function getFieldRefsTypeName(name) {
|
|
4775
4776
|
return `${name}FieldRefs`;
|
|
4776
4777
|
}
|
|
4777
|
-
function capitalize2(str) {
|
|
4778
|
-
return str[0].toUpperCase() + str.slice(1);
|
|
4779
|
-
}
|
|
4780
4778
|
function getRefAllowedTypeName(type) {
|
|
4781
4779
|
let typeName = type.type;
|
|
4782
4780
|
if (type.isList) {
|
|
@@ -4939,6 +4937,7 @@ function wrapWithAtLeast(body, input) {
|
|
|
4939
4937
|
}
|
|
4940
4938
|
|
|
4941
4939
|
// src/TSClient/Model.ts
|
|
4940
|
+
import { capitalize as capitalize5 } from "@prisma/client-common";
|
|
4942
4941
|
import * as DMMF2 from "@prisma/dmmf";
|
|
4943
4942
|
import * as ts7 from "@prisma/ts-builders";
|
|
4944
4943
|
import indent3 from "indent-string";
|
|
@@ -6144,15 +6143,24 @@ ${ts7.stringify(buildFluentWrapperDefinition(name, this.outputType, this.context
|
|
|
6144
6143
|
function buildModelDelegateMethod(modelName, actionName, context) {
|
|
6145
6144
|
const mapping = context.dmmf.mappingsMap[modelName] ?? { model: modelName, plural: `${modelName}s` };
|
|
6146
6145
|
const modelOrType = context.dmmf.typeAndModelMap[modelName];
|
|
6147
|
-
const
|
|
6146
|
+
const dependencyValidators = getNonAggregateMethodDependencyValidations(mapping, actionName, context);
|
|
6147
|
+
const method3 = ts7.method(actionName).setDocComment(ts7.docComment(getMethodJSDocBody(actionName, mapping, modelOrType))).addParameter(getNonAggregateMethodArgs(modelName, actionName, dependencyValidators)).setReturnType(getReturnType({ modelName, actionName }));
|
|
6148
6148
|
const generic = getNonAggregateMethodGenericParam(modelName, actionName);
|
|
6149
6149
|
if (generic) {
|
|
6150
6150
|
method3.addGenericParameter(generic);
|
|
6151
6151
|
}
|
|
6152
|
+
for (const validator of dependencyValidators) {
|
|
6153
|
+
method3.addGenericParameter(validator);
|
|
6154
|
+
}
|
|
6152
6155
|
return method3;
|
|
6153
6156
|
}
|
|
6154
|
-
function getNonAggregateMethodArgs(modelName, actionName) {
|
|
6155
|
-
const makeParameter = (type2) =>
|
|
6157
|
+
function getNonAggregateMethodArgs(modelName, actionName, dependencyValidators) {
|
|
6158
|
+
const makeParameter = (type2) => {
|
|
6159
|
+
if (dependencyValidators.length > 0) {
|
|
6160
|
+
type2 = ts7.intersectionType([type2, ...dependencyValidators.map((validator) => ts7.namedType(validator.name))]);
|
|
6161
|
+
}
|
|
6162
|
+
return ts7.parameter("args", type2);
|
|
6163
|
+
};
|
|
6156
6164
|
if (actionName === DMMF2.ModelAction.count) {
|
|
6157
6165
|
const type2 = ts7.omit(
|
|
6158
6166
|
ts7.namedType(getModelArgName(modelName, DMMF2.ModelAction.findMany)),
|
|
@@ -6182,6 +6190,32 @@ function getNonAggregateMethodGenericParam(modelName, actionName) {
|
|
|
6182
6190
|
}
|
|
6183
6191
|
return arg.extends(ts7.namedType(getModelArgName(modelName, actionName)));
|
|
6184
6192
|
}
|
|
6193
|
+
function getNonAggregateMethodDependencyValidations(modelMapping, actionName, context) {
|
|
6194
|
+
const outputFieldName = modelMapping[actionName];
|
|
6195
|
+
if (!outputFieldName) {
|
|
6196
|
+
throw new Error(`Missing mapping for ${modelMapping.model}.${actionName}`);
|
|
6197
|
+
}
|
|
6198
|
+
const outputField = context.dmmf.outputTypeMap.prisma["Query"].fields.find((f) => f.name === outputFieldName) ?? context.dmmf.outputTypeMap.prisma["Mutation"].fields.find((f) => f.name === outputFieldName);
|
|
6199
|
+
if (!outputField) {
|
|
6200
|
+
throw new Error(`Can't find output field ${outputFieldName} in the schema`);
|
|
6201
|
+
}
|
|
6202
|
+
const validators = [];
|
|
6203
|
+
for (const args of outputField.args) {
|
|
6204
|
+
if (args.requiresOtherFields === void 0) {
|
|
6205
|
+
continue;
|
|
6206
|
+
}
|
|
6207
|
+
const objectType9 = ts7.objectType();
|
|
6208
|
+
for (const reqArg of args.requiresOtherFields) {
|
|
6209
|
+
objectType9.add(ts7.property(reqArg, ts7.objectType()));
|
|
6210
|
+
}
|
|
6211
|
+
validators.push(
|
|
6212
|
+
ts7.genericParameter(`${capitalize5(args.name)}DependenciesValidator`).extends(
|
|
6213
|
+
ts7.conditionalType().check(ts7.stringLiteral(args.name)).extends(ts7.namedType("Prisma.Keys<T>")).then(objectType9).else(ts7.objectType())
|
|
6214
|
+
)
|
|
6215
|
+
);
|
|
6216
|
+
}
|
|
6217
|
+
return validators;
|
|
6218
|
+
}
|
|
6185
6219
|
function getReturnType({
|
|
6186
6220
|
modelName,
|
|
6187
6221
|
actionName,
|
|
@@ -7293,6 +7327,7 @@ Prisma.skip = skip
|
|
|
7293
7327
|
}
|
|
7294
7328
|
|
|
7295
7329
|
// src/TSClient/Count.ts
|
|
7330
|
+
import { capitalize as capitalize6 } from "@prisma/client-common";
|
|
7296
7331
|
import * as ts8 from "@prisma/ts-builders";
|
|
7297
7332
|
import indent5 from "indent-string";
|
|
7298
7333
|
var Count = class {
|
|
@@ -7347,7 +7382,7 @@ ${this.argsTypes.map((typeExport) => ts8.stringify(typeExport)).join("\n\n")}
|
|
|
7347
7382
|
}
|
|
7348
7383
|
};
|
|
7349
7384
|
function getCountArgsType(typeName, fieldName) {
|
|
7350
|
-
return `${typeName}Count${
|
|
7385
|
+
return `${typeName}Count${capitalize6(fieldName)}Args`;
|
|
7351
7386
|
}
|
|
7352
7387
|
|
|
7353
7388
|
// src/TSClient/FieldRefInput.ts
|
|
@@ -7385,7 +7420,7 @@ var GenerateContext = class {
|
|
|
7385
7420
|
};
|
|
7386
7421
|
|
|
7387
7422
|
// src/TSClient/PrismaClient.ts
|
|
7388
|
-
import { uncapitalize as uncapitalize7 } from "@prisma/client-common";
|
|
7423
|
+
import { capitalize as capitalize7, uncapitalize as uncapitalize7 } from "@prisma/client-common";
|
|
7389
7424
|
import { assertNever as assertNever2 } from "@prisma/internals";
|
|
7390
7425
|
import * as ts11 from "@prisma/ts-builders";
|
|
7391
7426
|
import indent7 from "indent-string";
|
|
@@ -7742,7 +7777,7 @@ var PrismaClientClass = class {
|
|
|
7742
7777
|
* @example
|
|
7743
7778
|
* \`\`\`
|
|
7744
7779
|
* const prisma = new PrismaClient()
|
|
7745
|
-
* // Fetch zero or more ${
|
|
7780
|
+
* // Fetch zero or more ${capitalize7(example.plural)}
|
|
7746
7781
|
* const ${uncapitalize7(example.plural)} = await prisma.${uncapitalize7(example.model)}.findMany()
|
|
7747
7782
|
* \`\`\`
|
|
7748
7783
|
*
|
|
@@ -7755,7 +7790,7 @@ var PrismaClientClass = class {
|
|
|
7755
7790
|
return `${this.jsDoc}
|
|
7756
7791
|
export class PrismaClient<
|
|
7757
7792
|
ClientOptions extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
|
|
7758
|
-
U = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never,
|
|
7793
|
+
const U = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never,
|
|
7759
7794
|
ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs
|
|
7760
7795
|
> {
|
|
7761
7796
|
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
|
|
@@ -7805,7 +7840,7 @@ ${[
|
|
|
7805
7840
|
* \`prisma.${methodName}\`: Exposes CRUD operations for the **${m.model}** model.
|
|
7806
7841
|
* Example usage:
|
|
7807
7842
|
* \`\`\`ts
|
|
7808
|
-
* // Fetch zero or more ${
|
|
7843
|
+
* // Fetch zero or more ${capitalize7(m.plural)}
|
|
7809
7844
|
* const ${uncapitalize7(m.plural)} = await prisma.${methodName}.findMany()
|
|
7810
7845
|
* \`\`\`
|
|
7811
7846
|
*/
|
|
@@ -7831,10 +7866,15 @@ export type LogDefinition = {
|
|
|
7831
7866
|
emit: 'stdout' | 'event'
|
|
7832
7867
|
}
|
|
7833
7868
|
|
|
7834
|
-
export type
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
:
|
|
7869
|
+
export type CheckIsLogLevel<T> = T extends LogLevel ? T : never;
|
|
7870
|
+
|
|
7871
|
+
export type GetLogType<T> = CheckIsLogLevel<
|
|
7872
|
+
T extends LogDefinition ? T['level'] : T
|
|
7873
|
+
>;
|
|
7874
|
+
|
|
7875
|
+
export type GetEvents<T extends any[]> = T extends Array<LogLevel | LogDefinition>
|
|
7876
|
+
? GetLogType<T[number]>
|
|
7877
|
+
: never;
|
|
7838
7878
|
|
|
7839
7879
|
export type QueryEvent = {
|
|
7840
7880
|
timestamp: Date
|
|
@@ -7914,16 +7954,24 @@ export type TransactionClient = Omit<Prisma.DefaultPrismaClient, runtime.ITXClie
|
|
|
7914
7954
|
ts11.property("log", ts11.array(ts11.unionType([ts11.namedType("LogLevel"), ts11.namedType("LogDefinition")]))).optional().setDocComment(ts11.docComment`
|
|
7915
7955
|
@example
|
|
7916
7956
|
\`\`\`
|
|
7917
|
-
//
|
|
7957
|
+
// Shorthand for \`emit: 'stdout'\`
|
|
7918
7958
|
log: ['query', 'info', 'warn', 'error']
|
|
7919
7959
|
|
|
7920
|
-
// Emit as events
|
|
7960
|
+
// Emit as events only
|
|
7921
7961
|
log: [
|
|
7922
|
-
{ emit: '
|
|
7923
|
-
{ emit: '
|
|
7924
|
-
{ emit: '
|
|
7925
|
-
{ emit: '
|
|
7962
|
+
{ emit: 'event', level: 'query' },
|
|
7963
|
+
{ emit: 'event', level: 'info' },
|
|
7964
|
+
{ emit: 'event', level: 'warn' }
|
|
7965
|
+
{ emit: 'event', level: 'error' }
|
|
7926
7966
|
]
|
|
7967
|
+
|
|
7968
|
+
// Emit as events and log to stdout
|
|
7969
|
+
log: [
|
|
7970
|
+
{ emit: 'stdout', level: 'query' },
|
|
7971
|
+
{ emit: 'stdout', level: 'info' },
|
|
7972
|
+
{ emit: 'stdout', level: 'warn' }
|
|
7973
|
+
{ emit: 'stdout', level: 'error' }
|
|
7974
|
+
]
|
|
7927
7975
|
\`\`\`
|
|
7928
7976
|
Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).
|
|
7929
7977
|
`)
|
|
@@ -9130,7 +9178,7 @@ import { ClientEngineType as ClientEngineType4, getClientEngineType as getClient
|
|
|
9130
9178
|
import { match } from "ts-pattern";
|
|
9131
9179
|
|
|
9132
9180
|
// package.json
|
|
9133
|
-
var version = "6.13.0-dev.
|
|
9181
|
+
var version = "6.13.0-dev.31";
|
|
9134
9182
|
|
|
9135
9183
|
// src/resolvePrismaClient.ts
|
|
9136
9184
|
var import_execa = __toESM(require_execa());
|
package/dist/utils.d.ts
CHANGED
|
@@ -30,7 +30,6 @@ export declare function getModelArgName(modelName: string, action?: DMMF.ModelAc
|
|
|
30
30
|
export declare function getPayloadName(modelName: string, namespace?: boolean): string;
|
|
31
31
|
export declare function getFieldRefsTypeName(name: string): string;
|
|
32
32
|
export declare function getType(name: string, isList: boolean, isOptional?: boolean): string;
|
|
33
|
-
export declare function capitalize(str: string): string;
|
|
34
33
|
export declare function getRefAllowedTypeName(type: DMMF.OutputTypeRef): string;
|
|
35
34
|
export declare function appendSkipType(context: GenerateContext, type: ts.TypeBuilder): ts.TypeBuilder;
|
|
36
35
|
export declare const extArgsParam: ts.GenericParameter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-generator-js",
|
|
3
|
-
"version": "6.13.0-dev.
|
|
3
|
+
"version": "6.13.0-dev.31",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@antfu/ni": "0.21.12",
|
|
28
|
-
"@prisma/engines-version": "6.
|
|
28
|
+
"@prisma/engines-version": "6.13.0-35.361e86d0ea4987e9f53a565309b3eed797a6bcbd",
|
|
29
29
|
"ci-info": "4.2.0",
|
|
30
30
|
"env-paths": "2.2.1",
|
|
31
31
|
"indent-string": "4.0.0",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"pkg-up": "3.1.0",
|
|
34
34
|
"pluralize": "8.0.0",
|
|
35
35
|
"ts-pattern": "5.6.2",
|
|
36
|
-
"@prisma/client-common": "6.13.0-dev.
|
|
37
|
-
"@prisma/debug": "6.13.0-dev.
|
|
38
|
-
"@prisma/dmmf": "6.13.0-dev.
|
|
39
|
-
"@prisma/fetch-engine": "6.13.0-dev.
|
|
40
|
-
"@prisma/generator": "6.13.0-dev.
|
|
41
|
-
"@prisma/get-platform": "6.13.0-dev.
|
|
42
|
-
"@prisma/ts-builders": "6.13.0-dev.
|
|
43
|
-
"@prisma/internals": "6.13.0-dev.
|
|
36
|
+
"@prisma/client-common": "6.13.0-dev.31",
|
|
37
|
+
"@prisma/debug": "6.13.0-dev.31",
|
|
38
|
+
"@prisma/dmmf": "6.13.0-dev.31",
|
|
39
|
+
"@prisma/fetch-engine": "6.13.0-dev.31",
|
|
40
|
+
"@prisma/generator": "6.13.0-dev.31",
|
|
41
|
+
"@prisma/get-platform": "6.13.0-dev.31",
|
|
42
|
+
"@prisma/ts-builders": "6.13.0-dev.31",
|
|
43
|
+
"@prisma/internals": "6.13.0-dev.31"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/pluralize": "0.0.33",
|