@prisma/client-generator-ts 6.16.0-dev.36 → 6.16.0-dev.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TSClient/GenerateContext.d.ts +3 -1
- package/dist/TSClient/ModelExports.d.ts +2 -0
- package/dist/TSClient/file-generators/BrowserFile.d.ts +3 -0
- package/dist/TSClient/file-generators/PrismaNamespaceBrowserFile.d.ts +2 -0
- package/dist/index.js +479 -405
- package/dist/index.mjs +456 -382
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -1850,7 +1850,7 @@ var require_ensure = __commonJS({
|
|
|
1850
1850
|
var require_utils2 = __commonJS({
|
|
1851
1851
|
"../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js"(exports, module) {
|
|
1852
1852
|
"use strict";
|
|
1853
|
-
function
|
|
1853
|
+
function stringify16(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
|
|
1854
1854
|
const EOF = finalEOL ? EOL : "";
|
|
1855
1855
|
const str = JSON.stringify(obj, replacer, spaces);
|
|
1856
1856
|
return str.replace(/\n/g, EOL) + EOF;
|
|
@@ -1859,7 +1859,7 @@ var require_utils2 = __commonJS({
|
|
|
1859
1859
|
if (Buffer.isBuffer(content)) content = content.toString("utf8");
|
|
1860
1860
|
return content.replace(/^\uFEFF/, "");
|
|
1861
1861
|
}
|
|
1862
|
-
module.exports = { stringify:
|
|
1862
|
+
module.exports = { stringify: stringify16, stripBom };
|
|
1863
1863
|
}
|
|
1864
1864
|
});
|
|
1865
1865
|
|
|
@@ -1874,7 +1874,7 @@ var require_jsonfile = __commonJS({
|
|
|
1874
1874
|
_fs = __require("fs");
|
|
1875
1875
|
}
|
|
1876
1876
|
var universalify = require_universalify();
|
|
1877
|
-
var { stringify:
|
|
1877
|
+
var { stringify: stringify16, stripBom } = require_utils2();
|
|
1878
1878
|
async function _readFile(file4, options = {}) {
|
|
1879
1879
|
if (typeof options === "string") {
|
|
1880
1880
|
options = { encoding: options };
|
|
@@ -1918,13 +1918,13 @@ var require_jsonfile = __commonJS({
|
|
|
1918
1918
|
}
|
|
1919
1919
|
async function _writeFile(file4, obj, options = {}) {
|
|
1920
1920
|
const fs3 = options.fs || _fs;
|
|
1921
|
-
const str =
|
|
1921
|
+
const str = stringify16(obj, options);
|
|
1922
1922
|
await universalify.fromCallback(fs3.writeFile)(file4, str, options);
|
|
1923
1923
|
}
|
|
1924
1924
|
var writeFile = universalify.fromPromise(_writeFile);
|
|
1925
1925
|
function writeFileSync(file4, obj, options = {}) {
|
|
1926
1926
|
const fs3 = options.fs || _fs;
|
|
1927
|
-
const str =
|
|
1927
|
+
const str = stringify16(obj, options);
|
|
1928
1928
|
return fs3.writeFileSync(file4, str, options);
|
|
1929
1929
|
}
|
|
1930
1930
|
var jsonfile = {
|
|
@@ -1986,10 +1986,10 @@ var require_output_file = __commonJS({
|
|
|
1986
1986
|
var require_output_json = __commonJS({
|
|
1987
1987
|
"../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json.js"(exports, module) {
|
|
1988
1988
|
"use strict";
|
|
1989
|
-
var { stringify:
|
|
1989
|
+
var { stringify: stringify16 } = require_utils2();
|
|
1990
1990
|
var { outputFile } = require_output_file();
|
|
1991
1991
|
async function outputJson(file4, data, options = {}) {
|
|
1992
|
-
const str =
|
|
1992
|
+
const str = stringify16(data, options);
|
|
1993
1993
|
await outputFile(file4, str, options);
|
|
1994
1994
|
}
|
|
1995
1995
|
module.exports = outputJson;
|
|
@@ -2000,10 +2000,10 @@ var require_output_json = __commonJS({
|
|
|
2000
2000
|
var require_output_json_sync = __commonJS({
|
|
2001
2001
|
"../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module) {
|
|
2002
2002
|
"use strict";
|
|
2003
|
-
var { stringify:
|
|
2003
|
+
var { stringify: stringify16 } = require_utils2();
|
|
2004
2004
|
var { outputFileSync } = require_output_file();
|
|
2005
2005
|
function outputJsonSync(file4, data, options) {
|
|
2006
|
-
const str =
|
|
2006
|
+
const str = stringify16(data, options);
|
|
2007
2007
|
outputFileSync(file4, str, options);
|
|
2008
2008
|
}
|
|
2009
2009
|
module.exports = outputJsonSync;
|
|
@@ -2219,7 +2219,7 @@ import { overwriteFile } from "@prisma/fetch-engine";
|
|
|
2219
2219
|
import {
|
|
2220
2220
|
assertNever as assertNever3,
|
|
2221
2221
|
ClientEngineType as ClientEngineType3,
|
|
2222
|
-
getClientEngineType as
|
|
2222
|
+
getClientEngineType as getClientEngineType4,
|
|
2223
2223
|
pathToPosix as pathToPosix3,
|
|
2224
2224
|
setClassName
|
|
2225
2225
|
} from "@prisma/internals";
|
|
@@ -2894,11 +2894,51 @@ var GenericArgsInfo = class {
|
|
|
2894
2894
|
}
|
|
2895
2895
|
};
|
|
2896
2896
|
|
|
2897
|
+
// src/TSClient/file-generators/BrowserFile.ts
|
|
2898
|
+
import { getClientEngineType } from "@prisma/internals";
|
|
2899
|
+
|
|
2900
|
+
// src/TSClient/ModelExports.ts
|
|
2901
|
+
import * as ts3 from "@prisma/ts-builders";
|
|
2902
|
+
function modelExports(context) {
|
|
2903
|
+
return Object.values(context.dmmf.typeAndModelMap).filter((model) => context.dmmf.outputTypeMap.model[model.name]).map((model) => {
|
|
2904
|
+
const docLines = model.documentation ?? "";
|
|
2905
|
+
const modelLine = `Model ${model.name}
|
|
2906
|
+
`;
|
|
2907
|
+
const docs = `${modelLine}${docLines}`;
|
|
2908
|
+
const suffix = "Model";
|
|
2909
|
+
const modelTypeExport = ts3.moduleExport(ts3.typeDeclaration(model.name, ts3.namedType(`Prisma.${model.name}${suffix}`))).setDocComment(ts3.docComment(docs));
|
|
2910
|
+
return ts3.stringify(modelTypeExport);
|
|
2911
|
+
});
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
// src/TSClient/file-generators/BrowserFile.ts
|
|
2915
|
+
var jsDocHeader = `/*
|
|
2916
|
+
* This file should be your main import to use Prisma-related types and utilities in a browser.
|
|
2917
|
+
* Use it to get access to models, enums, and input types.
|
|
2918
|
+
*
|
|
2919
|
+
* This file does not contain a \`PrismaClient\` class, nor several other helpers that are intended as server-side only.
|
|
2920
|
+
* See \`client.ts\` for the standard, server-side entry point.
|
|
2921
|
+
*
|
|
2922
|
+
* \u{1F7E2} You can import this file directly.
|
|
2923
|
+
*/
|
|
2924
|
+
`;
|
|
2925
|
+
function createBrowserFile(context, options) {
|
|
2926
|
+
const clientEngineType = getClientEngineType(options.generator);
|
|
2927
|
+
options.generator.config.engineType = clientEngineType;
|
|
2928
|
+
return `${jsDocHeader}
|
|
2929
|
+
import * as Prisma from '${context.importFileName("./internal/prismaNamespaceBrowser")}'
|
|
2930
|
+
export { Prisma }
|
|
2931
|
+
export * as $Enums from '${context.importFileName("./enums")}'
|
|
2932
|
+
export * from '${context.importFileName("./enums")}';
|
|
2933
|
+
${modelExports(context).join("\n")}
|
|
2934
|
+
`;
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2897
2937
|
// src/TSClient/file-generators/ClassFile.ts
|
|
2898
2938
|
import crypto from "node:crypto";
|
|
2899
2939
|
import path2 from "node:path";
|
|
2900
|
-
import { getClientEngineType, pathToPosix } from "@prisma/internals";
|
|
2901
|
-
import * as
|
|
2940
|
+
import { getClientEngineType as getClientEngineType2, pathToPosix } from "@prisma/internals";
|
|
2941
|
+
import * as ts6 from "@prisma/ts-builders";
|
|
2902
2942
|
import ciInfo from "ci-info";
|
|
2903
2943
|
|
|
2904
2944
|
// src/utils/buildInjectableEdgeEnv.ts
|
|
@@ -3538,22 +3578,22 @@ function buildWasmFileMap({ activeProvider, runtimeName }) {
|
|
|
3538
3578
|
|
|
3539
3579
|
// src/TSClient/PrismaClient.ts
|
|
3540
3580
|
import { capitalize as capitalize7, uncapitalize as uncapitalize4 } from "@prisma/client-common";
|
|
3541
|
-
import * as
|
|
3581
|
+
import * as ts5 from "@prisma/ts-builders";
|
|
3542
3582
|
import indent3 from "indent-string";
|
|
3543
3583
|
|
|
3544
3584
|
// src/utils/runtimeImport.ts
|
|
3545
|
-
import * as
|
|
3585
|
+
import * as ts4 from "@prisma/ts-builders";
|
|
3546
3586
|
function runtimeImport(name) {
|
|
3547
3587
|
return name;
|
|
3548
3588
|
}
|
|
3549
3589
|
function runtimeImportedType(name) {
|
|
3550
|
-
return
|
|
3590
|
+
return ts4.namedType(`runtime.${name}`);
|
|
3551
3591
|
}
|
|
3552
3592
|
|
|
3553
3593
|
// src/TSClient/utils/type-builders.ts
|
|
3554
|
-
import { NamedType, namedType as
|
|
3594
|
+
import { NamedType, namedType as namedType5 } from "@prisma/ts-builders";
|
|
3555
3595
|
function omit(type, keyType) {
|
|
3556
|
-
return
|
|
3596
|
+
return namedType5("Omit").addGenericArgument(type).addGenericArgument(keyType);
|
|
3557
3597
|
}
|
|
3558
3598
|
function promise(resultType) {
|
|
3559
3599
|
return new NamedType("runtime.Types.Utils.JsPromise").addGenericArgument(resultType);
|
|
@@ -3567,14 +3607,14 @@ function optional(innerType) {
|
|
|
3567
3607
|
|
|
3568
3608
|
// src/TSClient/PrismaClient.ts
|
|
3569
3609
|
function extendsPropertyDefinition() {
|
|
3570
|
-
const extendsDefinition =
|
|
3571
|
-
|
|
3610
|
+
const extendsDefinition = ts5.namedType("runtime.Types.Extensions.ExtendsHook").addGenericArgument(ts5.stringLiteral("extends")).addGenericArgument(ts5.namedType("Prisma.TypeMapCb").addGenericArgument(ts5.namedType("OmitOpts"))).addGenericArgument(ts5.namedType("ExtArgs")).addGenericArgument(
|
|
3611
|
+
ts5.namedType("runtime.Types.Utils.Call").addGenericArgument(ts5.namedType("Prisma.TypeMapCb").addGenericArgument(ts5.namedType("OmitOpts"))).addGenericArgument(ts5.objectType().add(ts5.property("extArgs", ts5.namedType("ExtArgs"))))
|
|
3572
3612
|
);
|
|
3573
|
-
return
|
|
3613
|
+
return ts5.stringify(ts5.property("$extends", extendsDefinition), { indentLevel: 1 });
|
|
3574
3614
|
}
|
|
3575
3615
|
function batchingTransactionDefinition(context) {
|
|
3576
|
-
const method3 =
|
|
3577
|
-
|
|
3616
|
+
const method3 = ts5.method("$transaction").setDocComment(
|
|
3617
|
+
ts5.docComment`
|
|
3578
3618
|
Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.
|
|
3579
3619
|
@example
|
|
3580
3620
|
\`\`\`
|
|
@@ -3587,25 +3627,25 @@ function batchingTransactionDefinition(context) {
|
|
|
3587
3627
|
|
|
3588
3628
|
Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).
|
|
3589
3629
|
`
|
|
3590
|
-
).addGenericParameter(
|
|
3630
|
+
).addGenericParameter(ts5.genericParameter("P").extends(ts5.array(prismaPromise(ts5.anyType)))).addParameter(ts5.parameter("arg", ts5.arraySpread(ts5.namedType("P")))).setReturnType(promise(ts5.namedType("runtime.Types.Utils.UnwrapTuple").addGenericArgument(ts5.namedType("P"))));
|
|
3591
3631
|
if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
|
|
3592
|
-
const options =
|
|
3593
|
-
method3.addParameter(
|
|
3632
|
+
const options = ts5.objectType().formatInline().add(ts5.property("isolationLevel", ts5.namedType("Prisma.TransactionIsolationLevel")).optional());
|
|
3633
|
+
method3.addParameter(ts5.parameter("options", options).optional());
|
|
3594
3634
|
}
|
|
3595
|
-
return
|
|
3635
|
+
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3596
3636
|
}
|
|
3597
3637
|
function interactiveTransactionDefinition(context) {
|
|
3598
|
-
const options =
|
|
3638
|
+
const options = ts5.objectType().formatInline().add(ts5.property("maxWait", ts5.numberType).optional()).add(ts5.property("timeout", ts5.numberType).optional());
|
|
3599
3639
|
if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
|
|
3600
|
-
const isolationLevel =
|
|
3640
|
+
const isolationLevel = ts5.property("isolationLevel", ts5.namedType("Prisma.TransactionIsolationLevel")).optional();
|
|
3601
3641
|
options.add(isolationLevel);
|
|
3602
3642
|
}
|
|
3603
|
-
const returnType = promise(
|
|
3604
|
-
const callbackType =
|
|
3605
|
-
|
|
3643
|
+
const returnType = promise(ts5.namedType("R"));
|
|
3644
|
+
const callbackType = ts5.functionType().addParameter(
|
|
3645
|
+
ts5.parameter("prisma", omit(ts5.namedType("PrismaClient"), ts5.namedType("runtime.ITXClientDenyList")))
|
|
3606
3646
|
).setReturnType(returnType);
|
|
3607
|
-
const method3 =
|
|
3608
|
-
return
|
|
3647
|
+
const method3 = ts5.method("$transaction").addGenericParameter(ts5.genericParameter("R")).addParameter(ts5.parameter("fn", callbackType)).addParameter(ts5.parameter("options", options).optional()).setReturnType(returnType);
|
|
3648
|
+
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3609
3649
|
}
|
|
3610
3650
|
function queryRawDefinition(context) {
|
|
3611
3651
|
if (!context.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
|
|
@@ -3670,9 +3710,9 @@ function queryRawTypedDefinition(context) {
|
|
|
3670
3710
|
if (!context.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
|
|
3671
3711
|
return "";
|
|
3672
3712
|
}
|
|
3673
|
-
const param =
|
|
3674
|
-
const method3 =
|
|
3675
|
-
|
|
3713
|
+
const param = ts5.genericParameter("T");
|
|
3714
|
+
const method3 = ts5.method("$queryRawTyped").setDocComment(
|
|
3715
|
+
ts5.docComment`
|
|
3676
3716
|
Executes a typed SQL query and returns a typed result
|
|
3677
3717
|
@example
|
|
3678
3718
|
\`\`\`
|
|
@@ -3682,19 +3722,19 @@ function queryRawTypedDefinition(context) {
|
|
|
3682
3722
|
\`\`\`
|
|
3683
3723
|
`
|
|
3684
3724
|
).addGenericParameter(param).addParameter(
|
|
3685
|
-
|
|
3725
|
+
ts5.parameter(
|
|
3686
3726
|
"typedSql",
|
|
3687
|
-
runtimeImportedType("TypedSql").addGenericArgument(
|
|
3727
|
+
runtimeImportedType("TypedSql").addGenericArgument(ts5.array(ts5.unknownType)).addGenericArgument(param.toArgument())
|
|
3688
3728
|
)
|
|
3689
|
-
).setReturnType(prismaPromise(
|
|
3690
|
-
return
|
|
3729
|
+
).setReturnType(prismaPromise(ts5.array(param.toArgument())));
|
|
3730
|
+
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3691
3731
|
}
|
|
3692
3732
|
function metricDefinition(context) {
|
|
3693
3733
|
if (!context.isPreviewFeatureOn("metrics")) {
|
|
3694
3734
|
return "";
|
|
3695
3735
|
}
|
|
3696
|
-
const property13 =
|
|
3697
|
-
|
|
3736
|
+
const property13 = ts5.property("$metrics", ts5.namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
|
|
3737
|
+
ts5.docComment`
|
|
3698
3738
|
Gives access to the client metrics in json or prometheus format.
|
|
3699
3739
|
|
|
3700
3740
|
@example
|
|
@@ -3705,13 +3745,13 @@ function metricDefinition(context) {
|
|
|
3705
3745
|
\`\`\`
|
|
3706
3746
|
`
|
|
3707
3747
|
).readonly();
|
|
3708
|
-
return
|
|
3748
|
+
return ts5.stringify(property13, { indentLevel: 1, newLine: "leading" });
|
|
3709
3749
|
}
|
|
3710
3750
|
function runCommandRawDefinition(context) {
|
|
3711
3751
|
if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
|
|
3712
3752
|
return "";
|
|
3713
3753
|
}
|
|
3714
|
-
const method3 =
|
|
3754
|
+
const method3 = ts5.method("$runCommandRaw").addParameter(ts5.parameter("command", ts5.namedType("Prisma.InputJsonObject"))).setReturnType(prismaPromise(ts5.namedType("Prisma.JsonObject"))).setDocComment(ts5.docComment`
|
|
3715
3755
|
Executes a raw MongoDB command and returns the result of it.
|
|
3716
3756
|
@example
|
|
3717
3757
|
\`\`\`
|
|
@@ -3724,7 +3764,7 @@ function runCommandRawDefinition(context) {
|
|
|
3724
3764
|
|
|
3725
3765
|
Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
|
|
3726
3766
|
`);
|
|
3727
|
-
return
|
|
3767
|
+
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3728
3768
|
}
|
|
3729
3769
|
function eventRegistrationMethodDeclaration(runtimeName) {
|
|
3730
3770
|
if (runtimeName === "binary") {
|
|
@@ -3743,7 +3783,7 @@ function getPrismaClientClassDocComment({ dmmf }) {
|
|
|
3743
3783
|
plural: "users"
|
|
3744
3784
|
};
|
|
3745
3785
|
}
|
|
3746
|
-
return
|
|
3786
|
+
return ts5.docComment`
|
|
3747
3787
|
## Prisma Client
|
|
3748
3788
|
|
|
3749
3789
|
Type-safe database client for TypeScript
|
|
@@ -3763,7 +3803,7 @@ var PrismaClientClass = class {
|
|
|
3763
3803
|
this.runtimeName = runtimeName;
|
|
3764
3804
|
}
|
|
3765
3805
|
get jsDoc() {
|
|
3766
|
-
return
|
|
3806
|
+
return ts5.stringify(getPrismaClientClassDocComment(this.context));
|
|
3767
3807
|
}
|
|
3768
3808
|
toTS() {
|
|
3769
3809
|
const { dmmf } = this.context;
|
|
@@ -3837,15 +3877,15 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
|
3837
3877
|
if (this.runtimeName !== "react-native") {
|
|
3838
3878
|
return null;
|
|
3839
3879
|
}
|
|
3840
|
-
const method3 =
|
|
3841
|
-
|
|
3880
|
+
const method3 = ts5.method("$applyPendingMigrations").setReturnType(promise(ts5.voidType)).setDocComment(
|
|
3881
|
+
ts5.docComment`Tries to apply pending migrations one by one. If a migration fails to apply, the function will stop and throw an error. You are responsible for informing the user and possibly blocking the app as we cannot guarantee the state of the database.`
|
|
3842
3882
|
);
|
|
3843
|
-
return
|
|
3883
|
+
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3844
3884
|
}
|
|
3845
3885
|
};
|
|
3846
3886
|
|
|
3847
3887
|
// src/TSClient/file-generators/ClassFile.ts
|
|
3848
|
-
var
|
|
3888
|
+
var jsDocHeader2 = `/*
|
|
3849
3889
|
* WARNING: This is an internal file that is subject to change!
|
|
3850
3890
|
*
|
|
3851
3891
|
* \u{1F6D1} Under no circumstances should you import this file directly! \u{1F6D1}
|
|
@@ -3855,12 +3895,12 @@ var jsDocHeader = `/*
|
|
|
3855
3895
|
`;
|
|
3856
3896
|
function createClassFile(context, options) {
|
|
3857
3897
|
const imports = [
|
|
3858
|
-
|
|
3859
|
-
|
|
3898
|
+
ts6.moduleImport(context.runtimeImport).asNamespace("runtime"),
|
|
3899
|
+
ts6.moduleImport(context.importFileName(`./prismaNamespace`)).asNamespace("Prisma").typeOnly()
|
|
3860
3900
|
];
|
|
3861
|
-
const stringifiedImports = imports.map((i) =>
|
|
3901
|
+
const stringifiedImports = imports.map((i) => ts6.stringify(i));
|
|
3862
3902
|
const prismaClientClass = new PrismaClientClass(context, options.runtimeName);
|
|
3863
|
-
return `${
|
|
3903
|
+
return `${jsDocHeader2}
|
|
3864
3904
|
${stringifiedImports.join("\n")}
|
|
3865
3905
|
|
|
3866
3906
|
${clientConfig(context, options)}
|
|
@@ -3887,7 +3927,7 @@ function clientConfig(context, options) {
|
|
|
3887
3927
|
activeProvider,
|
|
3888
3928
|
moduleFormat
|
|
3889
3929
|
} = options;
|
|
3890
|
-
const clientEngineType =
|
|
3930
|
+
const clientEngineType = getClientEngineType2(generator);
|
|
3891
3931
|
generator.config.engineType = clientEngineType;
|
|
3892
3932
|
const inlineSchemaHash = crypto.createHash("sha256").update(Buffer.from(inlineSchema, "utf8").toString("base64")).digest("hex");
|
|
3893
3933
|
const datasourceFilePath = datasources[0].sourceFilePath;
|
|
@@ -3919,8 +3959,8 @@ ${buildDebugInitialization(edge)}
|
|
|
3919
3959
|
|
|
3920
3960
|
// src/TSClient/file-generators/ClientFile.ts
|
|
3921
3961
|
import path4 from "node:path";
|
|
3922
|
-
import { ClientEngineType as ClientEngineType2, getClientEngineType as
|
|
3923
|
-
import * as
|
|
3962
|
+
import { ClientEngineType as ClientEngineType2, getClientEngineType as getClientEngineType3 } from "@prisma/internals";
|
|
3963
|
+
import * as ts7 from "@prisma/ts-builders";
|
|
3924
3964
|
|
|
3925
3965
|
// src/utils/buildNFTAnnotations.ts
|
|
3926
3966
|
import { getNodeAPIName } from "@prisma/get-platform";
|
|
@@ -3966,51 +4006,44 @@ path.join(process.cwd(), ${JSON.stringify(pathToPosix2(relativeFilePath))})`;
|
|
|
3966
4006
|
}
|
|
3967
4007
|
|
|
3968
4008
|
// src/TSClient/file-generators/ClientFile.ts
|
|
3969
|
-
var
|
|
4009
|
+
var jsDocHeader3 = `/*
|
|
3970
4010
|
* This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
|
|
3971
|
-
*
|
|
4011
|
+
* If you're looking for something you can import in the client-side of your application, please refer to the \`browser.ts\` file instead.
|
|
4012
|
+
*
|
|
3972
4013
|
* \u{1F7E2} You can import this file directly.
|
|
3973
4014
|
*/
|
|
3974
4015
|
`;
|
|
3975
4016
|
function createClientFile(context, options) {
|
|
3976
|
-
const clientEngineType =
|
|
4017
|
+
const clientEngineType = getClientEngineType3(options.generator);
|
|
3977
4018
|
options.generator.config.engineType = clientEngineType;
|
|
3978
4019
|
const imports = [
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
].map((i) =>
|
|
4020
|
+
ts7.moduleImport(context.runtimeImport).asNamespace("runtime"),
|
|
4021
|
+
ts7.moduleImport(context.importFileName("./enums")).asNamespace("$Enums"),
|
|
4022
|
+
ts7.moduleImport(context.importFileName("./internal/class")).asNamespace("$Class"),
|
|
4023
|
+
ts7.moduleImport(context.importFileName("./internal/prismaNamespace")).asNamespace("Prisma")
|
|
4024
|
+
].map((i) => ts7.stringify(i));
|
|
3984
4025
|
const exports = [
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
4026
|
+
ts7.moduleExportFrom(context.importFileName("./enums")).asNamespace("$Enums"),
|
|
4027
|
+
ts7.moduleExportFrom(context.importFileName("./enums")),
|
|
4028
|
+
ts7.moduleExport(
|
|
4029
|
+
ts7.constDeclaration("PrismaClient").setValue(ts7.functionCall("$Class.getPrismaClientClass", [ts7.namedValue("__dirname")]))
|
|
3989
4030
|
).setDocComment(getPrismaClientClassDocComment(context)),
|
|
3990
|
-
|
|
3991
|
-
|
|
4031
|
+
ts7.moduleExport(
|
|
4032
|
+
ts7.typeDeclaration(
|
|
3992
4033
|
"PrismaClient",
|
|
3993
|
-
|
|
4034
|
+
ts7.namedType("$Class.PrismaClient").addGenericArgument(ts7.namedType("LogOpts")).addGenericArgument(ts7.namedType("OmitOpts")).addGenericArgument(ts7.namedType("ExtArgs"))
|
|
3994
4035
|
).addGenericParameter(
|
|
3995
|
-
|
|
4036
|
+
ts7.genericParameter("LogOpts").extends(ts7.namedType("Prisma.LogLevel")).default(ts7.neverType)
|
|
3996
4037
|
).addGenericParameter(
|
|
3997
|
-
|
|
4038
|
+
ts7.genericParameter("OmitOpts").extends(ts7.namedType("Prisma.PrismaClientOptions").subKey("omit")).default(ts7.namedType("Prisma.PrismaClientOptions").subKey("omit"))
|
|
3998
4039
|
).addGenericParameter(
|
|
3999
|
-
|
|
4040
|
+
ts7.genericParameter("ExtArgs").extends(ts7.namedType("runtime.Types.Extensions.InternalArgs")).default(ts7.namedType("runtime.Types.Extensions.DefaultArgs"))
|
|
4000
4041
|
)
|
|
4001
4042
|
)
|
|
4002
|
-
].map((e) =>
|
|
4003
|
-
const modelExports = Object.values(context.dmmf.typeAndModelMap).filter((model) => context.dmmf.outputTypeMap.model[model.name]).map((model) => {
|
|
4004
|
-
const docLines = model.documentation ?? "";
|
|
4005
|
-
const modelLine = `Model ${model.name}
|
|
4006
|
-
`;
|
|
4007
|
-
const docs = `${modelLine}${docLines}`;
|
|
4008
|
-
const modelTypeExport = ts6.moduleExport(ts6.typeDeclaration(model.name, ts6.namedType(`Prisma.${model.name}Model`))).setDocComment(ts6.docComment(docs));
|
|
4009
|
-
return ts6.stringify(modelTypeExport);
|
|
4010
|
-
});
|
|
4043
|
+
].map((e) => ts7.stringify(e));
|
|
4011
4044
|
const binaryTargets = clientEngineType === ClientEngineType2.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) : Object.keys(options.binaryPaths.queryEngine ?? {});
|
|
4012
4045
|
const relativeOutdir = path4.relative(process.cwd(), options.outputDir);
|
|
4013
|
-
return `${
|
|
4046
|
+
return `${jsDocHeader3}
|
|
4014
4047
|
${buildPreamble(options.edge, options.moduleFormat)}
|
|
4015
4048
|
${imports.join("\n")}
|
|
4016
4049
|
|
|
@@ -4019,7 +4052,7 @@ export { Prisma }
|
|
|
4019
4052
|
|
|
4020
4053
|
${buildNFTAnnotations(options.edge || !options.copyEngine, clientEngineType, binaryTargets, relativeOutdir)}
|
|
4021
4054
|
|
|
4022
|
-
${modelExports.join("\n")}
|
|
4055
|
+
${modelExports(context).join("\n")}
|
|
4023
4056
|
`;
|
|
4024
4057
|
}
|
|
4025
4058
|
function buildPreamble(edge, moduleFormat) {
|
|
@@ -4039,8 +4072,8 @@ globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))
|
|
|
4039
4072
|
}
|
|
4040
4073
|
|
|
4041
4074
|
// src/TSClient/file-generators/CommonInputTypesFile.ts
|
|
4042
|
-
import * as
|
|
4043
|
-
var
|
|
4075
|
+
import * as ts8 from "@prisma/ts-builders";
|
|
4076
|
+
var jsDocHeader4 = `/*
|
|
4044
4077
|
* This file exports various common sort, input & filter types that are not directly linked to a particular model.
|
|
4045
4078
|
*
|
|
4046
4079
|
* \u{1F7E2} You can import this file directly.
|
|
@@ -4048,12 +4081,12 @@ var jsDocHeader3 = `/*
|
|
|
4048
4081
|
`;
|
|
4049
4082
|
function createCommonInputTypeFiles(context) {
|
|
4050
4083
|
const imports = [
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
].map((i) =>
|
|
4084
|
+
ts8.moduleImport(context.runtimeImport).asNamespace("runtime").typeOnly(),
|
|
4085
|
+
ts8.moduleImport(context.importFileName(`./enums`)).asNamespace("$Enums"),
|
|
4086
|
+
ts8.moduleImport(context.importFileName(`./internal/prismaNamespace`)).asNamespace("Prisma").typeOnly()
|
|
4087
|
+
].map((i) => ts8.stringify(i));
|
|
4055
4088
|
const genericInputTypes = context.dmmf.inputObjectTypes.prisma?.filter((i) => !i.meta?.grouping)?.map((inputType) => new InputType(inputType, context).toTS()) ?? [];
|
|
4056
|
-
return `${
|
|
4089
|
+
return `${jsDocHeader4}
|
|
4057
4090
|
${imports.join("\n")}
|
|
4058
4091
|
|
|
4059
4092
|
${genericInputTypes.join("\n")}
|
|
@@ -4064,7 +4097,7 @@ ${context.dmmf.inputObjectTypes.model?.map((inputType) => new InputType(inputTyp
|
|
|
4064
4097
|
|
|
4065
4098
|
// src/TSClient/file-generators/EnumsFile.ts
|
|
4066
4099
|
import { datamodelEnumToSchemaEnum } from "@prisma/dmmf";
|
|
4067
|
-
var
|
|
4100
|
+
var jsDocHeader5 = `/*
|
|
4068
4101
|
* This file exports all enum related types from the schema.
|
|
4069
4102
|
*
|
|
4070
4103
|
* \u{1F7E2} You can import this file directly.
|
|
@@ -4077,35 +4110,35 @@ function createEnumsFile(context) {
|
|
|
4077
4110
|
modelEnums.push(new Enum(datamodelEnumToSchemaEnum(datamodelEnum), false).toTS());
|
|
4078
4111
|
}
|
|
4079
4112
|
if (modelEnums.length === 0) {
|
|
4080
|
-
return `${
|
|
4113
|
+
return `${jsDocHeader5}
|
|
4081
4114
|
|
|
4082
4115
|
// This file is empty because there are no enums in the schema.
|
|
4083
4116
|
export {}
|
|
4084
4117
|
`;
|
|
4085
4118
|
}
|
|
4086
|
-
return
|
|
4119
|
+
return jsDocHeader5 + modelEnums.join("\n\n");
|
|
4087
4120
|
}
|
|
4088
4121
|
|
|
4089
4122
|
// src/TSClient/file-generators/ModelFile.ts
|
|
4090
|
-
import * as
|
|
4123
|
+
import * as ts15 from "@prisma/ts-builders";
|
|
4091
4124
|
|
|
4092
4125
|
// src/TSClient/Model.ts
|
|
4093
4126
|
import { capitalize as capitalize9 } from "@prisma/client-common";
|
|
4094
4127
|
import * as DMMF2 from "@prisma/dmmf";
|
|
4095
|
-
import * as
|
|
4128
|
+
import * as ts14 from "@prisma/ts-builders";
|
|
4096
4129
|
import indent5 from "indent-string";
|
|
4097
4130
|
import { klona } from "klona";
|
|
4098
4131
|
|
|
4099
4132
|
// src/TSClient/Args.ts
|
|
4100
|
-
import * as
|
|
4133
|
+
import * as ts9 from "@prisma/ts-builders";
|
|
4101
4134
|
var ArgsTypeBuilder = class {
|
|
4102
4135
|
constructor(type, context, action) {
|
|
4103
4136
|
this.type = type;
|
|
4104
4137
|
this.context = context;
|
|
4105
4138
|
this.action = action;
|
|
4106
|
-
this.moduleExport =
|
|
4107
|
-
|
|
4108
|
-
).setDocComment(
|
|
4139
|
+
this.moduleExport = ts9.moduleExport(
|
|
4140
|
+
ts9.typeDeclaration(getModelArgName(type.name, action), ts9.objectType()).addGenericParameter(extArgsParam)
|
|
4141
|
+
).setDocComment(ts9.docComment(`${type.name} ${action ?? "without action"}`));
|
|
4109
4142
|
}
|
|
4110
4143
|
moduleExport;
|
|
4111
4144
|
addProperty(prop) {
|
|
@@ -4116,7 +4149,7 @@ var ArgsTypeBuilder = class {
|
|
|
4116
4149
|
const inputField = buildInputField(arg, this.context);
|
|
4117
4150
|
const docComment9 = getArgFieldJSDoc(this.type, this.action, arg);
|
|
4118
4151
|
if (docComment9) {
|
|
4119
|
-
inputField.setDocComment(
|
|
4152
|
+
inputField.setDocComment(ts9.docComment(docComment9));
|
|
4120
4153
|
}
|
|
4121
4154
|
this.addProperty(inputField);
|
|
4122
4155
|
}
|
|
@@ -4124,13 +4157,13 @@ var ArgsTypeBuilder = class {
|
|
|
4124
4157
|
}
|
|
4125
4158
|
addSelectArg(selectTypeName = getSelectName(this.type.name)) {
|
|
4126
4159
|
this.addProperty(
|
|
4127
|
-
|
|
4160
|
+
ts9.property(
|
|
4128
4161
|
"select",
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4162
|
+
ts9.unionType([
|
|
4163
|
+
ts9.namedType(`Prisma.${selectTypeName}`).addGenericArgument(extArgsParam.toArgument()),
|
|
4164
|
+
ts9.nullType
|
|
4132
4165
|
])
|
|
4133
|
-
).optional().setDocComment(
|
|
4166
|
+
).optional().setDocComment(ts9.docComment(`Select specific fields to fetch from the ${this.type.name}`))
|
|
4134
4167
|
);
|
|
4135
4168
|
return this;
|
|
4136
4169
|
}
|
|
@@ -4140,25 +4173,25 @@ var ArgsTypeBuilder = class {
|
|
|
4140
4173
|
return this;
|
|
4141
4174
|
}
|
|
4142
4175
|
this.addProperty(
|
|
4143
|
-
|
|
4176
|
+
ts9.property(
|
|
4144
4177
|
"include",
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4178
|
+
ts9.unionType([
|
|
4179
|
+
ts9.namedType(`Prisma.${includeTypeName}`).addGenericArgument(extArgsParam.toArgument()),
|
|
4180
|
+
ts9.nullType
|
|
4148
4181
|
])
|
|
4149
|
-
).optional().setDocComment(
|
|
4182
|
+
).optional().setDocComment(ts9.docComment("Choose, which related nodes to fetch as well"))
|
|
4150
4183
|
);
|
|
4151
4184
|
return this;
|
|
4152
4185
|
}
|
|
4153
4186
|
addOmitArg() {
|
|
4154
4187
|
this.addProperty(
|
|
4155
|
-
|
|
4188
|
+
ts9.property(
|
|
4156
4189
|
"omit",
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4190
|
+
ts9.unionType([
|
|
4191
|
+
ts9.namedType(`Prisma.${getOmitName(this.type.name)}`).addGenericArgument(extArgsParam.toArgument()),
|
|
4192
|
+
ts9.nullType
|
|
4160
4193
|
])
|
|
4161
|
-
).optional().setDocComment(
|
|
4194
|
+
).optional().setDocComment(ts9.docComment(`Omit specific fields from the ${this.type.name}`))
|
|
4162
4195
|
);
|
|
4163
4196
|
return this;
|
|
4164
4197
|
}
|
|
@@ -4167,7 +4200,7 @@ var ArgsTypeBuilder = class {
|
|
|
4167
4200
|
return this;
|
|
4168
4201
|
}
|
|
4169
4202
|
setComment(comment) {
|
|
4170
|
-
this.moduleExport.setDocComment(
|
|
4203
|
+
this.moduleExport.setDocComment(ts9.docComment(comment));
|
|
4171
4204
|
return this;
|
|
4172
4205
|
}
|
|
4173
4206
|
createExport() {
|
|
@@ -4177,12 +4210,12 @@ var ArgsTypeBuilder = class {
|
|
|
4177
4210
|
|
|
4178
4211
|
// src/TSClient/Count.ts
|
|
4179
4212
|
import { capitalize as capitalize8 } from "@prisma/client-common";
|
|
4180
|
-
import * as
|
|
4213
|
+
import * as ts11 from "@prisma/ts-builders";
|
|
4181
4214
|
import indent4 from "indent-string";
|
|
4182
4215
|
|
|
4183
4216
|
// src/TSClient/Output.ts
|
|
4184
4217
|
import { hasOwnProperty } from "@prisma/internals";
|
|
4185
|
-
import * as
|
|
4218
|
+
import * as ts10 from "@prisma/ts-builders";
|
|
4186
4219
|
function buildModelOutputProperty(field, dmmf) {
|
|
4187
4220
|
let fieldTypeName = hasOwnProperty(GraphQLScalarToJSTypeTable, field.type) ? GraphQLScalarToJSTypeTable[field.type] : field.type;
|
|
4188
4221
|
if (Array.isArray(fieldTypeName)) {
|
|
@@ -4190,47 +4223,47 @@ function buildModelOutputProperty(field, dmmf) {
|
|
|
4190
4223
|
}
|
|
4191
4224
|
let fieldType;
|
|
4192
4225
|
if (field.kind === "object") {
|
|
4193
|
-
const payloadType =
|
|
4226
|
+
const payloadType = ts10.namedType(getPayloadName(field.type));
|
|
4194
4227
|
if (!dmmf.isComposite(field.type)) {
|
|
4195
|
-
payloadType.addGenericArgument(
|
|
4228
|
+
payloadType.addGenericArgument(ts10.namedType("ExtArgs"));
|
|
4196
4229
|
}
|
|
4197
4230
|
fieldType = payloadType;
|
|
4198
4231
|
} else if (field.kind === "enum") {
|
|
4199
|
-
fieldType =
|
|
4232
|
+
fieldType = ts10.namedType(`$Enums.${fieldTypeName}`);
|
|
4200
4233
|
} else {
|
|
4201
|
-
fieldType =
|
|
4234
|
+
fieldType = ts10.namedType(fieldTypeName);
|
|
4202
4235
|
}
|
|
4203
4236
|
if (field.isList) {
|
|
4204
|
-
fieldType =
|
|
4237
|
+
fieldType = ts10.array(fieldType);
|
|
4205
4238
|
} else if (!field.isRequired) {
|
|
4206
|
-
fieldType =
|
|
4239
|
+
fieldType = ts10.unionType(fieldType).addVariant(ts10.nullType);
|
|
4207
4240
|
}
|
|
4208
|
-
const property13 =
|
|
4241
|
+
const property13 = ts10.property(field.name, fieldType);
|
|
4209
4242
|
if (field.documentation) {
|
|
4210
|
-
property13.setDocComment(
|
|
4243
|
+
property13.setDocComment(ts10.docComment(field.documentation));
|
|
4211
4244
|
}
|
|
4212
4245
|
return property13;
|
|
4213
4246
|
}
|
|
4214
4247
|
function buildOutputType(type) {
|
|
4215
|
-
return
|
|
4248
|
+
return ts10.moduleExport(ts10.typeDeclaration(type.name, ts10.objectType().addMultiple(type.fields.map(buildOutputField))));
|
|
4216
4249
|
}
|
|
4217
4250
|
function buildOutputField(field) {
|
|
4218
4251
|
let fieldType;
|
|
4219
4252
|
if (field.outputType.location === "enumTypes" && field.outputType.namespace === "model") {
|
|
4220
|
-
fieldType =
|
|
4253
|
+
fieldType = ts10.namedType(enumTypeName(field.outputType));
|
|
4221
4254
|
} else {
|
|
4222
4255
|
const typeNames = GraphQLScalarToJSTypeTable[field.outputType.type] ?? field.outputType.type;
|
|
4223
|
-
fieldType = Array.isArray(typeNames) ?
|
|
4256
|
+
fieldType = Array.isArray(typeNames) ? ts10.namedType(typeNames[0]) : ts10.namedType(typeNames);
|
|
4224
4257
|
}
|
|
4225
4258
|
if (field.outputType.isList) {
|
|
4226
|
-
fieldType =
|
|
4259
|
+
fieldType = ts10.array(fieldType);
|
|
4227
4260
|
} else if (field.isNullable) {
|
|
4228
|
-
fieldType =
|
|
4261
|
+
fieldType = ts10.unionType(fieldType).addVariant(ts10.nullType);
|
|
4229
4262
|
}
|
|
4230
|
-
const property13 =
|
|
4263
|
+
const property13 = ts10.property(field.name, fieldType);
|
|
4231
4264
|
if (field.deprecation) {
|
|
4232
4265
|
property13.setDocComment(
|
|
4233
|
-
|
|
4266
|
+
ts10.docComment(`@deprecated since ${field.deprecation.sinceVersion} because ${field.deprecation.reason}`)
|
|
4234
4267
|
);
|
|
4235
4268
|
}
|
|
4236
4269
|
return property13;
|
|
@@ -4270,7 +4303,7 @@ var Count = class {
|
|
|
4270
4303
|
* Count Type ${name}
|
|
4271
4304
|
*/
|
|
4272
4305
|
|
|
4273
|
-
${
|
|
4306
|
+
${ts11.stringify(outputType)}
|
|
4274
4307
|
|
|
4275
4308
|
export type ${getSelectName(
|
|
4276
4309
|
name
|
|
@@ -4290,7 +4323,7 @@ ${indent4(
|
|
|
4290
4323
|
)}
|
|
4291
4324
|
}
|
|
4292
4325
|
|
|
4293
|
-
${this.argsTypes.map((typeExport) =>
|
|
4326
|
+
${this.argsTypes.map((typeExport) => ts11.stringify(typeExport)).join("\n\n")}
|
|
4294
4327
|
`;
|
|
4295
4328
|
}
|
|
4296
4329
|
};
|
|
@@ -4327,12 +4360,12 @@ ${this.stringifyFields()}
|
|
|
4327
4360
|
|
|
4328
4361
|
// src/TSClient/Payload.ts
|
|
4329
4362
|
import { uncapitalize as uncapitalize5 } from "@prisma/client-common";
|
|
4330
|
-
import * as
|
|
4363
|
+
import * as ts12 from "@prisma/ts-builders";
|
|
4331
4364
|
function buildModelPayload(model, context) {
|
|
4332
4365
|
const isComposite = context.dmmf.isComposite(model.name);
|
|
4333
|
-
const objects =
|
|
4334
|
-
const scalars =
|
|
4335
|
-
const composites =
|
|
4366
|
+
const objects = ts12.objectType();
|
|
4367
|
+
const scalars = ts12.objectType();
|
|
4368
|
+
const composites = ts12.objectType();
|
|
4336
4369
|
for (const field of model.fields) {
|
|
4337
4370
|
if (field.kind === "object") {
|
|
4338
4371
|
if (context.dmmf.isComposite(field.type)) {
|
|
@@ -4344,20 +4377,20 @@ function buildModelPayload(model, context) {
|
|
|
4344
4377
|
scalars.add(buildModelOutputProperty(field, context.dmmf));
|
|
4345
4378
|
}
|
|
4346
4379
|
}
|
|
4347
|
-
const scalarsType = isComposite ? scalars :
|
|
4348
|
-
const payloadTypeDeclaration =
|
|
4380
|
+
const scalarsType = isComposite ? scalars : ts12.namedType("runtime.Types.Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts12.namedType("ExtArgs").subKey("result").subKey(uncapitalize5(model.name)));
|
|
4381
|
+
const payloadTypeDeclaration = ts12.typeDeclaration(
|
|
4349
4382
|
getPayloadName(model.name, false),
|
|
4350
|
-
|
|
4383
|
+
ts12.objectType().add(ts12.property("name", ts12.stringLiteral(model.name))).add(ts12.property("objects", objects)).add(ts12.property("scalars", scalarsType)).add(ts12.property("composites", composites))
|
|
4351
4384
|
);
|
|
4352
4385
|
if (!isComposite) {
|
|
4353
4386
|
payloadTypeDeclaration.addGenericParameter(extArgsParam);
|
|
4354
4387
|
}
|
|
4355
|
-
return
|
|
4388
|
+
return ts12.moduleExport(payloadTypeDeclaration);
|
|
4356
4389
|
}
|
|
4357
4390
|
|
|
4358
4391
|
// src/TSClient/SelectIncludeOmit.ts
|
|
4359
4392
|
import { uncapitalize as uncapitalize6 } from "@prisma/client-common";
|
|
4360
|
-
import * as
|
|
4393
|
+
import * as ts13 from "@prisma/ts-builders";
|
|
4361
4394
|
function buildIncludeType({
|
|
4362
4395
|
modelName,
|
|
4363
4396
|
typeName = getIncludeName(modelName),
|
|
@@ -4368,14 +4401,14 @@ function buildIncludeType({
|
|
|
4368
4401
|
return buildExport(typeName, type);
|
|
4369
4402
|
}
|
|
4370
4403
|
function buildOmitType({ modelName, fields, context }) {
|
|
4371
|
-
const keysType =
|
|
4404
|
+
const keysType = ts13.unionType(
|
|
4372
4405
|
fields.filter(
|
|
4373
4406
|
(field) => field.outputType.location === "scalar" || field.outputType.location === "enumTypes" || context.dmmf.isComposite(field.outputType.type)
|
|
4374
|
-
).map((field) =>
|
|
4407
|
+
).map((field) => ts13.stringLiteral(field.name))
|
|
4375
4408
|
);
|
|
4376
|
-
const omitType =
|
|
4409
|
+
const omitType = ts13.namedType("runtime.Types.Extensions.GetOmit").addGenericArgument(keysType).addGenericArgument(modelResultExtensionsType(modelName));
|
|
4377
4410
|
if (context.isPreviewFeatureOn("strictUndefinedChecks")) {
|
|
4378
|
-
omitType.addGenericArgument(
|
|
4411
|
+
omitType.addGenericArgument(ts13.namedType("runtime.Types.Skip"));
|
|
4379
4412
|
}
|
|
4380
4413
|
return buildExport(getOmitName(modelName), omitType);
|
|
4381
4414
|
}
|
|
@@ -4386,7 +4419,7 @@ function buildSelectType({
|
|
|
4386
4419
|
context
|
|
4387
4420
|
}) {
|
|
4388
4421
|
const objectType11 = buildSelectOrIncludeObject(modelName, fields, context);
|
|
4389
|
-
const selectType =
|
|
4422
|
+
const selectType = ts13.namedType("runtime.Types.Extensions.GetSelect").addGenericArgument(objectType11).addGenericArgument(modelResultExtensionsType(modelName));
|
|
4390
4423
|
return buildExport(typeName, selectType);
|
|
4391
4424
|
}
|
|
4392
4425
|
function modelResultExtensionsType(modelName) {
|
|
@@ -4398,24 +4431,24 @@ function buildScalarSelectType({ modelName, fields, context }) {
|
|
|
4398
4431
|
fields.filter((field) => field.outputType.location === "scalar" || field.outputType.location === "enumTypes"),
|
|
4399
4432
|
context
|
|
4400
4433
|
);
|
|
4401
|
-
return
|
|
4434
|
+
return ts13.moduleExport(ts13.typeDeclaration(`${getSelectName(modelName)}Scalar`, object));
|
|
4402
4435
|
}
|
|
4403
4436
|
function buildSelectOrIncludeObject(modelName, fields, context) {
|
|
4404
|
-
const objectType11 =
|
|
4437
|
+
const objectType11 = ts13.objectType();
|
|
4405
4438
|
for (const field of fields) {
|
|
4406
|
-
const fieldType =
|
|
4439
|
+
const fieldType = ts13.unionType(ts13.booleanType);
|
|
4407
4440
|
if (field.outputType.location === "outputObjectTypes") {
|
|
4408
|
-
const subSelectType =
|
|
4441
|
+
const subSelectType = ts13.namedType(`Prisma.${getFieldArgName(field, modelName)}`);
|
|
4409
4442
|
subSelectType.addGenericArgument(extArgsParam.toArgument());
|
|
4410
4443
|
fieldType.addVariant(subSelectType);
|
|
4411
4444
|
}
|
|
4412
|
-
objectType11.add(
|
|
4445
|
+
objectType11.add(ts13.property(field.name, appendSkipType(context, fieldType)).optional());
|
|
4413
4446
|
}
|
|
4414
4447
|
return objectType11;
|
|
4415
4448
|
}
|
|
4416
4449
|
function buildExport(typeName, type) {
|
|
4417
|
-
const declaration =
|
|
4418
|
-
return
|
|
4450
|
+
const declaration = ts13.typeDeclaration(typeName, type);
|
|
4451
|
+
return ts13.moduleExport(declaration.addGenericParameter(extArgsParam));
|
|
4419
4452
|
}
|
|
4420
4453
|
function getIncludeFields(fields, dmmf) {
|
|
4421
4454
|
return fields.filter((field) => {
|
|
@@ -4544,7 +4577,7 @@ ${indent5(
|
|
|
4544
4577
|
)}
|
|
4545
4578
|
}
|
|
4546
4579
|
|
|
4547
|
-
${
|
|
4580
|
+
${ts14.stringify(buildOutputType(groupByType))}
|
|
4548
4581
|
|
|
4549
4582
|
type ${getGroupByPayloadName(model.name)}<T extends ${groupByArgsName}> = Prisma.PrismaPromise<
|
|
4550
4583
|
Array<
|
|
@@ -4594,7 +4627,7 @@ type ${getGroupByPayloadName(model.name)}<T extends ${groupByArgsName}> = Prisma
|
|
|
4594
4627
|
}
|
|
4595
4628
|
const aggregateArgsName = getAggregateArgsName(model.name);
|
|
4596
4629
|
const aggregateName = getAggregateName(model.name);
|
|
4597
|
-
return `${aggregateTypes.map(buildOutputType).map((type) =>
|
|
4630
|
+
return `${aggregateTypes.map(buildOutputType).map((type) => ts14.stringify(type)).join("\n\n")}
|
|
4598
4631
|
|
|
4599
4632
|
${aggregateTypes.length > 1 ? aggregateTypes.slice(1).map((type) => {
|
|
4600
4633
|
const newType = {
|
|
@@ -4662,31 +4695,31 @@ export type ${getAggregateGetName(model.name)}<T extends ${getAggregateArgsName(
|
|
|
4662
4695
|
const modelLine = `Model ${this.model.name}
|
|
4663
4696
|
`;
|
|
4664
4697
|
const docs = `${modelLine}${docLines}`;
|
|
4665
|
-
const modelTypeExport =
|
|
4666
|
-
|
|
4698
|
+
const modelTypeExport = ts14.moduleExport(
|
|
4699
|
+
ts14.typeDeclaration(
|
|
4667
4700
|
`${this.model.name}Model`,
|
|
4668
|
-
|
|
4701
|
+
ts14.namedType(`runtime.Types.Result.DefaultSelection`).addGenericArgument(ts14.namedType(getPayloadName(this.model.name)))
|
|
4669
4702
|
)
|
|
4670
|
-
).setDocComment(
|
|
4671
|
-
return
|
|
4703
|
+
).setDocComment(ts14.docComment(docs));
|
|
4704
|
+
return ts14.stringify(modelTypeExport);
|
|
4672
4705
|
}
|
|
4673
4706
|
toTS() {
|
|
4674
4707
|
const { model } = this;
|
|
4675
4708
|
const isComposite = this.dmmf.isComposite(model.name);
|
|
4676
|
-
const omitType =
|
|
4709
|
+
const omitType = ts14.stringify(
|
|
4677
4710
|
buildOmitType({ modelName: this.model.name, context: this.context, fields: this.type.fields }),
|
|
4678
4711
|
{
|
|
4679
4712
|
newLine: "leading"
|
|
4680
4713
|
}
|
|
4681
4714
|
);
|
|
4682
4715
|
const hasRelationField = model.fields.some((f) => f.kind === "object");
|
|
4683
|
-
const includeType = hasRelationField ?
|
|
4716
|
+
const includeType = hasRelationField ? ts14.stringify(
|
|
4684
4717
|
buildIncludeType({ modelName: this.model.name, context: this.context, fields: this.type.fields }),
|
|
4685
4718
|
{
|
|
4686
4719
|
newLine: "leading"
|
|
4687
4720
|
}
|
|
4688
4721
|
) : "";
|
|
4689
|
-
const createManyAndReturnIncludeType = hasRelationField && this.createManyAndReturnType ?
|
|
4722
|
+
const createManyAndReturnIncludeType = hasRelationField && this.createManyAndReturnType ? ts14.stringify(
|
|
4690
4723
|
buildIncludeType({
|
|
4691
4724
|
typeName: getIncludeCreateManyAndReturnName(this.model.name),
|
|
4692
4725
|
modelName: this.model.name,
|
|
@@ -4697,7 +4730,7 @@ export type ${getAggregateGetName(model.name)}<T extends ${getAggregateArgsName(
|
|
|
4697
4730
|
newLine: "leading"
|
|
4698
4731
|
}
|
|
4699
4732
|
) : "";
|
|
4700
|
-
const updateManyAndReturnIncludeType = hasRelationField && this.updateManyAndReturnType ?
|
|
4733
|
+
const updateManyAndReturnIncludeType = hasRelationField && this.updateManyAndReturnType ? ts14.stringify(
|
|
4701
4734
|
buildIncludeType({
|
|
4702
4735
|
typeName: getIncludeUpdateManyAndReturnName(this.model.name),
|
|
4703
4736
|
modelName: this.model.name,
|
|
@@ -4719,8 +4752,8 @@ ${this.getDeepInputTypes()}
|
|
|
4719
4752
|
|
|
4720
4753
|
${this.getCountTypes()}
|
|
4721
4754
|
|
|
4722
|
-
${
|
|
4723
|
-
${this.createManyAndReturnType ?
|
|
4755
|
+
${ts14.stringify(buildSelectType({ modelName: this.model.name, fields: this.type.fields, context: this.context }))}
|
|
4756
|
+
${this.createManyAndReturnType ? ts14.stringify(
|
|
4724
4757
|
buildSelectType({
|
|
4725
4758
|
modelName: this.model.name,
|
|
4726
4759
|
fields: this.createManyAndReturnType.fields,
|
|
@@ -4729,7 +4762,7 @@ ${this.createManyAndReturnType ? ts13.stringify(
|
|
|
4729
4762
|
}),
|
|
4730
4763
|
{ newLine: "leading" }
|
|
4731
4764
|
) : ""}
|
|
4732
|
-
${this.updateManyAndReturnType ?
|
|
4765
|
+
${this.updateManyAndReturnType ? ts14.stringify(
|
|
4733
4766
|
buildSelectType({
|
|
4734
4767
|
modelName: this.model.name,
|
|
4735
4768
|
fields: this.updateManyAndReturnType.fields,
|
|
@@ -4738,12 +4771,12 @@ ${this.updateManyAndReturnType ? ts13.stringify(
|
|
|
4738
4771
|
}),
|
|
4739
4772
|
{ newLine: "leading" }
|
|
4740
4773
|
) : ""}
|
|
4741
|
-
${
|
|
4774
|
+
${ts14.stringify(buildScalarSelectType({ modelName: this.model.name, fields: this.type.fields, context: this.context }), {
|
|
4742
4775
|
newLine: "leading"
|
|
4743
4776
|
})}
|
|
4744
4777
|
${omitType}${includeType}${createManyAndReturnIncludeType}${updateManyAndReturnIncludeType}
|
|
4745
4778
|
|
|
4746
|
-
${
|
|
4779
|
+
${ts14.stringify(buildModelPayload(this.model, this.context), { newLine: "none" })}
|
|
4747
4780
|
|
|
4748
4781
|
export type ${model.name}GetPayload<S extends boolean | null | undefined | ${getModelArgName(
|
|
4749
4782
|
model.name
|
|
@@ -4754,7 +4787,7 @@ ${isComposite ? "" : new ModelDelegate(this.type, this.context).toTS()}
|
|
|
4754
4787
|
${new ModelFieldRefs(this.type).toTS()}
|
|
4755
4788
|
|
|
4756
4789
|
// Custom InputTypes
|
|
4757
|
-
${this.argsTypes.map((type) =>
|
|
4790
|
+
${this.argsTypes.map((type) => ts14.stringify(type)).join("\n\n")}
|
|
4758
4791
|
`;
|
|
4759
4792
|
}
|
|
4760
4793
|
};
|
|
@@ -4785,7 +4818,7 @@ var ModelDelegate = class {
|
|
|
4785
4818
|
const nonAggregateActions = this.getNonAggregateActions(availableActions);
|
|
4786
4819
|
const groupByArgsName = getGroupByArgsName(name);
|
|
4787
4820
|
const countArgsName = getModelArgName(name, DMMF2.ModelAction.count);
|
|
4788
|
-
const genericDelegateParams = [extArgsParam,
|
|
4821
|
+
const genericDelegateParams = [extArgsParam, ts14.genericParameter("GlobalOmitOptions").default(ts14.objectType())];
|
|
4789
4822
|
const excludedArgsForCount = ["select", "include", "distinct", "omit"];
|
|
4790
4823
|
if (this.context.isPreviewFeatureOn("relationJoins")) {
|
|
4791
4824
|
excludedArgsForCount.push("relationLoadStrategy");
|
|
@@ -4796,11 +4829,11 @@ var ModelDelegate = class {
|
|
|
4796
4829
|
select?: ${getCountAggregateInputName(name)} | true
|
|
4797
4830
|
}
|
|
4798
4831
|
` : ""}
|
|
4799
|
-
export interface ${name}Delegate<${genericDelegateParams.map((param) =>
|
|
4832
|
+
export interface ${name}Delegate<${genericDelegateParams.map((param) => ts14.stringify(param)).join(", ")}> {
|
|
4800
4833
|
${indent5(`[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['model']['${name}'], meta: { name: '${name}' } }`, TAB_SIZE)}
|
|
4801
4834
|
${nonAggregateActions.map((action) => {
|
|
4802
4835
|
const method3 = buildModelDelegateMethod(name, action, this.context);
|
|
4803
|
-
return
|
|
4836
|
+
return ts14.stringify(method3, { indentLevel: 1, newLine: "trailing" });
|
|
4804
4837
|
}).join("\n")}
|
|
4805
4838
|
|
|
4806
4839
|
${availableActions.includes(DMMF2.ModelAction.aggregate) ? `${indent5(getMethodJSDoc(DMMF2.ModelAction.count, mapping, modelOrType), TAB_SIZE)}
|
|
@@ -4886,7 +4919,7 @@ ${availableActions.includes(DMMF2.ModelAction.groupBy) ? `${indent5(getMethodJSD
|
|
|
4886
4919
|
readonly fields: ${getFieldRefsTypeName(name)};
|
|
4887
4920
|
}
|
|
4888
4921
|
|
|
4889
|
-
${
|
|
4922
|
+
${ts14.stringify(buildFluentWrapperDefinition(name, this.outputType, this.context))}
|
|
4890
4923
|
`;
|
|
4891
4924
|
}
|
|
4892
4925
|
};
|
|
@@ -4894,7 +4927,7 @@ function buildModelDelegateMethod(modelName, actionName, context) {
|
|
|
4894
4927
|
const mapping = context.dmmf.mappingsMap[modelName] ?? { model: modelName, plural: `${modelName}s` };
|
|
4895
4928
|
const modelOrType = context.dmmf.typeAndModelMap[modelName];
|
|
4896
4929
|
const dependencyValidators = getNonAggregateMethodDependencyValidations(mapping, actionName, context);
|
|
4897
|
-
const method3 =
|
|
4930
|
+
const method3 = ts14.method(actionName).setDocComment(ts14.docComment(getMethodJSDocBody(actionName, mapping, modelOrType))).addParameter(getNonAggregateMethodArgs(modelName, actionName, dependencyValidators)).setReturnType(getReturnType({ modelName, actionName }));
|
|
4898
4931
|
const generic = getNonAggregateMethodGenericParam(modelName, actionName);
|
|
4899
4932
|
if (generic) {
|
|
4900
4933
|
method3.addGenericParameter(generic);
|
|
@@ -4907,22 +4940,22 @@ function buildModelDelegateMethod(modelName, actionName, context) {
|
|
|
4907
4940
|
function getNonAggregateMethodArgs(modelName, actionName, dependencyValidators) {
|
|
4908
4941
|
const makeParameter = (type2) => {
|
|
4909
4942
|
if (dependencyValidators.length > 0) {
|
|
4910
|
-
type2 =
|
|
4943
|
+
type2 = ts14.intersectionType([type2, ...dependencyValidators.map((validator) => ts14.namedType(validator.name))]);
|
|
4911
4944
|
}
|
|
4912
|
-
return
|
|
4945
|
+
return ts14.parameter("args", type2);
|
|
4913
4946
|
};
|
|
4914
4947
|
if (actionName === DMMF2.ModelAction.count) {
|
|
4915
4948
|
const type2 = omit(
|
|
4916
|
-
|
|
4917
|
-
|
|
4949
|
+
ts14.namedType(getModelArgName(modelName, DMMF2.ModelAction.findMany)),
|
|
4950
|
+
ts14.unionType(ts14.stringLiteral("select")).addVariant(ts14.stringLiteral("include")).addVariant(ts14.stringLiteral("distinct"))
|
|
4918
4951
|
);
|
|
4919
4952
|
return makeParameter(type2).optional();
|
|
4920
4953
|
}
|
|
4921
4954
|
if (actionName === DMMF2.ModelAction.findRaw || actionName === DMMF2.ModelAction.aggregateRaw) {
|
|
4922
|
-
return makeParameter(
|
|
4955
|
+
return makeParameter(ts14.namedType(`Prisma.${getModelArgName(modelName, actionName)}`)).optional();
|
|
4923
4956
|
}
|
|
4924
|
-
const type =
|
|
4925
|
-
|
|
4957
|
+
const type = ts14.namedType("Prisma.SelectSubset").addGenericArgument(ts14.namedType("T")).addGenericArgument(
|
|
4958
|
+
ts14.namedType(getModelArgName(modelName, actionName)).addGenericArgument(extArgsParam.toArgument())
|
|
4926
4959
|
);
|
|
4927
4960
|
const param = makeParameter(type);
|
|
4928
4961
|
if (actionName === DMMF2.ModelAction.findMany || actionName === DMMF2.ModelAction.findFirst || actionName === DMMF2.ModelAction.deleteMany || actionName === DMMF2.ModelAction.createMany || actionName === DMMF2.ModelAction.createManyAndReturn || actionName === DMMF2.ModelAction.findFirstOrThrow) {
|
|
@@ -4934,11 +4967,11 @@ function getNonAggregateMethodGenericParam(modelName, actionName) {
|
|
|
4934
4967
|
if (actionName === DMMF2.ModelAction.count || actionName === DMMF2.ModelAction.findRaw || actionName === DMMF2.ModelAction.aggregateRaw) {
|
|
4935
4968
|
return null;
|
|
4936
4969
|
}
|
|
4937
|
-
const arg =
|
|
4970
|
+
const arg = ts14.genericParameter("T");
|
|
4938
4971
|
if (actionName === DMMF2.ModelAction.aggregate) {
|
|
4939
|
-
return arg.extends(
|
|
4972
|
+
return arg.extends(ts14.namedType(getAggregateArgsName(modelName)));
|
|
4940
4973
|
}
|
|
4941
|
-
return arg.extends(
|
|
4974
|
+
return arg.extends(ts14.namedType(getModelArgName(modelName, actionName)));
|
|
4942
4975
|
}
|
|
4943
4976
|
function getNonAggregateMethodDependencyValidations(modelMapping, actionName, context) {
|
|
4944
4977
|
const outputFieldName = modelMapping[actionName];
|
|
@@ -4954,13 +4987,13 @@ function getNonAggregateMethodDependencyValidations(modelMapping, actionName, co
|
|
|
4954
4987
|
if (args.requiresOtherFields === void 0) {
|
|
4955
4988
|
continue;
|
|
4956
4989
|
}
|
|
4957
|
-
const objectType11 =
|
|
4990
|
+
const objectType11 = ts14.objectType();
|
|
4958
4991
|
for (const reqArg of args.requiresOtherFields) {
|
|
4959
|
-
objectType11.add(
|
|
4992
|
+
objectType11.add(ts14.property(reqArg, ts14.objectType()));
|
|
4960
4993
|
}
|
|
4961
4994
|
validators.push(
|
|
4962
|
-
|
|
4963
|
-
|
|
4995
|
+
ts14.genericParameter(`${capitalize9(args.name)}DependenciesValidator`).extends(
|
|
4996
|
+
ts14.conditionalType().check(ts14.stringLiteral(args.name)).extends(ts14.namedType("Prisma.Keys<T>")).then(objectType11).else(ts14.objectType())
|
|
4964
4997
|
)
|
|
4965
4998
|
);
|
|
4966
4999
|
}
|
|
@@ -4973,53 +5006,53 @@ function getReturnType({
|
|
|
4973
5006
|
isNullable = false
|
|
4974
5007
|
}) {
|
|
4975
5008
|
if (actionName === DMMF2.ModelAction.count) {
|
|
4976
|
-
return promise(
|
|
5009
|
+
return promise(ts14.numberType);
|
|
4977
5010
|
}
|
|
4978
5011
|
if (actionName === DMMF2.ModelAction.aggregate) {
|
|
4979
|
-
return promise(
|
|
5012
|
+
return promise(ts14.namedType(getAggregateGetName(modelName)).addGenericArgument(ts14.namedType("T")));
|
|
4980
5013
|
}
|
|
4981
5014
|
if (actionName === DMMF2.ModelAction.findRaw || actionName === DMMF2.ModelAction.aggregateRaw) {
|
|
4982
|
-
return prismaPromise(
|
|
5015
|
+
return prismaPromise(ts14.namedType("Prisma.JsonObject"));
|
|
4983
5016
|
}
|
|
4984
5017
|
if (actionName === DMMF2.ModelAction.deleteMany || actionName === DMMF2.ModelAction.updateMany || actionName === DMMF2.ModelAction.createMany) {
|
|
4985
|
-
return prismaPromise(
|
|
5018
|
+
return prismaPromise(ts14.namedType("Prisma.BatchPayload"));
|
|
4986
5019
|
}
|
|
4987
5020
|
const isList = actionName === DMMF2.ModelAction.findMany || actionName === DMMF2.ModelAction.createManyAndReturn || actionName === DMMF2.ModelAction.updateManyAndReturn;
|
|
4988
5021
|
if (isList) {
|
|
4989
5022
|
let result = getResultType(modelName, actionName);
|
|
4990
5023
|
if (isChaining) {
|
|
4991
|
-
result =
|
|
5024
|
+
result = ts14.unionType(result).addVariant(ts14.namedType("Null"));
|
|
4992
5025
|
}
|
|
4993
5026
|
return prismaPromise(result);
|
|
4994
5027
|
}
|
|
4995
5028
|
if (isChaining && actionName === DMMF2.ModelAction.findUniqueOrThrow) {
|
|
4996
|
-
const nullType7 = isNullable ?
|
|
4997
|
-
const result =
|
|
5029
|
+
const nullType7 = isNullable ? ts14.nullType : ts14.namedType("Null");
|
|
5030
|
+
const result = ts14.unionType(getResultType(modelName, actionName)).addVariant(nullType7);
|
|
4998
5031
|
return getFluentWrapper(modelName, result, nullType7);
|
|
4999
5032
|
}
|
|
5000
5033
|
if (actionName === DMMF2.ModelAction.findFirst || actionName === DMMF2.ModelAction.findUnique) {
|
|
5001
|
-
const result =
|
|
5002
|
-
return getFluentWrapper(modelName, result,
|
|
5034
|
+
const result = ts14.unionType(getResultType(modelName, actionName)).addVariant(ts14.nullType);
|
|
5035
|
+
return getFluentWrapper(modelName, result, ts14.nullType);
|
|
5003
5036
|
}
|
|
5004
5037
|
return getFluentWrapper(modelName, getResultType(modelName, actionName));
|
|
5005
5038
|
}
|
|
5006
|
-
function getFluentWrapper(modelName, resultType, nullType7 =
|
|
5007
|
-
return
|
|
5039
|
+
function getFluentWrapper(modelName, resultType, nullType7 = ts14.neverType) {
|
|
5040
|
+
return ts14.namedType(`Prisma.${fluentWrapperName(modelName)}`).addGenericArgument(resultType).addGenericArgument(nullType7).addGenericArgument(extArgsParam.toArgument()).addGenericArgument(ts14.namedType("GlobalOmitOptions"));
|
|
5008
5041
|
}
|
|
5009
5042
|
function getResultType(modelName, actionName) {
|
|
5010
|
-
return
|
|
5043
|
+
return ts14.namedType("runtime.Types.Result.GetResult").addGenericArgument(ts14.namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument())).addGenericArgument(ts14.namedType("T")).addGenericArgument(ts14.stringLiteral(actionName)).addGenericArgument(ts14.namedType("GlobalOmitOptions"));
|
|
5011
5044
|
}
|
|
5012
5045
|
function buildFluentWrapperDefinition(modelName, outputType, context) {
|
|
5013
|
-
const definition =
|
|
5014
|
-
definition.addGenericParameter(
|
|
5015
|
-
definition.add(
|
|
5046
|
+
const definition = ts14.interfaceDeclaration(fluentWrapperName(modelName));
|
|
5047
|
+
definition.addGenericParameter(ts14.genericParameter("T")).addGenericParameter(ts14.genericParameter("Null").default(ts14.neverType)).addGenericParameter(extArgsParam).addGenericParameter(ts14.genericParameter("GlobalOmitOptions").default(ts14.objectType())).extends(prismaPromise(ts14.namedType("T")));
|
|
5048
|
+
definition.add(ts14.property(ts14.toStringTag, ts14.stringLiteral("PrismaPromise")).readonly());
|
|
5016
5049
|
definition.addMultiple(
|
|
5017
5050
|
outputType.fields.filter(
|
|
5018
5051
|
(field) => field.outputType.location === "outputObjectTypes" && !context.dmmf.isComposite(field.outputType.type) && field.name !== "_count"
|
|
5019
5052
|
).map((field) => {
|
|
5020
|
-
const fieldArgType =
|
|
5021
|
-
const argsParam =
|
|
5022
|
-
return
|
|
5053
|
+
const fieldArgType = ts14.namedType(`Prisma.${getFieldArgName(field, modelName)}`).addGenericArgument(extArgsParam.toArgument());
|
|
5054
|
+
const argsParam = ts14.genericParameter("T").extends(fieldArgType).default(ts14.objectType());
|
|
5055
|
+
return ts14.method(field.name).addGenericParameter(argsParam).addParameter(ts14.parameter("args", subset(argsParam.toArgument(), fieldArgType)).optional()).setReturnType(
|
|
5023
5056
|
getReturnType({
|
|
5024
5057
|
modelName: field.outputType.type,
|
|
5025
5058
|
actionName: field.outputType.isList ? DMMF2.ModelAction.findMany : DMMF2.ModelAction.findUniqueOrThrow,
|
|
@@ -5030,37 +5063,37 @@ function buildFluentWrapperDefinition(modelName, outputType, context) {
|
|
|
5030
5063
|
})
|
|
5031
5064
|
);
|
|
5032
5065
|
definition.add(
|
|
5033
|
-
|
|
5034
|
-
|
|
5066
|
+
ts14.method("then").setDocComment(
|
|
5067
|
+
ts14.docComment`
|
|
5035
5068
|
Attaches callbacks for the resolution and/or rejection of the Promise.
|
|
5036
5069
|
@param onfulfilled The callback to execute when the Promise is resolved.
|
|
5037
5070
|
@param onrejected The callback to execute when the Promise is rejected.
|
|
5038
5071
|
@returns A Promise for the completion of which ever callback is executed.
|
|
5039
5072
|
`
|
|
5040
|
-
).addGenericParameter(
|
|
5073
|
+
).addGenericParameter(ts14.genericParameter("TResult1").default(ts14.namedType("T"))).addGenericParameter(ts14.genericParameter("TResult2").default(ts14.neverType)).addParameter(promiseCallback("onfulfilled", ts14.parameter("value", ts14.namedType("T")), ts14.namedType("TResult1"))).addParameter(promiseCallback("onrejected", ts14.parameter("reason", ts14.anyType), ts14.namedType("TResult2"))).setReturnType(promise(ts14.unionType([ts14.namedType("TResult1"), ts14.namedType("TResult2")])))
|
|
5041
5074
|
);
|
|
5042
5075
|
definition.add(
|
|
5043
|
-
|
|
5044
|
-
|
|
5076
|
+
ts14.method("catch").setDocComment(
|
|
5077
|
+
ts14.docComment`
|
|
5045
5078
|
Attaches a callback for only the rejection of the Promise.
|
|
5046
5079
|
@param onrejected The callback to execute when the Promise is rejected.
|
|
5047
5080
|
@returns A Promise for the completion of the callback.
|
|
5048
5081
|
`
|
|
5049
|
-
).addGenericParameter(
|
|
5082
|
+
).addGenericParameter(ts14.genericParameter("TResult").default(ts14.neverType)).addParameter(promiseCallback("onrejected", ts14.parameter("reason", ts14.anyType), ts14.namedType("TResult"))).setReturnType(promise(ts14.unionType([ts14.namedType("T"), ts14.namedType("TResult")])))
|
|
5050
5083
|
);
|
|
5051
5084
|
definition.add(
|
|
5052
|
-
|
|
5053
|
-
|
|
5085
|
+
ts14.method("finally").setDocComment(
|
|
5086
|
+
ts14.docComment`
|
|
5054
5087
|
Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
|
|
5055
5088
|
resolved value cannot be modified from the callback.
|
|
5056
5089
|
@param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
|
|
5057
5090
|
@returns A Promise for the completion of the callback.
|
|
5058
5091
|
`
|
|
5059
5092
|
).addParameter(
|
|
5060
|
-
|
|
5061
|
-
).setReturnType(promise(
|
|
5093
|
+
ts14.parameter("onfinally", ts14.unionType([ts14.functionType(), ts14.undefinedType, ts14.nullType])).optional()
|
|
5094
|
+
).setReturnType(promise(ts14.namedType("T")))
|
|
5062
5095
|
);
|
|
5063
|
-
return
|
|
5096
|
+
return ts14.moduleExport(definition).setDocComment(ts14.docComment`
|
|
5064
5097
|
The delegate class that acts as a "Promise-like" for ${modelName}.
|
|
5065
5098
|
Why is this prefixed with \`Prisma__\`?
|
|
5066
5099
|
Because we want to prevent naming conflicts as mentioned in
|
|
@@ -5068,20 +5101,20 @@ function buildFluentWrapperDefinition(modelName, outputType, context) {
|
|
|
5068
5101
|
`);
|
|
5069
5102
|
}
|
|
5070
5103
|
function promiseCallback(name, callbackParam, returnType) {
|
|
5071
|
-
return
|
|
5104
|
+
return ts14.parameter(
|
|
5072
5105
|
name,
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5106
|
+
ts14.unionType([
|
|
5107
|
+
ts14.functionType().addParameter(callbackParam).setReturnType(typeOrPromiseLike(returnType)),
|
|
5108
|
+
ts14.undefinedType,
|
|
5109
|
+
ts14.nullType
|
|
5077
5110
|
])
|
|
5078
5111
|
).optional();
|
|
5079
5112
|
}
|
|
5080
5113
|
function typeOrPromiseLike(type) {
|
|
5081
|
-
return
|
|
5114
|
+
return ts14.unionType([type, ts14.namedType("PromiseLike").addGenericArgument(type)]);
|
|
5082
5115
|
}
|
|
5083
5116
|
function subset(arg, baseType) {
|
|
5084
|
-
return
|
|
5117
|
+
return ts14.namedType("Prisma.Subset").addGenericArgument(arg).addGenericArgument(baseType);
|
|
5085
5118
|
}
|
|
5086
5119
|
function fluentWrapperName(modelName) {
|
|
5087
5120
|
return `Prisma__${modelName}Client`;
|
|
@@ -5089,24 +5122,24 @@ function fluentWrapperName(modelName) {
|
|
|
5089
5122
|
|
|
5090
5123
|
// src/TSClient/file-generators/ModelFile.ts
|
|
5091
5124
|
function createModelFile(context, modelName) {
|
|
5092
|
-
const
|
|
5125
|
+
const jsDocHeader9 = `/*
|
|
5093
5126
|
* This file exports the \`${modelName}\` model and its related types.
|
|
5094
5127
|
*
|
|
5095
5128
|
* \u{1F7E2} You can import this file directly.
|
|
5096
5129
|
*/
|
|
5097
5130
|
`;
|
|
5098
5131
|
const imports = [
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5132
|
+
ts15.moduleImport(context.runtimeImport).asNamespace("runtime").typeOnly(),
|
|
5133
|
+
ts15.moduleImport(context.importFileName(`../enums`)).asNamespace("$Enums").typeOnly(),
|
|
5134
|
+
ts15.moduleImport(context.importFileName(`../internal/prismaNamespace`)).asNamespace("Prisma").typeOnly()
|
|
5102
5135
|
];
|
|
5103
|
-
const importsString = imports.map((i) =>
|
|
5136
|
+
const importsString = imports.map((i) => ts15.stringify(i)).join("\n");
|
|
5104
5137
|
const model = context.dmmf.typeAndModelMap[modelName];
|
|
5105
|
-
return
|
|
5138
|
+
return jsDocHeader9 + importsString + "\n" + new Model(model, context).toTS();
|
|
5106
5139
|
}
|
|
5107
5140
|
|
|
5108
5141
|
// src/TSClient/file-generators/ModelsFile.ts
|
|
5109
|
-
var
|
|
5142
|
+
var jsDocHeader6 = `/*
|
|
5110
5143
|
* This is a barrel export file for all models and their related types.
|
|
5111
5144
|
*
|
|
5112
5145
|
* \u{1F7E2} You can import this file directly.
|
|
@@ -5115,11 +5148,46 @@ var jsDocHeader5 = `/*
|
|
|
5115
5148
|
function createModelsFile(context, modelsNames) {
|
|
5116
5149
|
const exports = modelsNames.map((m) => `export type * from './models/${context.importFileName(m)}'`);
|
|
5117
5150
|
exports.push(`export type * from './${context.importFileName("commonInputTypes")}'`);
|
|
5118
|
-
return
|
|
5151
|
+
return jsDocHeader6 + exports.join("\n");
|
|
5152
|
+
}
|
|
5153
|
+
|
|
5154
|
+
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
5155
|
+
import * as ts16 from "@prisma/ts-builders";
|
|
5156
|
+
var jsDocHeader7 = `/*
|
|
5157
|
+
* WARNING: This is an internal file that is subject to change!
|
|
5158
|
+
*
|
|
5159
|
+
* \u{1F6D1} Under no circumstances should you import this file directly! \u{1F6D1}
|
|
5160
|
+
*
|
|
5161
|
+
* All exports from this file are wrapped under a \`Prisma\` namespace object in the browser.ts file.
|
|
5162
|
+
* While this enables partial backward compatibility, it is not part of the stable public API.
|
|
5163
|
+
*
|
|
5164
|
+
* If you are looking for your Models, Enums, and Input Types, please import them from the respective
|
|
5165
|
+
* model files in the \`model\` directory!
|
|
5166
|
+
*/
|
|
5167
|
+
`;
|
|
5168
|
+
function createPrismaNamespaceBrowserFile(context) {
|
|
5169
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
|
|
5170
|
+
return `${jsDocHeader7}
|
|
5171
|
+
${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
|
|
5172
|
+
export type * from '${context.importFileName(`../models`)}'
|
|
5173
|
+
export type * from '${context.importFileName(`./prismaNamespace`)}'
|
|
5174
|
+
export const Decimal = runtime.Decimal
|
|
5175
|
+
${new Enum(
|
|
5176
|
+
{
|
|
5177
|
+
name: "ModelName",
|
|
5178
|
+
values: context.dmmf.mappings.modelOperations.map((m) => m.model)
|
|
5179
|
+
},
|
|
5180
|
+
true
|
|
5181
|
+
).toTS()}
|
|
5182
|
+
/**
|
|
5183
|
+
* Enums
|
|
5184
|
+
*/
|
|
5185
|
+
${prismaEnums?.join("\n\n")}
|
|
5186
|
+
`;
|
|
5119
5187
|
}
|
|
5120
5188
|
|
|
5121
5189
|
// src/TSClient/file-generators/PrismaNamespaceFile.ts
|
|
5122
|
-
import * as
|
|
5190
|
+
import * as ts19 from "@prisma/ts-builders";
|
|
5123
5191
|
|
|
5124
5192
|
// src/TSClient/common.ts
|
|
5125
5193
|
var commonCodeTS = ({ clientVersion, engineVersion, generator }) => {
|
|
@@ -5544,23 +5612,23 @@ export type ${this.type.name}<$PrismaModel> = FieldRefInputType<$PrismaModel, ${
|
|
|
5544
5612
|
|
|
5545
5613
|
// src/TSClient/globalOmit.ts
|
|
5546
5614
|
import { uncapitalize as uncapitalize7 } from "@prisma/client-common";
|
|
5547
|
-
import * as
|
|
5615
|
+
import * as ts17 from "@prisma/ts-builders";
|
|
5548
5616
|
function globalOmitConfig(dmmf) {
|
|
5549
|
-
const objectType11 =
|
|
5617
|
+
const objectType11 = ts17.objectType().addMultiple(
|
|
5550
5618
|
dmmf.datamodel.models.map((model) => {
|
|
5551
|
-
const type =
|
|
5552
|
-
return
|
|
5619
|
+
const type = ts17.namedType(`Prisma.${getOmitName(model.name)}`);
|
|
5620
|
+
return ts17.property(uncapitalize7(model.name), type).optional();
|
|
5553
5621
|
})
|
|
5554
5622
|
);
|
|
5555
|
-
return
|
|
5623
|
+
return ts17.moduleExport(ts17.typeDeclaration("GlobalOmitConfig", objectType11));
|
|
5556
5624
|
}
|
|
5557
5625
|
|
|
5558
5626
|
// src/TSClient/TypeMap.ts
|
|
5559
5627
|
import { uncapitalize as uncapitalize8 } from "@prisma/client-common";
|
|
5560
5628
|
import { assertNever as assertNever2 } from "@prisma/internals";
|
|
5561
|
-
import * as
|
|
5629
|
+
import * as ts18 from "@prisma/ts-builders";
|
|
5562
5630
|
function clientTypeMapDefinition(context) {
|
|
5563
|
-
const typeMap = `${
|
|
5631
|
+
const typeMap = `${ts18.stringify(clientTypeMapModelsDefinition(context))} & ${clientTypeMapOthersDefinition(context)}`;
|
|
5564
5632
|
return `
|
|
5565
5633
|
export interface TypeMapCb<GlobalOmitOptions = {}> extends runtime.Types.Utils.Fn<{extArgs: runtime.Types.Extensions.InternalArgs }, runtime.Types.Utils.Record<string, any>> {
|
|
5566
5634
|
returns: TypeMap<this['params']['extArgs'], GlobalOmitOptions>
|
|
@@ -5569,39 +5637,39 @@ export interface TypeMapCb<GlobalOmitOptions = {}> extends runtime.Types.Utils.F
|
|
|
5569
5637
|
export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> = ${typeMap}`;
|
|
5570
5638
|
}
|
|
5571
5639
|
function clientTypeMapModelsDefinition(context) {
|
|
5572
|
-
const meta =
|
|
5640
|
+
const meta = ts18.objectType();
|
|
5573
5641
|
const modelNames = context.dmmf.datamodel.models.map((m) => m.name);
|
|
5574
5642
|
if (modelNames.length === 0) {
|
|
5575
|
-
meta.add(
|
|
5643
|
+
meta.add(ts18.property("modelProps", ts18.neverType));
|
|
5576
5644
|
} else {
|
|
5577
|
-
meta.add(
|
|
5645
|
+
meta.add(ts18.property("modelProps", ts18.unionType(modelNames.map((name) => ts18.stringLiteral(uncapitalize8(name))))));
|
|
5578
5646
|
}
|
|
5579
|
-
const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ?
|
|
5580
|
-
meta.add(
|
|
5581
|
-
const model =
|
|
5647
|
+
const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? ts18.namedType("TransactionIsolationLevel") : ts18.neverType;
|
|
5648
|
+
meta.add(ts18.property("txIsolationLevel", isolationLevel));
|
|
5649
|
+
const model = ts18.objectType();
|
|
5582
5650
|
model.addMultiple(
|
|
5583
5651
|
modelNames.map((modelName) => {
|
|
5584
|
-
const entry =
|
|
5652
|
+
const entry = ts18.objectType();
|
|
5585
5653
|
entry.add(
|
|
5586
|
-
|
|
5654
|
+
ts18.property("payload", ts18.namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument()))
|
|
5587
5655
|
);
|
|
5588
|
-
entry.add(
|
|
5656
|
+
entry.add(ts18.property("fields", ts18.namedType(`Prisma.${getFieldRefsTypeName(modelName)}`)));
|
|
5589
5657
|
const actions = getModelActions(context.dmmf, modelName);
|
|
5590
|
-
const operations =
|
|
5658
|
+
const operations = ts18.objectType();
|
|
5591
5659
|
operations.addMultiple(
|
|
5592
5660
|
actions.map((action) => {
|
|
5593
|
-
const operationType =
|
|
5661
|
+
const operationType = ts18.objectType();
|
|
5594
5662
|
const argsType = `Prisma.${getModelArgName(modelName, action)}`;
|
|
5595
|
-
operationType.add(
|
|
5596
|
-
operationType.add(
|
|
5597
|
-
return
|
|
5663
|
+
operationType.add(ts18.property("args", ts18.namedType(argsType).addGenericArgument(extArgsParam.toArgument())));
|
|
5664
|
+
operationType.add(ts18.property("result", clientTypeMapModelsResultDefinition(modelName, action)));
|
|
5665
|
+
return ts18.property(action, operationType);
|
|
5598
5666
|
})
|
|
5599
5667
|
);
|
|
5600
|
-
entry.add(
|
|
5601
|
-
return
|
|
5668
|
+
entry.add(ts18.property("operations", operations));
|
|
5669
|
+
return ts18.property(modelName, entry);
|
|
5602
5670
|
})
|
|
5603
5671
|
);
|
|
5604
|
-
return
|
|
5672
|
+
return ts18.objectType().add(ts18.property("globalOmitOptions", ts18.objectType().add(ts18.property("omit", ts18.namedType("GlobalOmitOptions"))))).add(ts18.property("meta", meta)).add(ts18.property("model", model));
|
|
5605
5673
|
}
|
|
5606
5674
|
function clientTypeMapOthersDefinition(context) {
|
|
5607
5675
|
const otherOperationsNames = context.dmmf.getOtherOperationNames().flatMap((name) => {
|
|
@@ -5638,19 +5706,19 @@ function clientTypeMapOthersDefinition(context) {
|
|
|
5638
5706
|
}
|
|
5639
5707
|
function clientTypeMapModelsResultDefinition(modelName, action) {
|
|
5640
5708
|
if (action === "count")
|
|
5641
|
-
return
|
|
5642
|
-
if (action === "groupBy") return
|
|
5643
|
-
if (action === "aggregate") return optional(
|
|
5644
|
-
if (action === "findRaw") return
|
|
5645
|
-
if (action === "aggregateRaw") return
|
|
5646
|
-
if (action === "deleteMany") return
|
|
5647
|
-
if (action === "createMany") return
|
|
5648
|
-
if (action === "createManyAndReturn") return
|
|
5649
|
-
if (action === "updateMany") return
|
|
5650
|
-
if (action === "updateManyAndReturn") return
|
|
5651
|
-
if (action === "findMany") return
|
|
5652
|
-
if (action === "findFirst") return
|
|
5653
|
-
if (action === "findUnique") return
|
|
5709
|
+
return ts18.unionType([optional(ts18.namedType(`Prisma.${getCountAggregateOutputName(modelName)}`)), ts18.numberType]);
|
|
5710
|
+
if (action === "groupBy") return ts18.array(optional(ts18.namedType(`Prisma.${getGroupByName(modelName)}`)));
|
|
5711
|
+
if (action === "aggregate") return optional(ts18.namedType(`Prisma.${getAggregateName(modelName)}`));
|
|
5712
|
+
if (action === "findRaw") return ts18.namedType("Prisma.JsonObject");
|
|
5713
|
+
if (action === "aggregateRaw") return ts18.namedType("Prisma.JsonObject");
|
|
5714
|
+
if (action === "deleteMany") return ts18.namedType("BatchPayload");
|
|
5715
|
+
if (action === "createMany") return ts18.namedType("BatchPayload");
|
|
5716
|
+
if (action === "createManyAndReturn") return ts18.array(payloadToResult(modelName));
|
|
5717
|
+
if (action === "updateMany") return ts18.namedType("BatchPayload");
|
|
5718
|
+
if (action === "updateManyAndReturn") return ts18.array(payloadToResult(modelName));
|
|
5719
|
+
if (action === "findMany") return ts18.array(payloadToResult(modelName));
|
|
5720
|
+
if (action === "findFirst") return ts18.unionType([payloadToResult(modelName), ts18.nullType]);
|
|
5721
|
+
if (action === "findUnique") return ts18.unionType([payloadToResult(modelName), ts18.nullType]);
|
|
5654
5722
|
if (action === "findFirstOrThrow") return payloadToResult(modelName);
|
|
5655
5723
|
if (action === "findUniqueOrThrow") return payloadToResult(modelName);
|
|
5656
5724
|
if (action === "create") return payloadToResult(modelName);
|
|
@@ -5660,11 +5728,11 @@ function clientTypeMapModelsResultDefinition(modelName, action) {
|
|
|
5660
5728
|
assertNever2(action, `Unknown action: ${action}`);
|
|
5661
5729
|
}
|
|
5662
5730
|
function payloadToResult(modelName) {
|
|
5663
|
-
return
|
|
5731
|
+
return ts18.namedType("runtime.Types.Utils.PayloadToResult").addGenericArgument(ts18.namedType(getPayloadName(modelName)));
|
|
5664
5732
|
}
|
|
5665
5733
|
|
|
5666
5734
|
// src/TSClient/file-generators/PrismaNamespaceFile.ts
|
|
5667
|
-
var
|
|
5735
|
+
var jsDocHeader8 = `/*
|
|
5668
5736
|
* WARNING: This is an internal file that is subject to change!
|
|
5669
5737
|
*
|
|
5670
5738
|
* \u{1F6D1} Under no circumstances should you import this file directly! \u{1F6D1}
|
|
@@ -5678,13 +5746,13 @@ var jsDocHeader6 = `/*
|
|
|
5678
5746
|
`;
|
|
5679
5747
|
function createPrismaNamespaceFile(context, options) {
|
|
5680
5748
|
const imports = [
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
].map((i) =>
|
|
5749
|
+
ts19.moduleImport(context.runtimeImport).asNamespace("runtime"),
|
|
5750
|
+
ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
|
|
5751
|
+
ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
|
|
5752
|
+
].map((i) => ts19.stringify(i));
|
|
5685
5753
|
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
|
|
5686
5754
|
const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
|
|
5687
|
-
return `${
|
|
5755
|
+
return `${jsDocHeader8}
|
|
5688
5756
|
${imports.join("\n")}
|
|
5689
5757
|
|
|
5690
5758
|
export type * from '${context.importFileName(`../models`)}'
|
|
@@ -5724,8 +5792,8 @@ ${new Datasources(options.datasources).toTS()}
|
|
|
5724
5792
|
${clientExtensionsDefinitions()}
|
|
5725
5793
|
export type DefaultPrismaClient = PrismaClient
|
|
5726
5794
|
export type ErrorFormat = 'pretty' | 'colorless' | 'minimal'
|
|
5727
|
-
${
|
|
5728
|
-
${
|
|
5795
|
+
${ts19.stringify(ts19.moduleExport(buildClientOptions(context, options)))}
|
|
5796
|
+
${ts19.stringify(globalOmitConfig(context.dmmf))}
|
|
5729
5797
|
|
|
5730
5798
|
/* Types for Logging */
|
|
5731
5799
|
export type LogLevel = 'info' | 'query' | 'warn' | 'error'
|
|
@@ -5791,24 +5859,24 @@ export type TransactionClient = Omit<DefaultPrismaClient, runtime.ITXClientDenyL
|
|
|
5791
5859
|
`;
|
|
5792
5860
|
}
|
|
5793
5861
|
function clientExtensionsDefinitions() {
|
|
5794
|
-
const define =
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5862
|
+
const define = ts19.moduleExport(
|
|
5863
|
+
ts19.constDeclaration("defineExtension").setValue(
|
|
5864
|
+
ts19.namedValue("runtime.Extensions.defineExtension").as(ts19.namedType("unknown")).as(
|
|
5865
|
+
ts19.namedType("runtime.Types.Extensions.ExtendsHook").addGenericArgument(ts19.stringLiteral("define")).addGenericArgument(ts19.namedType("TypeMapCb")).addGenericArgument(ts19.namedType("runtime.Types.Extensions.DefaultArgs"))
|
|
5798
5866
|
)
|
|
5799
5867
|
)
|
|
5800
5868
|
);
|
|
5801
|
-
return
|
|
5869
|
+
return ts19.stringify(define);
|
|
5802
5870
|
}
|
|
5803
5871
|
function buildClientOptions(context, options) {
|
|
5804
|
-
const clientOptions =
|
|
5805
|
-
|
|
5872
|
+
const clientOptions = ts19.interfaceDeclaration("PrismaClientOptions").add(
|
|
5873
|
+
ts19.property("datasources", ts19.namedType("Datasources")).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
|
|
5806
5874
|
).add(
|
|
5807
|
-
|
|
5875
|
+
ts19.property("datasourceUrl", ts19.stringType).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
|
|
5808
5876
|
).add(
|
|
5809
|
-
|
|
5877
|
+
ts19.property("errorFormat", ts19.namedType("ErrorFormat")).optional().setDocComment(ts19.docComment('@default "colorless"'))
|
|
5810
5878
|
).add(
|
|
5811
|
-
|
|
5879
|
+
ts19.property("log", ts19.array(ts19.unionType([ts19.namedType("LogLevel"), ts19.namedType("LogDefinition")]))).optional().setDocComment(ts19.docComment`
|
|
5812
5880
|
@example
|
|
5813
5881
|
\`\`\`
|
|
5814
5882
|
// Shorthand for \`emit: 'stdout'\`
|
|
@@ -5833,12 +5901,12 @@ function buildClientOptions(context, options) {
|
|
|
5833
5901
|
Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).
|
|
5834
5902
|
`)
|
|
5835
5903
|
);
|
|
5836
|
-
const transactionOptions =
|
|
5904
|
+
const transactionOptions = ts19.objectType().add(ts19.property("maxWait", ts19.numberType).optional()).add(ts19.property("timeout", ts19.numberType).optional());
|
|
5837
5905
|
if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
|
|
5838
|
-
transactionOptions.add(
|
|
5906
|
+
transactionOptions.add(ts19.property("isolationLevel", ts19.namedType("TransactionIsolationLevel")).optional());
|
|
5839
5907
|
}
|
|
5840
5908
|
clientOptions.add(
|
|
5841
|
-
|
|
5909
|
+
ts19.property("transactionOptions", transactionOptions).optional().setDocComment(ts19.docComment`
|
|
5842
5910
|
The default values for transactionOptions
|
|
5843
5911
|
maxWait ?= 2000
|
|
5844
5912
|
timeout ?= 5000
|
|
@@ -5846,13 +5914,13 @@ function buildClientOptions(context, options) {
|
|
|
5846
5914
|
);
|
|
5847
5915
|
if (["library", "client", "wasm-compiler-edge", "wasm-engine-edge"].includes(options.runtimeName)) {
|
|
5848
5916
|
clientOptions.add(
|
|
5849
|
-
|
|
5850
|
-
|
|
5917
|
+
ts19.property("adapter", ts19.unionType([ts19.namedType("runtime.SqlDriverAdapterFactory"), ts19.namedType("null")])).optional().setDocComment(
|
|
5918
|
+
ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
|
|
5851
5919
|
)
|
|
5852
5920
|
);
|
|
5853
5921
|
}
|
|
5854
5922
|
clientOptions.add(
|
|
5855
|
-
|
|
5923
|
+
ts19.property("omit", ts19.namedType("GlobalOmitConfig")).optional().setDocComment(ts19.docComment`
|
|
5856
5924
|
Global configuration for omitting model fields by default.
|
|
5857
5925
|
|
|
5858
5926
|
@example
|
|
@@ -5874,6 +5942,7 @@ function buildClientOptions(context, options) {
|
|
|
5874
5942
|
var GenerateContext = class {
|
|
5875
5943
|
dmmf;
|
|
5876
5944
|
genericArgsInfo;
|
|
5945
|
+
runtimeBase;
|
|
5877
5946
|
runtimeImport;
|
|
5878
5947
|
outputFileName;
|
|
5879
5948
|
importFileName;
|
|
@@ -5881,6 +5950,7 @@ var GenerateContext = class {
|
|
|
5881
5950
|
constructor({
|
|
5882
5951
|
dmmf,
|
|
5883
5952
|
genericArgsInfo,
|
|
5953
|
+
runtimeBase,
|
|
5884
5954
|
runtimeImport: runtimeImport2,
|
|
5885
5955
|
outputFileName,
|
|
5886
5956
|
importFileName,
|
|
@@ -5888,6 +5958,7 @@ var GenerateContext = class {
|
|
|
5888
5958
|
}) {
|
|
5889
5959
|
this.dmmf = dmmf;
|
|
5890
5960
|
this.genericArgsInfo = genericArgsInfo;
|
|
5961
|
+
this.runtimeBase = runtimeBase;
|
|
5891
5962
|
this.runtimeImport = runtimeImport2;
|
|
5892
5963
|
this.outputFileName = outputFileName;
|
|
5893
5964
|
this.importFileName = importFileName;
|
|
@@ -5911,6 +5982,7 @@ var TSClient = class {
|
|
|
5911
5982
|
const context = new GenerateContext({
|
|
5912
5983
|
dmmf: this.dmmf,
|
|
5913
5984
|
genericArgsInfo: this.genericsInfo,
|
|
5985
|
+
runtimeBase: this.options.runtimeBase,
|
|
5914
5986
|
runtimeImport: `${this.options.runtimeBase}/${this.options.runtimeName}`,
|
|
5915
5987
|
outputFileName: generatedFileNameMapper(this.options.generatedFileExtension),
|
|
5916
5988
|
importFileName: importFileNameMapper(this.options.importFileExtension),
|
|
@@ -5923,12 +5995,14 @@ var TSClient = class {
|
|
|
5923
5995
|
}, {});
|
|
5924
5996
|
return {
|
|
5925
5997
|
[context.outputFileName("client")]: createClientFile(context, this.options),
|
|
5998
|
+
[context.outputFileName("browser")]: createBrowserFile(context, this.options),
|
|
5926
5999
|
[context.outputFileName("enums")]: createEnumsFile(context),
|
|
5927
6000
|
[context.outputFileName("commonInputTypes")]: createCommonInputTypeFiles(context),
|
|
5928
6001
|
[context.outputFileName("models")]: createModelsFile(context, modelNames),
|
|
5929
6002
|
models: modelsFileMap,
|
|
5930
6003
|
internal: {
|
|
5931
6004
|
[context.outputFileName("prismaNamespace")]: createPrismaNamespaceFile(context, this.options),
|
|
6005
|
+
[context.outputFileName("prismaNamespaceBrowser")]: createPrismaNamespaceBrowserFile(context),
|
|
5932
6006
|
[context.outputFileName("class")]: createClassFile(context, this.options)
|
|
5933
6007
|
}
|
|
5934
6008
|
};
|
|
@@ -5937,7 +6011,7 @@ var TSClient = class {
|
|
|
5937
6011
|
|
|
5938
6012
|
// src/typedSql/buildDbEnums.ts
|
|
5939
6013
|
import { isValidJsIdentifier } from "@prisma/internals";
|
|
5940
|
-
import * as
|
|
6014
|
+
import * as ts20 from "@prisma/ts-builders";
|
|
5941
6015
|
var DbEnumsList = class {
|
|
5942
6016
|
enums;
|
|
5943
6017
|
constructor(enums) {
|
|
@@ -5968,16 +6042,16 @@ var DbEnumsList = class {
|
|
|
5968
6042
|
}
|
|
5969
6043
|
};
|
|
5970
6044
|
function buildDbEnums(list) {
|
|
5971
|
-
const file4 =
|
|
5972
|
-
const iface =
|
|
6045
|
+
const file4 = ts20.file();
|
|
6046
|
+
const iface = ts20.interfaceDeclaration("$DbEnums");
|
|
5973
6047
|
for (const dbEnum of list.enums) {
|
|
5974
|
-
iface.add(
|
|
6048
|
+
iface.add(ts20.property(dbEnum.name, enumToUnion(dbEnum)));
|
|
5975
6049
|
}
|
|
5976
|
-
file4.add(
|
|
5977
|
-
return
|
|
6050
|
+
file4.add(ts20.moduleExport(iface));
|
|
6051
|
+
return ts20.stringify(file4);
|
|
5978
6052
|
}
|
|
5979
6053
|
function enumToUnion(dbEnum) {
|
|
5980
|
-
return
|
|
6054
|
+
return ts20.unionType(dbEnum.values.map(ts20.stringLiteral));
|
|
5981
6055
|
}
|
|
5982
6056
|
function queryUsesEnums(query, enums) {
|
|
5983
6057
|
if (enums.isEmpty()) {
|
|
@@ -5987,82 +6061,82 @@ function queryUsesEnums(query, enums) {
|
|
|
5987
6061
|
}
|
|
5988
6062
|
|
|
5989
6063
|
// src/typedSql/buildIndex.ts
|
|
5990
|
-
import * as
|
|
6064
|
+
import * as ts21 from "@prisma/ts-builders";
|
|
5991
6065
|
function buildIndex({ queries, enums, importName }) {
|
|
5992
|
-
const file4 =
|
|
6066
|
+
const file4 = ts21.file();
|
|
5993
6067
|
if (!enums.isEmpty()) {
|
|
5994
|
-
file4.add(
|
|
6068
|
+
file4.add(ts21.moduleExportFrom(importName("./sql/$DbEnums")).named(ts21.namedExport("$DbEnums").typeOnly()));
|
|
5995
6069
|
}
|
|
5996
6070
|
for (const query of queries) {
|
|
5997
|
-
file4.add(
|
|
6071
|
+
file4.add(ts21.moduleExportFrom(importName(`./sql/${query.name}`)));
|
|
5998
6072
|
}
|
|
5999
|
-
return
|
|
6073
|
+
return ts21.stringify(file4);
|
|
6000
6074
|
}
|
|
6001
6075
|
|
|
6002
6076
|
// src/typedSql/buildTypedQuery.ts
|
|
6003
|
-
import * as
|
|
6077
|
+
import * as ts23 from "@prisma/ts-builders";
|
|
6004
6078
|
|
|
6005
6079
|
// src/typedSql/mapTypes.ts
|
|
6006
|
-
import * as
|
|
6007
|
-
var decimal =
|
|
6008
|
-
var uint8Array =
|
|
6009
|
-
var date =
|
|
6010
|
-
var inputJsonValue =
|
|
6011
|
-
var jsonValue =
|
|
6012
|
-
var bigintIn =
|
|
6013
|
-
var decimalIn =
|
|
6080
|
+
import * as ts22 from "@prisma/ts-builders";
|
|
6081
|
+
var decimal = ts22.namedType("$runtime.Decimal");
|
|
6082
|
+
var uint8Array = ts22.namedType("Uint8Array");
|
|
6083
|
+
var date = ts22.namedType("Date");
|
|
6084
|
+
var inputJsonValue = ts22.namedType("$runtime.InputJsonObject");
|
|
6085
|
+
var jsonValue = ts22.namedType("$runtime.JsonValue");
|
|
6086
|
+
var bigintIn = ts22.unionType([ts22.numberType, ts22.bigintType]);
|
|
6087
|
+
var decimalIn = ts22.unionType([ts22.numberType, decimal]);
|
|
6014
6088
|
var typeMappings = {
|
|
6015
|
-
unknown:
|
|
6016
|
-
string:
|
|
6017
|
-
int:
|
|
6089
|
+
unknown: ts22.unknownType,
|
|
6090
|
+
string: ts22.stringType,
|
|
6091
|
+
int: ts22.numberType,
|
|
6018
6092
|
bigint: {
|
|
6019
6093
|
in: bigintIn,
|
|
6020
|
-
out:
|
|
6094
|
+
out: ts22.bigintType
|
|
6021
6095
|
},
|
|
6022
6096
|
decimal: {
|
|
6023
6097
|
in: decimalIn,
|
|
6024
6098
|
out: decimal
|
|
6025
6099
|
},
|
|
6026
|
-
float:
|
|
6027
|
-
double:
|
|
6028
|
-
enum:
|
|
6100
|
+
float: ts22.numberType,
|
|
6101
|
+
double: ts22.numberType,
|
|
6102
|
+
enum: ts22.stringType,
|
|
6029
6103
|
// TODO:
|
|
6030
6104
|
bytes: uint8Array,
|
|
6031
|
-
bool:
|
|
6032
|
-
char:
|
|
6105
|
+
bool: ts22.booleanType,
|
|
6106
|
+
char: ts22.stringType,
|
|
6033
6107
|
json: {
|
|
6034
6108
|
in: inputJsonValue,
|
|
6035
6109
|
out: jsonValue
|
|
6036
6110
|
},
|
|
6037
|
-
xml:
|
|
6038
|
-
uuid:
|
|
6111
|
+
xml: ts22.stringType,
|
|
6112
|
+
uuid: ts22.stringType,
|
|
6039
6113
|
date,
|
|
6040
6114
|
datetime: date,
|
|
6041
6115
|
time: date,
|
|
6042
|
-
null:
|
|
6043
|
-
"int-array":
|
|
6044
|
-
"string-array":
|
|
6116
|
+
null: ts22.nullType,
|
|
6117
|
+
"int-array": ts22.array(ts22.numberType),
|
|
6118
|
+
"string-array": ts22.array(ts22.stringType),
|
|
6045
6119
|
"json-array": {
|
|
6046
|
-
in:
|
|
6047
|
-
out:
|
|
6120
|
+
in: ts22.array(inputJsonValue),
|
|
6121
|
+
out: ts22.array(jsonValue)
|
|
6048
6122
|
},
|
|
6049
|
-
"uuid-array":
|
|
6050
|
-
"xml-array":
|
|
6123
|
+
"uuid-array": ts22.array(ts22.stringType),
|
|
6124
|
+
"xml-array": ts22.array(ts22.stringType),
|
|
6051
6125
|
"bigint-array": {
|
|
6052
|
-
in:
|
|
6053
|
-
out:
|
|
6126
|
+
in: ts22.array(bigintIn),
|
|
6127
|
+
out: ts22.array(ts22.bigintType)
|
|
6054
6128
|
},
|
|
6055
|
-
"float-array":
|
|
6056
|
-
"double-array":
|
|
6057
|
-
"char-array":
|
|
6058
|
-
"bytes-array":
|
|
6059
|
-
"bool-array":
|
|
6060
|
-
"date-array":
|
|
6061
|
-
"time-array":
|
|
6062
|
-
"datetime-array":
|
|
6129
|
+
"float-array": ts22.array(ts22.numberType),
|
|
6130
|
+
"double-array": ts22.array(ts22.numberType),
|
|
6131
|
+
"char-array": ts22.array(ts22.stringType),
|
|
6132
|
+
"bytes-array": ts22.array(uint8Array),
|
|
6133
|
+
"bool-array": ts22.array(ts22.booleanType),
|
|
6134
|
+
"date-array": ts22.array(date),
|
|
6135
|
+
"time-array": ts22.array(date),
|
|
6136
|
+
"datetime-array": ts22.array(date),
|
|
6063
6137
|
"decimal-array": {
|
|
6064
|
-
in:
|
|
6065
|
-
out:
|
|
6138
|
+
in: ts22.array(decimalIn),
|
|
6139
|
+
out: ts22.array(decimal)
|
|
6066
6140
|
}
|
|
6067
6141
|
};
|
|
6068
6142
|
function getInputType(introspectionType, nullable, enums) {
|
|
@@ -6070,7 +6144,7 @@ function getInputType(introspectionType, nullable, enums) {
|
|
|
6070
6144
|
if (!nullable) {
|
|
6071
6145
|
return inn;
|
|
6072
6146
|
} else {
|
|
6073
|
-
return new
|
|
6147
|
+
return new ts22.UnionType(inn).addVariant(ts22.nullType);
|
|
6074
6148
|
}
|
|
6075
6149
|
}
|
|
6076
6150
|
function getOutputType(introspectionType, nullable, enums) {
|
|
@@ -6078,7 +6152,7 @@ function getOutputType(introspectionType, nullable, enums) {
|
|
|
6078
6152
|
if (!nullable) {
|
|
6079
6153
|
return out;
|
|
6080
6154
|
} else {
|
|
6081
|
-
return new
|
|
6155
|
+
return new ts22.UnionType(out).addVariant(ts22.nullType);
|
|
6082
6156
|
}
|
|
6083
6157
|
}
|
|
6084
6158
|
function getMappingConfig(introspectionType, enums) {
|
|
@@ -6090,29 +6164,29 @@ function getMappingConfig(introspectionType, enums) {
|
|
|
6090
6164
|
}
|
|
6091
6165
|
throw new Error("Unknown type");
|
|
6092
6166
|
}
|
|
6093
|
-
if (config instanceof
|
|
6167
|
+
if (config instanceof ts22.TypeBuilder) {
|
|
6094
6168
|
return { in: config, out: config };
|
|
6095
6169
|
}
|
|
6096
6170
|
return config;
|
|
6097
6171
|
}
|
|
6098
6172
|
function getEnumType(name) {
|
|
6099
|
-
return
|
|
6173
|
+
return ts22.namedType("$DbEnums").subKey(name);
|
|
6100
6174
|
}
|
|
6101
6175
|
|
|
6102
6176
|
// src/typedSql/buildTypedQuery.ts
|
|
6103
6177
|
function buildTypedQuery({ query, runtimeBase, runtimeName, enums, importName }) {
|
|
6104
|
-
const file4 =
|
|
6105
|
-
file4.addImport(
|
|
6178
|
+
const file4 = ts23.file();
|
|
6179
|
+
file4.addImport(ts23.moduleImport(`${runtimeBase}/${runtimeName}`).asNamespace("$runtime"));
|
|
6106
6180
|
if (queryUsesEnums(query, enums)) {
|
|
6107
|
-
file4.addImport(
|
|
6181
|
+
file4.addImport(ts23.moduleImport(importName("./$DbEnums")).named(ts23.namedImport("$DbEnums").typeOnly()));
|
|
6108
6182
|
}
|
|
6109
|
-
const doc =
|
|
6110
|
-
const factoryType =
|
|
6111
|
-
const parametersType =
|
|
6183
|
+
const doc = ts23.docComment(query.documentation ?? void 0);
|
|
6184
|
+
const factoryType = ts23.functionType();
|
|
6185
|
+
const parametersType = ts23.tupleType();
|
|
6112
6186
|
for (const param of query.parameters) {
|
|
6113
6187
|
const paramType = getInputType(param.typ, param.nullable, enums);
|
|
6114
|
-
factoryType.addParameter(
|
|
6115
|
-
parametersType.add(
|
|
6188
|
+
factoryType.addParameter(ts23.parameter(param.name, paramType));
|
|
6189
|
+
parametersType.add(ts23.tupleItem(paramType).setName(param.name));
|
|
6116
6190
|
if (param.documentation) {
|
|
6117
6191
|
doc.addText(`@param ${param.name} ${param.documentation}`);
|
|
6118
6192
|
} else {
|
|
@@ -6120,26 +6194,26 @@ function buildTypedQuery({ query, runtimeBase, runtimeName, enums, importName })
|
|
|
6120
6194
|
}
|
|
6121
6195
|
}
|
|
6122
6196
|
factoryType.setReturnType(
|
|
6123
|
-
|
|
6197
|
+
ts23.namedType("$runtime.TypedSql").addGenericArgument(ts23.namedType(`${query.name}.Parameters`)).addGenericArgument(ts23.namedType(`${query.name}.Result`))
|
|
6124
6198
|
);
|
|
6125
6199
|
file4.add(
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6200
|
+
ts23.moduleExport(
|
|
6201
|
+
ts23.constDeclaration(query.name).setValue(
|
|
6202
|
+
ts23.functionCall("$runtime.makeTypedQueryFactory").addArgument(ts23.stringLiteral(query.source).asValue()).as(factoryType)
|
|
6129
6203
|
)
|
|
6130
6204
|
).setDocComment(doc)
|
|
6131
6205
|
);
|
|
6132
|
-
const namespace2 =
|
|
6133
|
-
namespace2.add(
|
|
6206
|
+
const namespace2 = ts23.namespace(query.name);
|
|
6207
|
+
namespace2.add(ts23.moduleExport(ts23.typeDeclaration("Parameters", parametersType)));
|
|
6134
6208
|
namespace2.add(buildResultType(query, enums));
|
|
6135
|
-
file4.add(
|
|
6136
|
-
return
|
|
6209
|
+
file4.add(ts23.moduleExport(namespace2));
|
|
6210
|
+
return ts23.stringify(file4);
|
|
6137
6211
|
}
|
|
6138
6212
|
function buildResultType(query, enums) {
|
|
6139
|
-
const type =
|
|
6140
|
-
query.resultColumns.map((column) =>
|
|
6213
|
+
const type = ts23.objectType().addMultiple(
|
|
6214
|
+
query.resultColumns.map((column) => ts23.property(column.name, getOutputType(column.typ, column.nullable, enums)))
|
|
6141
6215
|
);
|
|
6142
|
-
return
|
|
6216
|
+
return ts23.moduleExport(ts23.typeDeclaration("Result", type));
|
|
6143
6217
|
}
|
|
6144
6218
|
|
|
6145
6219
|
// src/typedSql/typedSql.ts
|
|
@@ -6214,7 +6288,7 @@ function buildClient({
|
|
|
6214
6288
|
moduleFormat,
|
|
6215
6289
|
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6216
6290
|
}) {
|
|
6217
|
-
const clientEngineType =
|
|
6291
|
+
const clientEngineType = getClientEngineType4(generator);
|
|
6218
6292
|
const runtimeName = getRuntimeNameForTarget(target, clientEngineType, generator.previewFeatures);
|
|
6219
6293
|
const outputName = generatedFileNameMapper(generatedFileExtension);
|
|
6220
6294
|
const importName = importFileNameMapper(importFileExtension);
|
|
@@ -6307,7 +6381,7 @@ async function generateClient(options) {
|
|
|
6307
6381
|
moduleFormat,
|
|
6308
6382
|
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6309
6383
|
} = options;
|
|
6310
|
-
const clientEngineType =
|
|
6384
|
+
const clientEngineType = getClientEngineType4(generator);
|
|
6311
6385
|
const { runtimeBase, outputDir } = await getGenerationDirs(options);
|
|
6312
6386
|
const { prismaClientDmmf, fileMap } = buildClient({
|
|
6313
6387
|
datamodel,
|
|
@@ -6532,12 +6606,12 @@ async function deleteOutputDir(outputDir) {
|
|
|
6532
6606
|
// src/generator.ts
|
|
6533
6607
|
import { Debug as Debug2 } from "@prisma/debug";
|
|
6534
6608
|
import { enginesVersion } from "@prisma/engines-version";
|
|
6535
|
-
import { ClientEngineType as ClientEngineType4, getClientEngineType as
|
|
6609
|
+
import { ClientEngineType as ClientEngineType4, getClientEngineType as getClientEngineType5, parseEnvValue } from "@prisma/internals";
|
|
6536
6610
|
import { getTsconfig } from "get-tsconfig";
|
|
6537
6611
|
import { match as match2 } from "ts-pattern";
|
|
6538
6612
|
|
|
6539
6613
|
// package.json
|
|
6540
|
-
var version = "6.16.0-dev.
|
|
6614
|
+
var version = "6.16.0-dev.37";
|
|
6541
6615
|
|
|
6542
6616
|
// src/module-format.ts
|
|
6543
6617
|
function parseModuleFormat(format) {
|
|
@@ -6638,7 +6712,7 @@ function getOutputPath(config) {
|
|
|
6638
6712
|
var PrismaClientTsGenerator = class {
|
|
6639
6713
|
name = "prisma-client-ts";
|
|
6640
6714
|
getManifest(config) {
|
|
6641
|
-
const requiresEngines = match2(
|
|
6715
|
+
const requiresEngines = match2(getClientEngineType5(config)).with(ClientEngineType4.Library, () => ["libqueryEngine"]).with(ClientEngineType4.Binary, () => ["queryEngine"]).with(ClientEngineType4.Client, () => []).exhaustive();
|
|
6642
6716
|
debug2("requiresEngines", requiresEngines);
|
|
6643
6717
|
return Promise.resolve({
|
|
6644
6718
|
defaultOutput: getOutputPath(config),
|