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