@prisma/client-generator-js 7.7.0-dev.1 → 7.7.0-dev.3
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/getDMMF.d.ts +1 -4
- package/dist/index.d.mts +3 -9
- package/dist/index.d.ts +3 -9
- package/dist/index.js +74 -128
- package/dist/index.mjs +55 -108
- package/package.json +10 -10
- package/dist/externalToInternalDmmf.d.ts +0 -7
package/dist/getDMMF.d.ts
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { GetDMMFOptions } from '@prisma/internals';
|
|
3
|
-
export declare function getPrismaClientDMMF(dmmf: DMMF.Document): DMMF.Document;
|
|
4
|
-
export declare function getDMMF(options: GetDMMFOptions): Promise<DMMF.Document>;
|
|
1
|
+
export { getInternalDMMF as getDMMF, externalToInternalDmmf as getPrismaClientDMMF } from '@prisma/internals';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ActiveConnectorType } from '@prisma/generator';
|
|
2
2
|
import type { BinaryPaths } from '@prisma/generator';
|
|
3
3
|
import type { DataSource } from '@prisma/generator';
|
|
4
|
-
import * as DMMF from '@prisma/dmmf';
|
|
4
|
+
import type * as DMMF from '@prisma/dmmf';
|
|
5
5
|
import { Generator as Generator_2 } from '@prisma/generator';
|
|
6
6
|
import { GeneratorConfig } from '@prisma/generator';
|
|
7
7
|
import { GeneratorManifest } from '@prisma/generator';
|
|
8
8
|
import { GeneratorOptions } from '@prisma/generator';
|
|
9
|
-
import
|
|
9
|
+
import { getInternalDMMF as getDMMF } from '@prisma/internals';
|
|
10
10
|
import type { SqlQueryOutput } from '@prisma/generator';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -15,12 +15,6 @@ import type { SqlQueryOutput } from '@prisma/generator';
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function dmmfToTypes(dmmf: DMMF.Document): string;
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Turns type: string into type: string[] for all args in order to support union input types
|
|
20
|
-
* @param document
|
|
21
|
-
*/
|
|
22
|
-
export declare function externalToInternalDmmf(document: DMMF.Document): DMMF.Document;
|
|
23
|
-
|
|
24
18
|
export declare function generateClient(options: GenerateClientOptions): Promise<void>;
|
|
25
19
|
|
|
26
20
|
export declare interface GenerateClientOptions {
|
|
@@ -44,7 +38,7 @@ export declare interface GenerateClientOptions {
|
|
|
44
38
|
compilerBuild: 'fast' | 'small';
|
|
45
39
|
}
|
|
46
40
|
|
|
47
|
-
export
|
|
41
|
+
export { getDMMF }
|
|
48
42
|
|
|
49
43
|
export declare class PrismaClientJsGenerator implements Generator_2 {
|
|
50
44
|
#private;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ActiveConnectorType } from '@prisma/generator';
|
|
2
2
|
import type { BinaryPaths } from '@prisma/generator';
|
|
3
3
|
import type { DataSource } from '@prisma/generator';
|
|
4
|
-
import * as DMMF from '@prisma/dmmf';
|
|
4
|
+
import type * as DMMF from '@prisma/dmmf';
|
|
5
5
|
import { Generator as Generator_2 } from '@prisma/generator';
|
|
6
6
|
import { GeneratorConfig } from '@prisma/generator';
|
|
7
7
|
import { GeneratorManifest } from '@prisma/generator';
|
|
8
8
|
import { GeneratorOptions } from '@prisma/generator';
|
|
9
|
-
import
|
|
9
|
+
import { getInternalDMMF as getDMMF } from '@prisma/internals';
|
|
10
10
|
import type { SqlQueryOutput } from '@prisma/generator';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -15,12 +15,6 @@ import type { SqlQueryOutput } from '@prisma/generator';
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function dmmfToTypes(dmmf: DMMF.Document): string;
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Turns type: string into type: string[] for all args in order to support union input types
|
|
20
|
-
* @param document
|
|
21
|
-
*/
|
|
22
|
-
export declare function externalToInternalDmmf(document: DMMF.Document): DMMF.Document;
|
|
23
|
-
|
|
24
18
|
export declare function generateClient(options: GenerateClientOptions): Promise<void>;
|
|
25
19
|
|
|
26
20
|
export declare interface GenerateClientOptions {
|
|
@@ -44,7 +38,7 @@ export declare interface GenerateClientOptions {
|
|
|
44
38
|
compilerBuild: 'fast' | 'small';
|
|
45
39
|
}
|
|
46
40
|
|
|
47
|
-
export
|
|
41
|
+
export { getDMMF }
|
|
48
42
|
|
|
49
43
|
export declare class PrismaClientJsGenerator implements Generator_2 {
|
|
50
44
|
#private;
|
package/dist/index.js
CHANGED
|
@@ -2171,57 +2171,11 @@ var index_exports = {};
|
|
|
2171
2171
|
__export(index_exports, {
|
|
2172
2172
|
PrismaClientJsGenerator: () => PrismaClientJsGenerator,
|
|
2173
2173
|
dmmfToTypes: () => dmmfToTypes,
|
|
2174
|
-
externalToInternalDmmf: () => externalToInternalDmmf,
|
|
2175
2174
|
generateClient: () => generateClient,
|
|
2176
|
-
getDMMF: () =>
|
|
2175
|
+
getDMMF: () => import_internals.getInternalDMMF
|
|
2177
2176
|
});
|
|
2178
2177
|
module.exports = __toCommonJS(index_exports);
|
|
2179
2178
|
|
|
2180
|
-
// src/externalToInternalDmmf.ts
|
|
2181
|
-
var import_client_common = require("@prisma/client-common");
|
|
2182
|
-
var import_pluralize = __toESM(require("pluralize"));
|
|
2183
|
-
function externalToInternalDmmf(document) {
|
|
2184
|
-
return {
|
|
2185
|
-
...document,
|
|
2186
|
-
mappings: getMappings(document.mappings, document.datamodel)
|
|
2187
|
-
};
|
|
2188
|
-
}
|
|
2189
|
-
function getMappings(mappings, datamodel) {
|
|
2190
|
-
const modelOperations = mappings.modelOperations.filter((mapping) => {
|
|
2191
|
-
const model = datamodel.models.find((m) => m.name === mapping.model);
|
|
2192
|
-
if (!model) {
|
|
2193
|
-
throw new Error(`Mapping without model ${mapping.model}`);
|
|
2194
|
-
}
|
|
2195
|
-
return model.fields.some((f) => f.kind !== "object");
|
|
2196
|
-
}).map((mapping) => ({
|
|
2197
|
-
model: mapping.model,
|
|
2198
|
-
plural: (0, import_pluralize.default)((0, import_client_common.uncapitalize)(mapping.model)),
|
|
2199
|
-
// TODO not needed anymore
|
|
2200
|
-
findUnique: mapping.findUnique || mapping.findSingle,
|
|
2201
|
-
findUniqueOrThrow: mapping.findUniqueOrThrow,
|
|
2202
|
-
findFirst: mapping.findFirst,
|
|
2203
|
-
findFirstOrThrow: mapping.findFirstOrThrow,
|
|
2204
|
-
findMany: mapping.findMany,
|
|
2205
|
-
create: mapping.createOne || mapping.createSingle || mapping.create,
|
|
2206
|
-
createMany: mapping.createMany,
|
|
2207
|
-
createManyAndReturn: mapping.createManyAndReturn,
|
|
2208
|
-
delete: mapping.deleteOne || mapping.deleteSingle || mapping.delete,
|
|
2209
|
-
update: mapping.updateOne || mapping.updateSingle || mapping.update,
|
|
2210
|
-
deleteMany: mapping.deleteMany,
|
|
2211
|
-
updateMany: mapping.updateMany,
|
|
2212
|
-
updateManyAndReturn: mapping.updateManyAndReturn,
|
|
2213
|
-
upsert: mapping.upsertOne || mapping.upsertSingle || mapping.upsert,
|
|
2214
|
-
aggregate: mapping.aggregate,
|
|
2215
|
-
groupBy: mapping.groupBy,
|
|
2216
|
-
findRaw: mapping.findRaw,
|
|
2217
|
-
aggregateRaw: mapping.aggregateRaw
|
|
2218
|
-
}));
|
|
2219
|
-
return {
|
|
2220
|
-
modelOperations,
|
|
2221
|
-
otherOperations: mappings.otherOperations
|
|
2222
|
-
};
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
2179
|
// src/generateClient.ts
|
|
2226
2180
|
var import_internals7 = require("@prisma/internals");
|
|
2227
2181
|
var import_crypto = require("crypto");
|
|
@@ -2568,16 +2522,9 @@ var package_default = {
|
|
|
2568
2522
|
|
|
2569
2523
|
// src/getDMMF.ts
|
|
2570
2524
|
var import_internals = require("@prisma/internals");
|
|
2571
|
-
function getPrismaClientDMMF(dmmf) {
|
|
2572
|
-
return externalToInternalDmmf(dmmf);
|
|
2573
|
-
}
|
|
2574
|
-
async function getDMMF(options) {
|
|
2575
|
-
const dmmf = await (0, import_internals.getDMMF)(options);
|
|
2576
|
-
return getPrismaClientDMMF(dmmf);
|
|
2577
|
-
}
|
|
2578
2525
|
|
|
2579
2526
|
// src/TSClient/Enum.ts
|
|
2580
|
-
var
|
|
2527
|
+
var import_client_common = require("@prisma/client-common");
|
|
2581
2528
|
var import_indent_string = __toESM(require("indent-string"));
|
|
2582
2529
|
|
|
2583
2530
|
// src/TSClient/constants.ts
|
|
@@ -2590,10 +2537,10 @@ var Enum = class {
|
|
|
2590
2537
|
this.useNamespace = useNamespace;
|
|
2591
2538
|
}
|
|
2592
2539
|
isObjectEnum() {
|
|
2593
|
-
return this.useNamespace &&
|
|
2540
|
+
return this.useNamespace && import_client_common.objectEnumNames.includes(this.type.name);
|
|
2594
2541
|
}
|
|
2595
2542
|
isStrictEnum() {
|
|
2596
|
-
return this.useNamespace &&
|
|
2543
|
+
return this.useNamespace && import_client_common.strictEnumNames.includes(this.type.name);
|
|
2597
2544
|
}
|
|
2598
2545
|
toJS() {
|
|
2599
2546
|
const { type } = this;
|
|
@@ -2632,12 +2579,12 @@ function TS(gen) {
|
|
|
2632
2579
|
}
|
|
2633
2580
|
|
|
2634
2581
|
// src/TSClient/Input.ts
|
|
2635
|
-
var
|
|
2582
|
+
var import_client_common3 = require("@prisma/client-common");
|
|
2636
2583
|
var ts2 = __toESM(require("@prisma/ts-builders"));
|
|
2637
2584
|
var import_indent_string2 = __toESM(require("indent-string"));
|
|
2638
2585
|
|
|
2639
2586
|
// src/utils.ts
|
|
2640
|
-
var
|
|
2587
|
+
var import_client_common2 = require("@prisma/client-common");
|
|
2641
2588
|
var DMMF = __toESM(require("@prisma/dmmf"));
|
|
2642
2589
|
var import_internals2 = require("@prisma/internals");
|
|
2643
2590
|
var ts = __toESM(require("@prisma/ts-builders"));
|
|
@@ -2669,28 +2616,28 @@ function getOmitName(modelName) {
|
|
|
2669
2616
|
return `${modelName}Omit`;
|
|
2670
2617
|
}
|
|
2671
2618
|
function getAggregateName(modelName) {
|
|
2672
|
-
return `Aggregate${(0,
|
|
2619
|
+
return `Aggregate${(0, import_client_common2.capitalize)(modelName)}`;
|
|
2673
2620
|
}
|
|
2674
2621
|
function getGroupByName(modelName) {
|
|
2675
|
-
return `${(0,
|
|
2622
|
+
return `${(0, import_client_common2.capitalize)(modelName)}GroupByOutputType`;
|
|
2676
2623
|
}
|
|
2677
2624
|
function getAvgAggregateName(modelName) {
|
|
2678
|
-
return `${(0,
|
|
2625
|
+
return `${(0, import_client_common2.capitalize)(modelName)}AvgAggregateOutputType`;
|
|
2679
2626
|
}
|
|
2680
2627
|
function getSumAggregateName(modelName) {
|
|
2681
|
-
return `${(0,
|
|
2628
|
+
return `${(0, import_client_common2.capitalize)(modelName)}SumAggregateOutputType`;
|
|
2682
2629
|
}
|
|
2683
2630
|
function getMinAggregateName(modelName) {
|
|
2684
|
-
return `${(0,
|
|
2631
|
+
return `${(0, import_client_common2.capitalize)(modelName)}MinAggregateOutputType`;
|
|
2685
2632
|
}
|
|
2686
2633
|
function getMaxAggregateName(modelName) {
|
|
2687
|
-
return `${(0,
|
|
2634
|
+
return `${(0, import_client_common2.capitalize)(modelName)}MaxAggregateOutputType`;
|
|
2688
2635
|
}
|
|
2689
2636
|
function getCountAggregateInputName(modelName) {
|
|
2690
|
-
return `${(0,
|
|
2637
|
+
return `${(0, import_client_common2.capitalize)(modelName)}CountAggregateInputType`;
|
|
2691
2638
|
}
|
|
2692
2639
|
function getCountAggregateOutputName(modelName) {
|
|
2693
|
-
return `${(0,
|
|
2640
|
+
return `${(0, import_client_common2.capitalize)(modelName)}CountAggregateOutputType`;
|
|
2694
2641
|
}
|
|
2695
2642
|
function getAggregateInputType(aggregateOutputType) {
|
|
2696
2643
|
return aggregateOutputType.replace(/OutputType$/, "InputType");
|
|
@@ -2699,13 +2646,13 @@ function getGroupByArgsName(modelName) {
|
|
|
2699
2646
|
return `${modelName}GroupByArgs`;
|
|
2700
2647
|
}
|
|
2701
2648
|
function getGroupByPayloadName(modelName) {
|
|
2702
|
-
return `Get${(0,
|
|
2649
|
+
return `Get${(0, import_client_common2.capitalize)(modelName)}GroupByPayload`;
|
|
2703
2650
|
}
|
|
2704
2651
|
function getAggregateArgsName(modelName) {
|
|
2705
|
-
return `${(0,
|
|
2652
|
+
return `${(0, import_client_common2.capitalize)(modelName)}AggregateArgs`;
|
|
2706
2653
|
}
|
|
2707
2654
|
function getAggregateGetName(modelName) {
|
|
2708
|
-
return `Get${(0,
|
|
2655
|
+
return `Get${(0, import_client_common2.capitalize)(modelName)}AggregateType`;
|
|
2709
2656
|
}
|
|
2710
2657
|
function getFieldArgName(field, modelName) {
|
|
2711
2658
|
if (field.args.length) {
|
|
@@ -2902,7 +2849,7 @@ var InputType = class {
|
|
|
2902
2849
|
toTS() {
|
|
2903
2850
|
const { type } = this;
|
|
2904
2851
|
const source = type.meta?.source;
|
|
2905
|
-
const fields = (0,
|
|
2852
|
+
const fields = (0, import_client_common3.uniqueBy)(type.fields, (f) => f.name);
|
|
2906
2853
|
const body = `{
|
|
2907
2854
|
${(0, import_indent_string2.default)(
|
|
2908
2855
|
fields.map((arg) => {
|
|
@@ -2934,7 +2881,7 @@ function wrapWithAtLeast(body, input) {
|
|
|
2934
2881
|
}
|
|
2935
2882
|
|
|
2936
2883
|
// src/TSClient/Model.ts
|
|
2937
|
-
var
|
|
2884
|
+
var import_client_common8 = require("@prisma/client-common");
|
|
2938
2885
|
var DMMF2 = __toESM(require("@prisma/dmmf"));
|
|
2939
2886
|
var ts7 = __toESM(require("@prisma/ts-builders"));
|
|
2940
2887
|
var import_indent_string3 = __toESM(require("indent-string"));
|
|
@@ -2944,11 +2891,11 @@ var import_klona = require("klona");
|
|
|
2944
2891
|
var ts3 = __toESM(require("@prisma/ts-builders"));
|
|
2945
2892
|
|
|
2946
2893
|
// src/TSClient/helpers.ts
|
|
2947
|
-
var
|
|
2948
|
-
var
|
|
2894
|
+
var import_client_common5 = require("@prisma/client-common");
|
|
2895
|
+
var import_pluralize = __toESM(require("pluralize"));
|
|
2949
2896
|
|
|
2950
2897
|
// src/TSClient/jsdoc.ts
|
|
2951
|
-
var
|
|
2898
|
+
var import_client_common4 = require("@prisma/client-common");
|
|
2952
2899
|
var Docs = {
|
|
2953
2900
|
cursor: `{@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}`,
|
|
2954
2901
|
pagination: `{@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}`,
|
|
@@ -3021,7 +2968,7 @@ const ${ctx.singular} = await ${ctx.method}({
|
|
|
3021
2968
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
3022
2969
|
@example
|
|
3023
2970
|
// Create many ${ctx.plural}
|
|
3024
|
-
const ${(0,
|
|
2971
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3025
2972
|
data: [
|
|
3026
2973
|
// ... provide data here
|
|
3027
2974
|
]
|
|
@@ -3035,7 +2982,7 @@ const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ct
|
|
|
3035
2982
|
body: (ctx) => {
|
|
3036
2983
|
const onlySelect = ctx.firstScalar ? `
|
|
3037
2984
|
// Create many ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
3038
|
-
const ${(0,
|
|
2985
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)}With${(0, import_client_common4.capitalize)(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
3039
2986
|
select: { ${ctx.firstScalar.name}: true },
|
|
3040
2987
|
data: [
|
|
3041
2988
|
// ... provide data here
|
|
@@ -3045,7 +2992,7 @@ const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)}With${(0, imp
|
|
|
3045
2992
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
3046
2993
|
@example
|
|
3047
2994
|
// Create many ${ctx.plural}
|
|
3048
|
-
const ${(0,
|
|
2995
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3049
2996
|
data: [
|
|
3050
2997
|
// ... provide data here
|
|
3051
2998
|
]
|
|
@@ -3063,7 +3010,7 @@ ${undefinedNote}
|
|
|
3063
3010
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3064
3011
|
@example
|
|
3065
3012
|
// Get one ${ctx.singular}
|
|
3066
|
-
const ${(0,
|
|
3013
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3067
3014
|
where: {
|
|
3068
3015
|
// ... provide filter here
|
|
3069
3016
|
}
|
|
@@ -3078,7 +3025,7 @@ if no matches were found.
|
|
|
3078
3025
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3079
3026
|
@example
|
|
3080
3027
|
// Get one ${ctx.singular}
|
|
3081
|
-
const ${(0,
|
|
3028
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3082
3029
|
where: {
|
|
3083
3030
|
// ... provide filter here
|
|
3084
3031
|
}
|
|
@@ -3093,7 +3040,7 @@ ${undefinedNote}
|
|
|
3093
3040
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3094
3041
|
@example
|
|
3095
3042
|
// Get one ${ctx.singular}
|
|
3096
|
-
const ${(0,
|
|
3043
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3097
3044
|
where: {
|
|
3098
3045
|
// ... provide filter here
|
|
3099
3046
|
}
|
|
@@ -3114,7 +3061,7 @@ ${undefinedNote}
|
|
|
3114
3061
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3115
3062
|
@example
|
|
3116
3063
|
// Get one ${ctx.singular}
|
|
3117
|
-
const ${(0,
|
|
3064
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3118
3065
|
where: {
|
|
3119
3066
|
// ... provide filter here
|
|
3120
3067
|
}
|
|
@@ -3132,7 +3079,7 @@ const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ct
|
|
|
3132
3079
|
body: (ctx) => {
|
|
3133
3080
|
const onlySelect = ctx.firstScalar ? `
|
|
3134
3081
|
// Only select the \`${ctx.firstScalar.name}\`
|
|
3135
|
-
const ${(0,
|
|
3082
|
+
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 } })` : "";
|
|
3136
3083
|
return `Find zero or more ${ctx.plural} that matches the filter.
|
|
3137
3084
|
${undefinedNote}
|
|
3138
3085
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to filter and select certain fields only.
|
|
@@ -3159,7 +3106,7 @@ ${onlySelect}
|
|
|
3159
3106
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one ${ctx.singular}.
|
|
3160
3107
|
@example
|
|
3161
3108
|
// Update one ${ctx.singular}
|
|
3162
|
-
const ${(0,
|
|
3109
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3163
3110
|
where: {
|
|
3164
3111
|
// ... provide filter here
|
|
3165
3112
|
},
|
|
@@ -3178,7 +3125,7 @@ const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ct
|
|
|
3178
3125
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update or create a ${ctx.singular}.
|
|
3179
3126
|
@example
|
|
3180
3127
|
// Update or create a ${ctx.singular}
|
|
3181
|
-
const ${(0,
|
|
3128
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3182
3129
|
create: {
|
|
3183
3130
|
// ... data to create a ${ctx.singular}
|
|
3184
3131
|
},
|
|
@@ -3272,7 +3219,7 @@ ${undefinedNote}
|
|
|
3272
3219
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one or more rows.
|
|
3273
3220
|
@example
|
|
3274
3221
|
// Update many ${ctx.plural}
|
|
3275
|
-
const ${(0,
|
|
3222
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3276
3223
|
where: {
|
|
3277
3224
|
// ... provide filter here
|
|
3278
3225
|
},
|
|
@@ -3291,7 +3238,7 @@ const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ct
|
|
|
3291
3238
|
body: (ctx) => {
|
|
3292
3239
|
const onlySelect = ctx.firstScalar ? `
|
|
3293
3240
|
// Update zero or more ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
3294
|
-
const ${(0,
|
|
3241
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)}With${(0, import_client_common4.capitalize)(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
3295
3242
|
select: { ${ctx.firstScalar.name}: true },
|
|
3296
3243
|
where: {
|
|
3297
3244
|
// ... provide filter here
|
|
@@ -3304,7 +3251,7 @@ const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)}With${(0, imp
|
|
|
3304
3251
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update many ${ctx.plural}.
|
|
3305
3252
|
@example
|
|
3306
3253
|
// Update many ${ctx.plural}
|
|
3307
|
-
const ${(0,
|
|
3254
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3308
3255
|
where: {
|
|
3309
3256
|
// ... provide filter here
|
|
3310
3257
|
},
|
|
@@ -3342,7 +3289,7 @@ const { count } = await ${ctx.method}({
|
|
|
3342
3289
|
body: (ctx) => `Perform aggregation operations on a ${ctx.singular}.
|
|
3343
3290
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which aggregations you would like to apply.
|
|
3344
3291
|
@example
|
|
3345
|
-
const ${(0,
|
|
3292
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3346
3293
|
pipeline: [
|
|
3347
3294
|
{ $match: { status: "registered" } },
|
|
3348
3295
|
{ $group: { _id: "$country", total: { $sum: 1 } } }
|
|
@@ -3357,7 +3304,7 @@ const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ct
|
|
|
3357
3304
|
body: (ctx) => `Find zero or more ${ctx.plural} that matches the filter.
|
|
3358
3305
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which filters you would like to apply.
|
|
3359
3306
|
@example
|
|
3360
|
-
const ${(0,
|
|
3307
|
+
const ${(0, import_client_common4.uncapitalize)(ctx.mapping.model)} = await ${ctx.method}({
|
|
3361
3308
|
filter: { age: { $gt: 25 } }
|
|
3362
3309
|
})`,
|
|
3363
3310
|
fields: {
|
|
@@ -3370,10 +3317,10 @@ const ${(0, import_client_common5.uncapitalize)(ctx.mapping.model)} = await ${ct
|
|
|
3370
3317
|
// src/TSClient/helpers.ts
|
|
3371
3318
|
function getMethodJSDocBody(action, mapping, model) {
|
|
3372
3319
|
const ctx = {
|
|
3373
|
-
singular: (0,
|
|
3374
|
-
plural: (0,
|
|
3320
|
+
singular: (0, import_client_common5.capitalize)(mapping.model),
|
|
3321
|
+
plural: (0, import_client_common5.capitalize)(mapping.plural),
|
|
3375
3322
|
firstScalar: model.fields.find((f) => f.kind === "scalar"),
|
|
3376
|
-
method: `prisma.${(0,
|
|
3323
|
+
method: `prisma.${(0, import_client_common5.uncapitalize)(mapping.model)}.${action}`,
|
|
3377
3324
|
action,
|
|
3378
3325
|
mapping,
|
|
3379
3326
|
model
|
|
@@ -3394,7 +3341,7 @@ function getArgFieldJSDoc(type, action, field) {
|
|
|
3394
3341
|
const fieldName = typeof field === "string" ? field : field.name;
|
|
3395
3342
|
if (JSDocs[action] && JSDocs[action]?.fields[fieldName]) {
|
|
3396
3343
|
const singular = type.name;
|
|
3397
|
-
const plural = (0,
|
|
3344
|
+
const plural = (0, import_pluralize.default)(type.name);
|
|
3398
3345
|
const comment = JSDocs[action]?.fields[fieldName](singular, plural);
|
|
3399
3346
|
return comment;
|
|
3400
3347
|
}
|
|
@@ -3570,7 +3517,7 @@ function enumTypeName(ref) {
|
|
|
3570
3517
|
}
|
|
3571
3518
|
|
|
3572
3519
|
// src/TSClient/Payload.ts
|
|
3573
|
-
var
|
|
3520
|
+
var import_client_common6 = require("@prisma/client-common");
|
|
3574
3521
|
var ts5 = __toESM(require("@prisma/ts-builders"));
|
|
3575
3522
|
function buildModelPayload(model, context) {
|
|
3576
3523
|
const isComposite = context.dmmf.isComposite(model.name);
|
|
@@ -3588,7 +3535,7 @@ function buildModelPayload(model, context) {
|
|
|
3588
3535
|
scalars.add(buildModelOutputProperty(field, context.dmmf));
|
|
3589
3536
|
}
|
|
3590
3537
|
}
|
|
3591
|
-
const scalarsType = isComposite ? scalars : ts5.namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts5.namedType("ExtArgs").subKey("result").subKey((0,
|
|
3538
|
+
const scalarsType = isComposite ? scalars : ts5.namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts5.namedType("ExtArgs").subKey("result").subKey((0, import_client_common6.uncapitalize)(model.name)));
|
|
3592
3539
|
const payloadTypeDeclaration = ts5.typeDeclaration(
|
|
3593
3540
|
getPayloadName(model.name, false),
|
|
3594
3541
|
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))
|
|
@@ -3600,7 +3547,7 @@ function buildModelPayload(model, context) {
|
|
|
3600
3547
|
}
|
|
3601
3548
|
|
|
3602
3549
|
// src/TSClient/SelectIncludeOmit.ts
|
|
3603
|
-
var
|
|
3550
|
+
var import_client_common7 = require("@prisma/client-common");
|
|
3604
3551
|
var ts6 = __toESM(require("@prisma/ts-builders"));
|
|
3605
3552
|
function buildIncludeType({
|
|
3606
3553
|
modelName,
|
|
@@ -3634,7 +3581,7 @@ function buildSelectType({
|
|
|
3634
3581
|
return buildExport(typeName, selectType);
|
|
3635
3582
|
}
|
|
3636
3583
|
function modelResultExtensionsType(modelName) {
|
|
3637
|
-
return extArgsParam.toArgument().subKey("result").subKey((0,
|
|
3584
|
+
return extArgsParam.toArgument().subKey("result").subKey((0, import_client_common7.uncapitalize)(modelName));
|
|
3638
3585
|
}
|
|
3639
3586
|
function buildScalarSelectType({ modelName, fields, context }) {
|
|
3640
3587
|
const object = buildSelectOrIncludeObject(
|
|
@@ -4208,7 +4155,7 @@ function getNonAggregateMethodDependencyValidations(modelMapping, actionName, co
|
|
|
4208
4155
|
objectType9.add(ts7.property(reqArg, ts7.objectType()));
|
|
4209
4156
|
}
|
|
4210
4157
|
validators.push(
|
|
4211
|
-
ts7.genericParameter(`${(0,
|
|
4158
|
+
ts7.genericParameter(`${(0, import_client_common8.capitalize)(args.name)}DependenciesValidator`).extends(
|
|
4212
4159
|
ts7.conditionalType().check(ts7.stringLiteral(args.name)).extends(ts7.namedType("Prisma.Keys<T>")).then(objectType9).else(ts7.objectType())
|
|
4213
4160
|
)
|
|
4214
4161
|
);
|
|
@@ -4343,7 +4290,7 @@ var ts12 = __toESM(require("@prisma/ts-builders"));
|
|
|
4343
4290
|
var import_indent_string7 = __toESM(require("indent-string"));
|
|
4344
4291
|
|
|
4345
4292
|
// src/dmmf.ts
|
|
4346
|
-
var
|
|
4293
|
+
var import_client_common9 = require("@prisma/client-common");
|
|
4347
4294
|
var DMMFHelper = class {
|
|
4348
4295
|
constructor(document) {
|
|
4349
4296
|
this.document = document;
|
|
@@ -4409,33 +4356,33 @@ var DMMFHelper = class {
|
|
|
4409
4356
|
return this.outputObjectTypes[ref.namespace ?? "prisma"].find((outputObject) => outputObject.name === ref.type);
|
|
4410
4357
|
}
|
|
4411
4358
|
buildModelMap() {
|
|
4412
|
-
return (0,
|
|
4359
|
+
return (0, import_client_common9.keyBy)(this.datamodel.models, "name");
|
|
4413
4360
|
}
|
|
4414
4361
|
buildTypeMap() {
|
|
4415
|
-
return (0,
|
|
4362
|
+
return (0, import_client_common9.keyBy)(this.datamodel.types, "name");
|
|
4416
4363
|
}
|
|
4417
4364
|
buildTypeModelMap() {
|
|
4418
4365
|
return { ...this.buildTypeMap(), ...this.buildModelMap() };
|
|
4419
4366
|
}
|
|
4420
4367
|
buildMappingsMap() {
|
|
4421
|
-
return (0,
|
|
4368
|
+
return (0, import_client_common9.keyBy)(this.mappings.modelOperations, "model");
|
|
4422
4369
|
}
|
|
4423
4370
|
buildMergedOutputTypeMap() {
|
|
4424
4371
|
if (!this.schema.outputObjectTypes.prisma) {
|
|
4425
4372
|
return {
|
|
4426
|
-
model: (0,
|
|
4427
|
-
prisma: (0,
|
|
4373
|
+
model: (0, import_client_common9.keyBy)(this.schema.outputObjectTypes.model, "name"),
|
|
4374
|
+
prisma: (0, import_client_common9.keyBy)([], "name")
|
|
4428
4375
|
};
|
|
4429
4376
|
}
|
|
4430
4377
|
return {
|
|
4431
|
-
model: (0,
|
|
4432
|
-
prisma: (0,
|
|
4378
|
+
model: (0, import_client_common9.keyBy)(this.schema.outputObjectTypes.model, "name"),
|
|
4379
|
+
prisma: (0, import_client_common9.keyBy)(this.schema.outputObjectTypes.prisma, "name")
|
|
4433
4380
|
};
|
|
4434
4381
|
}
|
|
4435
4382
|
buildRootFieldMap() {
|
|
4436
4383
|
return {
|
|
4437
|
-
...(0,
|
|
4438
|
-
...(0,
|
|
4384
|
+
...(0, import_client_common9.keyBy)(this.outputTypeMap.prisma.Query.fields, "name"),
|
|
4385
|
+
...(0, import_client_common9.keyBy)(this.outputTypeMap.prisma.Mutation.fields, "name")
|
|
4439
4386
|
};
|
|
4440
4387
|
}
|
|
4441
4388
|
buildInputTypesMap() {
|
|
@@ -4460,12 +4407,12 @@ function fullyQualifiedName(typeName, namespace3) {
|
|
|
4460
4407
|
}
|
|
4461
4408
|
|
|
4462
4409
|
// src/GenericsArgsInfo.ts
|
|
4463
|
-
var
|
|
4410
|
+
var import_client_common10 = require("@prisma/client-common");
|
|
4464
4411
|
var GenericArgsInfo = class {
|
|
4465
4412
|
constructor(_dmmf) {
|
|
4466
4413
|
this._dmmf = _dmmf;
|
|
4467
4414
|
}
|
|
4468
|
-
_cache = new
|
|
4415
|
+
_cache = new import_client_common10.Cache();
|
|
4469
4416
|
/**
|
|
4470
4417
|
* Determines if arg types need generic <$PrismaModel> argument added.
|
|
4471
4418
|
* Essentially, performs breadth-first search for any fieldRefTypes that
|
|
@@ -4548,12 +4495,12 @@ function buildDebugInitialization(edge) {
|
|
|
4548
4495
|
}
|
|
4549
4496
|
|
|
4550
4497
|
// src/utils/buildDMMF.ts
|
|
4551
|
-
var
|
|
4498
|
+
var import_client_common11 = require("@prisma/client-common");
|
|
4552
4499
|
function buildRuntimeDataModel(datamodel, runtimeName) {
|
|
4553
|
-
const runtimeDataModel = (0,
|
|
4500
|
+
const runtimeDataModel = (0, import_client_common11.dmmfToRuntimeDataModel)(datamodel);
|
|
4554
4501
|
let prunedDataModel;
|
|
4555
4502
|
if (runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
|
|
4556
|
-
prunedDataModel = (0,
|
|
4503
|
+
prunedDataModel = (0, import_client_common11.pruneRuntimeDataModel)(runtimeDataModel);
|
|
4557
4504
|
} else {
|
|
4558
4505
|
prunedDataModel = runtimeDataModel;
|
|
4559
4506
|
}
|
|
@@ -5161,7 +5108,7 @@ Prisma.skip = skip
|
|
|
5161
5108
|
}
|
|
5162
5109
|
|
|
5163
5110
|
// src/TSClient/Count.ts
|
|
5164
|
-
var
|
|
5111
|
+
var import_client_common12 = require("@prisma/client-common");
|
|
5165
5112
|
var ts8 = __toESM(require("@prisma/ts-builders"));
|
|
5166
5113
|
var import_indent_string5 = __toESM(require("indent-string"));
|
|
5167
5114
|
var Count = class {
|
|
@@ -5216,7 +5163,7 @@ ${this.argsTypes.map((typeExport) => ts8.stringify(typeExport)).join("\n\n")}
|
|
|
5216
5163
|
}
|
|
5217
5164
|
};
|
|
5218
5165
|
function getCountArgsType(typeName, fieldName) {
|
|
5219
|
-
return `${typeName}Count${(0,
|
|
5166
|
+
return `${typeName}Count${(0, import_client_common12.capitalize)(fieldName)}Args`;
|
|
5220
5167
|
}
|
|
5221
5168
|
|
|
5222
5169
|
// src/TSClient/FieldRefInput.ts
|
|
@@ -5259,7 +5206,7 @@ var GenerateContext = class {
|
|
|
5259
5206
|
};
|
|
5260
5207
|
|
|
5261
5208
|
// src/TSClient/PrismaClient.ts
|
|
5262
|
-
var
|
|
5209
|
+
var import_client_common14 = require("@prisma/client-common");
|
|
5263
5210
|
var import_internals4 = require("@prisma/internals");
|
|
5264
5211
|
var ts11 = __toESM(require("@prisma/ts-builders"));
|
|
5265
5212
|
var import_indent_string6 = __toESM(require("indent-string"));
|
|
@@ -5271,13 +5218,13 @@ function runtimeImportedType(name) {
|
|
|
5271
5218
|
}
|
|
5272
5219
|
|
|
5273
5220
|
// src/TSClient/globalOmit.ts
|
|
5274
|
-
var
|
|
5221
|
+
var import_client_common13 = require("@prisma/client-common");
|
|
5275
5222
|
var ts10 = __toESM(require("@prisma/ts-builders"));
|
|
5276
5223
|
function globalOmitConfig(dmmf) {
|
|
5277
5224
|
const objectType9 = ts10.objectType().addMultiple(
|
|
5278
5225
|
dmmf.datamodel.models.map((model) => {
|
|
5279
5226
|
const type = ts10.namedType(getOmitName(model.name));
|
|
5280
|
-
return ts10.property((0,
|
|
5227
|
+
return ts10.property((0, import_client_common13.uncapitalize)(model.name), type).optional();
|
|
5281
5228
|
})
|
|
5282
5229
|
);
|
|
5283
5230
|
return ts10.moduleExport(ts10.typeDeclaration("GlobalOmitConfig", objectType9));
|
|
@@ -5290,7 +5237,7 @@ function clientTypeMapModelsDefinition(context) {
|
|
|
5290
5237
|
if (modelNames.length === 0) {
|
|
5291
5238
|
meta.add(ts11.property("modelProps", ts11.neverType));
|
|
5292
5239
|
} else {
|
|
5293
|
-
meta.add(ts11.property("modelProps", ts11.unionType(modelNames.map((name) => ts11.stringLiteral((0,
|
|
5240
|
+
meta.add(ts11.property("modelProps", ts11.unionType(modelNames.map((name) => ts11.stringLiteral((0, import_client_common14.uncapitalize)(name))))));
|
|
5294
5241
|
}
|
|
5295
5242
|
const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? ts11.namedType("Prisma.TransactionIsolationLevel") : ts11.neverType;
|
|
5296
5243
|
meta.add(ts11.property("txIsolationLevel", isolationLevel));
|
|
@@ -5571,8 +5518,8 @@ var PrismaClientClass = class {
|
|
|
5571
5518
|
* const prisma = new PrismaClient({
|
|
5572
5519
|
* adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL })
|
|
5573
5520
|
* })
|
|
5574
|
-
* // Fetch zero or more ${(0,
|
|
5575
|
-
* const ${(0,
|
|
5521
|
+
* // Fetch zero or more ${(0, import_client_common14.capitalize)(example.plural)}
|
|
5522
|
+
* const ${(0, import_client_common14.uncapitalize)(example.plural)} = await prisma.${(0, import_client_common14.uncapitalize)(example.model)}.findMany()
|
|
5576
5523
|
* \`\`\`
|
|
5577
5524
|
*
|
|
5578
5525
|
*
|
|
@@ -5616,7 +5563,7 @@ ${[
|
|
|
5616
5563
|
|
|
5617
5564
|
${(0, import_indent_string6.default)(
|
|
5618
5565
|
dmmf.mappings.modelOperations.filter((m) => m.findMany).map((m) => {
|
|
5619
|
-
let methodName = (0,
|
|
5566
|
+
let methodName = (0, import_client_common14.uncapitalize)(m.model);
|
|
5620
5567
|
if (methodName === "constructor") {
|
|
5621
5568
|
methodName = '["constructor"]';
|
|
5622
5569
|
}
|
|
@@ -5625,8 +5572,8 @@ ${[
|
|
|
5625
5572
|
* \`prisma.${methodName}\`: Exposes CRUD operations for the **${m.model}** model.
|
|
5626
5573
|
* Example usage:
|
|
5627
5574
|
* \`\`\`ts
|
|
5628
|
-
* // Fetch zero or more ${(0,
|
|
5629
|
-
* const ${(0,
|
|
5575
|
+
* // Fetch zero or more ${(0, import_client_common14.capitalize)(m.plural)}
|
|
5576
|
+
* const ${(0, import_client_common14.uncapitalize)(m.plural)} = await prisma.${methodName}.findMany()
|
|
5630
5577
|
* \`\`\`
|
|
5631
5578
|
*/
|
|
5632
5579
|
get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
@@ -6384,7 +6331,7 @@ async function buildClient({
|
|
|
6384
6331
|
compilerBuild
|
|
6385
6332
|
}) {
|
|
6386
6333
|
const baseClientOptions = {
|
|
6387
|
-
dmmf:
|
|
6334
|
+
dmmf: (0, import_internals.externalToInternalDmmf)(dmmf),
|
|
6388
6335
|
datasources,
|
|
6389
6336
|
generator,
|
|
6390
6337
|
binaryPaths,
|
|
@@ -6833,7 +6780,7 @@ var import_engines_version = require("@prisma/engines-version");
|
|
|
6833
6780
|
var import_internals9 = require("@prisma/internals");
|
|
6834
6781
|
|
|
6835
6782
|
// package.json
|
|
6836
|
-
var version = "7.7.0-dev.
|
|
6783
|
+
var version = "7.7.0-dev.3";
|
|
6837
6784
|
|
|
6838
6785
|
// src/resolvePrismaClient.ts
|
|
6839
6786
|
var import_promises2 = __toESM(require("node:fs/promises"));
|
|
@@ -6975,7 +6922,6 @@ function dmmfToTypes(dmmf) {
|
|
|
6975
6922
|
0 && (module.exports = {
|
|
6976
6923
|
PrismaClientJsGenerator,
|
|
6977
6924
|
dmmfToTypes,
|
|
6978
|
-
externalToInternalDmmf,
|
|
6979
6925
|
generateClient,
|
|
6980
6926
|
getDMMF
|
|
6981
6927
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -2166,51 +2166,6 @@ var require_lib = __commonJS({
|
|
|
2166
2166
|
}
|
|
2167
2167
|
});
|
|
2168
2168
|
|
|
2169
|
-
// src/externalToInternalDmmf.ts
|
|
2170
|
-
import { capitalize, uncapitalize } from "@prisma/client-common";
|
|
2171
|
-
import pluralize from "pluralize";
|
|
2172
|
-
function externalToInternalDmmf(document) {
|
|
2173
|
-
return {
|
|
2174
|
-
...document,
|
|
2175
|
-
mappings: getMappings(document.mappings, document.datamodel)
|
|
2176
|
-
};
|
|
2177
|
-
}
|
|
2178
|
-
function getMappings(mappings, datamodel) {
|
|
2179
|
-
const modelOperations = mappings.modelOperations.filter((mapping) => {
|
|
2180
|
-
const model = datamodel.models.find((m) => m.name === mapping.model);
|
|
2181
|
-
if (!model) {
|
|
2182
|
-
throw new Error(`Mapping without model ${mapping.model}`);
|
|
2183
|
-
}
|
|
2184
|
-
return model.fields.some((f) => f.kind !== "object");
|
|
2185
|
-
}).map((mapping) => ({
|
|
2186
|
-
model: mapping.model,
|
|
2187
|
-
plural: pluralize(uncapitalize(mapping.model)),
|
|
2188
|
-
// TODO not needed anymore
|
|
2189
|
-
findUnique: mapping.findUnique || mapping.findSingle,
|
|
2190
|
-
findUniqueOrThrow: mapping.findUniqueOrThrow,
|
|
2191
|
-
findFirst: mapping.findFirst,
|
|
2192
|
-
findFirstOrThrow: mapping.findFirstOrThrow,
|
|
2193
|
-
findMany: mapping.findMany,
|
|
2194
|
-
create: mapping.createOne || mapping.createSingle || mapping.create,
|
|
2195
|
-
createMany: mapping.createMany,
|
|
2196
|
-
createManyAndReturn: mapping.createManyAndReturn,
|
|
2197
|
-
delete: mapping.deleteOne || mapping.deleteSingle || mapping.delete,
|
|
2198
|
-
update: mapping.updateOne || mapping.updateSingle || mapping.update,
|
|
2199
|
-
deleteMany: mapping.deleteMany,
|
|
2200
|
-
updateMany: mapping.updateMany,
|
|
2201
|
-
updateManyAndReturn: mapping.updateManyAndReturn,
|
|
2202
|
-
upsert: mapping.upsertOne || mapping.upsertSingle || mapping.upsert,
|
|
2203
|
-
aggregate: mapping.aggregate,
|
|
2204
|
-
groupBy: mapping.groupBy,
|
|
2205
|
-
findRaw: mapping.findRaw,
|
|
2206
|
-
aggregateRaw: mapping.aggregateRaw
|
|
2207
|
-
}));
|
|
2208
|
-
return {
|
|
2209
|
-
modelOperations,
|
|
2210
|
-
otherOperations: mappings.otherOperations
|
|
2211
|
-
};
|
|
2212
|
-
}
|
|
2213
|
-
|
|
2214
2169
|
// src/generateClient.ts
|
|
2215
2170
|
var import_fs_extra = __toESM(require_lib());
|
|
2216
2171
|
import { pathToPosix, setClassName } from "@prisma/internals";
|
|
@@ -2556,14 +2511,7 @@ var package_default = {
|
|
|
2556
2511
|
};
|
|
2557
2512
|
|
|
2558
2513
|
// src/getDMMF.ts
|
|
2559
|
-
import {
|
|
2560
|
-
function getPrismaClientDMMF(dmmf) {
|
|
2561
|
-
return externalToInternalDmmf(dmmf);
|
|
2562
|
-
}
|
|
2563
|
-
async function getDMMF(options) {
|
|
2564
|
-
const dmmf = await getRawDMMF(options);
|
|
2565
|
-
return getPrismaClientDMMF(dmmf);
|
|
2566
|
-
}
|
|
2514
|
+
import { getInternalDMMF, externalToInternalDmmf } from "@prisma/internals";
|
|
2567
2515
|
|
|
2568
2516
|
// src/TSClient/Enum.ts
|
|
2569
2517
|
import { objectEnumNames, strictEnumNames } from "@prisma/client-common";
|
|
@@ -2626,7 +2574,7 @@ import * as ts2 from "@prisma/ts-builders";
|
|
|
2626
2574
|
import indent2 from "indent-string";
|
|
2627
2575
|
|
|
2628
2576
|
// src/utils.ts
|
|
2629
|
-
import { capitalize
|
|
2577
|
+
import { capitalize } from "@prisma/client-common";
|
|
2630
2578
|
import * as DMMF from "@prisma/dmmf";
|
|
2631
2579
|
import { assertNever } from "@prisma/internals";
|
|
2632
2580
|
import * as ts from "@prisma/ts-builders";
|
|
@@ -2658,28 +2606,28 @@ function getOmitName(modelName) {
|
|
|
2658
2606
|
return `${modelName}Omit`;
|
|
2659
2607
|
}
|
|
2660
2608
|
function getAggregateName(modelName) {
|
|
2661
|
-
return `Aggregate${
|
|
2609
|
+
return `Aggregate${capitalize(modelName)}`;
|
|
2662
2610
|
}
|
|
2663
2611
|
function getGroupByName(modelName) {
|
|
2664
|
-
return `${
|
|
2612
|
+
return `${capitalize(modelName)}GroupByOutputType`;
|
|
2665
2613
|
}
|
|
2666
2614
|
function getAvgAggregateName(modelName) {
|
|
2667
|
-
return `${
|
|
2615
|
+
return `${capitalize(modelName)}AvgAggregateOutputType`;
|
|
2668
2616
|
}
|
|
2669
2617
|
function getSumAggregateName(modelName) {
|
|
2670
|
-
return `${
|
|
2618
|
+
return `${capitalize(modelName)}SumAggregateOutputType`;
|
|
2671
2619
|
}
|
|
2672
2620
|
function getMinAggregateName(modelName) {
|
|
2673
|
-
return `${
|
|
2621
|
+
return `${capitalize(modelName)}MinAggregateOutputType`;
|
|
2674
2622
|
}
|
|
2675
2623
|
function getMaxAggregateName(modelName) {
|
|
2676
|
-
return `${
|
|
2624
|
+
return `${capitalize(modelName)}MaxAggregateOutputType`;
|
|
2677
2625
|
}
|
|
2678
2626
|
function getCountAggregateInputName(modelName) {
|
|
2679
|
-
return `${
|
|
2627
|
+
return `${capitalize(modelName)}CountAggregateInputType`;
|
|
2680
2628
|
}
|
|
2681
2629
|
function getCountAggregateOutputName(modelName) {
|
|
2682
|
-
return `${
|
|
2630
|
+
return `${capitalize(modelName)}CountAggregateOutputType`;
|
|
2683
2631
|
}
|
|
2684
2632
|
function getAggregateInputType(aggregateOutputType) {
|
|
2685
2633
|
return aggregateOutputType.replace(/OutputType$/, "InputType");
|
|
@@ -2688,13 +2636,13 @@ function getGroupByArgsName(modelName) {
|
|
|
2688
2636
|
return `${modelName}GroupByArgs`;
|
|
2689
2637
|
}
|
|
2690
2638
|
function getGroupByPayloadName(modelName) {
|
|
2691
|
-
return `Get${
|
|
2639
|
+
return `Get${capitalize(modelName)}GroupByPayload`;
|
|
2692
2640
|
}
|
|
2693
2641
|
function getAggregateArgsName(modelName) {
|
|
2694
|
-
return `${
|
|
2642
|
+
return `${capitalize(modelName)}AggregateArgs`;
|
|
2695
2643
|
}
|
|
2696
2644
|
function getAggregateGetName(modelName) {
|
|
2697
|
-
return `Get${
|
|
2645
|
+
return `Get${capitalize(modelName)}AggregateType`;
|
|
2698
2646
|
}
|
|
2699
2647
|
function getFieldArgName(field, modelName) {
|
|
2700
2648
|
if (field.args.length) {
|
|
@@ -2923,7 +2871,7 @@ function wrapWithAtLeast(body, input) {
|
|
|
2923
2871
|
}
|
|
2924
2872
|
|
|
2925
2873
|
// src/TSClient/Model.ts
|
|
2926
|
-
import { capitalize as
|
|
2874
|
+
import { capitalize as capitalize4 } from "@prisma/client-common";
|
|
2927
2875
|
import * as DMMF2 from "@prisma/dmmf";
|
|
2928
2876
|
import * as ts7 from "@prisma/ts-builders";
|
|
2929
2877
|
import indent3 from "indent-string";
|
|
@@ -2933,11 +2881,11 @@ import { klona } from "klona";
|
|
|
2933
2881
|
import * as ts3 from "@prisma/ts-builders";
|
|
2934
2882
|
|
|
2935
2883
|
// src/TSClient/helpers.ts
|
|
2936
|
-
import { capitalize as
|
|
2937
|
-
import
|
|
2884
|
+
import { capitalize as capitalize3, uncapitalize as uncapitalize2 } from "@prisma/client-common";
|
|
2885
|
+
import pluralize from "pluralize";
|
|
2938
2886
|
|
|
2939
2887
|
// src/TSClient/jsdoc.ts
|
|
2940
|
-
import { capitalize as
|
|
2888
|
+
import { capitalize as capitalize2, uncapitalize } from "@prisma/client-common";
|
|
2941
2889
|
var Docs = {
|
|
2942
2890
|
cursor: `{@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}`,
|
|
2943
2891
|
pagination: `{@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}`,
|
|
@@ -3010,7 +2958,7 @@ const ${ctx.singular} = await ${ctx.method}({
|
|
|
3010
2958
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
3011
2959
|
@example
|
|
3012
2960
|
// Create many ${ctx.plural}
|
|
3013
|
-
const ${
|
|
2961
|
+
const ${uncapitalize(ctx.mapping.model)} = await ${ctx.method}({
|
|
3014
2962
|
data: [
|
|
3015
2963
|
// ... provide data here
|
|
3016
2964
|
]
|
|
@@ -3024,7 +2972,7 @@ const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
3024
2972
|
body: (ctx) => {
|
|
3025
2973
|
const onlySelect = ctx.firstScalar ? `
|
|
3026
2974
|
// Create many ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
3027
|
-
const ${
|
|
2975
|
+
const ${uncapitalize(ctx.mapping.model)}With${capitalize2(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
3028
2976
|
select: { ${ctx.firstScalar.name}: true },
|
|
3029
2977
|
data: [
|
|
3030
2978
|
// ... provide data here
|
|
@@ -3034,7 +2982,7 @@ const ${uncapitalize2(ctx.mapping.model)}With${capitalize3(ctx.firstScalar.name)
|
|
|
3034
2982
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to create many ${ctx.plural}.
|
|
3035
2983
|
@example
|
|
3036
2984
|
// Create many ${ctx.plural}
|
|
3037
|
-
const ${
|
|
2985
|
+
const ${uncapitalize(ctx.mapping.model)} = await ${ctx.method}({
|
|
3038
2986
|
data: [
|
|
3039
2987
|
// ... provide data here
|
|
3040
2988
|
]
|
|
@@ -3052,7 +3000,7 @@ ${undefinedNote}
|
|
|
3052
3000
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3053
3001
|
@example
|
|
3054
3002
|
// Get one ${ctx.singular}
|
|
3055
|
-
const ${
|
|
3003
|
+
const ${uncapitalize(ctx.mapping.model)} = await ${ctx.method}({
|
|
3056
3004
|
where: {
|
|
3057
3005
|
// ... provide filter here
|
|
3058
3006
|
}
|
|
@@ -3067,7 +3015,7 @@ if no matches were found.
|
|
|
3067
3015
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3068
3016
|
@example
|
|
3069
3017
|
// Get one ${ctx.singular}
|
|
3070
|
-
const ${
|
|
3018
|
+
const ${uncapitalize(ctx.mapping.model)} = await ${ctx.method}({
|
|
3071
3019
|
where: {
|
|
3072
3020
|
// ... provide filter here
|
|
3073
3021
|
}
|
|
@@ -3082,7 +3030,7 @@ ${undefinedNote}
|
|
|
3082
3030
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3083
3031
|
@example
|
|
3084
3032
|
// Get one ${ctx.singular}
|
|
3085
|
-
const ${
|
|
3033
|
+
const ${uncapitalize(ctx.mapping.model)} = await ${ctx.method}({
|
|
3086
3034
|
where: {
|
|
3087
3035
|
// ... provide filter here
|
|
3088
3036
|
}
|
|
@@ -3103,7 +3051,7 @@ ${undefinedNote}
|
|
|
3103
3051
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to find a ${ctx.singular}
|
|
3104
3052
|
@example
|
|
3105
3053
|
// Get one ${ctx.singular}
|
|
3106
|
-
const ${
|
|
3054
|
+
const ${uncapitalize(ctx.mapping.model)} = await ${ctx.method}({
|
|
3107
3055
|
where: {
|
|
3108
3056
|
// ... provide filter here
|
|
3109
3057
|
}
|
|
@@ -3121,7 +3069,7 @@ const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
3121
3069
|
body: (ctx) => {
|
|
3122
3070
|
const onlySelect = ctx.firstScalar ? `
|
|
3123
3071
|
// Only select the \`${ctx.firstScalar.name}\`
|
|
3124
|
-
const ${
|
|
3072
|
+
const ${uncapitalize(ctx.mapping.model)}With${capitalize2(ctx.firstScalar.name)}Only = await ${ctx.method}({ select: { ${ctx.firstScalar.name}: true } })` : "";
|
|
3125
3073
|
return `Find zero or more ${ctx.plural} that matches the filter.
|
|
3126
3074
|
${undefinedNote}
|
|
3127
3075
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to filter and select certain fields only.
|
|
@@ -3148,7 +3096,7 @@ ${onlySelect}
|
|
|
3148
3096
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one ${ctx.singular}.
|
|
3149
3097
|
@example
|
|
3150
3098
|
// Update one ${ctx.singular}
|
|
3151
|
-
const ${
|
|
3099
|
+
const ${uncapitalize(ctx.mapping.model)} = await ${ctx.method}({
|
|
3152
3100
|
where: {
|
|
3153
3101
|
// ... provide filter here
|
|
3154
3102
|
},
|
|
@@ -3167,7 +3115,7 @@ const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
3167
3115
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update or create a ${ctx.singular}.
|
|
3168
3116
|
@example
|
|
3169
3117
|
// Update or create a ${ctx.singular}
|
|
3170
|
-
const ${
|
|
3118
|
+
const ${uncapitalize(ctx.mapping.model)} = await ${ctx.method}({
|
|
3171
3119
|
create: {
|
|
3172
3120
|
// ... data to create a ${ctx.singular}
|
|
3173
3121
|
},
|
|
@@ -3261,7 +3209,7 @@ ${undefinedNote}
|
|
|
3261
3209
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update one or more rows.
|
|
3262
3210
|
@example
|
|
3263
3211
|
// Update many ${ctx.plural}
|
|
3264
|
-
const ${
|
|
3212
|
+
const ${uncapitalize(ctx.mapping.model)} = await ${ctx.method}({
|
|
3265
3213
|
where: {
|
|
3266
3214
|
// ... provide filter here
|
|
3267
3215
|
},
|
|
@@ -3280,7 +3228,7 @@ const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
3280
3228
|
body: (ctx) => {
|
|
3281
3229
|
const onlySelect = ctx.firstScalar ? `
|
|
3282
3230
|
// Update zero or more ${ctx.plural} and only return the \`${ctx.firstScalar.name}\`
|
|
3283
|
-
const ${
|
|
3231
|
+
const ${uncapitalize(ctx.mapping.model)}With${capitalize2(ctx.firstScalar.name)}Only = await ${ctx.method}({
|
|
3284
3232
|
select: { ${ctx.firstScalar.name}: true },
|
|
3285
3233
|
where: {
|
|
3286
3234
|
// ... provide filter here
|
|
@@ -3293,7 +3241,7 @@ const ${uncapitalize2(ctx.mapping.model)}With${capitalize3(ctx.firstScalar.name)
|
|
|
3293
3241
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Arguments to update many ${ctx.plural}.
|
|
3294
3242
|
@example
|
|
3295
3243
|
// Update many ${ctx.plural}
|
|
3296
|
-
const ${
|
|
3244
|
+
const ${uncapitalize(ctx.mapping.model)} = await ${ctx.method}({
|
|
3297
3245
|
where: {
|
|
3298
3246
|
// ... provide filter here
|
|
3299
3247
|
},
|
|
@@ -3331,7 +3279,7 @@ const { count } = await ${ctx.method}({
|
|
|
3331
3279
|
body: (ctx) => `Perform aggregation operations on a ${ctx.singular}.
|
|
3332
3280
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which aggregations you would like to apply.
|
|
3333
3281
|
@example
|
|
3334
|
-
const ${
|
|
3282
|
+
const ${uncapitalize(ctx.mapping.model)} = await ${ctx.method}({
|
|
3335
3283
|
pipeline: [
|
|
3336
3284
|
{ $match: { status: "registered" } },
|
|
3337
3285
|
{ $group: { _id: "$country", total: { $sum: 1 } } }
|
|
@@ -3346,7 +3294,7 @@ const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
3346
3294
|
body: (ctx) => `Find zero or more ${ctx.plural} that matches the filter.
|
|
3347
3295
|
@param {${getModelArgName(ctx.model.name, ctx.action)}} args - Select which filters you would like to apply.
|
|
3348
3296
|
@example
|
|
3349
|
-
const ${
|
|
3297
|
+
const ${uncapitalize(ctx.mapping.model)} = await ${ctx.method}({
|
|
3350
3298
|
filter: { age: { $gt: 25 } }
|
|
3351
3299
|
})`,
|
|
3352
3300
|
fields: {
|
|
@@ -3359,10 +3307,10 @@ const ${uncapitalize2(ctx.mapping.model)} = await ${ctx.method}({
|
|
|
3359
3307
|
// src/TSClient/helpers.ts
|
|
3360
3308
|
function getMethodJSDocBody(action, mapping, model) {
|
|
3361
3309
|
const ctx = {
|
|
3362
|
-
singular:
|
|
3363
|
-
plural:
|
|
3310
|
+
singular: capitalize3(mapping.model),
|
|
3311
|
+
plural: capitalize3(mapping.plural),
|
|
3364
3312
|
firstScalar: model.fields.find((f) => f.kind === "scalar"),
|
|
3365
|
-
method: `prisma.${
|
|
3313
|
+
method: `prisma.${uncapitalize2(mapping.model)}.${action}`,
|
|
3366
3314
|
action,
|
|
3367
3315
|
mapping,
|
|
3368
3316
|
model
|
|
@@ -3383,7 +3331,7 @@ function getArgFieldJSDoc(type, action, field) {
|
|
|
3383
3331
|
const fieldName = typeof field === "string" ? field : field.name;
|
|
3384
3332
|
if (JSDocs[action] && JSDocs[action]?.fields[fieldName]) {
|
|
3385
3333
|
const singular = type.name;
|
|
3386
|
-
const plural =
|
|
3334
|
+
const plural = pluralize(type.name);
|
|
3387
3335
|
const comment = JSDocs[action]?.fields[fieldName](singular, plural);
|
|
3388
3336
|
return comment;
|
|
3389
3337
|
}
|
|
@@ -3559,7 +3507,7 @@ function enumTypeName(ref) {
|
|
|
3559
3507
|
}
|
|
3560
3508
|
|
|
3561
3509
|
// src/TSClient/Payload.ts
|
|
3562
|
-
import { uncapitalize as
|
|
3510
|
+
import { uncapitalize as uncapitalize3 } from "@prisma/client-common";
|
|
3563
3511
|
import * as ts5 from "@prisma/ts-builders";
|
|
3564
3512
|
function buildModelPayload(model, context) {
|
|
3565
3513
|
const isComposite = context.dmmf.isComposite(model.name);
|
|
@@ -3577,7 +3525,7 @@ function buildModelPayload(model, context) {
|
|
|
3577
3525
|
scalars.add(buildModelOutputProperty(field, context.dmmf));
|
|
3578
3526
|
}
|
|
3579
3527
|
}
|
|
3580
|
-
const scalarsType = isComposite ? scalars : ts5.namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts5.namedType("ExtArgs").subKey("result").subKey(
|
|
3528
|
+
const scalarsType = isComposite ? scalars : ts5.namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts5.namedType("ExtArgs").subKey("result").subKey(uncapitalize3(model.name)));
|
|
3581
3529
|
const payloadTypeDeclaration = ts5.typeDeclaration(
|
|
3582
3530
|
getPayloadName(model.name, false),
|
|
3583
3531
|
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))
|
|
@@ -3589,7 +3537,7 @@ function buildModelPayload(model, context) {
|
|
|
3589
3537
|
}
|
|
3590
3538
|
|
|
3591
3539
|
// src/TSClient/SelectIncludeOmit.ts
|
|
3592
|
-
import { uncapitalize as
|
|
3540
|
+
import { uncapitalize as uncapitalize4 } from "@prisma/client-common";
|
|
3593
3541
|
import * as ts6 from "@prisma/ts-builders";
|
|
3594
3542
|
function buildIncludeType({
|
|
3595
3543
|
modelName,
|
|
@@ -3623,7 +3571,7 @@ function buildSelectType({
|
|
|
3623
3571
|
return buildExport(typeName, selectType);
|
|
3624
3572
|
}
|
|
3625
3573
|
function modelResultExtensionsType(modelName) {
|
|
3626
|
-
return extArgsParam.toArgument().subKey("result").subKey(
|
|
3574
|
+
return extArgsParam.toArgument().subKey("result").subKey(uncapitalize4(modelName));
|
|
3627
3575
|
}
|
|
3628
3576
|
function buildScalarSelectType({ modelName, fields, context }) {
|
|
3629
3577
|
const object = buildSelectOrIncludeObject(
|
|
@@ -4197,7 +4145,7 @@ function getNonAggregateMethodDependencyValidations(modelMapping, actionName, co
|
|
|
4197
4145
|
objectType9.add(ts7.property(reqArg, ts7.objectType()));
|
|
4198
4146
|
}
|
|
4199
4147
|
validators.push(
|
|
4200
|
-
ts7.genericParameter(`${
|
|
4148
|
+
ts7.genericParameter(`${capitalize4(args.name)}DependenciesValidator`).extends(
|
|
4201
4149
|
ts7.conditionalType().check(ts7.stringLiteral(args.name)).extends(ts7.namedType("Prisma.Keys<T>")).then(objectType9).else(ts7.objectType())
|
|
4202
4150
|
)
|
|
4203
4151
|
);
|
|
@@ -5153,7 +5101,7 @@ Prisma.skip = skip
|
|
|
5153
5101
|
}
|
|
5154
5102
|
|
|
5155
5103
|
// src/TSClient/Count.ts
|
|
5156
|
-
import { capitalize as
|
|
5104
|
+
import { capitalize as capitalize5 } from "@prisma/client-common";
|
|
5157
5105
|
import * as ts8 from "@prisma/ts-builders";
|
|
5158
5106
|
import indent5 from "indent-string";
|
|
5159
5107
|
var Count = class {
|
|
@@ -5208,7 +5156,7 @@ ${this.argsTypes.map((typeExport) => ts8.stringify(typeExport)).join("\n\n")}
|
|
|
5208
5156
|
}
|
|
5209
5157
|
};
|
|
5210
5158
|
function getCountArgsType(typeName, fieldName) {
|
|
5211
|
-
return `${typeName}Count${
|
|
5159
|
+
return `${typeName}Count${capitalize5(fieldName)}Args`;
|
|
5212
5160
|
}
|
|
5213
5161
|
|
|
5214
5162
|
// src/TSClient/FieldRefInput.ts
|
|
@@ -5251,7 +5199,7 @@ var GenerateContext = class {
|
|
|
5251
5199
|
};
|
|
5252
5200
|
|
|
5253
5201
|
// src/TSClient/PrismaClient.ts
|
|
5254
|
-
import { capitalize as
|
|
5202
|
+
import { capitalize as capitalize6, uncapitalize as uncapitalize6 } from "@prisma/client-common";
|
|
5255
5203
|
import { assertNever as assertNever2 } from "@prisma/internals";
|
|
5256
5204
|
import * as ts11 from "@prisma/ts-builders";
|
|
5257
5205
|
import indent6 from "indent-string";
|
|
@@ -5263,13 +5211,13 @@ function runtimeImportedType(name) {
|
|
|
5263
5211
|
}
|
|
5264
5212
|
|
|
5265
5213
|
// src/TSClient/globalOmit.ts
|
|
5266
|
-
import { uncapitalize as
|
|
5214
|
+
import { uncapitalize as uncapitalize5 } from "@prisma/client-common";
|
|
5267
5215
|
import * as ts10 from "@prisma/ts-builders";
|
|
5268
5216
|
function globalOmitConfig(dmmf) {
|
|
5269
5217
|
const objectType9 = ts10.objectType().addMultiple(
|
|
5270
5218
|
dmmf.datamodel.models.map((model) => {
|
|
5271
5219
|
const type = ts10.namedType(getOmitName(model.name));
|
|
5272
|
-
return ts10.property(
|
|
5220
|
+
return ts10.property(uncapitalize5(model.name), type).optional();
|
|
5273
5221
|
})
|
|
5274
5222
|
);
|
|
5275
5223
|
return ts10.moduleExport(ts10.typeDeclaration("GlobalOmitConfig", objectType9));
|
|
@@ -5282,7 +5230,7 @@ function clientTypeMapModelsDefinition(context) {
|
|
|
5282
5230
|
if (modelNames.length === 0) {
|
|
5283
5231
|
meta.add(ts11.property("modelProps", ts11.neverType));
|
|
5284
5232
|
} else {
|
|
5285
|
-
meta.add(ts11.property("modelProps", ts11.unionType(modelNames.map((name) => ts11.stringLiteral(
|
|
5233
|
+
meta.add(ts11.property("modelProps", ts11.unionType(modelNames.map((name) => ts11.stringLiteral(uncapitalize6(name))))));
|
|
5286
5234
|
}
|
|
5287
5235
|
const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? ts11.namedType("Prisma.TransactionIsolationLevel") : ts11.neverType;
|
|
5288
5236
|
meta.add(ts11.property("txIsolationLevel", isolationLevel));
|
|
@@ -5563,8 +5511,8 @@ var PrismaClientClass = class {
|
|
|
5563
5511
|
* const prisma = new PrismaClient({
|
|
5564
5512
|
* adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL })
|
|
5565
5513
|
* })
|
|
5566
|
-
* // Fetch zero or more ${
|
|
5567
|
-
* const ${
|
|
5514
|
+
* // Fetch zero or more ${capitalize6(example.plural)}
|
|
5515
|
+
* const ${uncapitalize6(example.plural)} = await prisma.${uncapitalize6(example.model)}.findMany()
|
|
5568
5516
|
* \`\`\`
|
|
5569
5517
|
*
|
|
5570
5518
|
*
|
|
@@ -5608,7 +5556,7 @@ ${[
|
|
|
5608
5556
|
|
|
5609
5557
|
${indent6(
|
|
5610
5558
|
dmmf.mappings.modelOperations.filter((m) => m.findMany).map((m) => {
|
|
5611
|
-
let methodName =
|
|
5559
|
+
let methodName = uncapitalize6(m.model);
|
|
5612
5560
|
if (methodName === "constructor") {
|
|
5613
5561
|
methodName = '["constructor"]';
|
|
5614
5562
|
}
|
|
@@ -5617,8 +5565,8 @@ ${[
|
|
|
5617
5565
|
* \`prisma.${methodName}\`: Exposes CRUD operations for the **${m.model}** model.
|
|
5618
5566
|
* Example usage:
|
|
5619
5567
|
* \`\`\`ts
|
|
5620
|
-
* // Fetch zero or more ${
|
|
5621
|
-
* const ${
|
|
5568
|
+
* // Fetch zero or more ${capitalize6(m.plural)}
|
|
5569
|
+
* const ${uncapitalize6(m.plural)} = await prisma.${methodName}.findMany()
|
|
5622
5570
|
* \`\`\`
|
|
5623
5571
|
*/
|
|
5624
5572
|
get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
@@ -6376,7 +6324,7 @@ async function buildClient({
|
|
|
6376
6324
|
compilerBuild
|
|
6377
6325
|
}) {
|
|
6378
6326
|
const baseClientOptions = {
|
|
6379
|
-
dmmf:
|
|
6327
|
+
dmmf: externalToInternalDmmf(dmmf),
|
|
6380
6328
|
datasources,
|
|
6381
6329
|
generator,
|
|
6382
6330
|
binaryPaths,
|
|
@@ -6825,7 +6773,7 @@ import { enginesVersion } from "@prisma/engines-version";
|
|
|
6825
6773
|
import { BuiltInProvider, parseEnvValue } from "@prisma/internals";
|
|
6826
6774
|
|
|
6827
6775
|
// package.json
|
|
6828
|
-
var version = "7.7.0-dev.
|
|
6776
|
+
var version = "7.7.0-dev.3";
|
|
6829
6777
|
|
|
6830
6778
|
// src/resolvePrismaClient.ts
|
|
6831
6779
|
import fs2 from "node:fs/promises";
|
|
@@ -6966,7 +6914,6 @@ function dmmfToTypes(dmmf) {
|
|
|
6966
6914
|
export {
|
|
6967
6915
|
PrismaClientJsGenerator,
|
|
6968
6916
|
dmmfToTypes,
|
|
6969
|
-
externalToInternalDmmf,
|
|
6970
6917
|
generateClient,
|
|
6971
|
-
getDMMF
|
|
6918
|
+
getInternalDMMF as getDMMF
|
|
6972
6919
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-generator-js",
|
|
3
|
-
"version": "7.7.0-dev.
|
|
3
|
+
"version": "7.7.0-dev.3",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"package-up": "5.0.0",
|
|
33
33
|
"pluralize": "8.0.0",
|
|
34
34
|
"ts-pattern": "5.6.2",
|
|
35
|
-
"@prisma/
|
|
36
|
-
"@prisma/
|
|
37
|
-
"@prisma/fetch-engine": "7.7.0-dev.
|
|
38
|
-
"@prisma/
|
|
39
|
-
"@prisma/
|
|
40
|
-
"@prisma/get-platform": "7.7.0-dev.
|
|
41
|
-
"@prisma/
|
|
42
|
-
"@prisma/
|
|
43
|
-
"@prisma/
|
|
35
|
+
"@prisma/debug": "7.7.0-dev.3",
|
|
36
|
+
"@prisma/client-common": "7.7.0-dev.3",
|
|
37
|
+
"@prisma/fetch-engine": "7.7.0-dev.3",
|
|
38
|
+
"@prisma/generator": "7.7.0-dev.3",
|
|
39
|
+
"@prisma/param-graph-builder": "7.7.0-dev.3",
|
|
40
|
+
"@prisma/get-platform": "7.7.0-dev.3",
|
|
41
|
+
"@prisma/ts-builders": "7.7.0-dev.3",
|
|
42
|
+
"@prisma/dmmf": "7.7.0-dev.3",
|
|
43
|
+
"@prisma/internals": "7.7.0-dev.3"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/pluralize": "0.0.33"
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as DMMF from '@prisma/dmmf';
|
|
2
|
-
export declare function getCountAggregateOutputName(modelName: string): string;
|
|
3
|
-
/**
|
|
4
|
-
* Turns type: string into type: string[] for all args in order to support union input types
|
|
5
|
-
* @param document
|
|
6
|
-
*/
|
|
7
|
-
export declare function externalToInternalDmmf(document: DMMF.Document): DMMF.Document;
|