prisma 5.20.0-dev.2 → 5.20.0-dev.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +22 -22
- package/build/prisma_schema_build_bg.wasm +0 -0
- package/package.json +10 -10
- package/prisma-client/generator-build/index.js +275 -197
- package/prisma-client/package.json +3 -3
- package/prisma-client/runtime/binary.js +76 -76
- package/prisma-client/runtime/edge-esm.js +16 -16
- package/prisma-client/runtime/edge.js +16 -16
- package/prisma-client/runtime/library.d.ts +35 -10
- package/prisma-client/runtime/library.js +51 -51
- package/prisma-client/runtime/query_engine_bg.mysql.js +2 -2
- package/prisma-client/runtime/query_engine_bg.postgresql.js +2 -2
- package/prisma-client/runtime/query_engine_bg.sqlite.js +2 -2
- package/prisma-client/runtime/react-native.d.ts +35 -10
- package/prisma-client/runtime/react-native.js +26 -26
- package/prisma-client/scripts/default-index.js +3 -3
|
@@ -33,18 +33,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/@prisma+engines-version@5.20.0-
|
|
36
|
+
// ../../node_modules/.pnpm/@prisma+engines-version@5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284/node_modules/@prisma/engines-version/package.json
|
|
37
37
|
var require_package = __commonJS({
|
|
38
|
-
"../../node_modules/.pnpm/@prisma+engines-version@5.20.0-
|
|
38
|
+
"../../node_modules/.pnpm/@prisma+engines-version@5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284/node_modules/@prisma/engines-version/package.json"(exports2, module2) {
|
|
39
39
|
module2.exports = {
|
|
40
40
|
name: "@prisma/engines-version",
|
|
41
|
-
version: "5.20.0-
|
|
41
|
+
version: "5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284",
|
|
42
42
|
main: "index.js",
|
|
43
43
|
types: "index.d.ts",
|
|
44
44
|
license: "Apache-2.0",
|
|
45
45
|
author: "Tim Suchanek <suchanek@prisma.io>",
|
|
46
46
|
prisma: {
|
|
47
|
-
enginesVersion: "
|
|
47
|
+
enginesVersion: "06fc58a368dc7be9fbbbe894adf8d445d208c284"
|
|
48
48
|
},
|
|
49
49
|
repository: {
|
|
50
50
|
type: "git",
|
|
@@ -66,9 +66,9 @@ var require_package = __commonJS({
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
// ../../node_modules/.pnpm/@prisma+engines-version@5.20.0-
|
|
69
|
+
// ../../node_modules/.pnpm/@prisma+engines-version@5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284/node_modules/@prisma/engines-version/index.js
|
|
70
70
|
var require_engines_version = __commonJS({
|
|
71
|
-
"../../node_modules/.pnpm/@prisma+engines-version@5.20.0-
|
|
71
|
+
"../../node_modules/.pnpm/@prisma+engines-version@5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284/node_modules/@prisma/engines-version/index.js"(exports2) {
|
|
72
72
|
"use strict";
|
|
73
73
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
74
74
|
exports2.enginesVersion = void 0;
|
|
@@ -3166,7 +3166,7 @@ var require_package2 = __commonJS({
|
|
|
3166
3166
|
"package.json"(exports2, module2) {
|
|
3167
3167
|
module2.exports = {
|
|
3168
3168
|
name: "@prisma/client",
|
|
3169
|
-
version: "5.20.0-dev.
|
|
3169
|
+
version: "5.20.0-dev.20",
|
|
3170
3170
|
description: "Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.",
|
|
3171
3171
|
keywords: [
|
|
3172
3172
|
"ORM",
|
|
@@ -3365,7 +3365,7 @@ var require_package2 = __commonJS({
|
|
|
3365
3365
|
"@prisma/debug": "workspace:*",
|
|
3366
3366
|
"@prisma/driver-adapter-utils": "workspace:*",
|
|
3367
3367
|
"@prisma/engines": "workspace:*",
|
|
3368
|
-
"@prisma/engines-version": "5.20.0-
|
|
3368
|
+
"@prisma/engines-version": "5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284",
|
|
3369
3369
|
"@prisma/fetch-engine": "workspace:*",
|
|
3370
3370
|
"@prisma/generator-helper": "workspace:*",
|
|
3371
3371
|
"@prisma/get-platform": "workspace:*",
|
|
@@ -3374,7 +3374,7 @@ var require_package2 = __commonJS({
|
|
|
3374
3374
|
"@prisma/migrate": "workspace:*",
|
|
3375
3375
|
"@prisma/mini-proxy": "0.9.5",
|
|
3376
3376
|
"@prisma/pg-worker": "workspace:*",
|
|
3377
|
-
"@prisma/query-engine-wasm": "5.20.0-
|
|
3377
|
+
"@prisma/query-engine-wasm": "5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284",
|
|
3378
3378
|
"@snaplet/copycat": "0.17.3",
|
|
3379
3379
|
"@swc-node/register": "1.10.9",
|
|
3380
3380
|
"@swc/core": "1.6.13",
|
|
@@ -5789,21 +5789,163 @@ function wellKnownSymbol(name) {
|
|
|
5789
5789
|
}
|
|
5790
5790
|
var toStringTag = wellKnownSymbol("toStringTag");
|
|
5791
5791
|
|
|
5792
|
+
// src/generation/utils.ts
|
|
5793
|
+
function getSelectName(modelName) {
|
|
5794
|
+
return `${modelName}Select`;
|
|
5795
|
+
}
|
|
5796
|
+
function getSelectCreateManyAndReturnName(modelName) {
|
|
5797
|
+
return `${modelName}SelectCreateManyAndReturn`;
|
|
5798
|
+
}
|
|
5799
|
+
function getIncludeName(modelName) {
|
|
5800
|
+
return `${modelName}Include`;
|
|
5801
|
+
}
|
|
5802
|
+
function getIncludeCreateManyAndReturnName(modelName) {
|
|
5803
|
+
return `${modelName}IncludeCreateManyAndReturn`;
|
|
5804
|
+
}
|
|
5805
|
+
function getCreateManyAndReturnOutputType(modelName) {
|
|
5806
|
+
return `CreateMany${modelName}AndReturnOutputType`;
|
|
5807
|
+
}
|
|
5808
|
+
function getOmitName(modelName) {
|
|
5809
|
+
return `${modelName}Omit`;
|
|
5810
|
+
}
|
|
5811
|
+
function getAggregateName(modelName) {
|
|
5812
|
+
return `Aggregate${capitalize2(modelName)}`;
|
|
5813
|
+
}
|
|
5814
|
+
function getGroupByName(modelName) {
|
|
5815
|
+
return `${capitalize2(modelName)}GroupByOutputType`;
|
|
5816
|
+
}
|
|
5817
|
+
function getAvgAggregateName(modelName) {
|
|
5818
|
+
return `${capitalize2(modelName)}AvgAggregateOutputType`;
|
|
5819
|
+
}
|
|
5820
|
+
function getSumAggregateName(modelName) {
|
|
5821
|
+
return `${capitalize2(modelName)}SumAggregateOutputType`;
|
|
5822
|
+
}
|
|
5823
|
+
function getMinAggregateName(modelName) {
|
|
5824
|
+
return `${capitalize2(modelName)}MinAggregateOutputType`;
|
|
5825
|
+
}
|
|
5826
|
+
function getMaxAggregateName(modelName) {
|
|
5827
|
+
return `${capitalize2(modelName)}MaxAggregateOutputType`;
|
|
5828
|
+
}
|
|
5829
|
+
function getCountAggregateInputName(modelName) {
|
|
5830
|
+
return `${capitalize2(modelName)}CountAggregateInputType`;
|
|
5831
|
+
}
|
|
5832
|
+
function getCountAggregateOutputName(modelName) {
|
|
5833
|
+
return `${capitalize2(modelName)}CountAggregateOutputType`;
|
|
5834
|
+
}
|
|
5835
|
+
function getAggregateInputType(aggregateOutputType) {
|
|
5836
|
+
return aggregateOutputType.replace(/OutputType$/, "InputType");
|
|
5837
|
+
}
|
|
5838
|
+
function getGroupByArgsName(modelName) {
|
|
5839
|
+
return `${modelName}GroupByArgs`;
|
|
5840
|
+
}
|
|
5841
|
+
function getGroupByPayloadName(modelName) {
|
|
5842
|
+
return `Get${capitalize2(modelName)}GroupByPayload`;
|
|
5843
|
+
}
|
|
5844
|
+
function getAggregateArgsName(modelName) {
|
|
5845
|
+
return `${capitalize2(modelName)}AggregateArgs`;
|
|
5846
|
+
}
|
|
5847
|
+
function getAggregateGetName(modelName) {
|
|
5848
|
+
return `Get${capitalize2(modelName)}AggregateType`;
|
|
5849
|
+
}
|
|
5850
|
+
function getFieldArgName(field, modelName) {
|
|
5851
|
+
if (field.args.length) {
|
|
5852
|
+
return getModelFieldArgsName(field, modelName);
|
|
5853
|
+
}
|
|
5854
|
+
return getModelArgName(field.outputType.type);
|
|
5855
|
+
}
|
|
5856
|
+
function getModelFieldArgsName(field, modelName) {
|
|
5857
|
+
return `${modelName}$${field.name}Args`;
|
|
5858
|
+
}
|
|
5859
|
+
function getLegacyModelArgName(modelName) {
|
|
5860
|
+
return `${modelName}Args`;
|
|
5861
|
+
}
|
|
5862
|
+
function getModelArgName(modelName, action) {
|
|
5863
|
+
if (!action) {
|
|
5864
|
+
return `${modelName}DefaultArgs`;
|
|
5865
|
+
}
|
|
5866
|
+
switch (action) {
|
|
5867
|
+
case DMMF.ModelAction.findMany:
|
|
5868
|
+
return `${modelName}FindManyArgs`;
|
|
5869
|
+
case DMMF.ModelAction.findUnique:
|
|
5870
|
+
return `${modelName}FindUniqueArgs`;
|
|
5871
|
+
case DMMF.ModelAction.findUniqueOrThrow:
|
|
5872
|
+
return `${modelName}FindUniqueOrThrowArgs`;
|
|
5873
|
+
case DMMF.ModelAction.findFirst:
|
|
5874
|
+
return `${modelName}FindFirstArgs`;
|
|
5875
|
+
case DMMF.ModelAction.findFirstOrThrow:
|
|
5876
|
+
return `${modelName}FindFirstOrThrowArgs`;
|
|
5877
|
+
case DMMF.ModelAction.upsert:
|
|
5878
|
+
return `${modelName}UpsertArgs`;
|
|
5879
|
+
case DMMF.ModelAction.update:
|
|
5880
|
+
return `${modelName}UpdateArgs`;
|
|
5881
|
+
case DMMF.ModelAction.updateMany:
|
|
5882
|
+
return `${modelName}UpdateManyArgs`;
|
|
5883
|
+
case DMMF.ModelAction.delete:
|
|
5884
|
+
return `${modelName}DeleteArgs`;
|
|
5885
|
+
case DMMF.ModelAction.create:
|
|
5886
|
+
return `${modelName}CreateArgs`;
|
|
5887
|
+
case DMMF.ModelAction.createMany:
|
|
5888
|
+
return `${modelName}CreateManyArgs`;
|
|
5889
|
+
case DMMF.ModelAction.createManyAndReturn:
|
|
5890
|
+
return `${modelName}CreateManyAndReturnArgs`;
|
|
5891
|
+
case DMMF.ModelAction.deleteMany:
|
|
5892
|
+
return `${modelName}DeleteManyArgs`;
|
|
5893
|
+
case DMMF.ModelAction.groupBy:
|
|
5894
|
+
return getGroupByArgsName(modelName);
|
|
5895
|
+
case DMMF.ModelAction.aggregate:
|
|
5896
|
+
return getAggregateArgsName(modelName);
|
|
5897
|
+
case DMMF.ModelAction.count:
|
|
5898
|
+
return `${modelName}CountArgs`;
|
|
5899
|
+
case DMMF.ModelAction.findRaw:
|
|
5900
|
+
return `${modelName}FindRawArgs`;
|
|
5901
|
+
case DMMF.ModelAction.aggregateRaw:
|
|
5902
|
+
return `${modelName}AggregateRawArgs`;
|
|
5903
|
+
default:
|
|
5904
|
+
assertNever(action, `Unknown action: ${action}`);
|
|
5905
|
+
}
|
|
5906
|
+
}
|
|
5907
|
+
function getPayloadName(modelName, namespace2 = true) {
|
|
5908
|
+
if (namespace2) {
|
|
5909
|
+
return `Prisma.${getPayloadName(modelName, false)}`;
|
|
5910
|
+
}
|
|
5911
|
+
return `$${modelName}Payload`;
|
|
5912
|
+
}
|
|
5913
|
+
function getFieldRefsTypeName(name) {
|
|
5914
|
+
return `${name}FieldRefs`;
|
|
5915
|
+
}
|
|
5916
|
+
function capitalize2(str) {
|
|
5917
|
+
return str[0].toUpperCase() + str.slice(1);
|
|
5918
|
+
}
|
|
5919
|
+
function getRefAllowedTypeName(type) {
|
|
5920
|
+
let typeName = type.type;
|
|
5921
|
+
if (type.isList) {
|
|
5922
|
+
typeName += "[]";
|
|
5923
|
+
}
|
|
5924
|
+
return `'${typeName}'`;
|
|
5925
|
+
}
|
|
5926
|
+
function appendSkipType(context, type) {
|
|
5927
|
+
if (context.isPreviewFeatureOn("strictUndefinedChecks")) {
|
|
5928
|
+
return unionType([type, namedType("$Types.Skip")]);
|
|
5929
|
+
}
|
|
5930
|
+
return type;
|
|
5931
|
+
}
|
|
5932
|
+
var extArgsParam = genericParameter("ExtArgs").extends(namedType("$Extensions.InternalArgs")).default(namedType("$Extensions.DefaultArgs"));
|
|
5933
|
+
|
|
5792
5934
|
// src/generation/TSClient/Input.ts
|
|
5793
5935
|
var InputField = class {
|
|
5794
|
-
constructor(field,
|
|
5936
|
+
constructor(field, context, source) {
|
|
5795
5937
|
this.field = field;
|
|
5796
|
-
this.
|
|
5938
|
+
this.context = context;
|
|
5797
5939
|
this.source = source;
|
|
5798
5940
|
}
|
|
5799
5941
|
toTS() {
|
|
5800
|
-
const property2 = buildInputField(this.field, this.
|
|
5942
|
+
const property2 = buildInputField(this.field, this.context, this.source);
|
|
5801
5943
|
return stringify(property2);
|
|
5802
5944
|
}
|
|
5803
5945
|
};
|
|
5804
|
-
function buildInputField(field,
|
|
5805
|
-
const tsType = buildAllFieldTypes(field.inputTypes,
|
|
5806
|
-
const tsProperty = property(field.name, tsType);
|
|
5946
|
+
function buildInputField(field, context, source) {
|
|
5947
|
+
const tsType = buildAllFieldTypes(field.inputTypes, context, source);
|
|
5948
|
+
const tsProperty = property(field.name, field.isRequired ? tsType : appendSkipType(context, tsType));
|
|
5807
5949
|
if (!field.isRequired) {
|
|
5808
5950
|
tsProperty.optional();
|
|
5809
5951
|
}
|
|
@@ -5850,11 +5992,11 @@ function buildSingleFieldType(t, genericsInfo, source) {
|
|
|
5850
5992
|
function namedInputType(typeName) {
|
|
5851
5993
|
return namedType(JSOutputTypeToInputType[typeName] ?? typeName);
|
|
5852
5994
|
}
|
|
5853
|
-
function buildAllFieldTypes(inputTypes,
|
|
5995
|
+
function buildAllFieldTypes(inputTypes, context, source) {
|
|
5854
5996
|
const inputObjectTypes = inputTypes.filter((t) => t.location === "inputObjectTypes" && !t.isList);
|
|
5855
5997
|
const otherTypes = inputTypes.filter((t) => t.location !== "inputObjectTypes" || t.isList);
|
|
5856
|
-
const tsInputObjectTypes = inputObjectTypes.map((type) => buildSingleFieldType(type,
|
|
5857
|
-
const tsOtherTypes = otherTypes.map((type) => buildSingleFieldType(type,
|
|
5998
|
+
const tsInputObjectTypes = inputObjectTypes.map((type) => buildSingleFieldType(type, context.genericArgsInfo, source));
|
|
5999
|
+
const tsOtherTypes = otherTypes.map((type) => buildSingleFieldType(type, context.genericArgsInfo, source));
|
|
5858
6000
|
if (tsOtherTypes.length === 0) {
|
|
5859
6001
|
return xorTypes(tsInputObjectTypes);
|
|
5860
6002
|
}
|
|
@@ -5867,9 +6009,9 @@ function xorTypes(types) {
|
|
|
5867
6009
|
return types.reduce((prev, curr) => namedType("XOR").addGenericArgument(prev).addGenericArgument(curr));
|
|
5868
6010
|
}
|
|
5869
6011
|
var InputType = class {
|
|
5870
|
-
constructor(type,
|
|
6012
|
+
constructor(type, context) {
|
|
5871
6013
|
this.type = type;
|
|
5872
|
-
this.
|
|
6014
|
+
this.context = context;
|
|
5873
6015
|
this.generatedName = type.name;
|
|
5874
6016
|
}
|
|
5875
6017
|
toTS() {
|
|
@@ -5879,7 +6021,7 @@ var InputType = class {
|
|
|
5879
6021
|
const body = `{
|
|
5880
6022
|
${(0, import_indent_string2.default)(
|
|
5881
6023
|
fields.map((arg) => {
|
|
5882
|
-
return new InputField(arg, this.
|
|
6024
|
+
return new InputField(arg, this.context, source).toTS();
|
|
5883
6025
|
}).join("\n"),
|
|
5884
6026
|
TAB_SIZE
|
|
5885
6027
|
)}
|
|
@@ -5892,7 +6034,7 @@ export type ${this.getTypeName()} = ${wrapWithAtLeast(body, type)}`;
|
|
|
5892
6034
|
return this;
|
|
5893
6035
|
}
|
|
5894
6036
|
getTypeName() {
|
|
5895
|
-
if (this.
|
|
6037
|
+
if (this.context.genericArgsInfo.typeNeedsGenericModelArg(this.type)) {
|
|
5896
6038
|
return `${this.generatedName}<$PrismaModel = never>`;
|
|
5897
6039
|
}
|
|
5898
6040
|
return this.generatedName;
|
|
@@ -5979,142 +6121,6 @@ function klona(x) {
|
|
|
5979
6121
|
return x;
|
|
5980
6122
|
}
|
|
5981
6123
|
|
|
5982
|
-
// src/generation/utils.ts
|
|
5983
|
-
function getSelectName(modelName) {
|
|
5984
|
-
return `${modelName}Select`;
|
|
5985
|
-
}
|
|
5986
|
-
function getSelectCreateManyAndReturnName(modelName) {
|
|
5987
|
-
return `${modelName}SelectCreateManyAndReturn`;
|
|
5988
|
-
}
|
|
5989
|
-
function getIncludeName(modelName) {
|
|
5990
|
-
return `${modelName}Include`;
|
|
5991
|
-
}
|
|
5992
|
-
function getIncludeCreateManyAndReturnName(modelName) {
|
|
5993
|
-
return `${modelName}IncludeCreateManyAndReturn`;
|
|
5994
|
-
}
|
|
5995
|
-
function getCreateManyAndReturnOutputType(modelName) {
|
|
5996
|
-
return `CreateMany${modelName}AndReturnOutputType`;
|
|
5997
|
-
}
|
|
5998
|
-
function getOmitName(modelName) {
|
|
5999
|
-
return `${modelName}Omit`;
|
|
6000
|
-
}
|
|
6001
|
-
function getAggregateName(modelName) {
|
|
6002
|
-
return `Aggregate${capitalize2(modelName)}`;
|
|
6003
|
-
}
|
|
6004
|
-
function getGroupByName(modelName) {
|
|
6005
|
-
return `${capitalize2(modelName)}GroupByOutputType`;
|
|
6006
|
-
}
|
|
6007
|
-
function getAvgAggregateName(modelName) {
|
|
6008
|
-
return `${capitalize2(modelName)}AvgAggregateOutputType`;
|
|
6009
|
-
}
|
|
6010
|
-
function getSumAggregateName(modelName) {
|
|
6011
|
-
return `${capitalize2(modelName)}SumAggregateOutputType`;
|
|
6012
|
-
}
|
|
6013
|
-
function getMinAggregateName(modelName) {
|
|
6014
|
-
return `${capitalize2(modelName)}MinAggregateOutputType`;
|
|
6015
|
-
}
|
|
6016
|
-
function getMaxAggregateName(modelName) {
|
|
6017
|
-
return `${capitalize2(modelName)}MaxAggregateOutputType`;
|
|
6018
|
-
}
|
|
6019
|
-
function getCountAggregateInputName(modelName) {
|
|
6020
|
-
return `${capitalize2(modelName)}CountAggregateInputType`;
|
|
6021
|
-
}
|
|
6022
|
-
function getCountAggregateOutputName(modelName) {
|
|
6023
|
-
return `${capitalize2(modelName)}CountAggregateOutputType`;
|
|
6024
|
-
}
|
|
6025
|
-
function getAggregateInputType(aggregateOutputType) {
|
|
6026
|
-
return aggregateOutputType.replace(/OutputType$/, "InputType");
|
|
6027
|
-
}
|
|
6028
|
-
function getGroupByArgsName(modelName) {
|
|
6029
|
-
return `${modelName}GroupByArgs`;
|
|
6030
|
-
}
|
|
6031
|
-
function getGroupByPayloadName(modelName) {
|
|
6032
|
-
return `Get${capitalize2(modelName)}GroupByPayload`;
|
|
6033
|
-
}
|
|
6034
|
-
function getAggregateArgsName(modelName) {
|
|
6035
|
-
return `${capitalize2(modelName)}AggregateArgs`;
|
|
6036
|
-
}
|
|
6037
|
-
function getAggregateGetName(modelName) {
|
|
6038
|
-
return `Get${capitalize2(modelName)}AggregateType`;
|
|
6039
|
-
}
|
|
6040
|
-
function getFieldArgName(field, modelName) {
|
|
6041
|
-
if (field.args.length) {
|
|
6042
|
-
return getModelFieldArgsName(field, modelName);
|
|
6043
|
-
}
|
|
6044
|
-
return getModelArgName(field.outputType.type);
|
|
6045
|
-
}
|
|
6046
|
-
function getModelFieldArgsName(field, modelName) {
|
|
6047
|
-
return `${modelName}$${field.name}Args`;
|
|
6048
|
-
}
|
|
6049
|
-
function getLegacyModelArgName(modelName) {
|
|
6050
|
-
return `${modelName}Args`;
|
|
6051
|
-
}
|
|
6052
|
-
function getModelArgName(modelName, action) {
|
|
6053
|
-
if (!action) {
|
|
6054
|
-
return `${modelName}DefaultArgs`;
|
|
6055
|
-
}
|
|
6056
|
-
switch (action) {
|
|
6057
|
-
case DMMF.ModelAction.findMany:
|
|
6058
|
-
return `${modelName}FindManyArgs`;
|
|
6059
|
-
case DMMF.ModelAction.findUnique:
|
|
6060
|
-
return `${modelName}FindUniqueArgs`;
|
|
6061
|
-
case DMMF.ModelAction.findUniqueOrThrow:
|
|
6062
|
-
return `${modelName}FindUniqueOrThrowArgs`;
|
|
6063
|
-
case DMMF.ModelAction.findFirst:
|
|
6064
|
-
return `${modelName}FindFirstArgs`;
|
|
6065
|
-
case DMMF.ModelAction.findFirstOrThrow:
|
|
6066
|
-
return `${modelName}FindFirstOrThrowArgs`;
|
|
6067
|
-
case DMMF.ModelAction.upsert:
|
|
6068
|
-
return `${modelName}UpsertArgs`;
|
|
6069
|
-
case DMMF.ModelAction.update:
|
|
6070
|
-
return `${modelName}UpdateArgs`;
|
|
6071
|
-
case DMMF.ModelAction.updateMany:
|
|
6072
|
-
return `${modelName}UpdateManyArgs`;
|
|
6073
|
-
case DMMF.ModelAction.delete:
|
|
6074
|
-
return `${modelName}DeleteArgs`;
|
|
6075
|
-
case DMMF.ModelAction.create:
|
|
6076
|
-
return `${modelName}CreateArgs`;
|
|
6077
|
-
case DMMF.ModelAction.createMany:
|
|
6078
|
-
return `${modelName}CreateManyArgs`;
|
|
6079
|
-
case DMMF.ModelAction.createManyAndReturn:
|
|
6080
|
-
return `${modelName}CreateManyAndReturnArgs`;
|
|
6081
|
-
case DMMF.ModelAction.deleteMany:
|
|
6082
|
-
return `${modelName}DeleteManyArgs`;
|
|
6083
|
-
case DMMF.ModelAction.groupBy:
|
|
6084
|
-
return getGroupByArgsName(modelName);
|
|
6085
|
-
case DMMF.ModelAction.aggregate:
|
|
6086
|
-
return getAggregateArgsName(modelName);
|
|
6087
|
-
case DMMF.ModelAction.count:
|
|
6088
|
-
return `${modelName}CountArgs`;
|
|
6089
|
-
case DMMF.ModelAction.findRaw:
|
|
6090
|
-
return `${modelName}FindRawArgs`;
|
|
6091
|
-
case DMMF.ModelAction.aggregateRaw:
|
|
6092
|
-
return `${modelName}AggregateRawArgs`;
|
|
6093
|
-
default:
|
|
6094
|
-
assertNever(action, `Unknown action: ${action}`);
|
|
6095
|
-
}
|
|
6096
|
-
}
|
|
6097
|
-
function getPayloadName(modelName, namespace2 = true) {
|
|
6098
|
-
if (namespace2) {
|
|
6099
|
-
return `Prisma.${getPayloadName(modelName, false)}`;
|
|
6100
|
-
}
|
|
6101
|
-
return `$${modelName}Payload`;
|
|
6102
|
-
}
|
|
6103
|
-
function getFieldRefsTypeName(name) {
|
|
6104
|
-
return `${name}FieldRefs`;
|
|
6105
|
-
}
|
|
6106
|
-
function capitalize2(str) {
|
|
6107
|
-
return str[0].toUpperCase() + str.slice(1);
|
|
6108
|
-
}
|
|
6109
|
-
function getRefAllowedTypeName(type) {
|
|
6110
|
-
let typeName = type.type;
|
|
6111
|
-
if (type.isList) {
|
|
6112
|
-
typeName += "[]";
|
|
6113
|
-
}
|
|
6114
|
-
return `'${typeName}'`;
|
|
6115
|
-
}
|
|
6116
|
-
var extArgsParam = genericParameter("ExtArgs").extends(namedType("$Extensions.InternalArgs")).default(namedType("$Extensions.DefaultArgs"));
|
|
6117
|
-
|
|
6118
6124
|
// src/generation/TSClient/helpers.ts
|
|
6119
6125
|
var import_pluralize2 = __toESM(require_pluralize());
|
|
6120
6126
|
|
|
@@ -6552,7 +6558,7 @@ var ArgsTypeBuilder = class {
|
|
|
6552
6558
|
}
|
|
6553
6559
|
addSchemaArgs(args) {
|
|
6554
6560
|
for (const arg of args) {
|
|
6555
|
-
const inputField = buildInputField(arg, this.context
|
|
6561
|
+
const inputField = buildInputField(arg, this.context);
|
|
6556
6562
|
const docComment2 = getArgFieldJSDoc(this.type, this.action, arg);
|
|
6557
6563
|
if (docComment2) {
|
|
6558
6564
|
inputField.setDocComment(docComment(docComment2));
|
|
@@ -6740,37 +6746,46 @@ function buildModelPayload(model, context) {
|
|
|
6740
6746
|
function buildIncludeType({
|
|
6741
6747
|
modelName,
|
|
6742
6748
|
typeName = getIncludeName(modelName),
|
|
6743
|
-
|
|
6749
|
+
context,
|
|
6744
6750
|
fields
|
|
6745
6751
|
}) {
|
|
6746
|
-
const type = buildSelectOrIncludeObject(modelName, getIncludeFields(fields, dmmf));
|
|
6752
|
+
const type = buildSelectOrIncludeObject(modelName, getIncludeFields(fields, context.dmmf), context);
|
|
6747
6753
|
return buildExport(typeName, type);
|
|
6748
6754
|
}
|
|
6749
|
-
function buildOmitType({ modelName, fields,
|
|
6755
|
+
function buildOmitType({ modelName, fields, context }) {
|
|
6750
6756
|
const keysType = unionType(
|
|
6751
6757
|
fields.filter(
|
|
6752
|
-
(field) => field.outputType.location === "scalar" || field.outputType.location === "enumTypes" || dmmf.isComposite(field.outputType.type)
|
|
6758
|
+
(field) => field.outputType.location === "scalar" || field.outputType.location === "enumTypes" || context.dmmf.isComposite(field.outputType.type)
|
|
6753
6759
|
).map((field) => stringLiteral(field.name))
|
|
6754
6760
|
);
|
|
6755
6761
|
const omitType = namedType("$Extensions.GetOmit").addGenericArgument(keysType).addGenericArgument(modelResultExtensionsType(modelName));
|
|
6762
|
+
if (context.isPreviewFeatureOn("strictUndefinedChecks")) {
|
|
6763
|
+
omitType.addGenericArgument(namedType("$Types.Skip"));
|
|
6764
|
+
}
|
|
6756
6765
|
return buildExport(getOmitName(modelName), omitType);
|
|
6757
6766
|
}
|
|
6758
|
-
function buildSelectType({
|
|
6759
|
-
|
|
6767
|
+
function buildSelectType({
|
|
6768
|
+
modelName,
|
|
6769
|
+
typeName = getSelectName(modelName),
|
|
6770
|
+
fields,
|
|
6771
|
+
context
|
|
6772
|
+
}) {
|
|
6773
|
+
const objectType2 = buildSelectOrIncludeObject(modelName, fields, context);
|
|
6760
6774
|
const selectType = namedType("$Extensions.GetSelect").addGenericArgument(objectType2).addGenericArgument(modelResultExtensionsType(modelName));
|
|
6761
6775
|
return buildExport(typeName, selectType);
|
|
6762
6776
|
}
|
|
6763
6777
|
function modelResultExtensionsType(modelName) {
|
|
6764
6778
|
return extArgsParam.toArgument().subKey("result").subKey(lowerCase(modelName));
|
|
6765
6779
|
}
|
|
6766
|
-
function buildScalarSelectType({ modelName, fields }) {
|
|
6780
|
+
function buildScalarSelectType({ modelName, fields, context }) {
|
|
6767
6781
|
const object = buildSelectOrIncludeObject(
|
|
6768
6782
|
modelName,
|
|
6769
|
-
fields.filter((field) => field.outputType.location === "scalar" || field.outputType.location === "enumTypes")
|
|
6783
|
+
fields.filter((field) => field.outputType.location === "scalar" || field.outputType.location === "enumTypes"),
|
|
6784
|
+
context
|
|
6770
6785
|
);
|
|
6771
6786
|
return moduleExport(typeDeclaration(`${getSelectName(modelName)}Scalar`, object));
|
|
6772
6787
|
}
|
|
6773
|
-
function buildSelectOrIncludeObject(modelName, fields) {
|
|
6788
|
+
function buildSelectOrIncludeObject(modelName, fields, context) {
|
|
6774
6789
|
const objectType2 = objectType();
|
|
6775
6790
|
for (const field of fields) {
|
|
6776
6791
|
const fieldType = unionType(booleanType);
|
|
@@ -6779,7 +6794,7 @@ function buildSelectOrIncludeObject(modelName, fields) {
|
|
|
6779
6794
|
subSelectType.addGenericArgument(extArgsParam.toArgument());
|
|
6780
6795
|
fieldType.addVariant(subSelectType);
|
|
6781
6796
|
}
|
|
6782
|
-
objectType2.add(property(field.name, fieldType).optional());
|
|
6797
|
+
objectType2.add(property(field.name, appendSkipType(context, fieldType)).optional());
|
|
6783
6798
|
}
|
|
6784
6799
|
return objectType2;
|
|
6785
6800
|
}
|
|
@@ -6814,7 +6829,6 @@ var Model = class {
|
|
|
6814
6829
|
this.model = model;
|
|
6815
6830
|
this.context = context;
|
|
6816
6831
|
this.dmmf = context.dmmf;
|
|
6817
|
-
this.genericsInfo = context.genericArgsInfo;
|
|
6818
6832
|
this.type = this.context.dmmf.outputTypeMap.model[model.name];
|
|
6819
6833
|
this.createManyAndReturnType = this.context.dmmf.outputTypeMap.model[getCreateManyAndReturnOutputType(model.name)];
|
|
6820
6834
|
this.mapping = this.context.dmmf.mappings.modelOperations.find((m) => m.model === model.name);
|
|
@@ -6888,7 +6902,7 @@ export type ${groupByArgsName}<ExtArgs extends $Extensions.InternalArgs = $Exten
|
|
|
6888
6902
|
${(0, import_indent_string3.default)(
|
|
6889
6903
|
groupByRootField.args.map((arg) => {
|
|
6890
6904
|
const updatedArg = { ...arg, comment: getArgFieldJSDoc(this.type, DMMF.ModelAction.groupBy, arg) };
|
|
6891
|
-
return new InputField(updatedArg, this.
|
|
6905
|
+
return new InputField(updatedArg, this.context).toTS();
|
|
6892
6906
|
}).concat(
|
|
6893
6907
|
groupByType.fields.filter((f) => f.outputType.location === "outputObjectTypes").map((f) => {
|
|
6894
6908
|
if (f.outputType.location === "outputObjectTypes") {
|
|
@@ -6975,14 +6989,14 @@ ${aggregateTypes.length > 1 ? aggregateTypes.slice(1).map((type) => {
|
|
|
6975
6989
|
]
|
|
6976
6990
|
}))
|
|
6977
6991
|
};
|
|
6978
|
-
return new InputType(newType, this.
|
|
6992
|
+
return new InputType(newType, this.context).toTS();
|
|
6979
6993
|
}).join("\n") : ""}
|
|
6980
6994
|
|
|
6981
6995
|
export type ${aggregateArgsName}<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = {
|
|
6982
6996
|
${(0, import_indent_string3.default)(
|
|
6983
6997
|
aggregateRootField.args.map((arg) => {
|
|
6984
6998
|
const updatedArg = { ...arg, comment: getArgFieldJSDoc(this.type, DMMF.ModelAction.aggregate, arg) };
|
|
6985
|
-
return new InputField(updatedArg, this.
|
|
6999
|
+
return new InputField(updatedArg, this.context).toTS();
|
|
6986
7000
|
}).concat(
|
|
6987
7001
|
aggregateType.fields.map((f) => {
|
|
6988
7002
|
let data = "";
|
|
@@ -7025,18 +7039,21 @@ export type ${getAggregateGetName(model.name)}<T extends ${getAggregateArgsName(
|
|
|
7025
7039
|
toTS() {
|
|
7026
7040
|
const { model } = this;
|
|
7027
7041
|
const isComposite = this.dmmf.isComposite(model.name);
|
|
7028
|
-
const omitType = this.context.isPreviewFeatureOn("omitApi") ? stringify(buildOmitType({ modelName: this.model.name,
|
|
7042
|
+
const omitType = this.context.isPreviewFeatureOn("omitApi") ? stringify(buildOmitType({ modelName: this.model.name, context: this.context, fields: this.type.fields }), {
|
|
7029
7043
|
newLine: "leading"
|
|
7030
7044
|
}) : "";
|
|
7031
7045
|
const hasRelationField = model.fields.some((f) => f.kind === "object");
|
|
7032
|
-
const includeType = hasRelationField ? stringify(
|
|
7033
|
-
|
|
7034
|
-
|
|
7046
|
+
const includeType = hasRelationField ? stringify(
|
|
7047
|
+
buildIncludeType({ modelName: this.model.name, context: this.context, fields: this.type.fields }),
|
|
7048
|
+
{
|
|
7049
|
+
newLine: "leading"
|
|
7050
|
+
}
|
|
7051
|
+
) : "";
|
|
7035
7052
|
const createManyAndReturnIncludeType = hasRelationField && this.createManyAndReturnType ? stringify(
|
|
7036
7053
|
buildIncludeType({
|
|
7037
7054
|
typeName: getIncludeCreateManyAndReturnName(this.model.name),
|
|
7038
7055
|
modelName: this.model.name,
|
|
7039
|
-
|
|
7056
|
+
context: this.context,
|
|
7040
7057
|
fields: this.createManyAndReturnType.fields
|
|
7041
7058
|
}),
|
|
7042
7059
|
{
|
|
@@ -7052,16 +7069,17 @@ ${!isComposite ? this.getAggregationTypes() : ""}
|
|
|
7052
7069
|
|
|
7053
7070
|
${!isComposite ? this.getGroupByTypes() : ""}
|
|
7054
7071
|
|
|
7055
|
-
${stringify(buildSelectType({ modelName: this.model.name, fields: this.type.fields }))}
|
|
7072
|
+
${stringify(buildSelectType({ modelName: this.model.name, fields: this.type.fields, context: this.context }))}
|
|
7056
7073
|
${this.createManyAndReturnType ? stringify(
|
|
7057
7074
|
buildSelectType({
|
|
7058
7075
|
modelName: this.model.name,
|
|
7059
7076
|
fields: this.createManyAndReturnType.fields,
|
|
7077
|
+
context: this.context,
|
|
7060
7078
|
typeName: getSelectCreateManyAndReturnName(this.model.name)
|
|
7061
7079
|
}),
|
|
7062
7080
|
{ newLine: "leading" }
|
|
7063
7081
|
) : ""}
|
|
7064
|
-
${stringify(buildScalarSelectType({ modelName: this.model.name, fields: this.type.fields }), {
|
|
7082
|
+
${stringify(buildScalarSelectType({ modelName: this.model.name, fields: this.type.fields, context: this.context }), {
|
|
7065
7083
|
newLine: "leading"
|
|
7066
7084
|
})}
|
|
7067
7085
|
${omitType}${includeType}${createManyAndReturnIncludeType}
|
|
@@ -7839,6 +7857,7 @@ var commonCodeJS = ({
|
|
|
7839
7857
|
browser,
|
|
7840
7858
|
clientVersion: clientVersion2,
|
|
7841
7859
|
engineVersion,
|
|
7860
|
+
generator,
|
|
7842
7861
|
deno
|
|
7843
7862
|
}) => `${deno ? "const exports = {}" : ""}
|
|
7844
7863
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -7862,14 +7881,16 @@ import {
|
|
|
7862
7881
|
Extensions,
|
|
7863
7882
|
defineDmmfProperty,
|
|
7864
7883
|
Public,
|
|
7865
|
-
getRuntime
|
|
7884
|
+
getRuntime,
|
|
7885
|
+
skip
|
|
7866
7886
|
} from '${runtimeBase}/${runtimeNameJs}.js'` : browser ? `
|
|
7867
7887
|
const {
|
|
7868
7888
|
Decimal,
|
|
7869
7889
|
objectEnumValues,
|
|
7870
7890
|
makeStrictEnum,
|
|
7871
7891
|
Public,
|
|
7872
|
-
getRuntime
|
|
7892
|
+
getRuntime,
|
|
7893
|
+
skip
|
|
7873
7894
|
} = require('${runtimeBase}/${runtimeNameJs}.js')
|
|
7874
7895
|
` : `
|
|
7875
7896
|
const {
|
|
@@ -7884,6 +7905,7 @@ const {
|
|
|
7884
7905
|
empty,
|
|
7885
7906
|
join,
|
|
7886
7907
|
raw,
|
|
7908
|
+
skip,
|
|
7887
7909
|
Decimal,
|
|
7888
7910
|
Debug,
|
|
7889
7911
|
objectEnumValues,
|
|
@@ -7945,6 +7967,8 @@ Prisma.NullTypes = {
|
|
|
7945
7967
|
JsonNull: objectEnumValues.classes.JsonNull,
|
|
7946
7968
|
AnyNull: objectEnumValues.classes.AnyNull
|
|
7947
7969
|
}
|
|
7970
|
+
|
|
7971
|
+
${buildPrismaSkipJs(generator.previewFeatures)}
|
|
7948
7972
|
`;
|
|
7949
7973
|
var notSupportOnBrowser = (fnc, browser) => {
|
|
7950
7974
|
if (browser) {
|
|
@@ -7956,7 +7980,13 @@ In case this error is unexpected for you, please report it in https://pris.ly/pr
|
|
|
7956
7980
|
}
|
|
7957
7981
|
return fnc;
|
|
7958
7982
|
};
|
|
7959
|
-
var commonCodeTS = ({
|
|
7983
|
+
var commonCodeTS = ({
|
|
7984
|
+
runtimeBase,
|
|
7985
|
+
runtimeNameTs,
|
|
7986
|
+
clientVersion: clientVersion2,
|
|
7987
|
+
engineVersion,
|
|
7988
|
+
generator
|
|
7989
|
+
}) => ({
|
|
7960
7990
|
tsWithoutNamespace: () => `import * as runtime from '${runtimeBase}/${runtimeNameTs}';
|
|
7961
7991
|
import $Types = runtime.Types // general types
|
|
7962
7992
|
import $Public = runtime.Types.Public
|
|
@@ -7994,6 +8024,8 @@ export import join = runtime.join
|
|
|
7994
8024
|
export import raw = runtime.raw
|
|
7995
8025
|
export import Sql = runtime.Sql
|
|
7996
8026
|
|
|
8027
|
+
${buildPrismaSkipTs(generator.previewFeatures)}
|
|
8028
|
+
|
|
7997
8029
|
/**
|
|
7998
8030
|
* Decimal.js
|
|
7999
8031
|
*/
|
|
@@ -8386,6 +8418,25 @@ class ${name} {
|
|
|
8386
8418
|
}`;
|
|
8387
8419
|
return (0, import_indent_string4.default)(source, TAB_SIZE);
|
|
8388
8420
|
}
|
|
8421
|
+
function buildPrismaSkipTs(previewFeatures) {
|
|
8422
|
+
if (previewFeatures.includes("strictUndefinedChecks")) {
|
|
8423
|
+
return `
|
|
8424
|
+
/**
|
|
8425
|
+
* Prisma.skip
|
|
8426
|
+
*/
|
|
8427
|
+
export import skip = runtime.skip
|
|
8428
|
+
`;
|
|
8429
|
+
}
|
|
8430
|
+
return "";
|
|
8431
|
+
}
|
|
8432
|
+
function buildPrismaSkipJs(previewFeatures) {
|
|
8433
|
+
if (previewFeatures.includes("strictUndefinedChecks")) {
|
|
8434
|
+
return `
|
|
8435
|
+
Prisma.skip = skip
|
|
8436
|
+
`;
|
|
8437
|
+
}
|
|
8438
|
+
return "";
|
|
8439
|
+
}
|
|
8389
8440
|
|
|
8390
8441
|
// src/generation/TSClient/Count.ts
|
|
8391
8442
|
var import_indent_string5 = __toESM(require_indent_string());
|
|
@@ -9290,14 +9341,14 @@ ${this.dmmf.inputObjectTypes.prisma?.reduce((acc, inputType) => {
|
|
|
9290
9341
|
${baseName}
|
|
9291
9342
|
>
|
|
9292
9343
|
| OptionalFlat<Omit<${baseName}, 'path'>>`);
|
|
9293
|
-
acc.push(new InputType(inputType,
|
|
9344
|
+
acc.push(new InputType(inputType, context).overrideName(`${inputType.name}Base`).toTS());
|
|
9294
9345
|
} else {
|
|
9295
|
-
acc.push(new InputType(inputType,
|
|
9346
|
+
acc.push(new InputType(inputType, context).toTS());
|
|
9296
9347
|
}
|
|
9297
9348
|
return acc;
|
|
9298
9349
|
}, []).join("\n")}
|
|
9299
9350
|
|
|
9300
|
-
${this.dmmf.inputObjectTypes.model?.map((inputType) => new InputType(inputType,
|
|
9351
|
+
${this.dmmf.inputObjectTypes.model?.map((inputType) => new InputType(inputType, context).toTS()).join("\n") ?? ""}
|
|
9301
9352
|
|
|
9302
9353
|
/**
|
|
9303
9354
|
* Aliases for legacy arg types
|
|
@@ -9391,22 +9442,43 @@ var DbEnumsList = class {
|
|
|
9391
9442
|
hasEnum(name) {
|
|
9392
9443
|
return Boolean(this.enums.find((dbEnum) => dbEnum.name === name));
|
|
9393
9444
|
}
|
|
9394
|
-
*
|
|
9445
|
+
*validJsIdentifiers() {
|
|
9395
9446
|
for (const dbEnum of this.enums) {
|
|
9396
|
-
|
|
9447
|
+
if (isValidJsIdentifier(dbEnum.name)) {
|
|
9448
|
+
yield dbEnum;
|
|
9449
|
+
}
|
|
9450
|
+
}
|
|
9451
|
+
}
|
|
9452
|
+
*invalidJsIdentifiers() {
|
|
9453
|
+
for (const dbEnum of this.enums) {
|
|
9454
|
+
if (!isValidJsIdentifier(dbEnum.name)) {
|
|
9455
|
+
yield dbEnum;
|
|
9456
|
+
}
|
|
9397
9457
|
}
|
|
9398
9458
|
}
|
|
9399
9459
|
};
|
|
9400
9460
|
function buildDbEnums(list) {
|
|
9401
9461
|
const file2 = file();
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
}
|
|
9462
|
+
file2.add(buildInvalidIdentifierEnums(list));
|
|
9463
|
+
file2.add(buildValidIdentifierEnums(list));
|
|
9405
9464
|
return stringify(file2);
|
|
9406
9465
|
}
|
|
9407
|
-
function
|
|
9408
|
-
const
|
|
9409
|
-
|
|
9466
|
+
function buildValidIdentifierEnums(list) {
|
|
9467
|
+
const namespace2 = namespace("$DbEnums");
|
|
9468
|
+
for (const dbEnum of list.validJsIdentifiers()) {
|
|
9469
|
+
namespace2.add(typeDeclaration(dbEnum.name, enumToUnion(dbEnum)));
|
|
9470
|
+
}
|
|
9471
|
+
return moduleExport(namespace2);
|
|
9472
|
+
}
|
|
9473
|
+
function buildInvalidIdentifierEnums(list) {
|
|
9474
|
+
const iface = interfaceDeclaration("$DbEnums");
|
|
9475
|
+
for (const dbEnum of list.invalidJsIdentifiers()) {
|
|
9476
|
+
iface.add(property(dbEnum.name, enumToUnion(dbEnum)));
|
|
9477
|
+
}
|
|
9478
|
+
return moduleExport(iface);
|
|
9479
|
+
}
|
|
9480
|
+
function enumToUnion(dbEnum) {
|
|
9481
|
+
return unionType(dbEnum.values.map(stringLiteral));
|
|
9410
9482
|
}
|
|
9411
9483
|
function queryUsesEnums(query, enums) {
|
|
9412
9484
|
if (enums.isEmpty()) {
|
|
@@ -9419,7 +9491,7 @@ function queryUsesEnums(query, enums) {
|
|
|
9419
9491
|
function buildIndexTs(queries, enums) {
|
|
9420
9492
|
const file2 = file();
|
|
9421
9493
|
if (!enums.isEmpty()) {
|
|
9422
|
-
file2.add(moduleExportFrom("./$DbEnums").
|
|
9494
|
+
file2.add(moduleExportFrom("./$DbEnums").named("$DbEnums"));
|
|
9423
9495
|
}
|
|
9424
9496
|
for (const query of queries) {
|
|
9425
9497
|
file2.add(moduleExportFrom(`./${query.name}`));
|
|
@@ -9526,7 +9598,7 @@ function getMappingConfig(introspectionType, enums) {
|
|
|
9526
9598
|
const config = typeMappings[introspectionType];
|
|
9527
9599
|
if (!config) {
|
|
9528
9600
|
if (enums.hasEnum(introspectionType)) {
|
|
9529
|
-
const type =
|
|
9601
|
+
const type = getEnumType(introspectionType);
|
|
9530
9602
|
return { in: type, out: type };
|
|
9531
9603
|
}
|
|
9532
9604
|
throw new Error("Unknown type");
|
|
@@ -9536,13 +9608,19 @@ function getMappingConfig(introspectionType, enums) {
|
|
|
9536
9608
|
}
|
|
9537
9609
|
return config;
|
|
9538
9610
|
}
|
|
9611
|
+
function getEnumType(name) {
|
|
9612
|
+
if (isValidJsIdentifier(name)) {
|
|
9613
|
+
return namedType(`$DbEnums.${name}`);
|
|
9614
|
+
}
|
|
9615
|
+
return namedType("$DbEnums").subKey(name);
|
|
9616
|
+
}
|
|
9539
9617
|
|
|
9540
9618
|
// src/generation/typedSql/buildTypedQuery.ts
|
|
9541
9619
|
function buildTypedQueryTs({ query, runtimeBase, runtimeName, enums }) {
|
|
9542
9620
|
const file2 = file();
|
|
9543
9621
|
file2.addImport(moduleImport(`${runtimeBase}/${runtimeName}`).asNamespace("$runtime"));
|
|
9544
9622
|
if (queryUsesEnums(query, enums)) {
|
|
9545
|
-
file2.addImport(moduleImport("./$DbEnums").
|
|
9623
|
+
file2.addImport(moduleImport("./$DbEnums").named("$DbEnums"));
|
|
9546
9624
|
}
|
|
9547
9625
|
const doc = docComment(query.documentation ?? void 0);
|
|
9548
9626
|
const factoryType = functionType();
|