@prisma/client-generator-ts 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 +33 -33
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -2194,7 +2194,7 @@ function getMappings(mappings, datamodel) {
|
|
|
2194
2194
|
return model.fields.some((f) => f.kind !== "object");
|
|
2195
2195
|
}).map((mapping) => ({
|
|
2196
2196
|
model: mapping.model,
|
|
2197
|
-
plural: (0, import_pluralize.default)((0, import_client_common.
|
|
2197
|
+
plural: (0, import_pluralize.default)((0, import_client_common.uncapitalize)(mapping.model)),
|
|
2198
2198
|
// TODO not needed anymore
|
|
2199
2199
|
findUnique: mapping.findUnique || mapping.findSingle,
|
|
2200
2200
|
findUniqueOrThrow: mapping.findUniqueOrThrow,
|
|
@@ -3032,7 +3032,7 @@ const ${ctx.singular} = await ${ctx.method}({
|
|
|
3032
3032
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
3033
3033
|
@example
|
|
3034
3034
|
// Create many ${ctx.plural}
|
|
3035
|
-
const ${(0, import_client_common7.
|
|
3035
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3036
3036
|
data: [
|
|
3037
3037
|
// ... provide data here
|
|
3038
3038
|
]
|
|
@@ -3046,7 +3046,7 @@ const ${(0, import_client_common7.lowerCase)(ctx.mapping.model)} = await ${ctx.m
|
|
|
3046
3046
|
body: (ctx) => {
|
|
3047
3047
|
const onlySelect = ctx.firstScalar ? `
|
|
3048
3048
|
// Create many ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
3049
|
-
const ${(0, import_client_common7.
|
|
3049
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)}With${(0, import_client_common7.capitalize)(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
3050
3050
|
select: { ${ctx.firstScalar.name}: true },
|
|
3051
3051
|
data: [
|
|
3052
3052
|
// ... provide data here
|
|
@@ -3056,7 +3056,7 @@ const ${(0, import_client_common7.lowerCase)(ctx.mapping.model)}With${(0, import
|
|
|
3056
3056
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
3057
3057
|
@example
|
|
3058
3058
|
// Create many ${ctx.plural}
|
|
3059
|
-
const ${(0, import_client_common7.
|
|
3059
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3060
3060
|
data: [
|
|
3061
3061
|
// ... provide data here
|
|
3062
3062
|
]
|
|
@@ -3074,7 +3074,7 @@ ${undefinedNote}
|
|
|
3074
3074
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3075
3075
|
@example
|
|
3076
3076
|
// Get one ${ctx.singular}
|
|
3077
|
-
const ${(0, import_client_common7.
|
|
3077
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3078
3078
|
where: {
|
|
3079
3079
|
// ... provide filter here
|
|
3080
3080
|
}
|
|
@@ -3089,7 +3089,7 @@ if no matches were found.
|
|
|
3089
3089
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3090
3090
|
@example
|
|
3091
3091
|
// Get one ${ctx.singular}
|
|
3092
|
-
const ${(0, import_client_common7.
|
|
3092
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3093
3093
|
where: {
|
|
3094
3094
|
// ... provide filter here
|
|
3095
3095
|
}
|
|
@@ -3104,7 +3104,7 @@ ${undefinedNote}
|
|
|
3104
3104
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3105
3105
|
@example
|
|
3106
3106
|
// Get one ${ctx.singular}
|
|
3107
|
-
const ${(0, import_client_common7.
|
|
3107
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3108
3108
|
where: {
|
|
3109
3109
|
// ... provide filter here
|
|
3110
3110
|
}
|
|
@@ -3125,7 +3125,7 @@ ${undefinedNote}
|
|
|
3125
3125
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3126
3126
|
@example
|
|
3127
3127
|
// Get one ${ctx.singular}
|
|
3128
|
-
const ${(0, import_client_common7.
|
|
3128
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3129
3129
|
where: {
|
|
3130
3130
|
// ... provide filter here
|
|
3131
3131
|
}
|
|
@@ -3143,7 +3143,7 @@ const ${(0, import_client_common7.lowerCase)(ctx.mapping.model)} = await ${ctx.m
|
|
|
3143
3143
|
body: (ctx) => {
|
|
3144
3144
|
const onlySelect = ctx.firstScalar ? `
|
|
3145
3145
|
// Only select the \`${ctx.firstScalar.name}\`
|
|
3146
|
-
const ${(0, import_client_common7.
|
|
3146
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)}With${(0, import_client_common7.capitalize)(ctx.firstScalar.name)}Only = await ${ctx.method}({ select: { ${ctx.firstScalar.name}: true } })` : "";
|
|
3147
3147
|
return `Find zero or more ${ctx.plural} that matches the filter.
|
|
3148
3148
|
${undefinedNote}
|
|
3149
3149
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to filter and select certain fields only.
|
|
@@ -3169,7 +3169,7 @@ ${onlySelect}
|
|
|
3169
3169
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one ${ctx.singular}.
|
|
3170
3170
|
@example
|
|
3171
3171
|
// Update one ${ctx.singular}
|
|
3172
|
-
const ${(0, import_client_common7.
|
|
3172
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3173
3173
|
where: {
|
|
3174
3174
|
// ... provide filter here
|
|
3175
3175
|
},
|
|
@@ -3188,7 +3188,7 @@ const ${(0, import_client_common7.lowerCase)(ctx.mapping.model)} = await ${ctx.m
|
|
|
3188
3188
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update or create a ${ctx.singular}.
|
|
3189
3189
|
@example
|
|
3190
3190
|
// Update or create a ${ctx.singular}
|
|
3191
|
-
const ${(0, import_client_common7.
|
|
3191
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3192
3192
|
create: {
|
|
3193
3193
|
// ... data to create a ${ctx.singular}
|
|
3194
3194
|
},
|
|
@@ -3282,7 +3282,7 @@ ${undefinedNote}
|
|
|
3282
3282
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one or more rows.
|
|
3283
3283
|
@example
|
|
3284
3284
|
// Update many ${ctx.plural}
|
|
3285
|
-
const ${(0, import_client_common7.
|
|
3285
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3286
3286
|
where: {
|
|
3287
3287
|
// ... provide filter here
|
|
3288
3288
|
},
|
|
@@ -3301,7 +3301,7 @@ const ${(0, import_client_common7.lowerCase)(ctx.mapping.model)} = await ${ctx.m
|
|
|
3301
3301
|
body: (ctx) => {
|
|
3302
3302
|
const onlySelect = ctx.firstScalar ? `
|
|
3303
3303
|
// Update zero or more ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
3304
|
-
const ${(0, import_client_common7.
|
|
3304
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)}With${(0, import_client_common7.capitalize)(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
3305
3305
|
select: { ${ctx.firstScalar.name}: true },
|
|
3306
3306
|
where: {
|
|
3307
3307
|
// ... provide filter here
|
|
@@ -3314,7 +3314,7 @@ const ${(0, import_client_common7.lowerCase)(ctx.mapping.model)}With${(0, import
|
|
|
3314
3314
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update many ${ctx.plural}.
|
|
3315
3315
|
@example
|
|
3316
3316
|
// Update many ${ctx.plural}
|
|
3317
|
-
const ${(0, import_client_common7.
|
|
3317
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3318
3318
|
where: {
|
|
3319
3319
|
// ... provide filter here
|
|
3320
3320
|
},
|
|
@@ -3352,7 +3352,7 @@ const { count } = await ${ctx.method}({
|
|
|
3352
3352
|
body: (ctx) => `Perform aggregation operations on a ${ctx.singular}.
|
|
3353
3353
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which aggregations you would like to apply.
|
|
3354
3354
|
@example
|
|
3355
|
-
const ${(0, import_client_common7.
|
|
3355
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3356
3356
|
pipeline: [
|
|
3357
3357
|
{ $match: { status: "registered" } },
|
|
3358
3358
|
{ $group: { _id: "$country", total: { $sum: 1 } } }
|
|
@@ -3367,7 +3367,7 @@ const ${(0, import_client_common7.lowerCase)(ctx.mapping.model)} = await ${ctx.m
|
|
|
3367
3367
|
body: (ctx) => `Find zero or more ${ctx.plural} that matches the filter.
|
|
3368
3368
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which filters you would like to apply.
|
|
3369
3369
|
@example
|
|
3370
|
-
const ${(0, import_client_common7.
|
|
3370
|
+
const ${(0, import_client_common7.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3371
3371
|
filter: { age: { $gt: 25 } }
|
|
3372
3372
|
})`,
|
|
3373
3373
|
fields: {
|
|
@@ -3383,7 +3383,7 @@ function getMethodJSDocBody(action, mapping, model) {
|
|
|
3383
3383
|
singular: (0, import_client_common8.capitalize)(mapping.model),
|
|
3384
3384
|
plural: (0, import_client_common8.capitalize)(mapping.plural),
|
|
3385
3385
|
firstScalar: model.fields.find((f) => f.kind === "scalar"),
|
|
3386
|
-
method: `prisma.${(0, import_client_common8.
|
|
3386
|
+
method: `prisma.${(0, import_client_common8.uncapitalize)(mapping.model)}.${action}`,
|
|
3387
3387
|
action,
|
|
3388
3388
|
mapping,
|
|
3389
3389
|
model
|
|
@@ -3719,7 +3719,7 @@ function getPrismaClientClassDocComment({ dmmf }) {
|
|
|
3719
3719
|
\`\`\`
|
|
3720
3720
|
const prisma = new PrismaClient()
|
|
3721
3721
|
// Fetch zero or more ${capitalize3(example.plural)}
|
|
3722
|
-
const ${(0, import_client_common11.
|
|
3722
|
+
const ${(0, import_client_common11.uncapitalize)(example.plural)} = await prisma.${(0, import_client_common11.uncapitalize)(example.model)}.findMany()
|
|
3723
3723
|
\`\`\`
|
|
3724
3724
|
|
|
3725
3725
|
Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
|
|
@@ -3788,7 +3788,7 @@ ${[
|
|
|
3788
3788
|
|
|
3789
3789
|
${(0, import_indent_string3.default)(
|
|
3790
3790
|
dmmf.mappings.modelOperations.filter((m) => m.findMany).map((m) => {
|
|
3791
|
-
let methodName = (0, import_client_common11.
|
|
3791
|
+
let methodName = (0, import_client_common11.uncapitalize)(m.model);
|
|
3792
3792
|
if (methodName === "constructor") {
|
|
3793
3793
|
methodName = '["constructor"]';
|
|
3794
3794
|
}
|
|
@@ -3798,7 +3798,7 @@ ${[
|
|
|
3798
3798
|
* Example usage:
|
|
3799
3799
|
* \`\`\`ts
|
|
3800
3800
|
* // Fetch zero or more ${capitalize3(m.plural)}
|
|
3801
|
-
* const ${(0, import_client_common11.
|
|
3801
|
+
* const ${(0, import_client_common11.uncapitalize)(m.plural)} = await prisma.${methodName}.findMany()
|
|
3802
3802
|
* \`\`\`
|
|
3803
3803
|
*/
|
|
3804
3804
|
get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
@@ -4328,7 +4328,7 @@ function buildModelPayload(model, context) {
|
|
|
4328
4328
|
scalars.add(buildModelOutputProperty(field, context.dmmf));
|
|
4329
4329
|
}
|
|
4330
4330
|
}
|
|
4331
|
-
const scalarsType = isComposite ? scalars : ts11.namedType("runtime.Types.Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts11.namedType("ExtArgs").subKey("result").subKey((0, import_client_common12.
|
|
4331
|
+
const scalarsType = isComposite ? scalars : ts11.namedType("runtime.Types.Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts11.namedType("ExtArgs").subKey("result").subKey((0, import_client_common12.uncapitalize)(model.name)));
|
|
4332
4332
|
const payloadTypeDeclaration = ts11.typeDeclaration(
|
|
4333
4333
|
getPayloadName(model.name, false),
|
|
4334
4334
|
ts11.objectType().add(ts11.property("name", ts11.stringLiteral(model.name))).add(ts11.property("objects", objects)).add(ts11.property("scalars", scalarsType)).add(ts11.property("composites", composites))
|
|
@@ -4374,7 +4374,7 @@ function buildSelectType({
|
|
|
4374
4374
|
return buildExport(typeName, selectType);
|
|
4375
4375
|
}
|
|
4376
4376
|
function modelResultExtensionsType(modelName) {
|
|
4377
|
-
return extArgsParam.toArgument().subKey("result").subKey((0, import_client_common13.
|
|
4377
|
+
return extArgsParam.toArgument().subKey("result").subKey((0, import_client_common13.uncapitalize)(modelName));
|
|
4378
4378
|
}
|
|
4379
4379
|
function buildScalarSelectType({ modelName, fields, context }) {
|
|
4380
4380
|
const object = buildSelectOrIncludeObject(
|
|
@@ -5503,7 +5503,7 @@ function globalOmitConfig(dmmf) {
|
|
|
5503
5503
|
const objectType11 = ts15.objectType().addMultiple(
|
|
5504
5504
|
dmmf.datamodel.models.map((model) => {
|
|
5505
5505
|
const type = ts15.namedType(`Prisma.${getOmitName(model.name)}`);
|
|
5506
|
-
return ts15.property((0, import_client_common14.
|
|
5506
|
+
return ts15.property((0, import_client_common14.uncapitalize)(model.name), type).optional();
|
|
5507
5507
|
})
|
|
5508
5508
|
);
|
|
5509
5509
|
return ts15.moduleExport(ts15.typeDeclaration("GlobalOmitConfig", objectType11));
|
|
@@ -5528,7 +5528,7 @@ function clientTypeMapModelsDefinition(context) {
|
|
|
5528
5528
|
if (modelNames.length === 0) {
|
|
5529
5529
|
meta.add(ts16.property("modelProps", ts16.neverType));
|
|
5530
5530
|
} else {
|
|
5531
|
-
meta.add(ts16.property("modelProps", ts16.unionType(modelNames.map((name) => ts16.stringLiteral((0, import_client_common15.
|
|
5531
|
+
meta.add(ts16.property("modelProps", ts16.unionType(modelNames.map((name) => ts16.stringLiteral((0, import_client_common15.uncapitalize)(name))))));
|
|
5532
5532
|
}
|
|
5533
5533
|
const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? ts16.namedType("TransactionIsolationLevel") : ts16.neverType;
|
|
5534
5534
|
meta.add(ts16.property("txIsolationLevel", isolationLevel));
|
|
@@ -6490,7 +6490,7 @@ var import_get_tsconfig = require("get-tsconfig");
|
|
|
6490
6490
|
var import_ts_pattern2 = require("ts-pattern");
|
|
6491
6491
|
|
|
6492
6492
|
// package.json
|
|
6493
|
-
var version = "6.12.0-dev.
|
|
6493
|
+
var version = "6.12.0-dev.8";
|
|
6494
6494
|
|
|
6495
6495
|
// src/module-format.ts
|
|
6496
6496
|
function parseModuleFormat(format) {
|
package/dist/index.mjs
CHANGED
|
@@ -2167,7 +2167,7 @@ var require_lib = __commonJS({
|
|
|
2167
2167
|
});
|
|
2168
2168
|
|
|
2169
2169
|
// src/externalToInternalDmmf.ts
|
|
2170
|
-
import { capitalize,
|
|
2170
|
+
import { capitalize, uncapitalize } from "@prisma/client-common";
|
|
2171
2171
|
import pluralize from "pluralize";
|
|
2172
2172
|
function externalToInternalDmmf(document) {
|
|
2173
2173
|
return {
|
|
@@ -2184,7 +2184,7 @@ function getMappings(mappings, datamodel) {
|
|
|
2184
2184
|
return model.fields.some((f) => f.kind !== "object");
|
|
2185
2185
|
}).map((mapping) => ({
|
|
2186
2186
|
model: mapping.model,
|
|
2187
|
-
plural: pluralize(
|
|
2187
|
+
plural: pluralize(uncapitalize(mapping.model)),
|
|
2188
2188
|
// TODO not needed anymore
|
|
2189
2189
|
findUnique: mapping.findUnique || mapping.findSingle,
|
|
2190
2190
|
findUniqueOrThrow: mapping.findUniqueOrThrow,
|
|
@@ -2954,11 +2954,11 @@ import {
|
|
|
2954
2954
|
} from "@prisma/client-common";
|
|
2955
2955
|
|
|
2956
2956
|
// src/TSClient/helpers.ts
|
|
2957
|
-
import { capitalize as capitalize5,
|
|
2957
|
+
import { capitalize as capitalize5, uncapitalize as uncapitalize3 } from "@prisma/client-common";
|
|
2958
2958
|
import pluralize2 from "pluralize";
|
|
2959
2959
|
|
|
2960
2960
|
// src/TSClient/jsdoc.ts
|
|
2961
|
-
import { capitalize as capitalize4,
|
|
2961
|
+
import { capitalize as capitalize4, uncapitalize as uncapitalize2 } from "@prisma/client-common";
|
|
2962
2962
|
var Docs = {
|
|
2963
2963
|
cursor: `{@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}`,
|
|
2964
2964
|
pagination: `{@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}`,
|
|
@@ -3031,7 +3031,7 @@ const ${ctx.singular} = await ${ctx.method}({
|
|
|
3031
3031
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
3032
3032
|
@example
|
|
3033
3033
|
// Create many ${ctx.plural}
|
|
3034
|
-
const ${
|
|
3034
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
3035
3035
|
data: [
|
|
3036
3036
|
// ... provide data here
|
|
3037
3037
|
]
|
|
@@ -3045,7 +3045,7 @@ const ${lowerCase2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
3045
3045
|
body: (ctx) => {
|
|
3046
3046
|
const onlySelect = ctx.firstScalar ? `
|
|
3047
3047
|
// Create many ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
3048
|
-
const ${
|
|
3048
|
+
const ${uncapitalize2(ctx.mapping.model)}With${capitalize4(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
3049
3049
|
select: { ${ctx.firstScalar.name}: true },
|
|
3050
3050
|
data: [
|
|
3051
3051
|
// ... provide data here
|
|
@@ -3055,7 +3055,7 @@ const ${lowerCase2(ctx.mapping.model)}With${capitalize4(ctx.firstScalar.name)}On
|
|
|
3055
3055
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
3056
3056
|
@example
|
|
3057
3057
|
// Create many ${ctx.plural}
|
|
3058
|
-
const ${
|
|
3058
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
3059
3059
|
data: [
|
|
3060
3060
|
// ... provide data here
|
|
3061
3061
|
]
|
|
@@ -3073,7 +3073,7 @@ ${undefinedNote}
|
|
|
3073
3073
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3074
3074
|
@example
|
|
3075
3075
|
// Get one ${ctx.singular}
|
|
3076
|
-
const ${
|
|
3076
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
3077
3077
|
where: {
|
|
3078
3078
|
// ... provide filter here
|
|
3079
3079
|
}
|
|
@@ -3088,7 +3088,7 @@ if no matches were found.
|
|
|
3088
3088
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3089
3089
|
@example
|
|
3090
3090
|
// Get one ${ctx.singular}
|
|
3091
|
-
const ${
|
|
3091
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
3092
3092
|
where: {
|
|
3093
3093
|
// ... provide filter here
|
|
3094
3094
|
}
|
|
@@ -3103,7 +3103,7 @@ ${undefinedNote}
|
|
|
3103
3103
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3104
3104
|
@example
|
|
3105
3105
|
// Get one ${ctx.singular}
|
|
3106
|
-
const ${
|
|
3106
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
3107
3107
|
where: {
|
|
3108
3108
|
// ... provide filter here
|
|
3109
3109
|
}
|
|
@@ -3124,7 +3124,7 @@ ${undefinedNote}
|
|
|
3124
3124
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3125
3125
|
@example
|
|
3126
3126
|
// Get one ${ctx.singular}
|
|
3127
|
-
const ${
|
|
3127
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
3128
3128
|
where: {
|
|
3129
3129
|
// ... provide filter here
|
|
3130
3130
|
}
|
|
@@ -3142,7 +3142,7 @@ const ${lowerCase2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
3142
3142
|
body: (ctx) => {
|
|
3143
3143
|
const onlySelect = ctx.firstScalar ? `
|
|
3144
3144
|
// Only select the \`${ctx.firstScalar.name}\`
|
|
3145
|
-
const ${
|
|
3145
|
+
const ${uncapitalize2(ctx.mapping.model)}With${capitalize4(ctx.firstScalar.name)}Only = await ${ctx.method}({ select: { ${ctx.firstScalar.name}: true } })` : "";
|
|
3146
3146
|
return `Find zero or more ${ctx.plural} that matches the filter.
|
|
3147
3147
|
${undefinedNote}
|
|
3148
3148
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to filter and select certain fields only.
|
|
@@ -3168,7 +3168,7 @@ ${onlySelect}
|
|
|
3168
3168
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one ${ctx.singular}.
|
|
3169
3169
|
@example
|
|
3170
3170
|
// Update one ${ctx.singular}
|
|
3171
|
-
const ${
|
|
3171
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
3172
3172
|
where: {
|
|
3173
3173
|
// ... provide filter here
|
|
3174
3174
|
},
|
|
@@ -3187,7 +3187,7 @@ const ${lowerCase2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
3187
3187
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update or create a ${ctx.singular}.
|
|
3188
3188
|
@example
|
|
3189
3189
|
// Update or create a ${ctx.singular}
|
|
3190
|
-
const ${
|
|
3190
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
3191
3191
|
create: {
|
|
3192
3192
|
// ... data to create a ${ctx.singular}
|
|
3193
3193
|
},
|
|
@@ -3281,7 +3281,7 @@ ${undefinedNote}
|
|
|
3281
3281
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one or more rows.
|
|
3282
3282
|
@example
|
|
3283
3283
|
// Update many ${ctx.plural}
|
|
3284
|
-
const ${
|
|
3284
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
3285
3285
|
where: {
|
|
3286
3286
|
// ... provide filter here
|
|
3287
3287
|
},
|
|
@@ -3300,7 +3300,7 @@ const ${lowerCase2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
3300
3300
|
body: (ctx) => {
|
|
3301
3301
|
const onlySelect = ctx.firstScalar ? `
|
|
3302
3302
|
// Update zero or more ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
3303
|
-
const ${
|
|
3303
|
+
const ${uncapitalize2(ctx.mapping.model)}With${capitalize4(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
3304
3304
|
select: { ${ctx.firstScalar.name}: true },
|
|
3305
3305
|
where: {
|
|
3306
3306
|
// ... provide filter here
|
|
@@ -3313,7 +3313,7 @@ const ${lowerCase2(ctx.mapping.model)}With${capitalize4(ctx.firstScalar.name)}On
|
|
|
3313
3313
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update many ${ctx.plural}.
|
|
3314
3314
|
@example
|
|
3315
3315
|
// Update many ${ctx.plural}
|
|
3316
|
-
const ${
|
|
3316
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
3317
3317
|
where: {
|
|
3318
3318
|
// ... provide filter here
|
|
3319
3319
|
},
|
|
@@ -3351,7 +3351,7 @@ const { count } = await ${ctx.method}({
|
|
|
3351
3351
|
body: (ctx) => `Perform aggregation operations on a ${ctx.singular}.
|
|
3352
3352
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which aggregations you would like to apply.
|
|
3353
3353
|
@example
|
|
3354
|
-
const ${
|
|
3354
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
3355
3355
|
pipeline: [
|
|
3356
3356
|
{ $match: { status: "registered" } },
|
|
3357
3357
|
{ $group: { _id: "$country", total: { $sum: 1 } } }
|
|
@@ -3366,7 +3366,7 @@ const ${lowerCase2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
3366
3366
|
body: (ctx) => `Find zero or more ${ctx.plural} that matches the filter.
|
|
3367
3367
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which filters you would like to apply.
|
|
3368
3368
|
@example
|
|
3369
|
-
const ${
|
|
3369
|
+
const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
3370
3370
|
filter: { age: { $gt: 25 } }
|
|
3371
3371
|
})`,
|
|
3372
3372
|
fields: {
|
|
@@ -3382,7 +3382,7 @@ function getMethodJSDocBody(action, mapping, model) {
|
|
|
3382
3382
|
singular: capitalize5(mapping.model),
|
|
3383
3383
|
plural: capitalize5(mapping.plural),
|
|
3384
3384
|
firstScalar: model.fields.find((f) => f.kind === "scalar"),
|
|
3385
|
-
method: `prisma.${
|
|
3385
|
+
method: `prisma.${uncapitalize3(mapping.model)}.${action}`,
|
|
3386
3386
|
action,
|
|
3387
3387
|
mapping,
|
|
3388
3388
|
model
|
|
@@ -3504,7 +3504,7 @@ function buildInlineDatasource(ds) {
|
|
|
3504
3504
|
}
|
|
3505
3505
|
|
|
3506
3506
|
// src/TSClient/PrismaClient.ts
|
|
3507
|
-
import {
|
|
3507
|
+
import { uncapitalize as uncapitalize4 } from "@prisma/client-common";
|
|
3508
3508
|
import * as ts4 from "@prisma/ts-builders";
|
|
3509
3509
|
import indent3 from "indent-string";
|
|
3510
3510
|
|
|
@@ -3718,7 +3718,7 @@ function getPrismaClientClassDocComment({ dmmf }) {
|
|
|
3718
3718
|
\`\`\`
|
|
3719
3719
|
const prisma = new PrismaClient()
|
|
3720
3720
|
// Fetch zero or more ${capitalize3(example.plural)}
|
|
3721
|
-
const ${
|
|
3721
|
+
const ${uncapitalize4(example.plural)} = await prisma.${uncapitalize4(example.model)}.findMany()
|
|
3722
3722
|
\`\`\`
|
|
3723
3723
|
|
|
3724
3724
|
Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
|
|
@@ -3787,7 +3787,7 @@ ${[
|
|
|
3787
3787
|
|
|
3788
3788
|
${indent3(
|
|
3789
3789
|
dmmf.mappings.modelOperations.filter((m) => m.findMany).map((m) => {
|
|
3790
|
-
let methodName =
|
|
3790
|
+
let methodName = uncapitalize4(m.model);
|
|
3791
3791
|
if (methodName === "constructor") {
|
|
3792
3792
|
methodName = '["constructor"]';
|
|
3793
3793
|
}
|
|
@@ -3797,7 +3797,7 @@ ${[
|
|
|
3797
3797
|
* Example usage:
|
|
3798
3798
|
* \`\`\`ts
|
|
3799
3799
|
* // Fetch zero or more ${capitalize3(m.plural)}
|
|
3800
|
-
* const ${
|
|
3800
|
+
* const ${uncapitalize4(m.plural)} = await prisma.${methodName}.findMany()
|
|
3801
3801
|
* \`\`\`
|
|
3802
3802
|
*/
|
|
3803
3803
|
get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
@@ -4309,7 +4309,7 @@ ${this.stringifyFields()}
|
|
|
4309
4309
|
};
|
|
4310
4310
|
|
|
4311
4311
|
// src/TSClient/Payload.ts
|
|
4312
|
-
import {
|
|
4312
|
+
import { uncapitalize as uncapitalize5 } from "@prisma/client-common";
|
|
4313
4313
|
import * as ts11 from "@prisma/ts-builders";
|
|
4314
4314
|
function buildModelPayload(model, context) {
|
|
4315
4315
|
const isComposite = context.dmmf.isComposite(model.name);
|
|
@@ -4327,7 +4327,7 @@ function buildModelPayload(model, context) {
|
|
|
4327
4327
|
scalars.add(buildModelOutputProperty(field, context.dmmf));
|
|
4328
4328
|
}
|
|
4329
4329
|
}
|
|
4330
|
-
const scalarsType = isComposite ? scalars : ts11.namedType("runtime.Types.Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts11.namedType("ExtArgs").subKey("result").subKey(
|
|
4330
|
+
const scalarsType = isComposite ? scalars : ts11.namedType("runtime.Types.Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts11.namedType("ExtArgs").subKey("result").subKey(uncapitalize5(model.name)));
|
|
4331
4331
|
const payloadTypeDeclaration = ts11.typeDeclaration(
|
|
4332
4332
|
getPayloadName(model.name, false),
|
|
4333
4333
|
ts11.objectType().add(ts11.property("name", ts11.stringLiteral(model.name))).add(ts11.property("objects", objects)).add(ts11.property("scalars", scalarsType)).add(ts11.property("composites", composites))
|
|
@@ -4339,7 +4339,7 @@ function buildModelPayload(model, context) {
|
|
|
4339
4339
|
}
|
|
4340
4340
|
|
|
4341
4341
|
// src/TSClient/SelectIncludeOmit.ts
|
|
4342
|
-
import {
|
|
4342
|
+
import { uncapitalize as uncapitalize6 } from "@prisma/client-common";
|
|
4343
4343
|
import * as ts12 from "@prisma/ts-builders";
|
|
4344
4344
|
function buildIncludeType({
|
|
4345
4345
|
modelName,
|
|
@@ -4373,7 +4373,7 @@ function buildSelectType({
|
|
|
4373
4373
|
return buildExport(typeName, selectType);
|
|
4374
4374
|
}
|
|
4375
4375
|
function modelResultExtensionsType(modelName) {
|
|
4376
|
-
return extArgsParam.toArgument().subKey("result").subKey(
|
|
4376
|
+
return extArgsParam.toArgument().subKey("result").subKey(uncapitalize6(modelName));
|
|
4377
4377
|
}
|
|
4378
4378
|
function buildScalarSelectType({ modelName, fields, context }) {
|
|
4379
4379
|
const object = buildSelectOrIncludeObject(
|
|
@@ -5496,20 +5496,20 @@ export type ${this.type.name}<$PrismaModel> = FieldRefInputType<$PrismaModel, ${
|
|
|
5496
5496
|
};
|
|
5497
5497
|
|
|
5498
5498
|
// src/TSClient/globalOmit.ts
|
|
5499
|
-
import {
|
|
5499
|
+
import { uncapitalize as uncapitalize7 } from "@prisma/client-common";
|
|
5500
5500
|
import * as ts15 from "@prisma/ts-builders";
|
|
5501
5501
|
function globalOmitConfig(dmmf) {
|
|
5502
5502
|
const objectType11 = ts15.objectType().addMultiple(
|
|
5503
5503
|
dmmf.datamodel.models.map((model) => {
|
|
5504
5504
|
const type = ts15.namedType(`Prisma.${getOmitName(model.name)}`);
|
|
5505
|
-
return ts15.property(
|
|
5505
|
+
return ts15.property(uncapitalize7(model.name), type).optional();
|
|
5506
5506
|
})
|
|
5507
5507
|
);
|
|
5508
5508
|
return ts15.moduleExport(ts15.typeDeclaration("GlobalOmitConfig", objectType11));
|
|
5509
5509
|
}
|
|
5510
5510
|
|
|
5511
5511
|
// src/TSClient/TypeMap.ts
|
|
5512
|
-
import {
|
|
5512
|
+
import { uncapitalize as uncapitalize8 } from "@prisma/client-common";
|
|
5513
5513
|
import { assertNever as assertNever2 } from "@prisma/internals";
|
|
5514
5514
|
import * as ts16 from "@prisma/ts-builders";
|
|
5515
5515
|
function clientTypeMapDefinition(context) {
|
|
@@ -5527,7 +5527,7 @@ function clientTypeMapModelsDefinition(context) {
|
|
|
5527
5527
|
if (modelNames.length === 0) {
|
|
5528
5528
|
meta.add(ts16.property("modelProps", ts16.neverType));
|
|
5529
5529
|
} else {
|
|
5530
|
-
meta.add(ts16.property("modelProps", ts16.unionType(modelNames.map((name) => ts16.stringLiteral(
|
|
5530
|
+
meta.add(ts16.property("modelProps", ts16.unionType(modelNames.map((name) => ts16.stringLiteral(uncapitalize8(name))))));
|
|
5531
5531
|
}
|
|
5532
5532
|
const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? ts16.namedType("TransactionIsolationLevel") : ts16.neverType;
|
|
5533
5533
|
meta.add(ts16.property("txIsolationLevel", isolationLevel));
|
|
@@ -6489,7 +6489,7 @@ import { getTsconfig } from "get-tsconfig";
|
|
|
6489
6489
|
import { match as match2 } from "ts-pattern";
|
|
6490
6490
|
|
|
6491
6491
|
// package.json
|
|
6492
|
-
var version = "6.12.0-dev.
|
|
6492
|
+
var version = "6.12.0-dev.8";
|
|
6493
6493
|
|
|
6494
6494
|
// src/module-format.ts
|
|
6495
6495
|
function parseModuleFormat(format) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-generator-ts",
|
|
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",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"pkg-up": "3.1.0",
|
|
35
35
|
"pluralize": "8.0.0",
|
|
36
36
|
"ts-pattern": "5.6.2",
|
|
37
|
-
"@prisma/client-common": "6.12.0-dev.
|
|
38
|
-
"@prisma/debug": "6.12.0-dev.
|
|
39
|
-
"@prisma/
|
|
40
|
-
"@prisma/fetch-engine": "6.12.0-dev.
|
|
41
|
-
"@prisma/
|
|
42
|
-
"@prisma/
|
|
43
|
-
"@prisma/
|
|
44
|
-
"@prisma/
|
|
37
|
+
"@prisma/client-common": "6.12.0-dev.8",
|
|
38
|
+
"@prisma/debug": "6.12.0-dev.8",
|
|
39
|
+
"@prisma/generator": "6.12.0-dev.8",
|
|
40
|
+
"@prisma/fetch-engine": "6.12.0-dev.8",
|
|
41
|
+
"@prisma/get-platform": "6.12.0-dev.8",
|
|
42
|
+
"@prisma/dmmf": "6.12.0-dev.8",
|
|
43
|
+
"@prisma/internals": "6.12.0-dev.8",
|
|
44
|
+
"@prisma/ts-builders": "6.12.0-dev.8"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/pluralize": "0.0.33",
|