@prisma/client-generator-ts 6.19.0-integration-next.10 → 6.19.0-integration-engines-6-19-0-27-feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2.1
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 +1 -0
- package/dist/TSClient/TSClient.d.ts +1 -1
- package/dist/generateClient.d.ts +3 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +75 -38
- package/dist/index.mjs +75 -38
- package/dist/runtime-targets.d.ts +3 -3
- 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.objectEnumValues.classes.DbNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.DbNull),\n JsonNull: runtime.objectEnumValues.classes.JsonNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.JsonNull),\n AnyNull: runtime.objectEnumValues.classes.AnyNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.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.objectEnumValues.instances.DbNull\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.objectEnumValues.instances.JsonNull\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.objectEnumValues.instances.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 = 'library' | 'wasm-compiler-edge' | 'client' | (string & {});
|
|
6
|
+
export type RuntimeName = 'binary' | 'library' | 'wasm-engine-edge' | 'wasm-compiler-edge' | 'edge' | 'react-native' | '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,6 +26,8 @@ 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;
|
|
29
31
|
typedSql?: SqlQueryOutput[];
|
|
30
32
|
target: RuntimeTargetInternal;
|
|
31
33
|
generatedFileExtension: GeneratedFileExtension;
|
|
@@ -41,5 +43,5 @@ export interface BuildClientResult {
|
|
|
41
43
|
fileMap: FileMap;
|
|
42
44
|
prismaClientDmmf: DMMF.Document;
|
|
43
45
|
}
|
|
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;
|
|
46
|
+
export declare function buildClient({ schemaPath, runtimeBase, datamodel, binaryPaths, outputDir, generator, dmmf, datasources, engineVersion, clientVersion, activeProvider, postinstall, copyEngine, envPaths, typedSql, target, generatedFileExtension, importFileExtension, moduleFormat, tsNoCheckPreamble, }: O.Required<GenerateClientOptions, 'runtimeBase'>): BuildClientResult;
|
|
45
47
|
export declare function generateClient(options: GenerateClientOptions): Promise<void>;
|
package/dist/index.d.mts
CHANGED
|
@@ -40,6 +40,8 @@ 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;
|
|
43
45
|
typedSql?: SqlQueryOutput[];
|
|
44
46
|
target: RuntimeTargetInternal;
|
|
45
47
|
generatedFileExtension: GeneratedFileExtension;
|
|
@@ -70,6 +72,6 @@ export declare class PrismaClientTsGenerator implements Generator_2 {
|
|
|
70
72
|
*/
|
|
71
73
|
declare type RuntimeTargetInternal = (typeof supportedInternalRuntimes)[number];
|
|
72
74
|
|
|
73
|
-
declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"];
|
|
75
|
+
declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno", "react-native"];
|
|
74
76
|
|
|
75
77
|
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ 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;
|
|
43
45
|
typedSql?: SqlQueryOutput[];
|
|
44
46
|
target: RuntimeTargetInternal;
|
|
45
47
|
generatedFileExtension: GeneratedFileExtension;
|
|
@@ -70,6 +72,6 @@ export declare class PrismaClientTsGenerator implements Generator_2 {
|
|
|
70
72
|
*/
|
|
71
73
|
declare type RuntimeTargetInternal = (typeof supportedInternalRuntimes)[number];
|
|
72
74
|
|
|
73
|
-
declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"];
|
|
75
|
+
declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno", "react-native"];
|
|
74
76
|
|
|
75
77
|
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.values.map((v) => `${v}: ${this.getValue(v)}`).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,6 +2939,7 @@ ${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"));
|
|
2942
2943
|
var import_node_path2 = __toESM(require("node:path"));
|
|
2943
2944
|
var import_internals4 = require("@prisma/internals");
|
|
2944
2945
|
var ts6 = __toESM(require("@prisma/ts-builders"));
|
|
@@ -3455,7 +3456,7 @@ function escapeJson(str) {
|
|
|
3455
3456
|
function buildRuntimeDataModel(datamodel, runtimeName) {
|
|
3456
3457
|
const runtimeDataModel = (0, import_client_common10.dmmfToRuntimeDataModel)(datamodel);
|
|
3457
3458
|
let prunedDataModel;
|
|
3458
|
-
if (runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
|
|
3459
|
+
if (runtimeName === "wasm-engine-edge" || runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
|
|
3459
3460
|
prunedDataModel = (0, import_client_common10.pruneRuntimeDataModel)(runtimeDataModel);
|
|
3460
3461
|
} else {
|
|
3461
3462
|
prunedDataModel = runtimeDataModel;
|
|
@@ -3487,7 +3488,7 @@ var import_debug = require("@prisma/debug");
|
|
|
3487
3488
|
var import_ts_pattern = require("ts-pattern");
|
|
3488
3489
|
var debug = (0, import_debug.Debug)("prisma:client-generator-ts:wasm");
|
|
3489
3490
|
function usesEdgeWasmRuntime(component, runtimeName) {
|
|
3490
|
-
return runtimeName === "wasm-compiler-edge" && component === "compiler";
|
|
3491
|
+
return runtimeName === "wasm-engine-edge" && component === "engine" || runtimeName === "wasm-compiler-edge" && component === "compiler";
|
|
3491
3492
|
}
|
|
3492
3493
|
function buildGetWasmModule({
|
|
3493
3494
|
component,
|
|
@@ -3766,6 +3767,13 @@ function runCommandRawDefinition(context) {
|
|
|
3766
3767
|
`);
|
|
3767
3768
|
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3768
3769
|
}
|
|
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
|
+
}
|
|
3769
3777
|
function getPrismaClientClassDocComment({ dmmf }) {
|
|
3770
3778
|
let example;
|
|
3771
3779
|
if (dmmf.mappings.modelOperations.length) {
|
|
@@ -3821,7 +3829,7 @@ export interface PrismaClient<
|
|
|
3821
3829
|
> {
|
|
3822
3830
|
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
|
|
3823
3831
|
|
|
3824
|
-
$
|
|
3832
|
+
${eventRegistrationMethodDeclaration(this.runtimeName)}
|
|
3825
3833
|
|
|
3826
3834
|
/**
|
|
3827
3835
|
* Connect with the database
|
|
@@ -3841,6 +3849,7 @@ ${[
|
|
|
3841
3849
|
interactiveTransactionDefinition(this.context),
|
|
3842
3850
|
runCommandRawDefinition(this.context),
|
|
3843
3851
|
metricDefinition(this.context),
|
|
3852
|
+
this.applyPendingMigrationsDefinition(),
|
|
3844
3853
|
extendsPropertyDefinition()
|
|
3845
3854
|
].filter((d) => d !== null).join("\n").trim()}
|
|
3846
3855
|
|
|
@@ -3865,6 +3874,15 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
|
3865
3874
|
)}
|
|
3866
3875
|
}`;
|
|
3867
3876
|
}
|
|
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
|
+
}
|
|
3868
3886
|
};
|
|
3869
3887
|
|
|
3870
3888
|
// src/TSClient/file-generators/ClassFile.ts
|
|
@@ -3905,12 +3923,14 @@ function clientConfig(context, options) {
|
|
|
3905
3923
|
runtimeBase,
|
|
3906
3924
|
runtimeName,
|
|
3907
3925
|
datasources,
|
|
3926
|
+
copyEngine = true,
|
|
3908
3927
|
target,
|
|
3909
3928
|
activeProvider,
|
|
3910
3929
|
moduleFormat
|
|
3911
3930
|
} = options;
|
|
3912
3931
|
const clientEngineType = (0, import_internals4.getClientEngineType)(generator);
|
|
3913
3932
|
generator.config.engineType = clientEngineType;
|
|
3933
|
+
const inlineSchemaHash = import_node_crypto.default.createHash("sha256").update(Buffer.from(inlineSchema, "utf8").toString("base64")).digest("hex");
|
|
3914
3934
|
const datasourceFilePath = datasources[0].sourceFilePath;
|
|
3915
3935
|
const config = {
|
|
3916
3936
|
generator,
|
|
@@ -3923,6 +3943,8 @@ function clientConfig(context, options) {
|
|
|
3923
3943
|
ciName: import_ci_info.default.name ?? void 0,
|
|
3924
3944
|
inlineDatasources: buildInlineDatasources(datasources),
|
|
3925
3945
|
inlineSchema,
|
|
3946
|
+
inlineSchemaHash,
|
|
3947
|
+
copyEngine,
|
|
3926
3948
|
runtimeDataModel: { models: {}, enums: {}, types: {} },
|
|
3927
3949
|
dirname: ""
|
|
3928
3950
|
};
|
|
@@ -3971,6 +3993,9 @@ function getQueryEngineFilename(engineType, binaryTarget) {
|
|
|
3971
3993
|
if (engineType === import_internals5.ClientEngineType.Library) {
|
|
3972
3994
|
return (0, import_get_platform.getNodeAPIName)(binaryTarget, "fs");
|
|
3973
3995
|
}
|
|
3996
|
+
if (engineType === import_internals5.ClientEngineType.Binary) {
|
|
3997
|
+
return `query-engine-${binaryTarget}`;
|
|
3998
|
+
}
|
|
3974
3999
|
return void 0;
|
|
3975
4000
|
}
|
|
3976
4001
|
function buildNFTAnnotation(fileName, relativeOutdir) {
|
|
@@ -4017,7 +4042,7 @@ function createClientFile(context, options) {
|
|
|
4017
4042
|
)
|
|
4018
4043
|
)
|
|
4019
4044
|
].map((e) => ts7.stringify(e));
|
|
4020
|
-
const binaryTargets = clientEngineType === import_internals6.ClientEngineType.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) :
|
|
4045
|
+
const binaryTargets = clientEngineType === import_internals6.ClientEngineType.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) : Object.keys(options.binaryPaths.queryEngine ?? {});
|
|
4021
4046
|
const relativeOutdir = import_node_path3.default.relative(process.cwd(), options.outputDir);
|
|
4022
4047
|
return `${jsDocHeader3}
|
|
4023
4048
|
${buildPreamble(options.edge, options.moduleFormat)}
|
|
@@ -4026,7 +4051,7 @@ ${imports.join("\n")}
|
|
|
4026
4051
|
${exports2.join("\n")}
|
|
4027
4052
|
export { Prisma }
|
|
4028
4053
|
|
|
4029
|
-
${buildNFTAnnotations(options.edge, clientEngineType, binaryTargets, relativeOutdir)}
|
|
4054
|
+
${buildNFTAnnotations(options.edge || !options.copyEngine, clientEngineType, binaryTargets, relativeOutdir)}
|
|
4030
4055
|
|
|
4031
4056
|
${modelExports(context).join("\n")}
|
|
4032
4057
|
`;
|
|
@@ -5128,36 +5153,33 @@ function createModelsFile(context, modelsNames) {
|
|
|
5128
5153
|
}
|
|
5129
5154
|
|
|
5130
5155
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
5131
|
-
var import_dmmf2 = require("@prisma/dmmf");
|
|
5132
5156
|
var ts16 = __toESM(require("@prisma/ts-builders"));
|
|
5133
5157
|
|
|
5134
5158
|
// src/TSClient/NullTypes.ts
|
|
5135
5159
|
var nullTypes = `
|
|
5136
5160
|
export const NullTypes = {
|
|
5137
|
-
DbNull: runtime.
|
|
5138
|
-
JsonNull: runtime.
|
|
5139
|
-
AnyNull: runtime.
|
|
5161
|
+
DbNull: runtime.objectEnumValues.classes.DbNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.DbNull),
|
|
5162
|
+
JsonNull: runtime.objectEnumValues.classes.JsonNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.JsonNull),
|
|
5163
|
+
AnyNull: runtime.objectEnumValues.classes.AnyNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.AnyNull),
|
|
5140
5164
|
}
|
|
5141
5165
|
/**
|
|
5142
5166
|
* Helper for filtering JSON entries that have \`null\` on the database (empty on the db)
|
|
5143
5167
|
*
|
|
5144
5168
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5145
5169
|
*/
|
|
5146
|
-
export const DbNull = runtime.DbNull
|
|
5147
|
-
|
|
5170
|
+
export const DbNull = runtime.objectEnumValues.instances.DbNull
|
|
5148
5171
|
/**
|
|
5149
5172
|
* Helper for filtering JSON entries that have JSON \`null\` values (not empty on the db)
|
|
5150
5173
|
*
|
|
5151
5174
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5152
5175
|
*/
|
|
5153
|
-
export const JsonNull = runtime.JsonNull
|
|
5154
|
-
|
|
5176
|
+
export const JsonNull = runtime.objectEnumValues.instances.JsonNull
|
|
5155
5177
|
/**
|
|
5156
5178
|
* Helper for filtering JSON entries that are \`Prisma.DbNull\` or \`Prisma.JsonNull\`
|
|
5157
5179
|
*
|
|
5158
5180
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5159
5181
|
*/
|
|
5160
|
-
export const AnyNull = runtime.AnyNull
|
|
5182
|
+
export const AnyNull = runtime.objectEnumValues.instances.AnyNull
|
|
5161
5183
|
`;
|
|
5162
5184
|
|
|
5163
5185
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
@@ -5174,9 +5196,7 @@ var jsDocHeader7 = `/*
|
|
|
5174
5196
|
*/
|
|
5175
5197
|
`;
|
|
5176
5198
|
function createPrismaNamespaceBrowserFile(context) {
|
|
5177
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5178
|
-
(datamodelEnum) => new Enum((0, import_dmmf2.datamodelSchemaEnumToSchemaEnum)(datamodelEnum), false).toTS()
|
|
5179
|
-
);
|
|
5199
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
|
|
5180
5200
|
return `${jsDocHeader7}
|
|
5181
5201
|
${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
|
|
5182
5202
|
|
|
@@ -5190,10 +5210,7 @@ ${nullTypes}
|
|
|
5190
5210
|
${new Enum(
|
|
5191
5211
|
{
|
|
5192
5212
|
name: "ModelName",
|
|
5193
|
-
|
|
5194
|
-
key: m.model,
|
|
5195
|
-
value: m.model
|
|
5196
|
-
}))
|
|
5213
|
+
values: context.dmmf.mappings.modelOperations.map((m) => m.model)
|
|
5197
5214
|
},
|
|
5198
5215
|
true
|
|
5199
5216
|
).toTS()}
|
|
@@ -5206,7 +5223,6 @@ ${prismaEnums?.join("\n\n")}
|
|
|
5206
5223
|
}
|
|
5207
5224
|
|
|
5208
5225
|
// src/TSClient/file-generators/PrismaNamespaceFile.ts
|
|
5209
|
-
var import_dmmf3 = require("@prisma/dmmf");
|
|
5210
5226
|
var ts19 = __toESM(require("@prisma/ts-builders"));
|
|
5211
5227
|
|
|
5212
5228
|
// src/TSClient/common.ts
|
|
@@ -5746,9 +5762,7 @@ function createPrismaNamespaceFile(context, options) {
|
|
|
5746
5762
|
ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
|
|
5747
5763
|
ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
|
|
5748
5764
|
].map((i) => ts19.stringify(i));
|
|
5749
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5750
|
-
(type) => new Enum((0, import_dmmf3.datamodelSchemaEnumToSchemaEnum)(type), true).toTS()
|
|
5751
|
-
);
|
|
5765
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
|
|
5752
5766
|
const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
|
|
5753
5767
|
return `${jsDocHeader8}
|
|
5754
5768
|
${imports.join("\n")}
|
|
@@ -5759,10 +5773,7 @@ ${commonCodeTS(options)}
|
|
|
5759
5773
|
${new Enum(
|
|
5760
5774
|
{
|
|
5761
5775
|
name: "ModelName",
|
|
5762
|
-
|
|
5763
|
-
key: m.model,
|
|
5764
|
-
value: m.model
|
|
5765
|
-
}))
|
|
5776
|
+
values: context.dmmf.mappings.modelOperations.map((m) => m.model)
|
|
5766
5777
|
},
|
|
5767
5778
|
true
|
|
5768
5779
|
).toTS()}
|
|
@@ -5872,6 +5883,8 @@ function clientExtensionsDefinitions() {
|
|
|
5872
5883
|
function buildClientOptions(context, options) {
|
|
5873
5884
|
const clientOptions = ts19.interfaceDeclaration("PrismaClientOptions").add(
|
|
5874
5885
|
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"))
|
|
5875
5888
|
).add(
|
|
5876
5889
|
ts19.property("errorFormat", ts19.namedType("ErrorFormat")).optional().setDocComment(ts19.docComment('@default "colorless"'))
|
|
5877
5890
|
).add(
|
|
@@ -5911,7 +5924,7 @@ function buildClientOptions(context, options) {
|
|
|
5911
5924
|
timeout ?= 5000
|
|
5912
5925
|
`)
|
|
5913
5926
|
);
|
|
5914
|
-
if (["library", "client", "wasm-compiler-edge"].includes(options.runtimeName)) {
|
|
5927
|
+
if (["library", "client", "wasm-compiler-edge", "wasm-engine-edge"].includes(options.runtimeName)) {
|
|
5915
5928
|
clientOptions.add(
|
|
5916
5929
|
ts19.property("adapter", ts19.unionType([ts19.namedType("runtime.SqlDriverAdapterFactory"), ts19.namedType("null")])).optional().setDocComment(
|
|
5917
5930
|
ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
|
|
@@ -6279,6 +6292,7 @@ function buildClient({
|
|
|
6279
6292
|
clientVersion,
|
|
6280
6293
|
activeProvider,
|
|
6281
6294
|
postinstall,
|
|
6295
|
+
copyEngine,
|
|
6282
6296
|
envPaths,
|
|
6283
6297
|
typedSql,
|
|
6284
6298
|
target,
|
|
@@ -6304,8 +6318,9 @@ function buildClient({
|
|
|
6304
6318
|
engineVersion,
|
|
6305
6319
|
activeProvider,
|
|
6306
6320
|
postinstall,
|
|
6321
|
+
copyEngine,
|
|
6307
6322
|
datamodel,
|
|
6308
|
-
edge: ["wasm-compiler-edge"].includes(runtimeName),
|
|
6323
|
+
edge: ["edge", "wasm-engine-edge", "wasm-compiler-edge", "react-native"].includes(runtimeName),
|
|
6309
6324
|
runtimeName,
|
|
6310
6325
|
target,
|
|
6311
6326
|
generatedFileExtension,
|
|
@@ -6313,6 +6328,9 @@ function buildClient({
|
|
|
6313
6328
|
moduleFormat,
|
|
6314
6329
|
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6315
6330
|
};
|
|
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
|
+
}
|
|
6316
6334
|
const client = new TSClient(clientOptions);
|
|
6317
6335
|
let fileMap = client.generateClientFiles();
|
|
6318
6336
|
if (typedSql && typedSql.length > 0) {
|
|
@@ -6368,6 +6386,7 @@ async function generateClient(options) {
|
|
|
6368
6386
|
activeProvider,
|
|
6369
6387
|
postinstall,
|
|
6370
6388
|
envPaths,
|
|
6389
|
+
copyEngine = true,
|
|
6371
6390
|
typedSql,
|
|
6372
6391
|
target,
|
|
6373
6392
|
generatedFileExtension,
|
|
@@ -6390,6 +6409,7 @@ async function generateClient(options) {
|
|
|
6390
6409
|
engineVersion,
|
|
6391
6410
|
activeProvider,
|
|
6392
6411
|
postinstall,
|
|
6412
|
+
copyEngine,
|
|
6393
6413
|
envPaths,
|
|
6394
6414
|
typedSql,
|
|
6395
6415
|
target,
|
|
@@ -6414,8 +6434,8 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
|
|
|
6414
6434
|
await deleteOutputDir(outputDir);
|
|
6415
6435
|
await (0, import_fs_extra.ensureDir)(outputDir);
|
|
6416
6436
|
await writeFileMap(outputDir, fileMap);
|
|
6417
|
-
const enginePath = clientEngineType === import_internals10.ClientEngineType.Library ? binaryPaths.libqueryEngine :
|
|
6418
|
-
if (enginePath) {
|
|
6437
|
+
const enginePath = clientEngineType === import_internals10.ClientEngineType.Library ? binaryPaths.libqueryEngine : binaryPaths.queryEngine;
|
|
6438
|
+
if (copyEngine && enginePath) {
|
|
6419
6439
|
if (process.env.NETLIFY) {
|
|
6420
6440
|
await (0, import_fs_extra.ensureDir)("/tmp/prisma-engines");
|
|
6421
6441
|
}
|
|
@@ -6540,12 +6560,17 @@ function getRuntimeNameForTarget(target, engineType) {
|
|
|
6540
6560
|
return getNodeRuntimeName(engineType);
|
|
6541
6561
|
case "workerd":
|
|
6542
6562
|
case "vercel-edge":
|
|
6543
|
-
return "wasm-compiler-edge";
|
|
6563
|
+
return engineType === import_internals10.ClientEngineType.Client ? "wasm-compiler-edge" : "wasm-engine-edge";
|
|
6564
|
+
case "react-native":
|
|
6565
|
+
return "react-native";
|
|
6544
6566
|
default:
|
|
6545
6567
|
(0, import_internals10.assertNever)(target, "Unknown runtime target");
|
|
6546
6568
|
}
|
|
6547
6569
|
}
|
|
6548
6570
|
function getNodeRuntimeName(engineType) {
|
|
6571
|
+
if (engineType === import_internals10.ClientEngineType.Binary) {
|
|
6572
|
+
return "binary";
|
|
6573
|
+
}
|
|
6549
6574
|
if (engineType === import_internals10.ClientEngineType.Library) {
|
|
6550
6575
|
return "library";
|
|
6551
6576
|
}
|
|
@@ -6595,7 +6620,7 @@ var import_get_tsconfig = require("get-tsconfig");
|
|
|
6595
6620
|
var import_ts_pattern2 = require("ts-pattern");
|
|
6596
6621
|
|
|
6597
6622
|
// package.json
|
|
6598
|
-
var version = "6.19.0-integration-
|
|
6623
|
+
var version = "6.19.0-integration-engines-6-19-0-27-feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2.1";
|
|
6599
6624
|
|
|
6600
6625
|
// src/module-format.ts
|
|
6601
6626
|
function parseModuleFormat(format) {
|
|
@@ -6638,7 +6663,16 @@ function fromTsConfigModule(module2) {
|
|
|
6638
6663
|
}
|
|
6639
6664
|
|
|
6640
6665
|
// src/runtime-targets.ts
|
|
6641
|
-
var supportedPublicRuntimes = [
|
|
6666
|
+
var supportedPublicRuntimes = [
|
|
6667
|
+
"nodejs",
|
|
6668
|
+
"deno",
|
|
6669
|
+
"bun",
|
|
6670
|
+
"workerd",
|
|
6671
|
+
"cloudflare",
|
|
6672
|
+
"vercel-edge",
|
|
6673
|
+
"edge-light",
|
|
6674
|
+
"react-native"
|
|
6675
|
+
];
|
|
6642
6676
|
function parseRuntimeTarget(target) {
|
|
6643
6677
|
switch (target.toLowerCase()) {
|
|
6644
6678
|
case "workerd":
|
|
@@ -6652,6 +6686,8 @@ function parseRuntimeTarget(target) {
|
|
|
6652
6686
|
return "nodejs";
|
|
6653
6687
|
case "deno":
|
|
6654
6688
|
return "deno";
|
|
6689
|
+
case "react-native":
|
|
6690
|
+
return "react-native";
|
|
6655
6691
|
default:
|
|
6656
6692
|
throw new Error(
|
|
6657
6693
|
`Unknown target runtime: "${target}". The available options are: ${supportedPublicRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
|
|
@@ -6685,7 +6721,7 @@ function getOutputPath(config) {
|
|
|
6685
6721
|
var PrismaClientTsGenerator = class {
|
|
6686
6722
|
name = "prisma-client-ts";
|
|
6687
6723
|
getManifest(config) {
|
|
6688
|
-
const requiresEngines = (0, import_ts_pattern2.match)((0, import_internals11.getClientEngineType)(config)).with(import_internals11.ClientEngineType.Library, () => ["libqueryEngine"]).with(import_internals11.ClientEngineType.Client, () => []).exhaustive();
|
|
6724
|
+
const requiresEngines = (0, import_ts_pattern2.match)((0, import_internals11.getClientEngineType)(config)).with(import_internals11.ClientEngineType.Library, () => ["libqueryEngine"]).with(import_internals11.ClientEngineType.Binary, () => ["queryEngine"]).with(import_internals11.ClientEngineType.Client, () => []).exhaustive();
|
|
6689
6725
|
debug2("requiresEngines", requiresEngines);
|
|
6690
6726
|
return Promise.resolve({
|
|
6691
6727
|
defaultOutput: getOutputPath(config),
|
|
@@ -6725,6 +6761,7 @@ var PrismaClientTsGenerator = class {
|
|
|
6725
6761
|
clientVersion: version,
|
|
6726
6762
|
activeProvider: options.datasources[0]?.activeProvider,
|
|
6727
6763
|
postinstall: options.postinstall,
|
|
6764
|
+
copyEngine: !options.noEngine,
|
|
6728
6765
|
typedSql: options.typedSql,
|
|
6729
6766
|
target,
|
|
6730
6767
|
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.values.map((v) => `${v}: ${this.getValue(v)}`).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,6 +2935,7 @@ ${modelExports(context).join("\n")}
|
|
|
2935
2935
|
}
|
|
2936
2936
|
|
|
2937
2937
|
// src/TSClient/file-generators/ClassFile.ts
|
|
2938
|
+
import crypto from "node:crypto";
|
|
2938
2939
|
import path2 from "node:path";
|
|
2939
2940
|
import { getClientEngineType as getClientEngineType2, pathToPosix } from "@prisma/internals";
|
|
2940
2941
|
import * as ts6 from "@prisma/ts-builders";
|
|
@@ -3454,7 +3455,7 @@ function escapeJson(str) {
|
|
|
3454
3455
|
function buildRuntimeDataModel(datamodel, runtimeName) {
|
|
3455
3456
|
const runtimeDataModel = dmmfToRuntimeDataModel(datamodel);
|
|
3456
3457
|
let prunedDataModel;
|
|
3457
|
-
if (runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
|
|
3458
|
+
if (runtimeName === "wasm-engine-edge" || runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
|
|
3458
3459
|
prunedDataModel = pruneRuntimeDataModel(runtimeDataModel);
|
|
3459
3460
|
} else {
|
|
3460
3461
|
prunedDataModel = runtimeDataModel;
|
|
@@ -3486,7 +3487,7 @@ import { Debug } from "@prisma/debug";
|
|
|
3486
3487
|
import { match } from "ts-pattern";
|
|
3487
3488
|
var debug = Debug("prisma:client-generator-ts:wasm");
|
|
3488
3489
|
function usesEdgeWasmRuntime(component, runtimeName) {
|
|
3489
|
-
return runtimeName === "wasm-compiler-edge" && component === "compiler";
|
|
3490
|
+
return runtimeName === "wasm-engine-edge" && component === "engine" || runtimeName === "wasm-compiler-edge" && component === "compiler";
|
|
3490
3491
|
}
|
|
3491
3492
|
function buildGetWasmModule({
|
|
3492
3493
|
component,
|
|
@@ -3765,6 +3766,13 @@ function runCommandRawDefinition(context) {
|
|
|
3765
3766
|
`);
|
|
3766
3767
|
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3767
3768
|
}
|
|
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
|
+
}
|
|
3768
3776
|
function getPrismaClientClassDocComment({ dmmf }) {
|
|
3769
3777
|
let example;
|
|
3770
3778
|
if (dmmf.mappings.modelOperations.length) {
|
|
@@ -3820,7 +3828,7 @@ export interface PrismaClient<
|
|
|
3820
3828
|
> {
|
|
3821
3829
|
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
|
|
3822
3830
|
|
|
3823
|
-
$
|
|
3831
|
+
${eventRegistrationMethodDeclaration(this.runtimeName)}
|
|
3824
3832
|
|
|
3825
3833
|
/**
|
|
3826
3834
|
* Connect with the database
|
|
@@ -3840,6 +3848,7 @@ ${[
|
|
|
3840
3848
|
interactiveTransactionDefinition(this.context),
|
|
3841
3849
|
runCommandRawDefinition(this.context),
|
|
3842
3850
|
metricDefinition(this.context),
|
|
3851
|
+
this.applyPendingMigrationsDefinition(),
|
|
3843
3852
|
extendsPropertyDefinition()
|
|
3844
3853
|
].filter((d) => d !== null).join("\n").trim()}
|
|
3845
3854
|
|
|
@@ -3864,6 +3873,15 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
|
3864
3873
|
)}
|
|
3865
3874
|
}`;
|
|
3866
3875
|
}
|
|
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
|
+
}
|
|
3867
3885
|
};
|
|
3868
3886
|
|
|
3869
3887
|
// src/TSClient/file-generators/ClassFile.ts
|
|
@@ -3904,12 +3922,14 @@ function clientConfig(context, options) {
|
|
|
3904
3922
|
runtimeBase,
|
|
3905
3923
|
runtimeName,
|
|
3906
3924
|
datasources,
|
|
3925
|
+
copyEngine = true,
|
|
3907
3926
|
target,
|
|
3908
3927
|
activeProvider,
|
|
3909
3928
|
moduleFormat
|
|
3910
3929
|
} = options;
|
|
3911
3930
|
const clientEngineType = getClientEngineType2(generator);
|
|
3912
3931
|
generator.config.engineType = clientEngineType;
|
|
3932
|
+
const inlineSchemaHash = crypto.createHash("sha256").update(Buffer.from(inlineSchema, "utf8").toString("base64")).digest("hex");
|
|
3913
3933
|
const datasourceFilePath = datasources[0].sourceFilePath;
|
|
3914
3934
|
const config = {
|
|
3915
3935
|
generator,
|
|
@@ -3922,6 +3942,8 @@ function clientConfig(context, options) {
|
|
|
3922
3942
|
ciName: ciInfo.name ?? void 0,
|
|
3923
3943
|
inlineDatasources: buildInlineDatasources(datasources),
|
|
3924
3944
|
inlineSchema,
|
|
3945
|
+
inlineSchemaHash,
|
|
3946
|
+
copyEngine,
|
|
3925
3947
|
runtimeDataModel: { models: {}, enums: {}, types: {} },
|
|
3926
3948
|
dirname: ""
|
|
3927
3949
|
};
|
|
@@ -3970,6 +3992,9 @@ function getQueryEngineFilename(engineType, binaryTarget) {
|
|
|
3970
3992
|
if (engineType === ClientEngineType.Library) {
|
|
3971
3993
|
return getNodeAPIName(binaryTarget, "fs");
|
|
3972
3994
|
}
|
|
3995
|
+
if (engineType === ClientEngineType.Binary) {
|
|
3996
|
+
return `query-engine-${binaryTarget}`;
|
|
3997
|
+
}
|
|
3973
3998
|
return void 0;
|
|
3974
3999
|
}
|
|
3975
4000
|
function buildNFTAnnotation(fileName, relativeOutdir) {
|
|
@@ -4016,7 +4041,7 @@ function createClientFile(context, options) {
|
|
|
4016
4041
|
)
|
|
4017
4042
|
)
|
|
4018
4043
|
].map((e) => ts7.stringify(e));
|
|
4019
|
-
const binaryTargets = clientEngineType === ClientEngineType2.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) :
|
|
4044
|
+
const binaryTargets = clientEngineType === ClientEngineType2.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) : Object.keys(options.binaryPaths.queryEngine ?? {});
|
|
4020
4045
|
const relativeOutdir = path4.relative(process.cwd(), options.outputDir);
|
|
4021
4046
|
return `${jsDocHeader3}
|
|
4022
4047
|
${buildPreamble(options.edge, options.moduleFormat)}
|
|
@@ -4025,7 +4050,7 @@ ${imports.join("\n")}
|
|
|
4025
4050
|
${exports.join("\n")}
|
|
4026
4051
|
export { Prisma }
|
|
4027
4052
|
|
|
4028
|
-
${buildNFTAnnotations(options.edge, clientEngineType, binaryTargets, relativeOutdir)}
|
|
4053
|
+
${buildNFTAnnotations(options.edge || !options.copyEngine, clientEngineType, binaryTargets, relativeOutdir)}
|
|
4029
4054
|
|
|
4030
4055
|
${modelExports(context).join("\n")}
|
|
4031
4056
|
`;
|
|
@@ -5127,36 +5152,33 @@ function createModelsFile(context, modelsNames) {
|
|
|
5127
5152
|
}
|
|
5128
5153
|
|
|
5129
5154
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
5130
|
-
import { datamodelSchemaEnumToSchemaEnum } from "@prisma/dmmf";
|
|
5131
5155
|
import * as ts16 from "@prisma/ts-builders";
|
|
5132
5156
|
|
|
5133
5157
|
// src/TSClient/NullTypes.ts
|
|
5134
5158
|
var nullTypes = `
|
|
5135
5159
|
export const NullTypes = {
|
|
5136
|
-
DbNull: runtime.
|
|
5137
|
-
JsonNull: runtime.
|
|
5138
|
-
AnyNull: runtime.
|
|
5160
|
+
DbNull: runtime.objectEnumValues.classes.DbNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.DbNull),
|
|
5161
|
+
JsonNull: runtime.objectEnumValues.classes.JsonNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.JsonNull),
|
|
5162
|
+
AnyNull: runtime.objectEnumValues.classes.AnyNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.AnyNull),
|
|
5139
5163
|
}
|
|
5140
5164
|
/**
|
|
5141
5165
|
* Helper for filtering JSON entries that have \`null\` on the database (empty on the db)
|
|
5142
5166
|
*
|
|
5143
5167
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5144
5168
|
*/
|
|
5145
|
-
export const DbNull = runtime.DbNull
|
|
5146
|
-
|
|
5169
|
+
export const DbNull = runtime.objectEnumValues.instances.DbNull
|
|
5147
5170
|
/**
|
|
5148
5171
|
* Helper for filtering JSON entries that have JSON \`null\` values (not empty on the db)
|
|
5149
5172
|
*
|
|
5150
5173
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5151
5174
|
*/
|
|
5152
|
-
export const JsonNull = runtime.JsonNull
|
|
5153
|
-
|
|
5175
|
+
export const JsonNull = runtime.objectEnumValues.instances.JsonNull
|
|
5154
5176
|
/**
|
|
5155
5177
|
* Helper for filtering JSON entries that are \`Prisma.DbNull\` or \`Prisma.JsonNull\`
|
|
5156
5178
|
*
|
|
5157
5179
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5158
5180
|
*/
|
|
5159
|
-
export const AnyNull = runtime.AnyNull
|
|
5181
|
+
export const AnyNull = runtime.objectEnumValues.instances.AnyNull
|
|
5160
5182
|
`;
|
|
5161
5183
|
|
|
5162
5184
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
@@ -5173,9 +5195,7 @@ var jsDocHeader7 = `/*
|
|
|
5173
5195
|
*/
|
|
5174
5196
|
`;
|
|
5175
5197
|
function createPrismaNamespaceBrowserFile(context) {
|
|
5176
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5177
|
-
(datamodelEnum) => new Enum(datamodelSchemaEnumToSchemaEnum(datamodelEnum), false).toTS()
|
|
5178
|
-
);
|
|
5198
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
|
|
5179
5199
|
return `${jsDocHeader7}
|
|
5180
5200
|
${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
|
|
5181
5201
|
|
|
@@ -5189,10 +5209,7 @@ ${nullTypes}
|
|
|
5189
5209
|
${new Enum(
|
|
5190
5210
|
{
|
|
5191
5211
|
name: "ModelName",
|
|
5192
|
-
|
|
5193
|
-
key: m.model,
|
|
5194
|
-
value: m.model
|
|
5195
|
-
}))
|
|
5212
|
+
values: context.dmmf.mappings.modelOperations.map((m) => m.model)
|
|
5196
5213
|
},
|
|
5197
5214
|
true
|
|
5198
5215
|
).toTS()}
|
|
@@ -5205,7 +5222,6 @@ ${prismaEnums?.join("\n\n")}
|
|
|
5205
5222
|
}
|
|
5206
5223
|
|
|
5207
5224
|
// src/TSClient/file-generators/PrismaNamespaceFile.ts
|
|
5208
|
-
import { datamodelSchemaEnumToSchemaEnum as datamodelSchemaEnumToSchemaEnum2 } from "@prisma/dmmf";
|
|
5209
5225
|
import * as ts19 from "@prisma/ts-builders";
|
|
5210
5226
|
|
|
5211
5227
|
// src/TSClient/common.ts
|
|
@@ -5745,9 +5761,7 @@ function createPrismaNamespaceFile(context, options) {
|
|
|
5745
5761
|
ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
|
|
5746
5762
|
ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
|
|
5747
5763
|
].map((i) => ts19.stringify(i));
|
|
5748
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5749
|
-
(type) => new Enum(datamodelSchemaEnumToSchemaEnum2(type), true).toTS()
|
|
5750
|
-
);
|
|
5764
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
|
|
5751
5765
|
const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
|
|
5752
5766
|
return `${jsDocHeader8}
|
|
5753
5767
|
${imports.join("\n")}
|
|
@@ -5758,10 +5772,7 @@ ${commonCodeTS(options)}
|
|
|
5758
5772
|
${new Enum(
|
|
5759
5773
|
{
|
|
5760
5774
|
name: "ModelName",
|
|
5761
|
-
|
|
5762
|
-
key: m.model,
|
|
5763
|
-
value: m.model
|
|
5764
|
-
}))
|
|
5775
|
+
values: context.dmmf.mappings.modelOperations.map((m) => m.model)
|
|
5765
5776
|
},
|
|
5766
5777
|
true
|
|
5767
5778
|
).toTS()}
|
|
@@ -5871,6 +5882,8 @@ function clientExtensionsDefinitions() {
|
|
|
5871
5882
|
function buildClientOptions(context, options) {
|
|
5872
5883
|
const clientOptions = ts19.interfaceDeclaration("PrismaClientOptions").add(
|
|
5873
5884
|
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"))
|
|
5874
5887
|
).add(
|
|
5875
5888
|
ts19.property("errorFormat", ts19.namedType("ErrorFormat")).optional().setDocComment(ts19.docComment('@default "colorless"'))
|
|
5876
5889
|
).add(
|
|
@@ -5910,7 +5923,7 @@ function buildClientOptions(context, options) {
|
|
|
5910
5923
|
timeout ?= 5000
|
|
5911
5924
|
`)
|
|
5912
5925
|
);
|
|
5913
|
-
if (["library", "client", "wasm-compiler-edge"].includes(options.runtimeName)) {
|
|
5926
|
+
if (["library", "client", "wasm-compiler-edge", "wasm-engine-edge"].includes(options.runtimeName)) {
|
|
5914
5927
|
clientOptions.add(
|
|
5915
5928
|
ts19.property("adapter", ts19.unionType([ts19.namedType("runtime.SqlDriverAdapterFactory"), ts19.namedType("null")])).optional().setDocComment(
|
|
5916
5929
|
ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
|
|
@@ -6278,6 +6291,7 @@ function buildClient({
|
|
|
6278
6291
|
clientVersion,
|
|
6279
6292
|
activeProvider,
|
|
6280
6293
|
postinstall,
|
|
6294
|
+
copyEngine,
|
|
6281
6295
|
envPaths,
|
|
6282
6296
|
typedSql,
|
|
6283
6297
|
target,
|
|
@@ -6303,8 +6317,9 @@ function buildClient({
|
|
|
6303
6317
|
engineVersion,
|
|
6304
6318
|
activeProvider,
|
|
6305
6319
|
postinstall,
|
|
6320
|
+
copyEngine,
|
|
6306
6321
|
datamodel,
|
|
6307
|
-
edge: ["wasm-compiler-edge"].includes(runtimeName),
|
|
6322
|
+
edge: ["edge", "wasm-engine-edge", "wasm-compiler-edge", "react-native"].includes(runtimeName),
|
|
6308
6323
|
runtimeName,
|
|
6309
6324
|
target,
|
|
6310
6325
|
generatedFileExtension,
|
|
@@ -6312,6 +6327,9 @@ function buildClient({
|
|
|
6312
6327
|
moduleFormat,
|
|
6313
6328
|
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6314
6329
|
};
|
|
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
|
+
}
|
|
6315
6333
|
const client = new TSClient(clientOptions);
|
|
6316
6334
|
let fileMap = client.generateClientFiles();
|
|
6317
6335
|
if (typedSql && typedSql.length > 0) {
|
|
@@ -6367,6 +6385,7 @@ async function generateClient(options) {
|
|
|
6367
6385
|
activeProvider,
|
|
6368
6386
|
postinstall,
|
|
6369
6387
|
envPaths,
|
|
6388
|
+
copyEngine = true,
|
|
6370
6389
|
typedSql,
|
|
6371
6390
|
target,
|
|
6372
6391
|
generatedFileExtension,
|
|
@@ -6389,6 +6408,7 @@ async function generateClient(options) {
|
|
|
6389
6408
|
engineVersion,
|
|
6390
6409
|
activeProvider,
|
|
6391
6410
|
postinstall,
|
|
6411
|
+
copyEngine,
|
|
6392
6412
|
envPaths,
|
|
6393
6413
|
typedSql,
|
|
6394
6414
|
target,
|
|
@@ -6413,8 +6433,8 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
|
|
|
6413
6433
|
await deleteOutputDir(outputDir);
|
|
6414
6434
|
await (0, import_fs_extra.ensureDir)(outputDir);
|
|
6415
6435
|
await writeFileMap(outputDir, fileMap);
|
|
6416
|
-
const enginePath = clientEngineType === ClientEngineType3.Library ? binaryPaths.libqueryEngine :
|
|
6417
|
-
if (enginePath) {
|
|
6436
|
+
const enginePath = clientEngineType === ClientEngineType3.Library ? binaryPaths.libqueryEngine : binaryPaths.queryEngine;
|
|
6437
|
+
if (copyEngine && enginePath) {
|
|
6418
6438
|
if (process.env.NETLIFY) {
|
|
6419
6439
|
await (0, import_fs_extra.ensureDir)("/tmp/prisma-engines");
|
|
6420
6440
|
}
|
|
@@ -6539,12 +6559,17 @@ function getRuntimeNameForTarget(target, engineType) {
|
|
|
6539
6559
|
return getNodeRuntimeName(engineType);
|
|
6540
6560
|
case "workerd":
|
|
6541
6561
|
case "vercel-edge":
|
|
6542
|
-
return "wasm-compiler-edge";
|
|
6562
|
+
return engineType === ClientEngineType3.Client ? "wasm-compiler-edge" : "wasm-engine-edge";
|
|
6563
|
+
case "react-native":
|
|
6564
|
+
return "react-native";
|
|
6543
6565
|
default:
|
|
6544
6566
|
assertNever3(target, "Unknown runtime target");
|
|
6545
6567
|
}
|
|
6546
6568
|
}
|
|
6547
6569
|
function getNodeRuntimeName(engineType) {
|
|
6570
|
+
if (engineType === ClientEngineType3.Binary) {
|
|
6571
|
+
return "binary";
|
|
6572
|
+
}
|
|
6548
6573
|
if (engineType === ClientEngineType3.Library) {
|
|
6549
6574
|
return "library";
|
|
6550
6575
|
}
|
|
@@ -6594,7 +6619,7 @@ import { getTsconfig } from "get-tsconfig";
|
|
|
6594
6619
|
import { match as match2 } from "ts-pattern";
|
|
6595
6620
|
|
|
6596
6621
|
// package.json
|
|
6597
|
-
var version = "6.19.0-integration-
|
|
6622
|
+
var version = "6.19.0-integration-engines-6-19-0-27-feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2.1";
|
|
6598
6623
|
|
|
6599
6624
|
// src/module-format.ts
|
|
6600
6625
|
function parseModuleFormat(format) {
|
|
@@ -6637,7 +6662,16 @@ function fromTsConfigModule(module) {
|
|
|
6637
6662
|
}
|
|
6638
6663
|
|
|
6639
6664
|
// src/runtime-targets.ts
|
|
6640
|
-
var supportedPublicRuntimes = [
|
|
6665
|
+
var supportedPublicRuntimes = [
|
|
6666
|
+
"nodejs",
|
|
6667
|
+
"deno",
|
|
6668
|
+
"bun",
|
|
6669
|
+
"workerd",
|
|
6670
|
+
"cloudflare",
|
|
6671
|
+
"vercel-edge",
|
|
6672
|
+
"edge-light",
|
|
6673
|
+
"react-native"
|
|
6674
|
+
];
|
|
6641
6675
|
function parseRuntimeTarget(target) {
|
|
6642
6676
|
switch (target.toLowerCase()) {
|
|
6643
6677
|
case "workerd":
|
|
@@ -6651,6 +6685,8 @@ function parseRuntimeTarget(target) {
|
|
|
6651
6685
|
return "nodejs";
|
|
6652
6686
|
case "deno":
|
|
6653
6687
|
return "deno";
|
|
6688
|
+
case "react-native":
|
|
6689
|
+
return "react-native";
|
|
6654
6690
|
default:
|
|
6655
6691
|
throw new Error(
|
|
6656
6692
|
`Unknown target runtime: "${target}". The available options are: ${supportedPublicRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
|
|
@@ -6684,7 +6720,7 @@ function getOutputPath(config) {
|
|
|
6684
6720
|
var PrismaClientTsGenerator = class {
|
|
6685
6721
|
name = "prisma-client-ts";
|
|
6686
6722
|
getManifest(config) {
|
|
6687
|
-
const requiresEngines = match2(getClientEngineType5(config)).with(ClientEngineType4.Library, () => ["libqueryEngine"]).with(ClientEngineType4.Client, () => []).exhaustive();
|
|
6723
|
+
const requiresEngines = match2(getClientEngineType5(config)).with(ClientEngineType4.Library, () => ["libqueryEngine"]).with(ClientEngineType4.Binary, () => ["queryEngine"]).with(ClientEngineType4.Client, () => []).exhaustive();
|
|
6688
6724
|
debug2("requiresEngines", requiresEngines);
|
|
6689
6725
|
return Promise.resolve({
|
|
6690
6726
|
defaultOutput: getOutputPath(config),
|
|
@@ -6724,6 +6760,7 @@ var PrismaClientTsGenerator = class {
|
|
|
6724
6760
|
clientVersion: version,
|
|
6725
6761
|
activeProvider: options.datasources[0]?.activeProvider,
|
|
6726
6762
|
postinstall: options.postinstall,
|
|
6763
|
+
copyEngine: !options.noEngine,
|
|
6727
6764
|
typedSql: options.typedSql,
|
|
6728
6765
|
target,
|
|
6729
6766
|
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", "react-native"];
|
|
2
|
+
declare const supportedPublicRuntimes: readonly ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light", "react-native"];
|
|
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" | "react-native";
|
|
12
12
|
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-engines-6-19-0-27-feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2.1",
|
|
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-27.feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2",
|
|
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/
|
|
43
|
-
"@prisma/
|
|
44
|
-
"@prisma/
|
|
37
|
+
"@prisma/fetch-engine": "6.19.0-integration-engines-6-19-0-27-feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2.1",
|
|
38
|
+
"@prisma/client-common": "6.19.0-integration-engines-6-19-0-27-feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2.1",
|
|
39
|
+
"@prisma/debug": "6.19.0-integration-engines-6-19-0-27-feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2.1",
|
|
40
|
+
"@prisma/dmmf": "6.19.0-integration-engines-6-19-0-27-feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2.1",
|
|
41
|
+
"@prisma/get-platform": "6.19.0-integration-engines-6-19-0-27-feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2.1",
|
|
42
|
+
"@prisma/generator": "6.19.0-integration-engines-6-19-0-27-feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2.1",
|
|
43
|
+
"@prisma/internals": "6.19.0-integration-engines-6-19-0-27-feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2.1",
|
|
44
|
+
"@prisma/ts-builders": "6.19.0-integration-engines-6-19-0-27-feat-bump-database-versions-2-4b6e368f6da3d45f65f44068ed2758da3adcf9e2.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/pluralize": "0.0.33",
|