@prisma/client-generator-ts 6.19.0-integration-engines-6-19-0-28-next-8f44482e378cd05ba43deae3c6b1d441b5248e08.1 → 6.19.0-integration-next.12
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/NullTypes.d.ts +1 -1
- package/dist/TSClient/PrismaClient.d.ts +0 -1
- package/dist/TSClient/TSClient.d.ts +1 -1
- package/dist/generateClient.d.ts +1 -3
- package/dist/index.d.mts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +40 -107
- package/dist/index.mjs +40 -107
- package/dist/runtime-targets.d.ts +3 -3
- package/dist/utils/runtimeImport.d.ts +0 -7
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const nullTypes = "\nexport const NullTypes = {\n DbNull: runtime.
|
|
1
|
+
export declare const nullTypes = "\nexport const NullTypes = {\n DbNull: runtime.NullTypes.DbNull as (new (secret: never) => typeof runtime.DbNull),\n JsonNull: runtime.NullTypes.JsonNull as (new (secret: never) => typeof runtime.JsonNull),\n AnyNull: runtime.NullTypes.AnyNull as (new (secret: never) => typeof runtime.AnyNull),\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.DbNull\n\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.JsonNull\n\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.AnyNull\n";
|
|
@@ -3,7 +3,7 @@ import { DMMFHelper } from '../dmmf';
|
|
|
3
3
|
import type { FileMap } from '../generateClient';
|
|
4
4
|
import { GenerateClientOptions } from '../generateClient';
|
|
5
5
|
import { GenericArgsInfo } from '../GenericsArgsInfo';
|
|
6
|
-
export type RuntimeName = '
|
|
6
|
+
export type RuntimeName = 'library' | 'wasm-compiler-edge' | 'client' | (string & {});
|
|
7
7
|
export type TSClientOptions = O.Required<GenerateClientOptions, 'runtimeBase'> & {
|
|
8
8
|
/** The name of the runtime bundle to use */
|
|
9
9
|
runtimeName: RuntimeName;
|
package/dist/generateClient.d.ts
CHANGED
|
@@ -26,8 +26,6 @@ export interface GenerateClientOptions {
|
|
|
26
26
|
envPaths?: EnvPaths;
|
|
27
27
|
/** When --postinstall is passed via CLI */
|
|
28
28
|
postinstall?: boolean;
|
|
29
|
-
/** False when --no-engine is passed via CLI */
|
|
30
|
-
copyEngine?: boolean;
|
|
31
29
|
typedSql?: SqlQueryOutput[];
|
|
32
30
|
target: RuntimeTargetInternal;
|
|
33
31
|
generatedFileExtension: GeneratedFileExtension;
|
|
@@ -43,5 +41,5 @@ export interface BuildClientResult {
|
|
|
43
41
|
fileMap: FileMap;
|
|
44
42
|
prismaClientDmmf: DMMF.Document;
|
|
45
43
|
}
|
|
46
|
-
export declare function buildClient({ schemaPath, runtimeBase, datamodel, binaryPaths, outputDir, generator, dmmf, datasources, engineVersion, clientVersion, activeProvider, postinstall,
|
|
44
|
+
export declare function buildClient({ schemaPath, runtimeBase, datamodel, binaryPaths, outputDir, generator, dmmf, datasources, engineVersion, clientVersion, activeProvider, postinstall, envPaths, typedSql, target, generatedFileExtension, importFileExtension, moduleFormat, tsNoCheckPreamble, }: O.Required<GenerateClientOptions, 'runtimeBase'>): BuildClientResult;
|
|
47
45
|
export declare function generateClient(options: GenerateClientOptions): Promise<void>;
|
package/dist/index.d.mts
CHANGED
|
@@ -40,8 +40,6 @@ export declare interface GenerateClientOptions {
|
|
|
40
40
|
envPaths?: EnvPaths;
|
|
41
41
|
/** When --postinstall is passed via CLI */
|
|
42
42
|
postinstall?: boolean;
|
|
43
|
-
/** False when --no-engine is passed via CLI */
|
|
44
|
-
copyEngine?: boolean;
|
|
45
43
|
typedSql?: SqlQueryOutput[];
|
|
46
44
|
target: RuntimeTargetInternal;
|
|
47
45
|
generatedFileExtension: GeneratedFileExtension;
|
|
@@ -72,6 +70,6 @@ export declare class PrismaClientTsGenerator implements Generator_2 {
|
|
|
72
70
|
*/
|
|
73
71
|
declare type RuntimeTargetInternal = (typeof supportedInternalRuntimes)[number];
|
|
74
72
|
|
|
75
|
-
declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"
|
|
73
|
+
declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"];
|
|
76
74
|
|
|
77
75
|
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -40,8 +40,6 @@ export declare interface GenerateClientOptions {
|
|
|
40
40
|
envPaths?: EnvPaths;
|
|
41
41
|
/** When --postinstall is passed via CLI */
|
|
42
42
|
postinstall?: boolean;
|
|
43
|
-
/** False when --no-engine is passed via CLI */
|
|
44
|
-
copyEngine?: boolean;
|
|
45
43
|
typedSql?: SqlQueryOutput[];
|
|
46
44
|
target: RuntimeTargetInternal;
|
|
47
45
|
generatedFileExtension: GeneratedFileExtension;
|
|
@@ -72,6 +70,6 @@ export declare class PrismaClientTsGenerator implements Generator_2 {
|
|
|
72
70
|
*/
|
|
73
71
|
declare type RuntimeTargetInternal = (typeof supportedInternalRuntimes)[number];
|
|
74
72
|
|
|
75
|
-
declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"
|
|
73
|
+
declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"];
|
|
76
74
|
|
|
77
75
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -2385,7 +2385,7 @@ var Enum = class {
|
|
|
2385
2385
|
toTS() {
|
|
2386
2386
|
const { type } = this;
|
|
2387
2387
|
const enumVariants = `{
|
|
2388
|
-
${(0, import_indent_string.default)(type.
|
|
2388
|
+
${(0, import_indent_string.default)(type.data.map((v) => `${v.key}: ${this.getValue(v.value)}`).join(",\n"), TAB_SIZE)}
|
|
2389
2389
|
} as const`;
|
|
2390
2390
|
const enumBody = this.isStrictEnum() ? `runtime.makeStrictEnum(${enumVariants})` : enumVariants;
|
|
2391
2391
|
return `export const ${type.name} = ${enumBody}
|
|
@@ -2939,7 +2939,6 @@ ${modelExports(context).join("\n")}
|
|
|
2939
2939
|
}
|
|
2940
2940
|
|
|
2941
2941
|
// src/TSClient/file-generators/ClassFile.ts
|
|
2942
|
-
var import_node_crypto = __toESM(require("node:crypto"));
|
|
2943
2942
|
var import_node_path2 = __toESM(require("node:path"));
|
|
2944
2943
|
var import_internals4 = require("@prisma/internals");
|
|
2945
2944
|
var ts6 = __toESM(require("@prisma/ts-builders"));
|
|
@@ -3456,7 +3455,7 @@ function escapeJson(str) {
|
|
|
3456
3455
|
function buildRuntimeDataModel(datamodel, runtimeName) {
|
|
3457
3456
|
const runtimeDataModel = (0, import_client_common10.dmmfToRuntimeDataModel)(datamodel);
|
|
3458
3457
|
let prunedDataModel;
|
|
3459
|
-
if (runtimeName === "wasm-
|
|
3458
|
+
if (runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
|
|
3460
3459
|
prunedDataModel = (0, import_client_common10.pruneRuntimeDataModel)(runtimeDataModel);
|
|
3461
3460
|
} else {
|
|
3462
3461
|
prunedDataModel = runtimeDataModel;
|
|
@@ -3488,7 +3487,7 @@ var import_debug = require("@prisma/debug");
|
|
|
3488
3487
|
var import_ts_pattern = require("ts-pattern");
|
|
3489
3488
|
var debug = (0, import_debug.Debug)("prisma:client-generator-ts:wasm");
|
|
3490
3489
|
function usesEdgeWasmRuntime(component, runtimeName) {
|
|
3491
|
-
return runtimeName === "wasm-
|
|
3490
|
+
return runtimeName === "wasm-compiler-edge" && component === "compiler";
|
|
3492
3491
|
}
|
|
3493
3492
|
function buildGetWasmModule({
|
|
3494
3493
|
component,
|
|
@@ -3584,9 +3583,6 @@ var import_indent_string3 = __toESM(require("indent-string"));
|
|
|
3584
3583
|
|
|
3585
3584
|
// src/utils/runtimeImport.ts
|
|
3586
3585
|
var ts4 = __toESM(require("@prisma/ts-builders"));
|
|
3587
|
-
function runtimeImport(name) {
|
|
3588
|
-
return name;
|
|
3589
|
-
}
|
|
3590
3586
|
function runtimeImportedType(name) {
|
|
3591
3587
|
return ts4.namedType(`runtime.${name}`);
|
|
3592
3588
|
}
|
|
@@ -3730,24 +3726,6 @@ function queryRawTypedDefinition(context) {
|
|
|
3730
3726
|
).setReturnType(prismaPromise(ts5.array(param.toArgument())));
|
|
3731
3727
|
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3732
3728
|
}
|
|
3733
|
-
function metricDefinition(context) {
|
|
3734
|
-
if (!context.isPreviewFeatureOn("metrics")) {
|
|
3735
|
-
return "";
|
|
3736
|
-
}
|
|
3737
|
-
const property13 = ts5.property("$metrics", ts5.namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
|
|
3738
|
-
ts5.docComment`
|
|
3739
|
-
Gives access to the client metrics in json or prometheus format.
|
|
3740
|
-
|
|
3741
|
-
@example
|
|
3742
|
-
\`\`\`
|
|
3743
|
-
const metrics = await prisma.$metrics.json()
|
|
3744
|
-
// or
|
|
3745
|
-
const metrics = await prisma.$metrics.prometheus()
|
|
3746
|
-
\`\`\`
|
|
3747
|
-
`
|
|
3748
|
-
).readonly();
|
|
3749
|
-
return ts5.stringify(property13, { indentLevel: 1, newLine: "leading" });
|
|
3750
|
-
}
|
|
3751
3729
|
function runCommandRawDefinition(context) {
|
|
3752
3730
|
if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
|
|
3753
3731
|
return "";
|
|
@@ -3767,13 +3745,6 @@ function runCommandRawDefinition(context) {
|
|
|
3767
3745
|
`);
|
|
3768
3746
|
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3769
3747
|
}
|
|
3770
|
-
function eventRegistrationMethodDeclaration(runtimeName) {
|
|
3771
|
-
if (runtimeName === "binary") {
|
|
3772
|
-
return `$on<V extends (LogOpts | 'beforeExit')>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : V extends 'beforeExit' ? () => runtime.Types.Utils.JsPromise<void> : Prisma.LogEvent) => void): PrismaClient;`;
|
|
3773
|
-
} else {
|
|
3774
|
-
return `$on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;`;
|
|
3775
|
-
}
|
|
3776
|
-
}
|
|
3777
3748
|
function getPrismaClientClassDocComment({ dmmf }) {
|
|
3778
3749
|
let example;
|
|
3779
3750
|
if (dmmf.mappings.modelOperations.length) {
|
|
@@ -3829,7 +3800,7 @@ export interface PrismaClient<
|
|
|
3829
3800
|
> {
|
|
3830
3801
|
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
|
|
3831
3802
|
|
|
3832
|
-
$
|
|
3803
|
+
$on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
|
|
3833
3804
|
|
|
3834
3805
|
/**
|
|
3835
3806
|
* Connect with the database
|
|
@@ -3848,8 +3819,6 @@ ${[
|
|
|
3848
3819
|
batchingTransactionDefinition(this.context),
|
|
3849
3820
|
interactiveTransactionDefinition(this.context),
|
|
3850
3821
|
runCommandRawDefinition(this.context),
|
|
3851
|
-
metricDefinition(this.context),
|
|
3852
|
-
this.applyPendingMigrationsDefinition(),
|
|
3853
3822
|
extendsPropertyDefinition()
|
|
3854
3823
|
].filter((d) => d !== null).join("\n").trim()}
|
|
3855
3824
|
|
|
@@ -3874,15 +3843,6 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
|
3874
3843
|
)}
|
|
3875
3844
|
}`;
|
|
3876
3845
|
}
|
|
3877
|
-
applyPendingMigrationsDefinition() {
|
|
3878
|
-
if (this.runtimeName !== "react-native") {
|
|
3879
|
-
return null;
|
|
3880
|
-
}
|
|
3881
|
-
const method3 = ts5.method("$applyPendingMigrations").setReturnType(promise(ts5.voidType)).setDocComment(
|
|
3882
|
-
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.`
|
|
3883
|
-
);
|
|
3884
|
-
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3885
|
-
}
|
|
3886
3846
|
};
|
|
3887
3847
|
|
|
3888
3848
|
// src/TSClient/file-generators/ClassFile.ts
|
|
@@ -3923,14 +3883,12 @@ function clientConfig(context, options) {
|
|
|
3923
3883
|
runtimeBase,
|
|
3924
3884
|
runtimeName,
|
|
3925
3885
|
datasources,
|
|
3926
|
-
copyEngine = true,
|
|
3927
3886
|
target,
|
|
3928
3887
|
activeProvider,
|
|
3929
3888
|
moduleFormat
|
|
3930
3889
|
} = options;
|
|
3931
3890
|
const clientEngineType = (0, import_internals4.getClientEngineType)(generator);
|
|
3932
3891
|
generator.config.engineType = clientEngineType;
|
|
3933
|
-
const inlineSchemaHash = import_node_crypto.default.createHash("sha256").update(Buffer.from(inlineSchema, "utf8").toString("base64")).digest("hex");
|
|
3934
3892
|
const datasourceFilePath = datasources[0].sourceFilePath;
|
|
3935
3893
|
const config = {
|
|
3936
3894
|
generator,
|
|
@@ -3943,8 +3901,6 @@ function clientConfig(context, options) {
|
|
|
3943
3901
|
ciName: import_ci_info.default.name ?? void 0,
|
|
3944
3902
|
inlineDatasources: buildInlineDatasources(datasources),
|
|
3945
3903
|
inlineSchema,
|
|
3946
|
-
inlineSchemaHash,
|
|
3947
|
-
copyEngine,
|
|
3948
3904
|
runtimeDataModel: { models: {}, enums: {}, types: {} },
|
|
3949
3905
|
dirname: ""
|
|
3950
3906
|
};
|
|
@@ -3993,9 +3949,6 @@ function getQueryEngineFilename(engineType, binaryTarget) {
|
|
|
3993
3949
|
if (engineType === import_internals5.ClientEngineType.Library) {
|
|
3994
3950
|
return (0, import_get_platform.getNodeAPIName)(binaryTarget, "fs");
|
|
3995
3951
|
}
|
|
3996
|
-
if (engineType === import_internals5.ClientEngineType.Binary) {
|
|
3997
|
-
return `query-engine-${binaryTarget}`;
|
|
3998
|
-
}
|
|
3999
3952
|
return void 0;
|
|
4000
3953
|
}
|
|
4001
3954
|
function buildNFTAnnotation(fileName, relativeOutdir) {
|
|
@@ -4042,7 +3995,7 @@ function createClientFile(context, options) {
|
|
|
4042
3995
|
)
|
|
4043
3996
|
)
|
|
4044
3997
|
].map((e) => ts7.stringify(e));
|
|
4045
|
-
const binaryTargets = clientEngineType === import_internals6.ClientEngineType.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) :
|
|
3998
|
+
const binaryTargets = clientEngineType === import_internals6.ClientEngineType.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) : [];
|
|
4046
3999
|
const relativeOutdir = import_node_path3.default.relative(process.cwd(), options.outputDir);
|
|
4047
4000
|
return `${jsDocHeader3}
|
|
4048
4001
|
${buildPreamble(options.edge, options.moduleFormat)}
|
|
@@ -4051,7 +4004,7 @@ ${imports.join("\n")}
|
|
|
4051
4004
|
${exports2.join("\n")}
|
|
4052
4005
|
export { Prisma }
|
|
4053
4006
|
|
|
4054
|
-
${buildNFTAnnotations(options.edge
|
|
4007
|
+
${buildNFTAnnotations(options.edge, clientEngineType, binaryTargets, relativeOutdir)}
|
|
4055
4008
|
|
|
4056
4009
|
${modelExports(context).join("\n")}
|
|
4057
4010
|
`;
|
|
@@ -5153,33 +5106,36 @@ function createModelsFile(context, modelsNames) {
|
|
|
5153
5106
|
}
|
|
5154
5107
|
|
|
5155
5108
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
5109
|
+
var import_dmmf2 = require("@prisma/dmmf");
|
|
5156
5110
|
var ts16 = __toESM(require("@prisma/ts-builders"));
|
|
5157
5111
|
|
|
5158
5112
|
// src/TSClient/NullTypes.ts
|
|
5159
5113
|
var nullTypes = `
|
|
5160
5114
|
export const NullTypes = {
|
|
5161
|
-
DbNull: runtime.
|
|
5162
|
-
JsonNull: runtime.
|
|
5163
|
-
AnyNull: runtime.
|
|
5115
|
+
DbNull: runtime.NullTypes.DbNull as (new (secret: never) => typeof runtime.DbNull),
|
|
5116
|
+
JsonNull: runtime.NullTypes.JsonNull as (new (secret: never) => typeof runtime.JsonNull),
|
|
5117
|
+
AnyNull: runtime.NullTypes.AnyNull as (new (secret: never) => typeof runtime.AnyNull),
|
|
5164
5118
|
}
|
|
5165
5119
|
/**
|
|
5166
5120
|
* Helper for filtering JSON entries that have \`null\` on the database (empty on the db)
|
|
5167
5121
|
*
|
|
5168
5122
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5169
5123
|
*/
|
|
5170
|
-
export const DbNull = runtime.
|
|
5124
|
+
export const DbNull = runtime.DbNull
|
|
5125
|
+
|
|
5171
5126
|
/**
|
|
5172
5127
|
* Helper for filtering JSON entries that have JSON \`null\` values (not empty on the db)
|
|
5173
5128
|
*
|
|
5174
5129
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5175
5130
|
*/
|
|
5176
|
-
export const JsonNull = runtime.
|
|
5131
|
+
export const JsonNull = runtime.JsonNull
|
|
5132
|
+
|
|
5177
5133
|
/**
|
|
5178
5134
|
* Helper for filtering JSON entries that are \`Prisma.DbNull\` or \`Prisma.JsonNull\`
|
|
5179
5135
|
*
|
|
5180
5136
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5181
5137
|
*/
|
|
5182
|
-
export const AnyNull = runtime.
|
|
5138
|
+
export const AnyNull = runtime.AnyNull
|
|
5183
5139
|
`;
|
|
5184
5140
|
|
|
5185
5141
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
@@ -5196,7 +5152,9 @@ var jsDocHeader7 = `/*
|
|
|
5196
5152
|
*/
|
|
5197
5153
|
`;
|
|
5198
5154
|
function createPrismaNamespaceBrowserFile(context) {
|
|
5199
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5155
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5156
|
+
(datamodelEnum) => new Enum((0, import_dmmf2.datamodelSchemaEnumToSchemaEnum)(datamodelEnum), false).toTS()
|
|
5157
|
+
);
|
|
5200
5158
|
return `${jsDocHeader7}
|
|
5201
5159
|
${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
|
|
5202
5160
|
|
|
@@ -5210,7 +5168,10 @@ ${nullTypes}
|
|
|
5210
5168
|
${new Enum(
|
|
5211
5169
|
{
|
|
5212
5170
|
name: "ModelName",
|
|
5213
|
-
|
|
5171
|
+
data: context.dmmf.mappings.modelOperations.map((m) => ({
|
|
5172
|
+
key: m.model,
|
|
5173
|
+
value: m.model
|
|
5174
|
+
}))
|
|
5214
5175
|
},
|
|
5215
5176
|
true
|
|
5216
5177
|
).toTS()}
|
|
@@ -5223,6 +5184,7 @@ ${prismaEnums?.join("\n\n")}
|
|
|
5223
5184
|
}
|
|
5224
5185
|
|
|
5225
5186
|
// src/TSClient/file-generators/PrismaNamespaceFile.ts
|
|
5187
|
+
var import_dmmf3 = require("@prisma/dmmf");
|
|
5226
5188
|
var ts19 = __toESM(require("@prisma/ts-builders"));
|
|
5227
5189
|
|
|
5228
5190
|
// src/TSClient/common.ts
|
|
@@ -5270,14 +5232,6 @@ export type Decimal = runtime.Decimal
|
|
|
5270
5232
|
|
|
5271
5233
|
export type DecimalJsLike = runtime.DecimalJsLike
|
|
5272
5234
|
|
|
5273
|
-
/**
|
|
5274
|
-
* Metrics
|
|
5275
|
-
*/
|
|
5276
|
-
export type Metrics = runtime.Metrics
|
|
5277
|
-
export type Metric<T> = runtime.Metric<T>
|
|
5278
|
-
export type MetricHistogram = runtime.MetricHistogram
|
|
5279
|
-
export type MetricHistogramBucket = runtime.MetricHistogramBucket
|
|
5280
|
-
|
|
5281
5235
|
/**
|
|
5282
5236
|
* Extensions
|
|
5283
5237
|
*/
|
|
@@ -5762,7 +5716,9 @@ function createPrismaNamespaceFile(context, options) {
|
|
|
5762
5716
|
ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
|
|
5763
5717
|
ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
|
|
5764
5718
|
].map((i) => ts19.stringify(i));
|
|
5765
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5719
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5720
|
+
(type) => new Enum((0, import_dmmf3.datamodelSchemaEnumToSchemaEnum)(type), true).toTS()
|
|
5721
|
+
);
|
|
5766
5722
|
const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
|
|
5767
5723
|
return `${jsDocHeader8}
|
|
5768
5724
|
${imports.join("\n")}
|
|
@@ -5773,7 +5729,10 @@ ${commonCodeTS(options)}
|
|
|
5773
5729
|
${new Enum(
|
|
5774
5730
|
{
|
|
5775
5731
|
name: "ModelName",
|
|
5776
|
-
|
|
5732
|
+
data: context.dmmf.mappings.modelOperations.map((m) => ({
|
|
5733
|
+
key: m.model,
|
|
5734
|
+
value: m.model
|
|
5735
|
+
}))
|
|
5777
5736
|
},
|
|
5778
5737
|
true
|
|
5779
5738
|
).toTS()}
|
|
@@ -5883,8 +5842,6 @@ function clientExtensionsDefinitions() {
|
|
|
5883
5842
|
function buildClientOptions(context, options) {
|
|
5884
5843
|
const clientOptions = ts19.interfaceDeclaration("PrismaClientOptions").add(
|
|
5885
5844
|
ts19.property("datasources", ts19.namedType("Datasources")).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
|
|
5886
|
-
).add(
|
|
5887
|
-
ts19.property("datasourceUrl", ts19.stringType).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
|
|
5888
5845
|
).add(
|
|
5889
5846
|
ts19.property("errorFormat", ts19.namedType("ErrorFormat")).optional().setDocComment(ts19.docComment('@default "colorless"'))
|
|
5890
5847
|
).add(
|
|
@@ -5924,7 +5881,7 @@ function buildClientOptions(context, options) {
|
|
|
5924
5881
|
timeout ?= 5000
|
|
5925
5882
|
`)
|
|
5926
5883
|
);
|
|
5927
|
-
if (["library", "client", "wasm-compiler-edge"
|
|
5884
|
+
if (["library", "client", "wasm-compiler-edge"].includes(options.runtimeName)) {
|
|
5928
5885
|
clientOptions.add(
|
|
5929
5886
|
ts19.property("adapter", ts19.unionType([ts19.namedType("runtime.SqlDriverAdapterFactory"), ts19.namedType("null")])).optional().setDocComment(
|
|
5930
5887
|
ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
|
|
@@ -5963,7 +5920,7 @@ var GenerateContext = class {
|
|
|
5963
5920
|
dmmf,
|
|
5964
5921
|
genericArgsInfo,
|
|
5965
5922
|
runtimeBase,
|
|
5966
|
-
runtimeImport
|
|
5923
|
+
runtimeImport,
|
|
5967
5924
|
outputFileName,
|
|
5968
5925
|
importFileName,
|
|
5969
5926
|
generator
|
|
@@ -5971,7 +5928,7 @@ var GenerateContext = class {
|
|
|
5971
5928
|
this.dmmf = dmmf;
|
|
5972
5929
|
this.genericArgsInfo = genericArgsInfo;
|
|
5973
5930
|
this.runtimeBase = runtimeBase;
|
|
5974
|
-
this.runtimeImport =
|
|
5931
|
+
this.runtimeImport = runtimeImport;
|
|
5975
5932
|
this.outputFileName = outputFileName;
|
|
5976
5933
|
this.importFileName = importFileName;
|
|
5977
5934
|
this.generator = generator;
|
|
@@ -6292,7 +6249,6 @@ function buildClient({
|
|
|
6292
6249
|
clientVersion,
|
|
6293
6250
|
activeProvider,
|
|
6294
6251
|
postinstall,
|
|
6295
|
-
copyEngine,
|
|
6296
6252
|
envPaths,
|
|
6297
6253
|
typedSql,
|
|
6298
6254
|
target,
|
|
@@ -6318,9 +6274,8 @@ function buildClient({
|
|
|
6318
6274
|
engineVersion,
|
|
6319
6275
|
activeProvider,
|
|
6320
6276
|
postinstall,
|
|
6321
|
-
copyEngine,
|
|
6322
6277
|
datamodel,
|
|
6323
|
-
edge: ["
|
|
6278
|
+
edge: ["wasm-compiler-edge"].includes(runtimeName),
|
|
6324
6279
|
runtimeName,
|
|
6325
6280
|
target,
|
|
6326
6281
|
generatedFileExtension,
|
|
@@ -6328,9 +6283,6 @@ function buildClient({
|
|
|
6328
6283
|
moduleFormat,
|
|
6329
6284
|
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6330
6285
|
};
|
|
6331
|
-
if (runtimeName === "react-native" && !generator.previewFeatures.includes("reactNative")) {
|
|
6332
|
-
throw new Error(`Using the "react-native" runtime requires the "reactNative" preview feature to be enabled.`);
|
|
6333
|
-
}
|
|
6334
6286
|
const client = new TSClient(clientOptions);
|
|
6335
6287
|
let fileMap = client.generateClientFiles();
|
|
6336
6288
|
if (typedSql && typedSql.length > 0) {
|
|
@@ -6386,7 +6338,6 @@ async function generateClient(options) {
|
|
|
6386
6338
|
activeProvider,
|
|
6387
6339
|
postinstall,
|
|
6388
6340
|
envPaths,
|
|
6389
|
-
copyEngine = true,
|
|
6390
6341
|
typedSql,
|
|
6391
6342
|
target,
|
|
6392
6343
|
generatedFileExtension,
|
|
@@ -6409,7 +6360,6 @@ async function generateClient(options) {
|
|
|
6409
6360
|
engineVersion,
|
|
6410
6361
|
activeProvider,
|
|
6411
6362
|
postinstall,
|
|
6412
|
-
copyEngine,
|
|
6413
6363
|
envPaths,
|
|
6414
6364
|
typedSql,
|
|
6415
6365
|
target,
|
|
@@ -6434,8 +6384,8 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
|
|
|
6434
6384
|
await deleteOutputDir(outputDir);
|
|
6435
6385
|
await (0, import_fs_extra.ensureDir)(outputDir);
|
|
6436
6386
|
await writeFileMap(outputDir, fileMap);
|
|
6437
|
-
const enginePath = clientEngineType === import_internals10.ClientEngineType.Library ? binaryPaths.libqueryEngine :
|
|
6438
|
-
if (
|
|
6387
|
+
const enginePath = clientEngineType === import_internals10.ClientEngineType.Library ? binaryPaths.libqueryEngine : void 0;
|
|
6388
|
+
if (enginePath) {
|
|
6439
6389
|
if (process.env.NETLIFY) {
|
|
6440
6390
|
await (0, import_fs_extra.ensureDir)("/tmp/prisma-engines");
|
|
6441
6391
|
}
|
|
@@ -6560,17 +6510,12 @@ function getRuntimeNameForTarget(target, engineType) {
|
|
|
6560
6510
|
return getNodeRuntimeName(engineType);
|
|
6561
6511
|
case "workerd":
|
|
6562
6512
|
case "vercel-edge":
|
|
6563
|
-
return
|
|
6564
|
-
case "react-native":
|
|
6565
|
-
return "react-native";
|
|
6513
|
+
return "wasm-compiler-edge";
|
|
6566
6514
|
default:
|
|
6567
6515
|
(0, import_internals10.assertNever)(target, "Unknown runtime target");
|
|
6568
6516
|
}
|
|
6569
6517
|
}
|
|
6570
6518
|
function getNodeRuntimeName(engineType) {
|
|
6571
|
-
if (engineType === import_internals10.ClientEngineType.Binary) {
|
|
6572
|
-
return "binary";
|
|
6573
|
-
}
|
|
6574
6519
|
if (engineType === import_internals10.ClientEngineType.Library) {
|
|
6575
6520
|
return "library";
|
|
6576
6521
|
}
|
|
@@ -6620,7 +6565,7 @@ var import_get_tsconfig = require("get-tsconfig");
|
|
|
6620
6565
|
var import_ts_pattern2 = require("ts-pattern");
|
|
6621
6566
|
|
|
6622
6567
|
// package.json
|
|
6623
|
-
var version = "6.19.0-integration-
|
|
6568
|
+
var version = "6.19.0-integration-next.12";
|
|
6624
6569
|
|
|
6625
6570
|
// src/module-format.ts
|
|
6626
6571
|
function parseModuleFormat(format) {
|
|
@@ -6663,16 +6608,7 @@ function fromTsConfigModule(module2) {
|
|
|
6663
6608
|
}
|
|
6664
6609
|
|
|
6665
6610
|
// src/runtime-targets.ts
|
|
6666
|
-
var supportedPublicRuntimes = [
|
|
6667
|
-
"nodejs",
|
|
6668
|
-
"deno",
|
|
6669
|
-
"bun",
|
|
6670
|
-
"workerd",
|
|
6671
|
-
"cloudflare",
|
|
6672
|
-
"vercel-edge",
|
|
6673
|
-
"edge-light",
|
|
6674
|
-
"react-native"
|
|
6675
|
-
];
|
|
6611
|
+
var supportedPublicRuntimes = ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light"];
|
|
6676
6612
|
function parseRuntimeTarget(target) {
|
|
6677
6613
|
switch (target.toLowerCase()) {
|
|
6678
6614
|
case "workerd":
|
|
@@ -6686,8 +6622,6 @@ function parseRuntimeTarget(target) {
|
|
|
6686
6622
|
return "nodejs";
|
|
6687
6623
|
case "deno":
|
|
6688
6624
|
return "deno";
|
|
6689
|
-
case "react-native":
|
|
6690
|
-
return "react-native";
|
|
6691
6625
|
default:
|
|
6692
6626
|
throw new Error(
|
|
6693
6627
|
`Unknown target runtime: "${target}". The available options are: ${supportedPublicRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
|
|
@@ -6721,7 +6655,7 @@ function getOutputPath(config) {
|
|
|
6721
6655
|
var PrismaClientTsGenerator = class {
|
|
6722
6656
|
name = "prisma-client-ts";
|
|
6723
6657
|
getManifest(config) {
|
|
6724
|
-
const requiresEngines = (0, import_ts_pattern2.match)((0, import_internals11.getClientEngineType)(config)).with(import_internals11.ClientEngineType.Library, () => ["libqueryEngine"]).with(import_internals11.ClientEngineType.
|
|
6658
|
+
const requiresEngines = (0, import_ts_pattern2.match)((0, import_internals11.getClientEngineType)(config)).with(import_internals11.ClientEngineType.Library, () => ["libqueryEngine"]).with(import_internals11.ClientEngineType.Client, () => []).exhaustive();
|
|
6725
6659
|
debug2("requiresEngines", requiresEngines);
|
|
6726
6660
|
return Promise.resolve({
|
|
6727
6661
|
defaultOutput: getOutputPath(config),
|
|
@@ -6761,7 +6695,6 @@ var PrismaClientTsGenerator = class {
|
|
|
6761
6695
|
clientVersion: version,
|
|
6762
6696
|
activeProvider: options.datasources[0]?.activeProvider,
|
|
6763
6697
|
postinstall: options.postinstall,
|
|
6764
|
-
copyEngine: !options.noEngine,
|
|
6765
6698
|
typedSql: options.typedSql,
|
|
6766
6699
|
target,
|
|
6767
6700
|
generatedFileExtension,
|
package/dist/index.mjs
CHANGED
|
@@ -2381,7 +2381,7 @@ var Enum = class {
|
|
|
2381
2381
|
toTS() {
|
|
2382
2382
|
const { type } = this;
|
|
2383
2383
|
const enumVariants = `{
|
|
2384
|
-
${indent(type.
|
|
2384
|
+
${indent(type.data.map((v) => `${v.key}: ${this.getValue(v.value)}`).join(",\n"), TAB_SIZE)}
|
|
2385
2385
|
} as const`;
|
|
2386
2386
|
const enumBody = this.isStrictEnum() ? `runtime.makeStrictEnum(${enumVariants})` : enumVariants;
|
|
2387
2387
|
return `export const ${type.name} = ${enumBody}
|
|
@@ -2935,7 +2935,6 @@ ${modelExports(context).join("\n")}
|
|
|
2935
2935
|
}
|
|
2936
2936
|
|
|
2937
2937
|
// src/TSClient/file-generators/ClassFile.ts
|
|
2938
|
-
import crypto from "node:crypto";
|
|
2939
2938
|
import path2 from "node:path";
|
|
2940
2939
|
import { getClientEngineType as getClientEngineType2, pathToPosix } from "@prisma/internals";
|
|
2941
2940
|
import * as ts6 from "@prisma/ts-builders";
|
|
@@ -3455,7 +3454,7 @@ function escapeJson(str) {
|
|
|
3455
3454
|
function buildRuntimeDataModel(datamodel, runtimeName) {
|
|
3456
3455
|
const runtimeDataModel = dmmfToRuntimeDataModel(datamodel);
|
|
3457
3456
|
let prunedDataModel;
|
|
3458
|
-
if (runtimeName === "wasm-
|
|
3457
|
+
if (runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
|
|
3459
3458
|
prunedDataModel = pruneRuntimeDataModel(runtimeDataModel);
|
|
3460
3459
|
} else {
|
|
3461
3460
|
prunedDataModel = runtimeDataModel;
|
|
@@ -3487,7 +3486,7 @@ import { Debug } from "@prisma/debug";
|
|
|
3487
3486
|
import { match } from "ts-pattern";
|
|
3488
3487
|
var debug = Debug("prisma:client-generator-ts:wasm");
|
|
3489
3488
|
function usesEdgeWasmRuntime(component, runtimeName) {
|
|
3490
|
-
return runtimeName === "wasm-
|
|
3489
|
+
return runtimeName === "wasm-compiler-edge" && component === "compiler";
|
|
3491
3490
|
}
|
|
3492
3491
|
function buildGetWasmModule({
|
|
3493
3492
|
component,
|
|
@@ -3583,9 +3582,6 @@ import indent3 from "indent-string";
|
|
|
3583
3582
|
|
|
3584
3583
|
// src/utils/runtimeImport.ts
|
|
3585
3584
|
import * as ts4 from "@prisma/ts-builders";
|
|
3586
|
-
function runtimeImport(name) {
|
|
3587
|
-
return name;
|
|
3588
|
-
}
|
|
3589
3585
|
function runtimeImportedType(name) {
|
|
3590
3586
|
return ts4.namedType(`runtime.${name}`);
|
|
3591
3587
|
}
|
|
@@ -3729,24 +3725,6 @@ function queryRawTypedDefinition(context) {
|
|
|
3729
3725
|
).setReturnType(prismaPromise(ts5.array(param.toArgument())));
|
|
3730
3726
|
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3731
3727
|
}
|
|
3732
|
-
function metricDefinition(context) {
|
|
3733
|
-
if (!context.isPreviewFeatureOn("metrics")) {
|
|
3734
|
-
return "";
|
|
3735
|
-
}
|
|
3736
|
-
const property13 = ts5.property("$metrics", ts5.namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
|
|
3737
|
-
ts5.docComment`
|
|
3738
|
-
Gives access to the client metrics in json or prometheus format.
|
|
3739
|
-
|
|
3740
|
-
@example
|
|
3741
|
-
\`\`\`
|
|
3742
|
-
const metrics = await prisma.$metrics.json()
|
|
3743
|
-
// or
|
|
3744
|
-
const metrics = await prisma.$metrics.prometheus()
|
|
3745
|
-
\`\`\`
|
|
3746
|
-
`
|
|
3747
|
-
).readonly();
|
|
3748
|
-
return ts5.stringify(property13, { indentLevel: 1, newLine: "leading" });
|
|
3749
|
-
}
|
|
3750
3728
|
function runCommandRawDefinition(context) {
|
|
3751
3729
|
if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
|
|
3752
3730
|
return "";
|
|
@@ -3766,13 +3744,6 @@ function runCommandRawDefinition(context) {
|
|
|
3766
3744
|
`);
|
|
3767
3745
|
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3768
3746
|
}
|
|
3769
|
-
function eventRegistrationMethodDeclaration(runtimeName) {
|
|
3770
|
-
if (runtimeName === "binary") {
|
|
3771
|
-
return `$on<V extends (LogOpts | 'beforeExit')>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : V extends 'beforeExit' ? () => runtime.Types.Utils.JsPromise<void> : Prisma.LogEvent) => void): PrismaClient;`;
|
|
3772
|
-
} else {
|
|
3773
|
-
return `$on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;`;
|
|
3774
|
-
}
|
|
3775
|
-
}
|
|
3776
3747
|
function getPrismaClientClassDocComment({ dmmf }) {
|
|
3777
3748
|
let example;
|
|
3778
3749
|
if (dmmf.mappings.modelOperations.length) {
|
|
@@ -3828,7 +3799,7 @@ export interface PrismaClient<
|
|
|
3828
3799
|
> {
|
|
3829
3800
|
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
|
|
3830
3801
|
|
|
3831
|
-
$
|
|
3802
|
+
$on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
|
|
3832
3803
|
|
|
3833
3804
|
/**
|
|
3834
3805
|
* Connect with the database
|
|
@@ -3847,8 +3818,6 @@ ${[
|
|
|
3847
3818
|
batchingTransactionDefinition(this.context),
|
|
3848
3819
|
interactiveTransactionDefinition(this.context),
|
|
3849
3820
|
runCommandRawDefinition(this.context),
|
|
3850
|
-
metricDefinition(this.context),
|
|
3851
|
-
this.applyPendingMigrationsDefinition(),
|
|
3852
3821
|
extendsPropertyDefinition()
|
|
3853
3822
|
].filter((d) => d !== null).join("\n").trim()}
|
|
3854
3823
|
|
|
@@ -3873,15 +3842,6 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
|
3873
3842
|
)}
|
|
3874
3843
|
}`;
|
|
3875
3844
|
}
|
|
3876
|
-
applyPendingMigrationsDefinition() {
|
|
3877
|
-
if (this.runtimeName !== "react-native") {
|
|
3878
|
-
return null;
|
|
3879
|
-
}
|
|
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.`
|
|
3882
|
-
);
|
|
3883
|
-
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3884
|
-
}
|
|
3885
3845
|
};
|
|
3886
3846
|
|
|
3887
3847
|
// src/TSClient/file-generators/ClassFile.ts
|
|
@@ -3922,14 +3882,12 @@ function clientConfig(context, options) {
|
|
|
3922
3882
|
runtimeBase,
|
|
3923
3883
|
runtimeName,
|
|
3924
3884
|
datasources,
|
|
3925
|
-
copyEngine = true,
|
|
3926
3885
|
target,
|
|
3927
3886
|
activeProvider,
|
|
3928
3887
|
moduleFormat
|
|
3929
3888
|
} = options;
|
|
3930
3889
|
const clientEngineType = getClientEngineType2(generator);
|
|
3931
3890
|
generator.config.engineType = clientEngineType;
|
|
3932
|
-
const inlineSchemaHash = crypto.createHash("sha256").update(Buffer.from(inlineSchema, "utf8").toString("base64")).digest("hex");
|
|
3933
3891
|
const datasourceFilePath = datasources[0].sourceFilePath;
|
|
3934
3892
|
const config = {
|
|
3935
3893
|
generator,
|
|
@@ -3942,8 +3900,6 @@ function clientConfig(context, options) {
|
|
|
3942
3900
|
ciName: ciInfo.name ?? void 0,
|
|
3943
3901
|
inlineDatasources: buildInlineDatasources(datasources),
|
|
3944
3902
|
inlineSchema,
|
|
3945
|
-
inlineSchemaHash,
|
|
3946
|
-
copyEngine,
|
|
3947
3903
|
runtimeDataModel: { models: {}, enums: {}, types: {} },
|
|
3948
3904
|
dirname: ""
|
|
3949
3905
|
};
|
|
@@ -3992,9 +3948,6 @@ function getQueryEngineFilename(engineType, binaryTarget) {
|
|
|
3992
3948
|
if (engineType === ClientEngineType.Library) {
|
|
3993
3949
|
return getNodeAPIName(binaryTarget, "fs");
|
|
3994
3950
|
}
|
|
3995
|
-
if (engineType === ClientEngineType.Binary) {
|
|
3996
|
-
return `query-engine-${binaryTarget}`;
|
|
3997
|
-
}
|
|
3998
3951
|
return void 0;
|
|
3999
3952
|
}
|
|
4000
3953
|
function buildNFTAnnotation(fileName, relativeOutdir) {
|
|
@@ -4041,7 +3994,7 @@ function createClientFile(context, options) {
|
|
|
4041
3994
|
)
|
|
4042
3995
|
)
|
|
4043
3996
|
].map((e) => ts7.stringify(e));
|
|
4044
|
-
const binaryTargets = clientEngineType === ClientEngineType2.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) :
|
|
3997
|
+
const binaryTargets = clientEngineType === ClientEngineType2.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) : [];
|
|
4045
3998
|
const relativeOutdir = path4.relative(process.cwd(), options.outputDir);
|
|
4046
3999
|
return `${jsDocHeader3}
|
|
4047
4000
|
${buildPreamble(options.edge, options.moduleFormat)}
|
|
@@ -4050,7 +4003,7 @@ ${imports.join("\n")}
|
|
|
4050
4003
|
${exports.join("\n")}
|
|
4051
4004
|
export { Prisma }
|
|
4052
4005
|
|
|
4053
|
-
${buildNFTAnnotations(options.edge
|
|
4006
|
+
${buildNFTAnnotations(options.edge, clientEngineType, binaryTargets, relativeOutdir)}
|
|
4054
4007
|
|
|
4055
4008
|
${modelExports(context).join("\n")}
|
|
4056
4009
|
`;
|
|
@@ -5152,33 +5105,36 @@ function createModelsFile(context, modelsNames) {
|
|
|
5152
5105
|
}
|
|
5153
5106
|
|
|
5154
5107
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
5108
|
+
import { datamodelSchemaEnumToSchemaEnum } from "@prisma/dmmf";
|
|
5155
5109
|
import * as ts16 from "@prisma/ts-builders";
|
|
5156
5110
|
|
|
5157
5111
|
// src/TSClient/NullTypes.ts
|
|
5158
5112
|
var nullTypes = `
|
|
5159
5113
|
export const NullTypes = {
|
|
5160
|
-
DbNull: runtime.
|
|
5161
|
-
JsonNull: runtime.
|
|
5162
|
-
AnyNull: runtime.
|
|
5114
|
+
DbNull: runtime.NullTypes.DbNull as (new (secret: never) => typeof runtime.DbNull),
|
|
5115
|
+
JsonNull: runtime.NullTypes.JsonNull as (new (secret: never) => typeof runtime.JsonNull),
|
|
5116
|
+
AnyNull: runtime.NullTypes.AnyNull as (new (secret: never) => typeof runtime.AnyNull),
|
|
5163
5117
|
}
|
|
5164
5118
|
/**
|
|
5165
5119
|
* Helper for filtering JSON entries that have \`null\` on the database (empty on the db)
|
|
5166
5120
|
*
|
|
5167
5121
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5168
5122
|
*/
|
|
5169
|
-
export const DbNull = runtime.
|
|
5123
|
+
export const DbNull = runtime.DbNull
|
|
5124
|
+
|
|
5170
5125
|
/**
|
|
5171
5126
|
* Helper for filtering JSON entries that have JSON \`null\` values (not empty on the db)
|
|
5172
5127
|
*
|
|
5173
5128
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5174
5129
|
*/
|
|
5175
|
-
export const JsonNull = runtime.
|
|
5130
|
+
export const JsonNull = runtime.JsonNull
|
|
5131
|
+
|
|
5176
5132
|
/**
|
|
5177
5133
|
* Helper for filtering JSON entries that are \`Prisma.DbNull\` or \`Prisma.JsonNull\`
|
|
5178
5134
|
*
|
|
5179
5135
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5180
5136
|
*/
|
|
5181
|
-
export const AnyNull = runtime.
|
|
5137
|
+
export const AnyNull = runtime.AnyNull
|
|
5182
5138
|
`;
|
|
5183
5139
|
|
|
5184
5140
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
@@ -5195,7 +5151,9 @@ var jsDocHeader7 = `/*
|
|
|
5195
5151
|
*/
|
|
5196
5152
|
`;
|
|
5197
5153
|
function createPrismaNamespaceBrowserFile(context) {
|
|
5198
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5154
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5155
|
+
(datamodelEnum) => new Enum(datamodelSchemaEnumToSchemaEnum(datamodelEnum), false).toTS()
|
|
5156
|
+
);
|
|
5199
5157
|
return `${jsDocHeader7}
|
|
5200
5158
|
${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
|
|
5201
5159
|
|
|
@@ -5209,7 +5167,10 @@ ${nullTypes}
|
|
|
5209
5167
|
${new Enum(
|
|
5210
5168
|
{
|
|
5211
5169
|
name: "ModelName",
|
|
5212
|
-
|
|
5170
|
+
data: context.dmmf.mappings.modelOperations.map((m) => ({
|
|
5171
|
+
key: m.model,
|
|
5172
|
+
value: m.model
|
|
5173
|
+
}))
|
|
5213
5174
|
},
|
|
5214
5175
|
true
|
|
5215
5176
|
).toTS()}
|
|
@@ -5222,6 +5183,7 @@ ${prismaEnums?.join("\n\n")}
|
|
|
5222
5183
|
}
|
|
5223
5184
|
|
|
5224
5185
|
// src/TSClient/file-generators/PrismaNamespaceFile.ts
|
|
5186
|
+
import { datamodelSchemaEnumToSchemaEnum as datamodelSchemaEnumToSchemaEnum2 } from "@prisma/dmmf";
|
|
5225
5187
|
import * as ts19 from "@prisma/ts-builders";
|
|
5226
5188
|
|
|
5227
5189
|
// src/TSClient/common.ts
|
|
@@ -5269,14 +5231,6 @@ export type Decimal = runtime.Decimal
|
|
|
5269
5231
|
|
|
5270
5232
|
export type DecimalJsLike = runtime.DecimalJsLike
|
|
5271
5233
|
|
|
5272
|
-
/**
|
|
5273
|
-
* Metrics
|
|
5274
|
-
*/
|
|
5275
|
-
export type Metrics = runtime.Metrics
|
|
5276
|
-
export type Metric<T> = runtime.Metric<T>
|
|
5277
|
-
export type MetricHistogram = runtime.MetricHistogram
|
|
5278
|
-
export type MetricHistogramBucket = runtime.MetricHistogramBucket
|
|
5279
|
-
|
|
5280
5234
|
/**
|
|
5281
5235
|
* Extensions
|
|
5282
5236
|
*/
|
|
@@ -5761,7 +5715,9 @@ function createPrismaNamespaceFile(context, options) {
|
|
|
5761
5715
|
ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
|
|
5762
5716
|
ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
|
|
5763
5717
|
].map((i) => ts19.stringify(i));
|
|
5764
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5718
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5719
|
+
(type) => new Enum(datamodelSchemaEnumToSchemaEnum2(type), true).toTS()
|
|
5720
|
+
);
|
|
5765
5721
|
const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
|
|
5766
5722
|
return `${jsDocHeader8}
|
|
5767
5723
|
${imports.join("\n")}
|
|
@@ -5772,7 +5728,10 @@ ${commonCodeTS(options)}
|
|
|
5772
5728
|
${new Enum(
|
|
5773
5729
|
{
|
|
5774
5730
|
name: "ModelName",
|
|
5775
|
-
|
|
5731
|
+
data: context.dmmf.mappings.modelOperations.map((m) => ({
|
|
5732
|
+
key: m.model,
|
|
5733
|
+
value: m.model
|
|
5734
|
+
}))
|
|
5776
5735
|
},
|
|
5777
5736
|
true
|
|
5778
5737
|
).toTS()}
|
|
@@ -5882,8 +5841,6 @@ function clientExtensionsDefinitions() {
|
|
|
5882
5841
|
function buildClientOptions(context, options) {
|
|
5883
5842
|
const clientOptions = ts19.interfaceDeclaration("PrismaClientOptions").add(
|
|
5884
5843
|
ts19.property("datasources", ts19.namedType("Datasources")).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
|
|
5885
|
-
).add(
|
|
5886
|
-
ts19.property("datasourceUrl", ts19.stringType).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
|
|
5887
5844
|
).add(
|
|
5888
5845
|
ts19.property("errorFormat", ts19.namedType("ErrorFormat")).optional().setDocComment(ts19.docComment('@default "colorless"'))
|
|
5889
5846
|
).add(
|
|
@@ -5923,7 +5880,7 @@ function buildClientOptions(context, options) {
|
|
|
5923
5880
|
timeout ?= 5000
|
|
5924
5881
|
`)
|
|
5925
5882
|
);
|
|
5926
|
-
if (["library", "client", "wasm-compiler-edge"
|
|
5883
|
+
if (["library", "client", "wasm-compiler-edge"].includes(options.runtimeName)) {
|
|
5927
5884
|
clientOptions.add(
|
|
5928
5885
|
ts19.property("adapter", ts19.unionType([ts19.namedType("runtime.SqlDriverAdapterFactory"), ts19.namedType("null")])).optional().setDocComment(
|
|
5929
5886
|
ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
|
|
@@ -5962,7 +5919,7 @@ var GenerateContext = class {
|
|
|
5962
5919
|
dmmf,
|
|
5963
5920
|
genericArgsInfo,
|
|
5964
5921
|
runtimeBase,
|
|
5965
|
-
runtimeImport
|
|
5922
|
+
runtimeImport,
|
|
5966
5923
|
outputFileName,
|
|
5967
5924
|
importFileName,
|
|
5968
5925
|
generator
|
|
@@ -5970,7 +5927,7 @@ var GenerateContext = class {
|
|
|
5970
5927
|
this.dmmf = dmmf;
|
|
5971
5928
|
this.genericArgsInfo = genericArgsInfo;
|
|
5972
5929
|
this.runtimeBase = runtimeBase;
|
|
5973
|
-
this.runtimeImport =
|
|
5930
|
+
this.runtimeImport = runtimeImport;
|
|
5974
5931
|
this.outputFileName = outputFileName;
|
|
5975
5932
|
this.importFileName = importFileName;
|
|
5976
5933
|
this.generator = generator;
|
|
@@ -6291,7 +6248,6 @@ function buildClient({
|
|
|
6291
6248
|
clientVersion,
|
|
6292
6249
|
activeProvider,
|
|
6293
6250
|
postinstall,
|
|
6294
|
-
copyEngine,
|
|
6295
6251
|
envPaths,
|
|
6296
6252
|
typedSql,
|
|
6297
6253
|
target,
|
|
@@ -6317,9 +6273,8 @@ function buildClient({
|
|
|
6317
6273
|
engineVersion,
|
|
6318
6274
|
activeProvider,
|
|
6319
6275
|
postinstall,
|
|
6320
|
-
copyEngine,
|
|
6321
6276
|
datamodel,
|
|
6322
|
-
edge: ["
|
|
6277
|
+
edge: ["wasm-compiler-edge"].includes(runtimeName),
|
|
6323
6278
|
runtimeName,
|
|
6324
6279
|
target,
|
|
6325
6280
|
generatedFileExtension,
|
|
@@ -6327,9 +6282,6 @@ function buildClient({
|
|
|
6327
6282
|
moduleFormat,
|
|
6328
6283
|
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6329
6284
|
};
|
|
6330
|
-
if (runtimeName === "react-native" && !generator.previewFeatures.includes("reactNative")) {
|
|
6331
|
-
throw new Error(`Using the "react-native" runtime requires the "reactNative" preview feature to be enabled.`);
|
|
6332
|
-
}
|
|
6333
6285
|
const client = new TSClient(clientOptions);
|
|
6334
6286
|
let fileMap = client.generateClientFiles();
|
|
6335
6287
|
if (typedSql && typedSql.length > 0) {
|
|
@@ -6385,7 +6337,6 @@ async function generateClient(options) {
|
|
|
6385
6337
|
activeProvider,
|
|
6386
6338
|
postinstall,
|
|
6387
6339
|
envPaths,
|
|
6388
|
-
copyEngine = true,
|
|
6389
6340
|
typedSql,
|
|
6390
6341
|
target,
|
|
6391
6342
|
generatedFileExtension,
|
|
@@ -6408,7 +6359,6 @@ async function generateClient(options) {
|
|
|
6408
6359
|
engineVersion,
|
|
6409
6360
|
activeProvider,
|
|
6410
6361
|
postinstall,
|
|
6411
|
-
copyEngine,
|
|
6412
6362
|
envPaths,
|
|
6413
6363
|
typedSql,
|
|
6414
6364
|
target,
|
|
@@ -6433,8 +6383,8 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
|
|
|
6433
6383
|
await deleteOutputDir(outputDir);
|
|
6434
6384
|
await (0, import_fs_extra.ensureDir)(outputDir);
|
|
6435
6385
|
await writeFileMap(outputDir, fileMap);
|
|
6436
|
-
const enginePath = clientEngineType === ClientEngineType3.Library ? binaryPaths.libqueryEngine :
|
|
6437
|
-
if (
|
|
6386
|
+
const enginePath = clientEngineType === ClientEngineType3.Library ? binaryPaths.libqueryEngine : void 0;
|
|
6387
|
+
if (enginePath) {
|
|
6438
6388
|
if (process.env.NETLIFY) {
|
|
6439
6389
|
await (0, import_fs_extra.ensureDir)("/tmp/prisma-engines");
|
|
6440
6390
|
}
|
|
@@ -6559,17 +6509,12 @@ function getRuntimeNameForTarget(target, engineType) {
|
|
|
6559
6509
|
return getNodeRuntimeName(engineType);
|
|
6560
6510
|
case "workerd":
|
|
6561
6511
|
case "vercel-edge":
|
|
6562
|
-
return
|
|
6563
|
-
case "react-native":
|
|
6564
|
-
return "react-native";
|
|
6512
|
+
return "wasm-compiler-edge";
|
|
6565
6513
|
default:
|
|
6566
6514
|
assertNever3(target, "Unknown runtime target");
|
|
6567
6515
|
}
|
|
6568
6516
|
}
|
|
6569
6517
|
function getNodeRuntimeName(engineType) {
|
|
6570
|
-
if (engineType === ClientEngineType3.Binary) {
|
|
6571
|
-
return "binary";
|
|
6572
|
-
}
|
|
6573
6518
|
if (engineType === ClientEngineType3.Library) {
|
|
6574
6519
|
return "library";
|
|
6575
6520
|
}
|
|
@@ -6619,7 +6564,7 @@ import { getTsconfig } from "get-tsconfig";
|
|
|
6619
6564
|
import { match as match2 } from "ts-pattern";
|
|
6620
6565
|
|
|
6621
6566
|
// package.json
|
|
6622
|
-
var version = "6.19.0-integration-
|
|
6567
|
+
var version = "6.19.0-integration-next.12";
|
|
6623
6568
|
|
|
6624
6569
|
// src/module-format.ts
|
|
6625
6570
|
function parseModuleFormat(format) {
|
|
@@ -6662,16 +6607,7 @@ function fromTsConfigModule(module) {
|
|
|
6662
6607
|
}
|
|
6663
6608
|
|
|
6664
6609
|
// src/runtime-targets.ts
|
|
6665
|
-
var supportedPublicRuntimes = [
|
|
6666
|
-
"nodejs",
|
|
6667
|
-
"deno",
|
|
6668
|
-
"bun",
|
|
6669
|
-
"workerd",
|
|
6670
|
-
"cloudflare",
|
|
6671
|
-
"vercel-edge",
|
|
6672
|
-
"edge-light",
|
|
6673
|
-
"react-native"
|
|
6674
|
-
];
|
|
6610
|
+
var supportedPublicRuntimes = ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light"];
|
|
6675
6611
|
function parseRuntimeTarget(target) {
|
|
6676
6612
|
switch (target.toLowerCase()) {
|
|
6677
6613
|
case "workerd":
|
|
@@ -6685,8 +6621,6 @@ function parseRuntimeTarget(target) {
|
|
|
6685
6621
|
return "nodejs";
|
|
6686
6622
|
case "deno":
|
|
6687
6623
|
return "deno";
|
|
6688
|
-
case "react-native":
|
|
6689
|
-
return "react-native";
|
|
6690
6624
|
default:
|
|
6691
6625
|
throw new Error(
|
|
6692
6626
|
`Unknown target runtime: "${target}". The available options are: ${supportedPublicRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
|
|
@@ -6720,7 +6654,7 @@ function getOutputPath(config) {
|
|
|
6720
6654
|
var PrismaClientTsGenerator = class {
|
|
6721
6655
|
name = "prisma-client-ts";
|
|
6722
6656
|
getManifest(config) {
|
|
6723
|
-
const requiresEngines = match2(getClientEngineType5(config)).with(ClientEngineType4.Library, () => ["libqueryEngine"]).with(ClientEngineType4.
|
|
6657
|
+
const requiresEngines = match2(getClientEngineType5(config)).with(ClientEngineType4.Library, () => ["libqueryEngine"]).with(ClientEngineType4.Client, () => []).exhaustive();
|
|
6724
6658
|
debug2("requiresEngines", requiresEngines);
|
|
6725
6659
|
return Promise.resolve({
|
|
6726
6660
|
defaultOutput: getOutputPath(config),
|
|
@@ -6760,7 +6694,6 @@ var PrismaClientTsGenerator = class {
|
|
|
6760
6694
|
clientVersion: version,
|
|
6761
6695
|
activeProvider: options.datasources[0]?.activeProvider,
|
|
6762
6696
|
postinstall: options.postinstall,
|
|
6763
|
-
copyEngine: !options.noEngine,
|
|
6764
6697
|
typedSql: options.typedSql,
|
|
6765
6698
|
target,
|
|
6766
6699
|
generatedFileExtension,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"
|
|
2
|
-
declare const supportedPublicRuntimes: readonly ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light"
|
|
1
|
+
export declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"];
|
|
2
|
+
declare const supportedPublicRuntimes: readonly ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light"];
|
|
3
3
|
/**
|
|
4
4
|
* The user-facing `runtime` attribute for the `prisma-client` generator.
|
|
5
5
|
*/
|
|
@@ -8,5 +8,5 @@ export type RuntimeTarget = (typeof supportedPublicRuntimes)[number];
|
|
|
8
8
|
* The internal representation of the `runtime` attribute for the `prisma-client` generator.
|
|
9
9
|
*/
|
|
10
10
|
export type RuntimeTargetInternal = (typeof supportedInternalRuntimes)[number];
|
|
11
|
-
export declare function parseRuntimeTargetFromUnknown(target: unknown): "nodejs" | "workerd" | "vercel-edge" | "deno"
|
|
11
|
+
export declare function parseRuntimeTargetFromUnknown(target: unknown): "nodejs" | "workerd" | "vercel-edge" | "deno";
|
|
12
12
|
export {};
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import * as ts from '@prisma/ts-builders';
|
|
2
2
|
type RuntimeExport = keyof typeof import('@prisma/client/runtime/library') & string;
|
|
3
|
-
/**
|
|
4
|
-
* Helps to ensure that when we want to refer to a type or value, imported from runtime Module
|
|
5
|
-
* we are referring to the name, that is actually exported
|
|
6
|
-
*
|
|
7
|
-
* @param name imported name
|
|
8
|
-
*/
|
|
9
|
-
export declare function runtimeImport(name: RuntimeExport): string;
|
|
10
3
|
export declare function runtimeImportedType(name: RuntimeExport): ts.NamedType;
|
|
11
4
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-generator-ts",
|
|
3
|
-
"version": "6.19.0-integration-
|
|
3
|
+
"version": "6.19.0-integration-next.12",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@antfu/ni": "0.21.12",
|
|
28
|
-
"@prisma/engines-version": "6.19.0-
|
|
28
|
+
"@prisma/engines-version": "6.19.0-29.next-ac95b5893b3c05bf39a2431fc1a748dd46152ab4",
|
|
29
29
|
"ci-info": "4.2.0",
|
|
30
30
|
"fast-glob": "3.3.3",
|
|
31
31
|
"get-tsconfig": "4.10.0",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"package-up": "5.0.0",
|
|
35
35
|
"pluralize": "8.0.0",
|
|
36
36
|
"ts-pattern": "5.6.2",
|
|
37
|
-
"@prisma/
|
|
38
|
-
"@prisma/
|
|
39
|
-
"@prisma/
|
|
40
|
-
"@prisma/
|
|
41
|
-
"@prisma/
|
|
42
|
-
"@prisma/get-platform": "6.19.0-integration-
|
|
43
|
-
"@prisma/internals": "6.19.0-integration-
|
|
44
|
-
"@prisma/ts-builders": "6.19.0-integration-
|
|
37
|
+
"@prisma/client-common": "6.19.0-integration-next.12",
|
|
38
|
+
"@prisma/debug": "6.19.0-integration-next.12",
|
|
39
|
+
"@prisma/dmmf": "6.19.0-integration-next.12",
|
|
40
|
+
"@prisma/fetch-engine": "6.19.0-integration-next.12",
|
|
41
|
+
"@prisma/generator": "6.19.0-integration-next.12",
|
|
42
|
+
"@prisma/get-platform": "6.19.0-integration-next.12",
|
|
43
|
+
"@prisma/internals": "6.19.0-integration-next.12",
|
|
44
|
+
"@prisma/ts-builders": "6.19.0-integration-next.12"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/pluralize": "0.0.33",
|