@prisma/client-generator-ts 6.19.0-integration-engines-6-19-0-1-push-qtpkxwkvolmz-389b05cecb76e4e93db0ae07c19800226f238242.1 → 6.19.0-integration-next.5
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/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +32 -49
- package/dist/index.mjs +32 -49
- 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 = 'binary' | 'library' | 'wasm-
|
|
6
|
+
export type RuntimeName = 'binary' | '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/index.d.mts
CHANGED
|
@@ -72,6 +72,6 @@ export declare class PrismaClientTsGenerator implements Generator_2 {
|
|
|
72
72
|
*/
|
|
73
73
|
declare type RuntimeTargetInternal = (typeof supportedInternalRuntimes)[number];
|
|
74
74
|
|
|
75
|
-
declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"
|
|
75
|
+
declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"];
|
|
76
76
|
|
|
77
77
|
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,6 @@ export declare class PrismaClientTsGenerator implements Generator_2 {
|
|
|
72
72
|
*/
|
|
73
73
|
declare type RuntimeTargetInternal = (typeof supportedInternalRuntimes)[number];
|
|
74
74
|
|
|
75
|
-
declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"
|
|
75
|
+
declare const supportedInternalRuntimes: readonly ["nodejs", "workerd", "vercel-edge", "deno"];
|
|
76
76
|
|
|
77
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.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,
|
|
@@ -3849,7 +3848,6 @@ ${[
|
|
|
3849
3848
|
interactiveTransactionDefinition(this.context),
|
|
3850
3849
|
runCommandRawDefinition(this.context),
|
|
3851
3850
|
metricDefinition(this.context),
|
|
3852
|
-
this.applyPendingMigrationsDefinition(),
|
|
3853
3851
|
extendsPropertyDefinition()
|
|
3854
3852
|
].filter((d) => d !== null).join("\n").trim()}
|
|
3855
3853
|
|
|
@@ -3874,15 +3872,6 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
|
3874
3872
|
)}
|
|
3875
3873
|
}`;
|
|
3876
3874
|
}
|
|
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
3875
|
};
|
|
3887
3876
|
|
|
3888
3877
|
// src/TSClient/file-generators/ClassFile.ts
|
|
@@ -3930,7 +3919,6 @@ function clientConfig(context, options) {
|
|
|
3930
3919
|
} = options;
|
|
3931
3920
|
const clientEngineType = (0, import_internals4.getClientEngineType)(generator);
|
|
3932
3921
|
generator.config.engineType = clientEngineType;
|
|
3933
|
-
const inlineSchemaHash = import_node_crypto.default.createHash("sha256").update(Buffer.from(inlineSchema, "utf8").toString("base64")).digest("hex");
|
|
3934
3922
|
const datasourceFilePath = datasources[0].sourceFilePath;
|
|
3935
3923
|
const config = {
|
|
3936
3924
|
generator,
|
|
@@ -3943,7 +3931,6 @@ function clientConfig(context, options) {
|
|
|
3943
3931
|
ciName: import_ci_info.default.name ?? void 0,
|
|
3944
3932
|
inlineDatasources: buildInlineDatasources(datasources),
|
|
3945
3933
|
inlineSchema,
|
|
3946
|
-
inlineSchemaHash,
|
|
3947
3934
|
copyEngine,
|
|
3948
3935
|
runtimeDataModel: { models: {}, enums: {}, types: {} },
|
|
3949
3936
|
dirname: ""
|
|
@@ -5153,33 +5140,36 @@ function createModelsFile(context, modelsNames) {
|
|
|
5153
5140
|
}
|
|
5154
5141
|
|
|
5155
5142
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
5143
|
+
var import_dmmf2 = require("@prisma/dmmf");
|
|
5156
5144
|
var ts16 = __toESM(require("@prisma/ts-builders"));
|
|
5157
5145
|
|
|
5158
5146
|
// src/TSClient/NullTypes.ts
|
|
5159
5147
|
var nullTypes = `
|
|
5160
5148
|
export const NullTypes = {
|
|
5161
|
-
DbNull: runtime.
|
|
5162
|
-
JsonNull: runtime.
|
|
5163
|
-
AnyNull: runtime.
|
|
5149
|
+
DbNull: runtime.NullTypes.DbNull as (new (secret: never) => typeof runtime.DbNull),
|
|
5150
|
+
JsonNull: runtime.NullTypes.JsonNull as (new (secret: never) => typeof runtime.JsonNull),
|
|
5151
|
+
AnyNull: runtime.NullTypes.AnyNull as (new (secret: never) => typeof runtime.AnyNull),
|
|
5164
5152
|
}
|
|
5165
5153
|
/**
|
|
5166
5154
|
* Helper for filtering JSON entries that have \`null\` on the database (empty on the db)
|
|
5167
5155
|
*
|
|
5168
5156
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5169
5157
|
*/
|
|
5170
|
-
export const DbNull = runtime.
|
|
5158
|
+
export const DbNull = runtime.DbNull
|
|
5159
|
+
|
|
5171
5160
|
/**
|
|
5172
5161
|
* Helper for filtering JSON entries that have JSON \`null\` values (not empty on the db)
|
|
5173
5162
|
*
|
|
5174
5163
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5175
5164
|
*/
|
|
5176
|
-
export const JsonNull = runtime.
|
|
5165
|
+
export const JsonNull = runtime.JsonNull
|
|
5166
|
+
|
|
5177
5167
|
/**
|
|
5178
5168
|
* Helper for filtering JSON entries that are \`Prisma.DbNull\` or \`Prisma.JsonNull\`
|
|
5179
5169
|
*
|
|
5180
5170
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5181
5171
|
*/
|
|
5182
|
-
export const AnyNull = runtime.
|
|
5172
|
+
export const AnyNull = runtime.AnyNull
|
|
5183
5173
|
`;
|
|
5184
5174
|
|
|
5185
5175
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
@@ -5196,7 +5186,9 @@ var jsDocHeader7 = `/*
|
|
|
5196
5186
|
*/
|
|
5197
5187
|
`;
|
|
5198
5188
|
function createPrismaNamespaceBrowserFile(context) {
|
|
5199
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5189
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5190
|
+
(datamodelEnum) => new Enum((0, import_dmmf2.datamodelSchemaEnumToSchemaEnum)(datamodelEnum), false).toTS()
|
|
5191
|
+
);
|
|
5200
5192
|
return `${jsDocHeader7}
|
|
5201
5193
|
${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
|
|
5202
5194
|
|
|
@@ -5210,7 +5202,10 @@ ${nullTypes}
|
|
|
5210
5202
|
${new Enum(
|
|
5211
5203
|
{
|
|
5212
5204
|
name: "ModelName",
|
|
5213
|
-
|
|
5205
|
+
data: context.dmmf.mappings.modelOperations.map((m) => ({
|
|
5206
|
+
key: m.model,
|
|
5207
|
+
value: m.model
|
|
5208
|
+
}))
|
|
5214
5209
|
},
|
|
5215
5210
|
true
|
|
5216
5211
|
).toTS()}
|
|
@@ -5223,6 +5218,7 @@ ${prismaEnums?.join("\n\n")}
|
|
|
5223
5218
|
}
|
|
5224
5219
|
|
|
5225
5220
|
// src/TSClient/file-generators/PrismaNamespaceFile.ts
|
|
5221
|
+
var import_dmmf3 = require("@prisma/dmmf");
|
|
5226
5222
|
var ts19 = __toESM(require("@prisma/ts-builders"));
|
|
5227
5223
|
|
|
5228
5224
|
// src/TSClient/common.ts
|
|
@@ -5762,7 +5758,9 @@ function createPrismaNamespaceFile(context, options) {
|
|
|
5762
5758
|
ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
|
|
5763
5759
|
ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
|
|
5764
5760
|
].map((i) => ts19.stringify(i));
|
|
5765
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5761
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5762
|
+
(type) => new Enum((0, import_dmmf3.datamodelSchemaEnumToSchemaEnum)(type), true).toTS()
|
|
5763
|
+
);
|
|
5766
5764
|
const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
|
|
5767
5765
|
return `${jsDocHeader8}
|
|
5768
5766
|
${imports.join("\n")}
|
|
@@ -5773,7 +5771,10 @@ ${commonCodeTS(options)}
|
|
|
5773
5771
|
${new Enum(
|
|
5774
5772
|
{
|
|
5775
5773
|
name: "ModelName",
|
|
5776
|
-
|
|
5774
|
+
data: context.dmmf.mappings.modelOperations.map((m) => ({
|
|
5775
|
+
key: m.model,
|
|
5776
|
+
value: m.model
|
|
5777
|
+
}))
|
|
5777
5778
|
},
|
|
5778
5779
|
true
|
|
5779
5780
|
).toTS()}
|
|
@@ -5883,8 +5884,6 @@ function clientExtensionsDefinitions() {
|
|
|
5883
5884
|
function buildClientOptions(context, options) {
|
|
5884
5885
|
const clientOptions = ts19.interfaceDeclaration("PrismaClientOptions").add(
|
|
5885
5886
|
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
5887
|
).add(
|
|
5889
5888
|
ts19.property("errorFormat", ts19.namedType("ErrorFormat")).optional().setDocComment(ts19.docComment('@default "colorless"'))
|
|
5890
5889
|
).add(
|
|
@@ -5924,7 +5923,7 @@ function buildClientOptions(context, options) {
|
|
|
5924
5923
|
timeout ?= 5000
|
|
5925
5924
|
`)
|
|
5926
5925
|
);
|
|
5927
|
-
if (["library", "client", "wasm-compiler-edge"
|
|
5926
|
+
if (["library", "client", "wasm-compiler-edge"].includes(options.runtimeName)) {
|
|
5928
5927
|
clientOptions.add(
|
|
5929
5928
|
ts19.property("adapter", ts19.unionType([ts19.namedType("runtime.SqlDriverAdapterFactory"), ts19.namedType("null")])).optional().setDocComment(
|
|
5930
5929
|
ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
|
|
@@ -6320,7 +6319,7 @@ function buildClient({
|
|
|
6320
6319
|
postinstall,
|
|
6321
6320
|
copyEngine,
|
|
6322
6321
|
datamodel,
|
|
6323
|
-
edge: ["
|
|
6322
|
+
edge: ["wasm-compiler-edge"].includes(runtimeName),
|
|
6324
6323
|
runtimeName,
|
|
6325
6324
|
target,
|
|
6326
6325
|
generatedFileExtension,
|
|
@@ -6328,9 +6327,6 @@ function buildClient({
|
|
|
6328
6327
|
moduleFormat,
|
|
6329
6328
|
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6330
6329
|
};
|
|
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
6330
|
const client = new TSClient(clientOptions);
|
|
6335
6331
|
let fileMap = client.generateClientFiles();
|
|
6336
6332
|
if (typedSql && typedSql.length > 0) {
|
|
@@ -6560,9 +6556,7 @@ function getRuntimeNameForTarget(target, engineType) {
|
|
|
6560
6556
|
return getNodeRuntimeName(engineType);
|
|
6561
6557
|
case "workerd":
|
|
6562
6558
|
case "vercel-edge":
|
|
6563
|
-
return
|
|
6564
|
-
case "react-native":
|
|
6565
|
-
return "react-native";
|
|
6559
|
+
return "wasm-compiler-edge";
|
|
6566
6560
|
default:
|
|
6567
6561
|
(0, import_internals10.assertNever)(target, "Unknown runtime target");
|
|
6568
6562
|
}
|
|
@@ -6620,7 +6614,7 @@ var import_get_tsconfig = require("get-tsconfig");
|
|
|
6620
6614
|
var import_ts_pattern2 = require("ts-pattern");
|
|
6621
6615
|
|
|
6622
6616
|
// package.json
|
|
6623
|
-
var version = "6.19.0-integration-
|
|
6617
|
+
var version = "6.19.0-integration-next.5";
|
|
6624
6618
|
|
|
6625
6619
|
// src/module-format.ts
|
|
6626
6620
|
function parseModuleFormat(format) {
|
|
@@ -6663,16 +6657,7 @@ function fromTsConfigModule(module2) {
|
|
|
6663
6657
|
}
|
|
6664
6658
|
|
|
6665
6659
|
// 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
|
-
];
|
|
6660
|
+
var supportedPublicRuntimes = ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light"];
|
|
6676
6661
|
function parseRuntimeTarget(target) {
|
|
6677
6662
|
switch (target.toLowerCase()) {
|
|
6678
6663
|
case "workerd":
|
|
@@ -6686,8 +6671,6 @@ function parseRuntimeTarget(target) {
|
|
|
6686
6671
|
return "nodejs";
|
|
6687
6672
|
case "deno":
|
|
6688
6673
|
return "deno";
|
|
6689
|
-
case "react-native":
|
|
6690
|
-
return "react-native";
|
|
6691
6674
|
default:
|
|
6692
6675
|
throw new Error(
|
|
6693
6676
|
`Unknown target runtime: "${target}". The available options are: ${supportedPublicRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
|
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,
|
|
@@ -3848,7 +3847,6 @@ ${[
|
|
|
3848
3847
|
interactiveTransactionDefinition(this.context),
|
|
3849
3848
|
runCommandRawDefinition(this.context),
|
|
3850
3849
|
metricDefinition(this.context),
|
|
3851
|
-
this.applyPendingMigrationsDefinition(),
|
|
3852
3850
|
extendsPropertyDefinition()
|
|
3853
3851
|
].filter((d) => d !== null).join("\n").trim()}
|
|
3854
3852
|
|
|
@@ -3873,15 +3871,6 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
|
3873
3871
|
)}
|
|
3874
3872
|
}`;
|
|
3875
3873
|
}
|
|
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
3874
|
};
|
|
3886
3875
|
|
|
3887
3876
|
// src/TSClient/file-generators/ClassFile.ts
|
|
@@ -3929,7 +3918,6 @@ function clientConfig(context, options) {
|
|
|
3929
3918
|
} = options;
|
|
3930
3919
|
const clientEngineType = getClientEngineType2(generator);
|
|
3931
3920
|
generator.config.engineType = clientEngineType;
|
|
3932
|
-
const inlineSchemaHash = crypto.createHash("sha256").update(Buffer.from(inlineSchema, "utf8").toString("base64")).digest("hex");
|
|
3933
3921
|
const datasourceFilePath = datasources[0].sourceFilePath;
|
|
3934
3922
|
const config = {
|
|
3935
3923
|
generator,
|
|
@@ -3942,7 +3930,6 @@ function clientConfig(context, options) {
|
|
|
3942
3930
|
ciName: ciInfo.name ?? void 0,
|
|
3943
3931
|
inlineDatasources: buildInlineDatasources(datasources),
|
|
3944
3932
|
inlineSchema,
|
|
3945
|
-
inlineSchemaHash,
|
|
3946
3933
|
copyEngine,
|
|
3947
3934
|
runtimeDataModel: { models: {}, enums: {}, types: {} },
|
|
3948
3935
|
dirname: ""
|
|
@@ -5152,33 +5139,36 @@ function createModelsFile(context, modelsNames) {
|
|
|
5152
5139
|
}
|
|
5153
5140
|
|
|
5154
5141
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
5142
|
+
import { datamodelSchemaEnumToSchemaEnum } from "@prisma/dmmf";
|
|
5155
5143
|
import * as ts16 from "@prisma/ts-builders";
|
|
5156
5144
|
|
|
5157
5145
|
// src/TSClient/NullTypes.ts
|
|
5158
5146
|
var nullTypes = `
|
|
5159
5147
|
export const NullTypes = {
|
|
5160
|
-
DbNull: runtime.
|
|
5161
|
-
JsonNull: runtime.
|
|
5162
|
-
AnyNull: runtime.
|
|
5148
|
+
DbNull: runtime.NullTypes.DbNull as (new (secret: never) => typeof runtime.DbNull),
|
|
5149
|
+
JsonNull: runtime.NullTypes.JsonNull as (new (secret: never) => typeof runtime.JsonNull),
|
|
5150
|
+
AnyNull: runtime.NullTypes.AnyNull as (new (secret: never) => typeof runtime.AnyNull),
|
|
5163
5151
|
}
|
|
5164
5152
|
/**
|
|
5165
5153
|
* Helper for filtering JSON entries that have \`null\` on the database (empty on the db)
|
|
5166
5154
|
*
|
|
5167
5155
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5168
5156
|
*/
|
|
5169
|
-
export const DbNull = runtime.
|
|
5157
|
+
export const DbNull = runtime.DbNull
|
|
5158
|
+
|
|
5170
5159
|
/**
|
|
5171
5160
|
* Helper for filtering JSON entries that have JSON \`null\` values (not empty on the db)
|
|
5172
5161
|
*
|
|
5173
5162
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5174
5163
|
*/
|
|
5175
|
-
export const JsonNull = runtime.
|
|
5164
|
+
export const JsonNull = runtime.JsonNull
|
|
5165
|
+
|
|
5176
5166
|
/**
|
|
5177
5167
|
* Helper for filtering JSON entries that are \`Prisma.DbNull\` or \`Prisma.JsonNull\`
|
|
5178
5168
|
*
|
|
5179
5169
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5180
5170
|
*/
|
|
5181
|
-
export const AnyNull = runtime.
|
|
5171
|
+
export const AnyNull = runtime.AnyNull
|
|
5182
5172
|
`;
|
|
5183
5173
|
|
|
5184
5174
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
@@ -5195,7 +5185,9 @@ var jsDocHeader7 = `/*
|
|
|
5195
5185
|
*/
|
|
5196
5186
|
`;
|
|
5197
5187
|
function createPrismaNamespaceBrowserFile(context) {
|
|
5198
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5188
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5189
|
+
(datamodelEnum) => new Enum(datamodelSchemaEnumToSchemaEnum(datamodelEnum), false).toTS()
|
|
5190
|
+
);
|
|
5199
5191
|
return `${jsDocHeader7}
|
|
5200
5192
|
${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
|
|
5201
5193
|
|
|
@@ -5209,7 +5201,10 @@ ${nullTypes}
|
|
|
5209
5201
|
${new Enum(
|
|
5210
5202
|
{
|
|
5211
5203
|
name: "ModelName",
|
|
5212
|
-
|
|
5204
|
+
data: context.dmmf.mappings.modelOperations.map((m) => ({
|
|
5205
|
+
key: m.model,
|
|
5206
|
+
value: m.model
|
|
5207
|
+
}))
|
|
5213
5208
|
},
|
|
5214
5209
|
true
|
|
5215
5210
|
).toTS()}
|
|
@@ -5222,6 +5217,7 @@ ${prismaEnums?.join("\n\n")}
|
|
|
5222
5217
|
}
|
|
5223
5218
|
|
|
5224
5219
|
// src/TSClient/file-generators/PrismaNamespaceFile.ts
|
|
5220
|
+
import { datamodelSchemaEnumToSchemaEnum as datamodelSchemaEnumToSchemaEnum2 } from "@prisma/dmmf";
|
|
5225
5221
|
import * as ts19 from "@prisma/ts-builders";
|
|
5226
5222
|
|
|
5227
5223
|
// src/TSClient/common.ts
|
|
@@ -5761,7 +5757,9 @@ function createPrismaNamespaceFile(context, options) {
|
|
|
5761
5757
|
ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
|
|
5762
5758
|
ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
|
|
5763
5759
|
].map((i) => ts19.stringify(i));
|
|
5764
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5760
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5761
|
+
(type) => new Enum(datamodelSchemaEnumToSchemaEnum2(type), true).toTS()
|
|
5762
|
+
);
|
|
5765
5763
|
const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
|
|
5766
5764
|
return `${jsDocHeader8}
|
|
5767
5765
|
${imports.join("\n")}
|
|
@@ -5772,7 +5770,10 @@ ${commonCodeTS(options)}
|
|
|
5772
5770
|
${new Enum(
|
|
5773
5771
|
{
|
|
5774
5772
|
name: "ModelName",
|
|
5775
|
-
|
|
5773
|
+
data: context.dmmf.mappings.modelOperations.map((m) => ({
|
|
5774
|
+
key: m.model,
|
|
5775
|
+
value: m.model
|
|
5776
|
+
}))
|
|
5776
5777
|
},
|
|
5777
5778
|
true
|
|
5778
5779
|
).toTS()}
|
|
@@ -5882,8 +5883,6 @@ function clientExtensionsDefinitions() {
|
|
|
5882
5883
|
function buildClientOptions(context, options) {
|
|
5883
5884
|
const clientOptions = ts19.interfaceDeclaration("PrismaClientOptions").add(
|
|
5884
5885
|
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
5886
|
).add(
|
|
5888
5887
|
ts19.property("errorFormat", ts19.namedType("ErrorFormat")).optional().setDocComment(ts19.docComment('@default "colorless"'))
|
|
5889
5888
|
).add(
|
|
@@ -5923,7 +5922,7 @@ function buildClientOptions(context, options) {
|
|
|
5923
5922
|
timeout ?= 5000
|
|
5924
5923
|
`)
|
|
5925
5924
|
);
|
|
5926
|
-
if (["library", "client", "wasm-compiler-edge"
|
|
5925
|
+
if (["library", "client", "wasm-compiler-edge"].includes(options.runtimeName)) {
|
|
5927
5926
|
clientOptions.add(
|
|
5928
5927
|
ts19.property("adapter", ts19.unionType([ts19.namedType("runtime.SqlDriverAdapterFactory"), ts19.namedType("null")])).optional().setDocComment(
|
|
5929
5928
|
ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
|
|
@@ -6319,7 +6318,7 @@ function buildClient({
|
|
|
6319
6318
|
postinstall,
|
|
6320
6319
|
copyEngine,
|
|
6321
6320
|
datamodel,
|
|
6322
|
-
edge: ["
|
|
6321
|
+
edge: ["wasm-compiler-edge"].includes(runtimeName),
|
|
6323
6322
|
runtimeName,
|
|
6324
6323
|
target,
|
|
6325
6324
|
generatedFileExtension,
|
|
@@ -6327,9 +6326,6 @@ function buildClient({
|
|
|
6327
6326
|
moduleFormat,
|
|
6328
6327
|
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6329
6328
|
};
|
|
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
6329
|
const client = new TSClient(clientOptions);
|
|
6334
6330
|
let fileMap = client.generateClientFiles();
|
|
6335
6331
|
if (typedSql && typedSql.length > 0) {
|
|
@@ -6559,9 +6555,7 @@ function getRuntimeNameForTarget(target, engineType) {
|
|
|
6559
6555
|
return getNodeRuntimeName(engineType);
|
|
6560
6556
|
case "workerd":
|
|
6561
6557
|
case "vercel-edge":
|
|
6562
|
-
return
|
|
6563
|
-
case "react-native":
|
|
6564
|
-
return "react-native";
|
|
6558
|
+
return "wasm-compiler-edge";
|
|
6565
6559
|
default:
|
|
6566
6560
|
assertNever3(target, "Unknown runtime target");
|
|
6567
6561
|
}
|
|
@@ -6619,7 +6613,7 @@ import { getTsconfig } from "get-tsconfig";
|
|
|
6619
6613
|
import { match as match2 } from "ts-pattern";
|
|
6620
6614
|
|
|
6621
6615
|
// package.json
|
|
6622
|
-
var version = "6.19.0-integration-
|
|
6616
|
+
var version = "6.19.0-integration-next.5";
|
|
6623
6617
|
|
|
6624
6618
|
// src/module-format.ts
|
|
6625
6619
|
function parseModuleFormat(format) {
|
|
@@ -6662,16 +6656,7 @@ function fromTsConfigModule(module) {
|
|
|
6662
6656
|
}
|
|
6663
6657
|
|
|
6664
6658
|
// 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
|
-
];
|
|
6659
|
+
var supportedPublicRuntimes = ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light"];
|
|
6675
6660
|
function parseRuntimeTarget(target) {
|
|
6676
6661
|
switch (target.toLowerCase()) {
|
|
6677
6662
|
case "workerd":
|
|
@@ -6685,8 +6670,6 @@ function parseRuntimeTarget(target) {
|
|
|
6685
6670
|
return "nodejs";
|
|
6686
6671
|
case "deno":
|
|
6687
6672
|
return "deno";
|
|
6688
|
-
case "react-native":
|
|
6689
|
-
return "react-native";
|
|
6690
6673
|
default:
|
|
6691
6674
|
throw new Error(
|
|
6692
6675
|
`Unknown target runtime: "${target}". The available options are: ${supportedPublicRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
|
|
@@ -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.5",
|
|
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.
|
|
28
|
+
"@prisma/engines-version": "6.18.0-8.34b5a692b7bd79939a9a2c3ef97d816e749cda2f",
|
|
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/client-common": "6.19.0-integration-
|
|
38
|
-
"@prisma/
|
|
39
|
-
"@prisma/
|
|
40
|
-
"@prisma/
|
|
41
|
-
"@prisma/
|
|
42
|
-
"@prisma/
|
|
43
|
-
"@prisma/internals": "6.19.0-integration-
|
|
44
|
-
"@prisma/ts-builders": "6.19.0-integration-
|
|
37
|
+
"@prisma/client-common": "6.19.0-integration-next.5",
|
|
38
|
+
"@prisma/debug": "6.19.0-integration-next.5",
|
|
39
|
+
"@prisma/dmmf": "6.19.0-integration-next.5",
|
|
40
|
+
"@prisma/generator": "6.19.0-integration-next.5",
|
|
41
|
+
"@prisma/get-platform": "6.19.0-integration-next.5",
|
|
42
|
+
"@prisma/fetch-engine": "6.19.0-integration-next.5",
|
|
43
|
+
"@prisma/internals": "6.19.0-integration-next.5",
|
|
44
|
+
"@prisma/ts-builders": "6.19.0-integration-next.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/pluralize": "0.0.33",
|