@prisma/client-generator-ts 7.3.0-dev.1 → 7.3.0-dev.10
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/generateClient.d.ts +2 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +51 -35
- package/dist/index.mjs +51 -35
- package/dist/utils/wasm.d.ts +4 -2
- package/package.json +10 -10
package/dist/generateClient.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export interface GenerateClientOptions {
|
|
|
29
29
|
moduleFormat: ModuleFormat;
|
|
30
30
|
/** Include a "@ts-nocheck" comment at the top of all generated TS files */
|
|
31
31
|
tsNoCheckPreamble: Boolean;
|
|
32
|
+
compilerBuild: 'fast' | 'small';
|
|
32
33
|
}
|
|
33
34
|
export interface FileMap {
|
|
34
35
|
[name: string]: string | Buffer | FileMap;
|
|
@@ -37,5 +38,5 @@ export interface BuildClientResult {
|
|
|
37
38
|
fileMap: FileMap;
|
|
38
39
|
prismaClientDmmf: DMMF.Document;
|
|
39
40
|
}
|
|
40
|
-
export declare function buildClient({ schemaPath, runtimeBase, datamodel, binaryPaths, outputDir, generator, dmmf, datasources, engineVersion, clientVersion, activeProvider, typedSql, target, generatedFileExtension, importFileExtension, moduleFormat, tsNoCheckPreamble, }: O.Required<GenerateClientOptions, 'runtimeBase'>): BuildClientResult;
|
|
41
|
+
export declare function buildClient({ schemaPath, runtimeBase, datamodel, binaryPaths, outputDir, generator, dmmf, datasources, engineVersion, clientVersion, activeProvider, typedSql, target, generatedFileExtension, importFileExtension, moduleFormat, tsNoCheckPreamble, compilerBuild, }: O.Required<GenerateClientOptions, 'runtimeBase'>): BuildClientResult;
|
|
41
42
|
export declare function generateClient(options: GenerateClientOptions): Promise<void>;
|
package/dist/index.d.mts
CHANGED
|
@@ -43,6 +43,7 @@ export declare interface GenerateClientOptions {
|
|
|
43
43
|
moduleFormat: ModuleFormat;
|
|
44
44
|
/** Include a "@ts-nocheck" comment at the top of all generated TS files */
|
|
45
45
|
tsNoCheckPreamble: Boolean;
|
|
46
|
+
compilerBuild: 'fast' | 'small';
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
declare type GeneratedFileExtension = (typeof expectedGeneratedFileExtensions)[number] | (string & {});
|
package/dist/index.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare interface GenerateClientOptions {
|
|
|
43
43
|
moduleFormat: ModuleFormat;
|
|
44
44
|
/** Include a "@ts-nocheck" comment at the top of all generated TS files */
|
|
45
45
|
tsNoCheckPreamble: Boolean;
|
|
46
|
+
compilerBuild: 'fast' | 'small';
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
declare type GeneratedFileExtension = (typeof expectedGeneratedFileExtensions)[number] | (string & {});
|
package/dist/index.js
CHANGED
|
@@ -2384,7 +2384,7 @@ var Enum = class {
|
|
|
2384
2384
|
toTS() {
|
|
2385
2385
|
const { type } = this;
|
|
2386
2386
|
const enumVariants = `{
|
|
2387
|
-
${(0, import_indent_string.default)(type.
|
|
2387
|
+
${(0, import_indent_string.default)(type.values.map((v) => `${v}: ${this.getValue(v)}`).join(",\n"), TAB_SIZE)}
|
|
2388
2388
|
} as const`;
|
|
2389
2389
|
const enumBody = this.isStrictEnum() ? `runtime.makeStrictEnum(${enumVariants})` : enumVariants;
|
|
2390
2390
|
return `export const ${type.name} = ${enumBody}
|
|
@@ -3433,19 +3433,26 @@ var debug = (0, import_debug.Debug)("prisma:client-generator-ts:wasm");
|
|
|
3433
3433
|
function usesEdgeWasmRuntime(runtimeName) {
|
|
3434
3434
|
return runtimeName === "wasm-compiler-edge";
|
|
3435
3435
|
}
|
|
3436
|
-
function buildGetWasmModule({
|
|
3436
|
+
function buildGetWasmModule({
|
|
3437
|
+
runtimeName,
|
|
3438
|
+
runtimeBase,
|
|
3439
|
+
activeProvider,
|
|
3440
|
+
moduleFormat,
|
|
3441
|
+
compilerBuild
|
|
3442
|
+
}) {
|
|
3437
3443
|
const extension = (0, import_ts_pattern.match)(moduleFormat).with("esm", () => "mjs").with("cjs", () => "js").exhaustive();
|
|
3438
3444
|
const buildNonEdgeLoader = runtimeName === "client";
|
|
3439
3445
|
const buildEdgeLoader = !buildNonEdgeLoader;
|
|
3446
|
+
const artifactName = `query_compiler_${compilerBuild}_bg`;
|
|
3440
3447
|
let wasmPathBase;
|
|
3441
3448
|
let wasmBindingsPath;
|
|
3442
3449
|
let wasmModulePath;
|
|
3443
3450
|
if (buildEdgeLoader) {
|
|
3444
|
-
wasmPathBase =
|
|
3451
|
+
wasmPathBase = `./${artifactName}`;
|
|
3445
3452
|
wasmBindingsPath = `${wasmPathBase}.js`;
|
|
3446
3453
|
wasmModulePath = `${wasmPathBase}.wasm`;
|
|
3447
3454
|
} else {
|
|
3448
|
-
wasmPathBase = `${runtimeBase}
|
|
3455
|
+
wasmPathBase = `${runtimeBase}/${artifactName}.${activeProvider}`;
|
|
3449
3456
|
wasmBindingsPath = `${wasmPathBase}.mjs`;
|
|
3450
3457
|
wasmModulePath = `${wasmPathBase}.wasm`;
|
|
3451
3458
|
}
|
|
@@ -3465,7 +3472,9 @@ config.compilerWasm = {
|
|
|
3465
3472
|
getQueryCompilerWasmModule: async () => {
|
|
3466
3473
|
const { wasm } = await import(${JSON.stringify(wasmModulePath)})
|
|
3467
3474
|
return await decodeBase64AsWasm(wasm)
|
|
3468
|
-
}
|
|
3475
|
+
},
|
|
3476
|
+
|
|
3477
|
+
importName: ${JSON.stringify(`./${artifactName}.js`)}
|
|
3469
3478
|
}`;
|
|
3470
3479
|
}
|
|
3471
3480
|
if (buildEdgeLoader) {
|
|
@@ -3475,7 +3484,9 @@ config.compilerWasm = {
|
|
|
3475
3484
|
getQueryCompilerWasmModule: async () => {
|
|
3476
3485
|
const { default: module } = await import(${JSON.stringify(`${wasmModulePath}?module`)})
|
|
3477
3486
|
return module
|
|
3478
|
-
}
|
|
3487
|
+
},
|
|
3488
|
+
|
|
3489
|
+
importName: ${JSON.stringify(`./${artifactName}.js`)}
|
|
3479
3490
|
}`;
|
|
3480
3491
|
}
|
|
3481
3492
|
return `config.compilerWasm = undefined`;
|
|
@@ -3493,17 +3504,18 @@ function readSourceFile(sourceFile) {
|
|
|
3493
3504
|
throw new Error(`Could not find ${sourceFile} in ${bundledLocation} or ${sourceLocation}`);
|
|
3494
3505
|
}
|
|
3495
3506
|
}
|
|
3496
|
-
function buildWasmFileMap({ activeProvider, runtimeName }) {
|
|
3507
|
+
function buildWasmFileMap({ activeProvider, runtimeName, compilerBuild }) {
|
|
3497
3508
|
const fileMap = {};
|
|
3498
3509
|
debug("buildWasmFileMap with", { runtimeName });
|
|
3499
3510
|
if (!usesEdgeWasmRuntime(runtimeName)) {
|
|
3500
3511
|
debug("Skipping component compiler for runtime", runtimeName);
|
|
3501
3512
|
return fileMap;
|
|
3502
3513
|
}
|
|
3503
|
-
const
|
|
3514
|
+
const artifactName = `query_compiler_${compilerBuild}_bg`;
|
|
3515
|
+
const fileNameBase = `${artifactName}.${activeProvider}`;
|
|
3504
3516
|
const files = {
|
|
3505
|
-
[
|
|
3506
|
-
[
|
|
3517
|
+
[`${artifactName}.wasm`]: `${fileNameBase}.wasm`,
|
|
3518
|
+
[`${artifactName}.js`]: `${fileNameBase}.mjs`
|
|
3507
3519
|
};
|
|
3508
3520
|
for (const [targetFile, sourceFile] of Object.entries(files)) {
|
|
3509
3521
|
fileMap[targetFile] = readSourceFile(sourceFile);
|
|
@@ -3817,7 +3829,8 @@ function clientConfig(context, options) {
|
|
|
3817
3829
|
runtimeName,
|
|
3818
3830
|
target,
|
|
3819
3831
|
activeProvider,
|
|
3820
|
-
moduleFormat
|
|
3832
|
+
moduleFormat,
|
|
3833
|
+
compilerBuild
|
|
3821
3834
|
} = options;
|
|
3822
3835
|
const config = {
|
|
3823
3836
|
previewFeatures: generator.previewFeatures,
|
|
@@ -3830,7 +3843,7 @@ function clientConfig(context, options) {
|
|
|
3830
3843
|
return `
|
|
3831
3844
|
const config: runtime.GetPrismaClientConfig = ${JSON.stringify(config, null, 2)}
|
|
3832
3845
|
${buildRuntimeDataModel(context.dmmf.datamodel, runtimeName)}
|
|
3833
|
-
${buildGetWasmModule({ runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
|
|
3846
|
+
${buildGetWasmModule({ runtimeBase, runtimeName, target, activeProvider, moduleFormat, compilerBuild })}
|
|
3834
3847
|
${buildDebugInitialization(edge)}
|
|
3835
3848
|
`;
|
|
3836
3849
|
}
|
|
@@ -4975,7 +4988,6 @@ function createModelsFile(context, modelsNames) {
|
|
|
4975
4988
|
}
|
|
4976
4989
|
|
|
4977
4990
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
4978
|
-
var import_dmmf2 = require("@prisma/dmmf");
|
|
4979
4991
|
var ts16 = __toESM(require("@prisma/ts-builders"));
|
|
4980
4992
|
|
|
4981
4993
|
// src/TSClient/NullTypes.ts
|
|
@@ -5021,9 +5033,7 @@ var jsDocHeader7 = `/*
|
|
|
5021
5033
|
*/
|
|
5022
5034
|
`;
|
|
5023
5035
|
function createPrismaNamespaceBrowserFile(context) {
|
|
5024
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5025
|
-
(datamodelEnum) => new Enum((0, import_dmmf2.datamodelSchemaEnumToSchemaEnum)(datamodelEnum), false).toTS()
|
|
5026
|
-
);
|
|
5036
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
|
|
5027
5037
|
return `${jsDocHeader7}
|
|
5028
5038
|
${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
|
|
5029
5039
|
|
|
@@ -5037,10 +5047,7 @@ ${nullTypes}
|
|
|
5037
5047
|
${new Enum(
|
|
5038
5048
|
{
|
|
5039
5049
|
name: "ModelName",
|
|
5040
|
-
|
|
5041
|
-
key: m.model,
|
|
5042
|
-
value: m.model
|
|
5043
|
-
}))
|
|
5050
|
+
values: context.dmmf.mappings.modelOperations.map((m) => m.model)
|
|
5044
5051
|
},
|
|
5045
5052
|
true
|
|
5046
5053
|
).toTS()}
|
|
@@ -5053,7 +5060,6 @@ ${prismaEnums?.join("\n\n")}
|
|
|
5053
5060
|
}
|
|
5054
5061
|
|
|
5055
5062
|
// src/TSClient/file-generators/PrismaNamespaceFile.ts
|
|
5056
|
-
var import_dmmf3 = require("@prisma/dmmf");
|
|
5057
5063
|
var ts19 = __toESM(require("@prisma/ts-builders"));
|
|
5058
5064
|
|
|
5059
5065
|
// src/TSClient/common.ts
|
|
@@ -5566,9 +5572,7 @@ function createPrismaNamespaceFile(context, options) {
|
|
|
5566
5572
|
ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
|
|
5567
5573
|
ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
|
|
5568
5574
|
].map((i) => ts19.stringify(i));
|
|
5569
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5570
|
-
(type) => new Enum((0, import_dmmf3.datamodelSchemaEnumToSchemaEnum)(type), true).toTS()
|
|
5571
|
-
);
|
|
5575
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
|
|
5572
5576
|
const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
|
|
5573
5577
|
return `${jsDocHeader8}
|
|
5574
5578
|
${imports.join("\n")}
|
|
@@ -5579,10 +5583,7 @@ ${commonCodeTS(options)}
|
|
|
5579
5583
|
${new Enum(
|
|
5580
5584
|
{
|
|
5581
5585
|
name: "ModelName",
|
|
5582
|
-
|
|
5583
|
-
key: m.model,
|
|
5584
|
-
value: m.model
|
|
5585
|
-
}))
|
|
5586
|
+
values: context.dmmf.mappings.modelOperations.map((m) => m.model)
|
|
5586
5587
|
},
|
|
5587
5588
|
true
|
|
5588
5589
|
).toTS()}
|
|
@@ -6131,7 +6132,8 @@ function buildClient({
|
|
|
6131
6132
|
generatedFileExtension,
|
|
6132
6133
|
importFileExtension,
|
|
6133
6134
|
moduleFormat,
|
|
6134
|
-
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6135
|
+
tsNoCheckPreamble: tsNoCheckPreamble2,
|
|
6136
|
+
compilerBuild
|
|
6135
6137
|
}) {
|
|
6136
6138
|
const runtimeName = getRuntimeNameForTarget(target);
|
|
6137
6139
|
const outputName = generatedFileNameMapper(generatedFileExtension);
|
|
@@ -6154,7 +6156,8 @@ function buildClient({
|
|
|
6154
6156
|
generatedFileExtension,
|
|
6155
6157
|
importFileExtension,
|
|
6156
6158
|
moduleFormat,
|
|
6157
|
-
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6159
|
+
tsNoCheckPreamble: tsNoCheckPreamble2,
|
|
6160
|
+
compilerBuild
|
|
6158
6161
|
};
|
|
6159
6162
|
const client = new TSClient(clientOptions);
|
|
6160
6163
|
let fileMap = client.generateClientFiles();
|
|
@@ -6177,7 +6180,8 @@ function buildClient({
|
|
|
6177
6180
|
...fileMap.internal,
|
|
6178
6181
|
...buildWasmFileMap({
|
|
6179
6182
|
runtimeName,
|
|
6180
|
-
activeProvider
|
|
6183
|
+
activeProvider,
|
|
6184
|
+
compilerBuild
|
|
6181
6185
|
})
|
|
6182
6186
|
}
|
|
6183
6187
|
};
|
|
@@ -6214,7 +6218,8 @@ async function generateClient(options) {
|
|
|
6214
6218
|
generatedFileExtension,
|
|
6215
6219
|
importFileExtension,
|
|
6216
6220
|
moduleFormat,
|
|
6217
|
-
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6221
|
+
tsNoCheckPreamble: tsNoCheckPreamble2,
|
|
6222
|
+
compilerBuild
|
|
6218
6223
|
} = options;
|
|
6219
6224
|
const { runtimeBase, outputDir } = await getGenerationDirs(options);
|
|
6220
6225
|
const { prismaClientDmmf, fileMap } = buildClient({
|
|
@@ -6234,7 +6239,8 @@ async function generateClient(options) {
|
|
|
6234
6239
|
generatedFileExtension,
|
|
6235
6240
|
importFileExtension,
|
|
6236
6241
|
moduleFormat,
|
|
6237
|
-
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6242
|
+
tsNoCheckPreamble: tsNoCheckPreamble2,
|
|
6243
|
+
compilerBuild
|
|
6238
6244
|
});
|
|
6239
6245
|
const denylistsErrors = validateDmmfAgainstDenylists(prismaClientDmmf);
|
|
6240
6246
|
if (denylistsErrors) {
|
|
@@ -6406,7 +6412,7 @@ var import_internals7 = require("@prisma/internals");
|
|
|
6406
6412
|
var import_get_tsconfig = require("get-tsconfig");
|
|
6407
6413
|
|
|
6408
6414
|
// package.json
|
|
6409
|
-
var version = "7.3.0-dev.
|
|
6415
|
+
var version = "7.3.0-dev.10";
|
|
6410
6416
|
|
|
6411
6417
|
// src/module-format.ts
|
|
6412
6418
|
function parseModuleFormat(format) {
|
|
@@ -6536,11 +6542,21 @@ var PrismaClientTsGenerator = class {
|
|
|
6536
6542
|
generatedFileExtension,
|
|
6537
6543
|
importFileExtension,
|
|
6538
6544
|
moduleFormat,
|
|
6539
|
-
tsNoCheckPreamble: true
|
|
6545
|
+
tsNoCheckPreamble: true,
|
|
6540
6546
|
// Set to false only during internal tests
|
|
6547
|
+
compilerBuild: parseCompilerBuildFromUnknown(options.generator.config.compilerBuild, target)
|
|
6541
6548
|
});
|
|
6542
6549
|
}
|
|
6543
6550
|
};
|
|
6551
|
+
function parseCompilerBuildFromUnknown(value, target) {
|
|
6552
|
+
if (value === void 0) {
|
|
6553
|
+
return target === "vercel-edge" ? "small" : "fast";
|
|
6554
|
+
}
|
|
6555
|
+
if (value === "small" || value === "fast") {
|
|
6556
|
+
return value;
|
|
6557
|
+
}
|
|
6558
|
+
throw new Error(`Invalid compiler build: ${JSON.stringify(value)}, expected one of: "fast", "small"`);
|
|
6559
|
+
}
|
|
6544
6560
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6545
6561
|
0 && (module.exports = {
|
|
6546
6562
|
PrismaClientTsGenerator,
|
package/dist/index.mjs
CHANGED
|
@@ -2374,7 +2374,7 @@ var Enum = class {
|
|
|
2374
2374
|
toTS() {
|
|
2375
2375
|
const { type } = this;
|
|
2376
2376
|
const enumVariants = `{
|
|
2377
|
-
${indent(type.
|
|
2377
|
+
${indent(type.values.map((v) => `${v}: ${this.getValue(v)}`).join(",\n"), TAB_SIZE)}
|
|
2378
2378
|
} as const`;
|
|
2379
2379
|
const enumBody = this.isStrictEnum() ? `runtime.makeStrictEnum(${enumVariants})` : enumVariants;
|
|
2380
2380
|
return `export const ${type.name} = ${enumBody}
|
|
@@ -3426,19 +3426,26 @@ var debug = Debug("prisma:client-generator-ts:wasm");
|
|
|
3426
3426
|
function usesEdgeWasmRuntime(runtimeName) {
|
|
3427
3427
|
return runtimeName === "wasm-compiler-edge";
|
|
3428
3428
|
}
|
|
3429
|
-
function buildGetWasmModule({
|
|
3429
|
+
function buildGetWasmModule({
|
|
3430
|
+
runtimeName,
|
|
3431
|
+
runtimeBase,
|
|
3432
|
+
activeProvider,
|
|
3433
|
+
moduleFormat,
|
|
3434
|
+
compilerBuild
|
|
3435
|
+
}) {
|
|
3430
3436
|
const extension = match(moduleFormat).with("esm", () => "mjs").with("cjs", () => "js").exhaustive();
|
|
3431
3437
|
const buildNonEdgeLoader = runtimeName === "client";
|
|
3432
3438
|
const buildEdgeLoader = !buildNonEdgeLoader;
|
|
3439
|
+
const artifactName = `query_compiler_${compilerBuild}_bg`;
|
|
3433
3440
|
let wasmPathBase;
|
|
3434
3441
|
let wasmBindingsPath;
|
|
3435
3442
|
let wasmModulePath;
|
|
3436
3443
|
if (buildEdgeLoader) {
|
|
3437
|
-
wasmPathBase =
|
|
3444
|
+
wasmPathBase = `./${artifactName}`;
|
|
3438
3445
|
wasmBindingsPath = `${wasmPathBase}.js`;
|
|
3439
3446
|
wasmModulePath = `${wasmPathBase}.wasm`;
|
|
3440
3447
|
} else {
|
|
3441
|
-
wasmPathBase = `${runtimeBase}
|
|
3448
|
+
wasmPathBase = `${runtimeBase}/${artifactName}.${activeProvider}`;
|
|
3442
3449
|
wasmBindingsPath = `${wasmPathBase}.mjs`;
|
|
3443
3450
|
wasmModulePath = `${wasmPathBase}.wasm`;
|
|
3444
3451
|
}
|
|
@@ -3458,7 +3465,9 @@ config.compilerWasm = {
|
|
|
3458
3465
|
getQueryCompilerWasmModule: async () => {
|
|
3459
3466
|
const { wasm } = await import(${JSON.stringify(wasmModulePath)})
|
|
3460
3467
|
return await decodeBase64AsWasm(wasm)
|
|
3461
|
-
}
|
|
3468
|
+
},
|
|
3469
|
+
|
|
3470
|
+
importName: ${JSON.stringify(`./${artifactName}.js`)}
|
|
3462
3471
|
}`;
|
|
3463
3472
|
}
|
|
3464
3473
|
if (buildEdgeLoader) {
|
|
@@ -3468,7 +3477,9 @@ config.compilerWasm = {
|
|
|
3468
3477
|
getQueryCompilerWasmModule: async () => {
|
|
3469
3478
|
const { default: module } = await import(${JSON.stringify(`${wasmModulePath}?module`)})
|
|
3470
3479
|
return module
|
|
3471
|
-
}
|
|
3480
|
+
},
|
|
3481
|
+
|
|
3482
|
+
importName: ${JSON.stringify(`./${artifactName}.js`)}
|
|
3472
3483
|
}`;
|
|
3473
3484
|
}
|
|
3474
3485
|
return `config.compilerWasm = undefined`;
|
|
@@ -3486,17 +3497,18 @@ function readSourceFile(sourceFile) {
|
|
|
3486
3497
|
throw new Error(`Could not find ${sourceFile} in ${bundledLocation} or ${sourceLocation}`);
|
|
3487
3498
|
}
|
|
3488
3499
|
}
|
|
3489
|
-
function buildWasmFileMap({ activeProvider, runtimeName }) {
|
|
3500
|
+
function buildWasmFileMap({ activeProvider, runtimeName, compilerBuild }) {
|
|
3490
3501
|
const fileMap = {};
|
|
3491
3502
|
debug("buildWasmFileMap with", { runtimeName });
|
|
3492
3503
|
if (!usesEdgeWasmRuntime(runtimeName)) {
|
|
3493
3504
|
debug("Skipping component compiler for runtime", runtimeName);
|
|
3494
3505
|
return fileMap;
|
|
3495
3506
|
}
|
|
3496
|
-
const
|
|
3507
|
+
const artifactName = `query_compiler_${compilerBuild}_bg`;
|
|
3508
|
+
const fileNameBase = `${artifactName}.${activeProvider}`;
|
|
3497
3509
|
const files = {
|
|
3498
|
-
[
|
|
3499
|
-
[
|
|
3510
|
+
[`${artifactName}.wasm`]: `${fileNameBase}.wasm`,
|
|
3511
|
+
[`${artifactName}.js`]: `${fileNameBase}.mjs`
|
|
3500
3512
|
};
|
|
3501
3513
|
for (const [targetFile, sourceFile] of Object.entries(files)) {
|
|
3502
3514
|
fileMap[targetFile] = readSourceFile(sourceFile);
|
|
@@ -3810,7 +3822,8 @@ function clientConfig(context, options) {
|
|
|
3810
3822
|
runtimeName,
|
|
3811
3823
|
target,
|
|
3812
3824
|
activeProvider,
|
|
3813
|
-
moduleFormat
|
|
3825
|
+
moduleFormat,
|
|
3826
|
+
compilerBuild
|
|
3814
3827
|
} = options;
|
|
3815
3828
|
const config = {
|
|
3816
3829
|
previewFeatures: generator.previewFeatures,
|
|
@@ -3823,7 +3836,7 @@ function clientConfig(context, options) {
|
|
|
3823
3836
|
return `
|
|
3824
3837
|
const config: runtime.GetPrismaClientConfig = ${JSON.stringify(config, null, 2)}
|
|
3825
3838
|
${buildRuntimeDataModel(context.dmmf.datamodel, runtimeName)}
|
|
3826
|
-
${buildGetWasmModule({ runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
|
|
3839
|
+
${buildGetWasmModule({ runtimeBase, runtimeName, target, activeProvider, moduleFormat, compilerBuild })}
|
|
3827
3840
|
${buildDebugInitialization(edge)}
|
|
3828
3841
|
`;
|
|
3829
3842
|
}
|
|
@@ -4968,7 +4981,6 @@ function createModelsFile(context, modelsNames) {
|
|
|
4968
4981
|
}
|
|
4969
4982
|
|
|
4970
4983
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
4971
|
-
import { datamodelSchemaEnumToSchemaEnum } from "@prisma/dmmf";
|
|
4972
4984
|
import * as ts16 from "@prisma/ts-builders";
|
|
4973
4985
|
|
|
4974
4986
|
// src/TSClient/NullTypes.ts
|
|
@@ -5014,9 +5026,7 @@ var jsDocHeader7 = `/*
|
|
|
5014
5026
|
*/
|
|
5015
5027
|
`;
|
|
5016
5028
|
function createPrismaNamespaceBrowserFile(context) {
|
|
5017
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5018
|
-
(datamodelEnum) => new Enum(datamodelSchemaEnumToSchemaEnum(datamodelEnum), false).toTS()
|
|
5019
|
-
);
|
|
5029
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
|
|
5020
5030
|
return `${jsDocHeader7}
|
|
5021
5031
|
${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
|
|
5022
5032
|
|
|
@@ -5030,10 +5040,7 @@ ${nullTypes}
|
|
|
5030
5040
|
${new Enum(
|
|
5031
5041
|
{
|
|
5032
5042
|
name: "ModelName",
|
|
5033
|
-
|
|
5034
|
-
key: m.model,
|
|
5035
|
-
value: m.model
|
|
5036
|
-
}))
|
|
5043
|
+
values: context.dmmf.mappings.modelOperations.map((m) => m.model)
|
|
5037
5044
|
},
|
|
5038
5045
|
true
|
|
5039
5046
|
).toTS()}
|
|
@@ -5046,7 +5053,6 @@ ${prismaEnums?.join("\n\n")}
|
|
|
5046
5053
|
}
|
|
5047
5054
|
|
|
5048
5055
|
// src/TSClient/file-generators/PrismaNamespaceFile.ts
|
|
5049
|
-
import { datamodelSchemaEnumToSchemaEnum as datamodelSchemaEnumToSchemaEnum2 } from "@prisma/dmmf";
|
|
5050
5056
|
import * as ts19 from "@prisma/ts-builders";
|
|
5051
5057
|
|
|
5052
5058
|
// src/TSClient/common.ts
|
|
@@ -5559,9 +5565,7 @@ function createPrismaNamespaceFile(context, options) {
|
|
|
5559
5565
|
ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
|
|
5560
5566
|
ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
|
|
5561
5567
|
].map((i) => ts19.stringify(i));
|
|
5562
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5563
|
-
(type) => new Enum(datamodelSchemaEnumToSchemaEnum2(type), true).toTS()
|
|
5564
|
-
);
|
|
5568
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
|
|
5565
5569
|
const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
|
|
5566
5570
|
return `${jsDocHeader8}
|
|
5567
5571
|
${imports.join("\n")}
|
|
@@ -5572,10 +5576,7 @@ ${commonCodeTS(options)}
|
|
|
5572
5576
|
${new Enum(
|
|
5573
5577
|
{
|
|
5574
5578
|
name: "ModelName",
|
|
5575
|
-
|
|
5576
|
-
key: m.model,
|
|
5577
|
-
value: m.model
|
|
5578
|
-
}))
|
|
5579
|
+
values: context.dmmf.mappings.modelOperations.map((m) => m.model)
|
|
5579
5580
|
},
|
|
5580
5581
|
true
|
|
5581
5582
|
).toTS()}
|
|
@@ -6124,7 +6125,8 @@ function buildClient({
|
|
|
6124
6125
|
generatedFileExtension,
|
|
6125
6126
|
importFileExtension,
|
|
6126
6127
|
moduleFormat,
|
|
6127
|
-
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6128
|
+
tsNoCheckPreamble: tsNoCheckPreamble2,
|
|
6129
|
+
compilerBuild
|
|
6128
6130
|
}) {
|
|
6129
6131
|
const runtimeName = getRuntimeNameForTarget(target);
|
|
6130
6132
|
const outputName = generatedFileNameMapper(generatedFileExtension);
|
|
@@ -6147,7 +6149,8 @@ function buildClient({
|
|
|
6147
6149
|
generatedFileExtension,
|
|
6148
6150
|
importFileExtension,
|
|
6149
6151
|
moduleFormat,
|
|
6150
|
-
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6152
|
+
tsNoCheckPreamble: tsNoCheckPreamble2,
|
|
6153
|
+
compilerBuild
|
|
6151
6154
|
};
|
|
6152
6155
|
const client = new TSClient(clientOptions);
|
|
6153
6156
|
let fileMap = client.generateClientFiles();
|
|
@@ -6170,7 +6173,8 @@ function buildClient({
|
|
|
6170
6173
|
...fileMap.internal,
|
|
6171
6174
|
...buildWasmFileMap({
|
|
6172
6175
|
runtimeName,
|
|
6173
|
-
activeProvider
|
|
6176
|
+
activeProvider,
|
|
6177
|
+
compilerBuild
|
|
6174
6178
|
})
|
|
6175
6179
|
}
|
|
6176
6180
|
};
|
|
@@ -6207,7 +6211,8 @@ async function generateClient(options) {
|
|
|
6207
6211
|
generatedFileExtension,
|
|
6208
6212
|
importFileExtension,
|
|
6209
6213
|
moduleFormat,
|
|
6210
|
-
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6214
|
+
tsNoCheckPreamble: tsNoCheckPreamble2,
|
|
6215
|
+
compilerBuild
|
|
6211
6216
|
} = options;
|
|
6212
6217
|
const { runtimeBase, outputDir } = await getGenerationDirs(options);
|
|
6213
6218
|
const { prismaClientDmmf, fileMap } = buildClient({
|
|
@@ -6227,7 +6232,8 @@ async function generateClient(options) {
|
|
|
6227
6232
|
generatedFileExtension,
|
|
6228
6233
|
importFileExtension,
|
|
6229
6234
|
moduleFormat,
|
|
6230
|
-
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6235
|
+
tsNoCheckPreamble: tsNoCheckPreamble2,
|
|
6236
|
+
compilerBuild
|
|
6231
6237
|
});
|
|
6232
6238
|
const denylistsErrors = validateDmmfAgainstDenylists(prismaClientDmmf);
|
|
6233
6239
|
if (denylistsErrors) {
|
|
@@ -6399,7 +6405,7 @@ import { parseEnvValue } from "@prisma/internals";
|
|
|
6399
6405
|
import { getTsconfig } from "get-tsconfig";
|
|
6400
6406
|
|
|
6401
6407
|
// package.json
|
|
6402
|
-
var version = "7.3.0-dev.
|
|
6408
|
+
var version = "7.3.0-dev.10";
|
|
6403
6409
|
|
|
6404
6410
|
// src/module-format.ts
|
|
6405
6411
|
function parseModuleFormat(format) {
|
|
@@ -6529,11 +6535,21 @@ var PrismaClientTsGenerator = class {
|
|
|
6529
6535
|
generatedFileExtension,
|
|
6530
6536
|
importFileExtension,
|
|
6531
6537
|
moduleFormat,
|
|
6532
|
-
tsNoCheckPreamble: true
|
|
6538
|
+
tsNoCheckPreamble: true,
|
|
6533
6539
|
// Set to false only during internal tests
|
|
6540
|
+
compilerBuild: parseCompilerBuildFromUnknown(options.generator.config.compilerBuild, target)
|
|
6534
6541
|
});
|
|
6535
6542
|
}
|
|
6536
6543
|
};
|
|
6544
|
+
function parseCompilerBuildFromUnknown(value, target) {
|
|
6545
|
+
if (value === void 0) {
|
|
6546
|
+
return target === "vercel-edge" ? "small" : "fast";
|
|
6547
|
+
}
|
|
6548
|
+
if (value === "small" || value === "fast") {
|
|
6549
|
+
return value;
|
|
6550
|
+
}
|
|
6551
|
+
throw new Error(`Invalid compiler build: ${JSON.stringify(value)}, expected one of: "fast", "small"`);
|
|
6552
|
+
}
|
|
6537
6553
|
export {
|
|
6538
6554
|
PrismaClientTsGenerator,
|
|
6539
6555
|
externalToInternalDmmf,
|
package/dist/utils/wasm.d.ts
CHANGED
|
@@ -9,10 +9,12 @@ export type BuildWasmModuleOptions = {
|
|
|
9
9
|
target: RuntimeTargetInternal;
|
|
10
10
|
activeProvider: ActiveConnectorType;
|
|
11
11
|
moduleFormat: ModuleFormat;
|
|
12
|
+
compilerBuild: 'fast' | 'small';
|
|
12
13
|
};
|
|
13
|
-
export declare function buildGetWasmModule({ runtimeName, runtimeBase, activeProvider, moduleFormat }: BuildWasmModuleOptions): string;
|
|
14
|
+
export declare function buildGetWasmModule({ runtimeName, runtimeBase, activeProvider, moduleFormat, compilerBuild, }: BuildWasmModuleOptions): string;
|
|
14
15
|
export type BuildWasmFileMapOptions = {
|
|
15
16
|
activeProvider: ActiveConnectorType;
|
|
16
17
|
runtimeName: RuntimeName;
|
|
18
|
+
compilerBuild: 'fast' | 'small';
|
|
17
19
|
};
|
|
18
|
-
export declare function buildWasmFileMap({ activeProvider, runtimeName }: BuildWasmFileMapOptions): FileMap;
|
|
20
|
+
export declare function buildWasmFileMap({ activeProvider, runtimeName, compilerBuild }: BuildWasmFileMapOptions): FileMap;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client-generator-ts",
|
|
3
|
-
"version": "7.3.0-dev.
|
|
3
|
+
"version": "7.3.0-dev.10",
|
|
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": "7.
|
|
28
|
+
"@prisma/engines-version": "7.3.0-8.aee8f579c2872ad0cedd6fd7e9070704fdb3610e",
|
|
29
29
|
"fast-glob": "3.3.3",
|
|
30
30
|
"get-tsconfig": "4.10.0",
|
|
31
31
|
"indent-string": "4.0.0",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"package-up": "5.0.0",
|
|
34
34
|
"pluralize": "8.0.0",
|
|
35
35
|
"ts-pattern": "5.6.2",
|
|
36
|
-
"@prisma/client-common": "7.3.0-dev.
|
|
37
|
-
"@prisma/
|
|
38
|
-
"@prisma/
|
|
39
|
-
"@prisma/
|
|
40
|
-
"@prisma/generator": "7.3.0-dev.
|
|
41
|
-
"@prisma/
|
|
42
|
-
"@prisma/
|
|
43
|
-
"@prisma/ts-builders": "7.3.0-dev.
|
|
36
|
+
"@prisma/client-common": "7.3.0-dev.10",
|
|
37
|
+
"@prisma/debug": "7.3.0-dev.10",
|
|
38
|
+
"@prisma/fetch-engine": "7.3.0-dev.10",
|
|
39
|
+
"@prisma/dmmf": "7.3.0-dev.10",
|
|
40
|
+
"@prisma/generator": "7.3.0-dev.10",
|
|
41
|
+
"@prisma/get-platform": "7.3.0-dev.10",
|
|
42
|
+
"@prisma/internals": "7.3.0-dev.10",
|
|
43
|
+
"@prisma/ts-builders": "7.3.0-dev.10"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/pluralize": "0.0.33",
|