@prisma/client-generator-js 6.12.0-dev.6 → 6.12.0-dev.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/dist/index.js +25 -25
- package/dist/index.mjs +32 -32
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -4157,7 +4157,7 @@ function getMappings(mappings, datamodel) {
|
|
|
4157
4157
|
return model.fields.some((f) => f.kind !== "object");
|
|
4158
4158
|
}).map((mapping) => ({
|
|
4159
4159
|
model: mapping.model,
|
|
4160
|
-
plural: (0, import_pluralize.default)((0, import_client_common.
|
|
4160
|
+
plural: (0, import_pluralize.default)((0, import_client_common.uncapitalize)(mapping.model)),
|
|
4161
4161
|
// TODO not needed anymore
|
|
4162
4162
|
findUnique: mapping.findUnique || mapping.findSingle,
|
|
4163
4163
|
findUniqueOrThrow: mapping.findUniqueOrThrow,
|
|
@@ -5026,7 +5026,7 @@ const ${ctx.singular} = await ${ctx.method}({
|
|
|
5026
5026
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
5027
5027
|
@example
|
|
5028
5028
|
// Create many ${ctx.plural}
|
|
5029
|
-
const ${(0, import_client_common4.
|
|
5029
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5030
5030
|
data: [
|
|
5031
5031
|
// ... provide data here
|
|
5032
5032
|
]
|
|
@@ -5040,7 +5040,7 @@ const ${(0, import_client_common4.lowerCase)(ctx.mapping.model)} = await ${ctx.m
|
|
|
5040
5040
|
body: (ctx) => {
|
|
5041
5041
|
const onlySelect = ctx.firstScalar ? `
|
|
5042
5042
|
// Create many ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
5043
|
-
const ${(0, import_client_common4.
|
|
5043
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)}With${(0, import_client_common4.capitalize)(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
5044
5044
|
select: { ${ctx.firstScalar.name}: true },
|
|
5045
5045
|
data: [
|
|
5046
5046
|
// ... provide data here
|
|
@@ -5050,7 +5050,7 @@ const ${(0, import_client_common4.lowerCase)(ctx.mapping.model)}With${(0, import
|
|
|
5050
5050
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
5051
5051
|
@example
|
|
5052
5052
|
// Create many ${ctx.plural}
|
|
5053
|
-
const ${(0, import_client_common4.
|
|
5053
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5054
5054
|
data: [
|
|
5055
5055
|
// ... provide data here
|
|
5056
5056
|
]
|
|
@@ -5068,7 +5068,7 @@ ${undefinedNote}
|
|
|
5068
5068
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
5069
5069
|
@example
|
|
5070
5070
|
// Get one ${ctx.singular}
|
|
5071
|
-
const ${(0, import_client_common4.
|
|
5071
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5072
5072
|
where: {
|
|
5073
5073
|
// ... provide filter here
|
|
5074
5074
|
}
|
|
@@ -5083,7 +5083,7 @@ if no matches were found.
|
|
|
5083
5083
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
5084
5084
|
@example
|
|
5085
5085
|
// Get one ${ctx.singular}
|
|
5086
|
-
const ${(0, import_client_common4.
|
|
5086
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5087
5087
|
where: {
|
|
5088
5088
|
// ... provide filter here
|
|
5089
5089
|
}
|
|
@@ -5098,7 +5098,7 @@ ${undefinedNote}
|
|
|
5098
5098
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
5099
5099
|
@example
|
|
5100
5100
|
// Get one ${ctx.singular}
|
|
5101
|
-
const ${(0, import_client_common4.
|
|
5101
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5102
5102
|
where: {
|
|
5103
5103
|
// ... provide filter here
|
|
5104
5104
|
}
|
|
@@ -5119,7 +5119,7 @@ ${undefinedNote}
|
|
|
5119
5119
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
5120
5120
|
@example
|
|
5121
5121
|
// Get one ${ctx.singular}
|
|
5122
|
-
const ${(0, import_client_common4.
|
|
5122
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5123
5123
|
where: {
|
|
5124
5124
|
// ... provide filter here
|
|
5125
5125
|
}
|
|
@@ -5137,7 +5137,7 @@ const ${(0, import_client_common4.lowerCase)(ctx.mapping.model)} = await ${ctx.m
|
|
|
5137
5137
|
body: (ctx) => {
|
|
5138
5138
|
const onlySelect = ctx.firstScalar ? `
|
|
5139
5139
|
// Only select the \`${ctx.firstScalar.name}\`
|
|
5140
|
-
const ${(0, import_client_common4.
|
|
5140
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)}With${(0, import_client_common4.capitalize)(ctx.firstScalar.name)}Only = await ${ctx.method}({ select: { ${ctx.firstScalar.name}: true } })` : "";
|
|
5141
5141
|
return `Find zero or more ${ctx.plural} that matches the filter.
|
|
5142
5142
|
${undefinedNote}
|
|
5143
5143
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to filter and select certain fields only.
|
|
@@ -5163,7 +5163,7 @@ ${onlySelect}
|
|
|
5163
5163
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one ${ctx.singular}.
|
|
5164
5164
|
@example
|
|
5165
5165
|
// Update one ${ctx.singular}
|
|
5166
|
-
const ${(0, import_client_common4.
|
|
5166
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5167
5167
|
where: {
|
|
5168
5168
|
// ... provide filter here
|
|
5169
5169
|
},
|
|
@@ -5182,7 +5182,7 @@ const ${(0, import_client_common4.lowerCase)(ctx.mapping.model)} = await ${ctx.m
|
|
|
5182
5182
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update or create a ${ctx.singular}.
|
|
5183
5183
|
@example
|
|
5184
5184
|
// Update or create a ${ctx.singular}
|
|
5185
|
-
const ${(0, import_client_common4.
|
|
5185
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5186
5186
|
create: {
|
|
5187
5187
|
// ... data to create a ${ctx.singular}
|
|
5188
5188
|
},
|
|
@@ -5276,7 +5276,7 @@ ${undefinedNote}
|
|
|
5276
5276
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one or more rows.
|
|
5277
5277
|
@example
|
|
5278
5278
|
// Update many ${ctx.plural}
|
|
5279
|
-
const ${(0, import_client_common4.
|
|
5279
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5280
5280
|
where: {
|
|
5281
5281
|
// ... provide filter here
|
|
5282
5282
|
},
|
|
@@ -5295,7 +5295,7 @@ const ${(0, import_client_common4.lowerCase)(ctx.mapping.model)} = await ${ctx.m
|
|
|
5295
5295
|
body: (ctx) => {
|
|
5296
5296
|
const onlySelect = ctx.firstScalar ? `
|
|
5297
5297
|
// Update zero or more ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
5298
|
-
const ${(0, import_client_common4.
|
|
5298
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)}With${(0, import_client_common4.capitalize)(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
5299
5299
|
select: { ${ctx.firstScalar.name}: true },
|
|
5300
5300
|
where: {
|
|
5301
5301
|
// ... provide filter here
|
|
@@ -5308,7 +5308,7 @@ const ${(0, import_client_common4.lowerCase)(ctx.mapping.model)}With${(0, import
|
|
|
5308
5308
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update many ${ctx.plural}.
|
|
5309
5309
|
@example
|
|
5310
5310
|
// Update many ${ctx.plural}
|
|
5311
|
-
const ${(0, import_client_common4.
|
|
5311
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5312
5312
|
where: {
|
|
5313
5313
|
// ... provide filter here
|
|
5314
5314
|
},
|
|
@@ -5346,7 +5346,7 @@ const { count } = await ${ctx.method}({
|
|
|
5346
5346
|
body: (ctx) => `Perform aggregation operations on a ${ctx.singular}.
|
|
5347
5347
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which aggregations you would like to apply.
|
|
5348
5348
|
@example
|
|
5349
|
-
const ${(0, import_client_common4.
|
|
5349
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5350
5350
|
pipeline: [
|
|
5351
5351
|
{ $match: { status: "registered" } },
|
|
5352
5352
|
{ $group: { _id: "$country", total: { $sum: 1 } } }
|
|
@@ -5361,7 +5361,7 @@ const ${(0, import_client_common4.lowerCase)(ctx.mapping.model)} = await ${ctx.m
|
|
|
5361
5361
|
body: (ctx) => `Find zero or more ${ctx.plural} that matches the filter.
|
|
5362
5362
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which filters you would like to apply.
|
|
5363
5363
|
@example
|
|
5364
|
-
const ${(0, import_client_common4.
|
|
5364
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
5365
5365
|
filter: { age: { $gt: 25 } }
|
|
5366
5366
|
})`,
|
|
5367
5367
|
fields: {
|
|
@@ -5377,7 +5377,7 @@ function getMethodJSDocBody(action, mapping, model) {
|
|
|
5377
5377
|
singular: (0, import_client_common5.capitalize)(mapping.model),
|
|
5378
5378
|
plural: (0, import_client_common5.capitalize)(mapping.plural),
|
|
5379
5379
|
firstScalar: model.fields.find((f) => f.kind === "scalar"),
|
|
5380
|
-
method: `prisma.${(0, import_client_common5.
|
|
5380
|
+
method: `prisma.${(0, import_client_common5.uncapitalize)(mapping.model)}.${action}`,
|
|
5381
5381
|
action,
|
|
5382
5382
|
mapping,
|
|
5383
5383
|
model
|
|
@@ -5592,7 +5592,7 @@ function buildModelPayload(model, context) {
|
|
|
5592
5592
|
scalars.add(buildModelOutputProperty(field, context.dmmf));
|
|
5593
5593
|
}
|
|
5594
5594
|
}
|
|
5595
|
-
const scalarsType = isComposite ? scalars : ts5.namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts5.namedType("ExtArgs").subKey("result").subKey((0, import_client_common6.
|
|
5595
|
+
const scalarsType = isComposite ? scalars : ts5.namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts5.namedType("ExtArgs").subKey("result").subKey((0, import_client_common6.uncapitalize)(model.name)));
|
|
5596
5596
|
const payloadTypeDeclaration = ts5.typeDeclaration(
|
|
5597
5597
|
getPayloadName(model.name, false),
|
|
5598
5598
|
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))
|
|
@@ -5638,7 +5638,7 @@ function buildSelectType({
|
|
|
5638
5638
|
return buildExport(typeName, selectType);
|
|
5639
5639
|
}
|
|
5640
5640
|
function modelResultExtensionsType(modelName) {
|
|
5641
|
-
return extArgsParam.toArgument().subKey("result").subKey((0, import_client_common7.
|
|
5641
|
+
return extArgsParam.toArgument().subKey("result").subKey((0, import_client_common7.uncapitalize)(modelName));
|
|
5642
5642
|
}
|
|
5643
5643
|
function buildScalarSelectType({ modelName, fields, context }) {
|
|
5644
5644
|
const object = buildSelectOrIncludeObject(
|
|
@@ -7418,7 +7418,7 @@ function globalOmitConfig(dmmf) {
|
|
|
7418
7418
|
const objectType9 = ts10.objectType().addMultiple(
|
|
7419
7419
|
dmmf.datamodel.models.map((model) => {
|
|
7420
7420
|
const type = ts10.namedType(getOmitName(model.name));
|
|
7421
|
-
return ts10.property((0, import_client_common11.
|
|
7421
|
+
return ts10.property((0, import_client_common11.uncapitalize)(model.name), type).optional();
|
|
7422
7422
|
})
|
|
7423
7423
|
);
|
|
7424
7424
|
return ts10.moduleExport(ts10.typeDeclaration("GlobalOmitConfig", objectType9));
|
|
@@ -7431,7 +7431,7 @@ function clientTypeMapModelsDefinition(context) {
|
|
|
7431
7431
|
if (modelNames.length === 0) {
|
|
7432
7432
|
meta.add(ts11.property("modelProps", ts11.neverType));
|
|
7433
7433
|
} else {
|
|
7434
|
-
meta.add(ts11.property("modelProps", ts11.unionType(modelNames.map((name) => ts11.stringLiteral((0, import_client_common12.
|
|
7434
|
+
meta.add(ts11.property("modelProps", ts11.unionType(modelNames.map((name) => ts11.stringLiteral((0, import_client_common12.uncapitalize)(name))))));
|
|
7435
7435
|
}
|
|
7436
7436
|
const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? ts11.namedType("Prisma.TransactionIsolationLevel") : ts11.neverType;
|
|
7437
7437
|
meta.add(ts11.property("txIsolationLevel", isolationLevel));
|
|
@@ -7741,7 +7741,7 @@ var PrismaClientClass = class {
|
|
|
7741
7741
|
* \`\`\`
|
|
7742
7742
|
* const prisma = new PrismaClient()
|
|
7743
7743
|
* // Fetch zero or more ${capitalize2(example.plural)}
|
|
7744
|
-
* const ${(0, import_client_common12.
|
|
7744
|
+
* const ${(0, import_client_common12.uncapitalize)(example.plural)} = await prisma.${(0, import_client_common12.uncapitalize)(example.model)}.findMany()
|
|
7745
7745
|
* \`\`\`
|
|
7746
7746
|
*
|
|
7747
7747
|
*
|
|
@@ -7794,7 +7794,7 @@ ${[
|
|
|
7794
7794
|
|
|
7795
7795
|
${(0, import_indent_string7.default)(
|
|
7796
7796
|
dmmf.mappings.modelOperations.filter((m) => m.findMany).map((m) => {
|
|
7797
|
-
let methodName = (0, import_client_common12.
|
|
7797
|
+
let methodName = (0, import_client_common12.uncapitalize)(m.model);
|
|
7798
7798
|
if (methodName === "constructor") {
|
|
7799
7799
|
methodName = '["constructor"]';
|
|
7800
7800
|
}
|
|
@@ -7804,7 +7804,7 @@ ${[
|
|
|
7804
7804
|
* Example usage:
|
|
7805
7805
|
* \`\`\`ts
|
|
7806
7806
|
* // Fetch zero or more ${capitalize2(m.plural)}
|
|
7807
|
-
* const ${(0, import_client_common12.
|
|
7807
|
+
* const ${(0, import_client_common12.uncapitalize)(m.plural)} = await prisma.${methodName}.findMany()
|
|
7808
7808
|
* \`\`\`
|
|
7809
7809
|
*/
|
|
7810
7810
|
get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
@@ -9128,7 +9128,7 @@ var import_internals12 = require("@prisma/internals");
|
|
|
9128
9128
|
var import_ts_pattern = require("ts-pattern");
|
|
9129
9129
|
|
|
9130
9130
|
// package.json
|
|
9131
|
-
var version = "6.12.0-dev.
|
|
9131
|
+
var version = "6.12.0-dev.8";
|
|
9132
9132
|
|
|
9133
9133
|
// src/resolvePrismaClient.ts
|
|
9134
9134
|
var import_promises2 = __toESM(require("node:fs/promises"));
|
package/dist/index.mjs
CHANGED
|
@@ -4129,7 +4129,7 @@ var require_execa = __commonJS({
|
|
|
4129
4129
|
});
|
|
4130
4130
|
|
|
4131
4131
|
// src/externalToInternalDmmf.ts
|
|
4132
|
-
import { capitalize,
|
|
4132
|
+
import { capitalize, uncapitalize } from "@prisma/client-common";
|
|
4133
4133
|
import pluralize from "pluralize";
|
|
4134
4134
|
function externalToInternalDmmf(document) {
|
|
4135
4135
|
return {
|
|
@@ -4146,7 +4146,7 @@ function getMappings(mappings, datamodel) {
|
|
|
4146
4146
|
return model.fields.some((f) => f.kind !== "object");
|
|
4147
4147
|
}).map((mapping) => ({
|
|
4148
4148
|
model: mapping.model,
|
|
4149
|
-
plural: pluralize(
|
|
4149
|
+
plural: pluralize(uncapitalize(mapping.model)),
|
|
4150
4150
|
// TODO not needed anymore
|
|
4151
4151
|
findUnique: mapping.findUnique || mapping.findSingle,
|
|
4152
4152
|
findUniqueOrThrow: mapping.findUniqueOrThrow,
|
|
@@ -4944,11 +4944,11 @@ import { klona } from "klona";
|
|
|
4944
4944
|
import * as ts3 from "@prisma/ts-builders";
|
|
4945
4945
|
|
|
4946
4946
|
// src/TSClient/helpers.ts
|
|
4947
|
-
import { capitalize as capitalize4,
|
|
4947
|
+
import { capitalize as capitalize4, uncapitalize as uncapitalize3 } from "@prisma/client-common";
|
|
4948
4948
|
import pluralize2 from "pluralize";
|
|
4949
4949
|
|
|
4950
4950
|
// src/TSClient/jsdoc.ts
|
|
4951
|
-
import { capitalize as capitalize3,
|
|
4951
|
+
import { capitalize as capitalize3, uncapitalize as uncapitalize2 } from "@prisma/client-common";
|
|
4952
4952
|
var Docs = {
|
|
4953
4953
|
cursor: `{@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}`,
|
|
4954
4954
|
pagination: `{@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}`,
|
|
@@ -5021,7 +5021,7 @@ const ${ctx.singular} = await ${ctx.method}({
|
|
|
5021
5021
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
5022
5022
|
@example
|
|
5023
5023
|
// Create many ${ctx.plural}
|
|
5024
|
-
const ${
|
|
5024
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
5025
5025
|
data: [
|
|
5026
5026
|
// ... provide data here
|
|
5027
5027
|
]
|
|
@@ -5035,7 +5035,7 @@ const ${lowerCase2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
5035
5035
|
body: (ctx) => {
|
|
5036
5036
|
const onlySelect = ctx.firstScalar ? `
|
|
5037
5037
|
// Create many ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
5038
|
-
const ${
|
|
5038
|
+
const ${uncapitalize2(ctx.mapping.model)}With${capitalize3(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
5039
5039
|
select: { ${ctx.firstScalar.name}: true },
|
|
5040
5040
|
data: [
|
|
5041
5041
|
// ... provide data here
|
|
@@ -5045,7 +5045,7 @@ const ${lowerCase2(ctx.mapping.model)}With${capitalize3(ctx.firstScalar.name)}On
|
|
|
5045
5045
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
5046
5046
|
@example
|
|
5047
5047
|
// Create many ${ctx.plural}
|
|
5048
|
-
const ${
|
|
5048
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
5049
5049
|
data: [
|
|
5050
5050
|
// ... provide data here
|
|
5051
5051
|
]
|
|
@@ -5063,7 +5063,7 @@ ${undefinedNote}
|
|
|
5063
5063
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
5064
5064
|
@example
|
|
5065
5065
|
// Get one ${ctx.singular}
|
|
5066
|
-
const ${
|
|
5066
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
5067
5067
|
where: {
|
|
5068
5068
|
// ... provide filter here
|
|
5069
5069
|
}
|
|
@@ -5078,7 +5078,7 @@ if no matches were found.
|
|
|
5078
5078
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
5079
5079
|
@example
|
|
5080
5080
|
// Get one ${ctx.singular}
|
|
5081
|
-
const ${
|
|
5081
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
5082
5082
|
where: {
|
|
5083
5083
|
// ... provide filter here
|
|
5084
5084
|
}
|
|
@@ -5093,7 +5093,7 @@ ${undefinedNote}
|
|
|
5093
5093
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
5094
5094
|
@example
|
|
5095
5095
|
// Get one ${ctx.singular}
|
|
5096
|
-
const ${
|
|
5096
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
5097
5097
|
where: {
|
|
5098
5098
|
// ... provide filter here
|
|
5099
5099
|
}
|
|
@@ -5114,7 +5114,7 @@ ${undefinedNote}
|
|
|
5114
5114
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
5115
5115
|
@example
|
|
5116
5116
|
// Get one ${ctx.singular}
|
|
5117
|
-
const ${
|
|
5117
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
5118
5118
|
where: {
|
|
5119
5119
|
// ... provide filter here
|
|
5120
5120
|
}
|
|
@@ -5132,7 +5132,7 @@ const ${lowerCase2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
5132
5132
|
body: (ctx) => {
|
|
5133
5133
|
const onlySelect = ctx.firstScalar ? `
|
|
5134
5134
|
// Only select the \`${ctx.firstScalar.name}\`
|
|
5135
|
-
const ${
|
|
5135
|
+
const ${uncapitalize2(ctx.mapping.model)}With${capitalize3(ctx.firstScalar.name)}Only = await ${ctx.method}({ select: { ${ctx.firstScalar.name}: true } })` : "";
|
|
5136
5136
|
return `Find zero or more ${ctx.plural} that matches the filter.
|
|
5137
5137
|
${undefinedNote}
|
|
5138
5138
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to filter and select certain fields only.
|
|
@@ -5158,7 +5158,7 @@ ${onlySelect}
|
|
|
5158
5158
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one ${ctx.singular}.
|
|
5159
5159
|
@example
|
|
5160
5160
|
// Update one ${ctx.singular}
|
|
5161
|
-
const ${
|
|
5161
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
5162
5162
|
where: {
|
|
5163
5163
|
// ... provide filter here
|
|
5164
5164
|
},
|
|
@@ -5177,7 +5177,7 @@ const ${lowerCase2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
5177
5177
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update or create a ${ctx.singular}.
|
|
5178
5178
|
@example
|
|
5179
5179
|
// Update or create a ${ctx.singular}
|
|
5180
|
-
const ${
|
|
5180
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
5181
5181
|
create: {
|
|
5182
5182
|
// ... data to create a ${ctx.singular}
|
|
5183
5183
|
},
|
|
@@ -5271,7 +5271,7 @@ ${undefinedNote}
|
|
|
5271
5271
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one or more rows.
|
|
5272
5272
|
@example
|
|
5273
5273
|
// Update many ${ctx.plural}
|
|
5274
|
-
const ${
|
|
5274
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
5275
5275
|
where: {
|
|
5276
5276
|
// ... provide filter here
|
|
5277
5277
|
},
|
|
@@ -5290,7 +5290,7 @@ const ${lowerCase2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
5290
5290
|
body: (ctx) => {
|
|
5291
5291
|
const onlySelect = ctx.firstScalar ? `
|
|
5292
5292
|
// Update zero or more ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
5293
|
-
const ${
|
|
5293
|
+
const ${uncapitalize2(ctx.mapping.model)}With${capitalize3(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
5294
5294
|
select: { ${ctx.firstScalar.name}: true },
|
|
5295
5295
|
where: {
|
|
5296
5296
|
// ... provide filter here
|
|
@@ -5303,7 +5303,7 @@ const ${lowerCase2(ctx.mapping.model)}With${capitalize3(ctx.firstScalar.name)}On
|
|
|
5303
5303
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update many ${ctx.plural}.
|
|
5304
5304
|
@example
|
|
5305
5305
|
// Update many ${ctx.plural}
|
|
5306
|
-
const ${
|
|
5306
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
5307
5307
|
where: {
|
|
5308
5308
|
// ... provide filter here
|
|
5309
5309
|
},
|
|
@@ -5341,7 +5341,7 @@ const { count } = await ${ctx.method}({
|
|
|
5341
5341
|
body: (ctx) => `Perform aggregation operations on a ${ctx.singular}.
|
|
5342
5342
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which aggregations you would like to apply.
|
|
5343
5343
|
@example
|
|
5344
|
-
const ${
|
|
5344
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
5345
5345
|
pipeline: [
|
|
5346
5346
|
{ $match: { status: "registered" } },
|
|
5347
5347
|
{ $group: { _id: "$country", total: { $sum: 1 } } }
|
|
@@ -5356,7 +5356,7 @@ const ${lowerCase2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
5356
5356
|
body: (ctx) => `Find zero or more ${ctx.plural} that matches the filter.
|
|
5357
5357
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which filters you would like to apply.
|
|
5358
5358
|
@example
|
|
5359
|
-
const ${
|
|
5359
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
5360
5360
|
filter: { age: { $gt: 25 } }
|
|
5361
5361
|
})`,
|
|
5362
5362
|
fields: {
|
|
@@ -5372,7 +5372,7 @@ function getMethodJSDocBody(action, mapping, model) {
|
|
|
5372
5372
|
singular: capitalize4(mapping.model),
|
|
5373
5373
|
plural: capitalize4(mapping.plural),
|
|
5374
5374
|
firstScalar: model.fields.find((f) => f.kind === "scalar"),
|
|
5375
|
-
method: `prisma.${
|
|
5375
|
+
method: `prisma.${uncapitalize3(mapping.model)}.${action}`,
|
|
5376
5376
|
action,
|
|
5377
5377
|
mapping,
|
|
5378
5378
|
model
|
|
@@ -5569,7 +5569,7 @@ function enumTypeName(ref) {
|
|
|
5569
5569
|
}
|
|
5570
5570
|
|
|
5571
5571
|
// src/TSClient/Payload.ts
|
|
5572
|
-
import {
|
|
5572
|
+
import { uncapitalize as uncapitalize4 } from "@prisma/client-common";
|
|
5573
5573
|
import * as ts5 from "@prisma/ts-builders";
|
|
5574
5574
|
function buildModelPayload(model, context) {
|
|
5575
5575
|
const isComposite = context.dmmf.isComposite(model.name);
|
|
@@ -5587,7 +5587,7 @@ function buildModelPayload(model, context) {
|
|
|
5587
5587
|
scalars.add(buildModelOutputProperty(field, context.dmmf));
|
|
5588
5588
|
}
|
|
5589
5589
|
}
|
|
5590
|
-
const scalarsType = isComposite ? scalars : ts5.namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts5.namedType("ExtArgs").subKey("result").subKey(
|
|
5590
|
+
const scalarsType = isComposite ? scalars : ts5.namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts5.namedType("ExtArgs").subKey("result").subKey(uncapitalize4(model.name)));
|
|
5591
5591
|
const payloadTypeDeclaration = ts5.typeDeclaration(
|
|
5592
5592
|
getPayloadName(model.name, false),
|
|
5593
5593
|
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))
|
|
@@ -5599,7 +5599,7 @@ function buildModelPayload(model, context) {
|
|
|
5599
5599
|
}
|
|
5600
5600
|
|
|
5601
5601
|
// src/TSClient/SelectIncludeOmit.ts
|
|
5602
|
-
import {
|
|
5602
|
+
import { uncapitalize as uncapitalize5 } from "@prisma/client-common";
|
|
5603
5603
|
import * as ts6 from "@prisma/ts-builders";
|
|
5604
5604
|
function buildIncludeType({
|
|
5605
5605
|
modelName,
|
|
@@ -5633,7 +5633,7 @@ function buildSelectType({
|
|
|
5633
5633
|
return buildExport(typeName, selectType);
|
|
5634
5634
|
}
|
|
5635
5635
|
function modelResultExtensionsType(modelName) {
|
|
5636
|
-
return extArgsParam.toArgument().subKey("result").subKey(
|
|
5636
|
+
return extArgsParam.toArgument().subKey("result").subKey(uncapitalize5(modelName));
|
|
5637
5637
|
}
|
|
5638
5638
|
function buildScalarSelectType({ modelName, fields, context }) {
|
|
5639
5639
|
const object = buildSelectOrIncludeObject(
|
|
@@ -7381,7 +7381,7 @@ var GenerateContext = class {
|
|
|
7381
7381
|
};
|
|
7382
7382
|
|
|
7383
7383
|
// src/TSClient/PrismaClient.ts
|
|
7384
|
-
import {
|
|
7384
|
+
import { uncapitalize as uncapitalize7 } from "@prisma/client-common";
|
|
7385
7385
|
import { assertNever as assertNever2 } from "@prisma/internals";
|
|
7386
7386
|
import * as ts11 from "@prisma/ts-builders";
|
|
7387
7387
|
import indent7 from "indent-string";
|
|
@@ -7410,13 +7410,13 @@ ${indent6(sources.map((s) => `${s.name}?: Datasource`).join("\n"), 2)}
|
|
|
7410
7410
|
};
|
|
7411
7411
|
|
|
7412
7412
|
// src/TSClient/globalOmit.ts
|
|
7413
|
-
import {
|
|
7413
|
+
import { uncapitalize as uncapitalize6 } from "@prisma/client-common";
|
|
7414
7414
|
import * as ts10 from "@prisma/ts-builders";
|
|
7415
7415
|
function globalOmitConfig(dmmf) {
|
|
7416
7416
|
const objectType9 = ts10.objectType().addMultiple(
|
|
7417
7417
|
dmmf.datamodel.models.map((model) => {
|
|
7418
7418
|
const type = ts10.namedType(getOmitName(model.name));
|
|
7419
|
-
return ts10.property(
|
|
7419
|
+
return ts10.property(uncapitalize6(model.name), type).optional();
|
|
7420
7420
|
})
|
|
7421
7421
|
);
|
|
7422
7422
|
return ts10.moduleExport(ts10.typeDeclaration("GlobalOmitConfig", objectType9));
|
|
@@ -7429,7 +7429,7 @@ function clientTypeMapModelsDefinition(context) {
|
|
|
7429
7429
|
if (modelNames.length === 0) {
|
|
7430
7430
|
meta.add(ts11.property("modelProps", ts11.neverType));
|
|
7431
7431
|
} else {
|
|
7432
|
-
meta.add(ts11.property("modelProps", ts11.unionType(modelNames.map((name) => ts11.stringLiteral(
|
|
7432
|
+
meta.add(ts11.property("modelProps", ts11.unionType(modelNames.map((name) => ts11.stringLiteral(uncapitalize7(name))))));
|
|
7433
7433
|
}
|
|
7434
7434
|
const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? ts11.namedType("Prisma.TransactionIsolationLevel") : ts11.neverType;
|
|
7435
7435
|
meta.add(ts11.property("txIsolationLevel", isolationLevel));
|
|
@@ -7739,7 +7739,7 @@ var PrismaClientClass = class {
|
|
|
7739
7739
|
* \`\`\`
|
|
7740
7740
|
* const prisma = new PrismaClient()
|
|
7741
7741
|
* // Fetch zero or more ${capitalize2(example.plural)}
|
|
7742
|
-
* const ${
|
|
7742
|
+
* const ${uncapitalize7(example.plural)} = await prisma.${uncapitalize7(example.model)}.findMany()
|
|
7743
7743
|
* \`\`\`
|
|
7744
7744
|
*
|
|
7745
7745
|
*
|
|
@@ -7792,7 +7792,7 @@ ${[
|
|
|
7792
7792
|
|
|
7793
7793
|
${indent7(
|
|
7794
7794
|
dmmf.mappings.modelOperations.filter((m) => m.findMany).map((m) => {
|
|
7795
|
-
let methodName =
|
|
7795
|
+
let methodName = uncapitalize7(m.model);
|
|
7796
7796
|
if (methodName === "constructor") {
|
|
7797
7797
|
methodName = '["constructor"]';
|
|
7798
7798
|
}
|
|
@@ -7802,7 +7802,7 @@ ${[
|
|
|
7802
7802
|
* Example usage:
|
|
7803
7803
|
* \`\`\`ts
|
|
7804
7804
|
* // Fetch zero or more ${capitalize2(m.plural)}
|
|
7805
|
-
* const ${
|
|
7805
|
+
* const ${uncapitalize7(m.plural)} = await prisma.${methodName}.findMany()
|
|
7806
7806
|
* \`\`\`
|
|
7807
7807
|
*/
|
|
7808
7808
|
get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
@@ -9126,7 +9126,7 @@ import { ClientEngineType as ClientEngineType4, getClientEngineType as getClient
|
|
|
9126
9126
|
import { match } from "ts-pattern";
|
|
9127
9127
|
|
|
9128
9128
|
// package.json
|
|
9129
|
-
var version = "6.12.0-dev.
|
|
9129
|
+
var version = "6.12.0-dev.8";
|
|
9130
9130
|
|
|
9131
9131
|
// src/resolvePrismaClient.ts
|
|
9132
9132
|
var import_execa = __toESM(require_execa());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-generator-js",
|
|
3
|
-
"version": "6.12.0-dev.
|
|
3
|
+
"version": "6.12.0-dev.8",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -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/
|
|
37
|
-
"@prisma/
|
|
38
|
-
"@prisma/dmmf": "6.12.0-dev.
|
|
39
|
-
"@prisma/fetch-engine": "6.12.0-dev.
|
|
40
|
-
"@prisma/generator": "6.12.0-dev.
|
|
41
|
-
"@prisma/get-platform": "6.12.0-dev.
|
|
42
|
-
"@prisma/ts-builders": "6.12.0-dev.
|
|
43
|
-
"@prisma/internals": "6.12.0-dev.
|
|
36
|
+
"@prisma/client-common": "6.12.0-dev.8",
|
|
37
|
+
"@prisma/debug": "6.12.0-dev.8",
|
|
38
|
+
"@prisma/dmmf": "6.12.0-dev.8",
|
|
39
|
+
"@prisma/fetch-engine": "6.12.0-dev.8",
|
|
40
|
+
"@prisma/generator": "6.12.0-dev.8",
|
|
41
|
+
"@prisma/get-platform": "6.12.0-dev.8",
|
|
42
|
+
"@prisma/ts-builders": "6.12.0-dev.8",
|
|
43
|
+
"@prisma/internals": "6.12.0-dev.8"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/pluralize": "0.0.33",
|