@prisma/client-generator-js 6.7.0-dev.4 → 6.7.0-dev.41

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/index.js CHANGED
@@ -4413,7 +4413,7 @@ var package_default = {
4413
4413
  test: "dotenv -e ../../.db.env -- jest --silent",
4414
4414
  "test:e2e": "dotenv -e ../../.db.env -- tsx tests/e2e/_utils/run.ts",
4415
4415
  "test:functional": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts",
4416
- "test:functional:client": "PRISMA_UNSTABLE_CLIENT_ENGINE_TYPE=1 pnpm run test:functional --adapter js_pg --client-runtime client --preview-features driverAdapters --engine-type client --runInBand --json --outputFile tests/functional/results.json decimal",
4416
+ "test:functional:client": "pnpm run test:functional --adapter js_pg --client-runtime client --preview-features driverAdapters,queryCompiler --engine-type client --runInBand --json --outputFile tests/functional/results.json decimal",
4417
4417
  "test:memory": "dotenv -e ../../.db.env -- tsx helpers/memory-tests.ts",
4418
4418
  "test:functional:code": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts --no-types",
4419
4419
  "test:functional:types": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts --types-only",
@@ -4466,6 +4466,7 @@ var package_default = {
4466
4466
  "@opentelemetry/sdk-trace-base": "1.30.1",
4467
4467
  "@opentelemetry/semantic-conventions": "1.30.0",
4468
4468
  "@planetscale/database": "1.19.0",
4469
+ "@prisma/adapter-better-sqlite3": "workspace:*",
4469
4470
  "@prisma/adapter-d1": "workspace:*",
4470
4471
  "@prisma/adapter-libsql": "workspace:*",
4471
4472
  "@prisma/adapter-neon": "workspace:*",
@@ -4481,7 +4482,7 @@ var package_default = {
4481
4482
  "@prisma/dmmf": "workspace:*",
4482
4483
  "@prisma/driver-adapter-utils": "workspace:*",
4483
4484
  "@prisma/engines": "workspace:*",
4484
- "@prisma/engines-version": "6.7.0-2.f1c9ce159931e98b29ab3dd02ba38c01f49dc141",
4485
+ "@prisma/engines-version": "6.7.0-30.7f87299229fa36fe4a2adb8ffcfb188953f13c72",
4485
4486
  "@prisma/fetch-engine": "workspace:*",
4486
4487
  "@prisma/generator": "workspace:*",
4487
4488
  "@prisma/generator-helper": "workspace:*",
@@ -4491,8 +4492,8 @@ var package_default = {
4491
4492
  "@prisma/migrate": "workspace:*",
4492
4493
  "@prisma/mini-proxy": "0.9.5",
4493
4494
  "@prisma/pg-worker": "workspace:*",
4494
- "@prisma/query-compiler-wasm": "6.7.0-2.f1c9ce159931e98b29ab3dd02ba38c01f49dc141",
4495
- "@prisma/query-engine-wasm": "6.7.0-2.f1c9ce159931e98b29ab3dd02ba38c01f49dc141",
4495
+ "@prisma/query-compiler-wasm": "6.7.0-30.7f87299229fa36fe4a2adb8ffcfb188953f13c72",
4496
+ "@prisma/query-engine-wasm": "6.7.0-30.7f87299229fa36fe4a2adb8ffcfb188953f13c72",
4496
4497
  "@prisma/ts-builders": "workspace:*",
4497
4498
  "@snaplet/copycat": "6.0.0",
4498
4499
  "@swc-node/register": "1.10.9",
@@ -8530,6 +8531,24 @@ function buildTypedSql({
8530
8531
  return fileMap;
8531
8532
  }
8532
8533
 
8534
+ // src/utils/addPreamble.ts
8535
+ var generatedCodePreamble = `
8536
+ /* !!! This is code generated by Prisma. Do not edit directly. !!!
8537
+ /* eslint-disable */
8538
+ `;
8539
+ function addPreambleToJSFiles(fileMap) {
8540
+ for (const [key, value] of Object.entries(fileMap)) {
8541
+ if (typeof value === "string" && (key.endsWith(".js") || key.endsWith(".mjs"))) {
8542
+ fileMap[key] = addPreamble(value);
8543
+ } else if (typeof value === "object" && value !== null) {
8544
+ addPreambleToJSFiles(value);
8545
+ }
8546
+ }
8547
+ }
8548
+ function addPreamble(fileContent) {
8549
+ return generatedCodePreamble + fileContent;
8550
+ }
8551
+
8533
8552
  // src/generateClient.ts
8534
8553
  var debug = (0, import_debug.Debug)("prisma:client:generateClient");
8535
8554
  var DenylistError = class extends Error {
@@ -8753,6 +8772,7 @@ export * from './edge.js'`;
8753
8772
  });
8754
8773
  }
8755
8774
  fileMap["package.json"] = JSON.stringify(pkgJson, null, 2);
8775
+ addPreambleToJSFiles(fileMap);
8756
8776
  return {
8757
8777
  fileMap,
8758
8778
  // a map of file names to their contents
@@ -8805,6 +8825,9 @@ async function generateClient(options) {
8805
8825
  typedSql
8806
8826
  } = options;
8807
8827
  const clientEngineType = (0, import_internals10.getClientEngineType)(generator);
8828
+ if (clientEngineType === import_internals10.ClientEngineType.Client && !generator.previewFeatures.includes("queryCompiler")) {
8829
+ throw new Error('`engineType = "client"` requires enabling the `queryCompiler` preview feature');
8830
+ }
8808
8831
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
8809
8832
  const { prismaClientDmmf, fileMap } = await buildClient({
8810
8833
  datamodel,
@@ -9067,11 +9090,6 @@ function getNodeRuntimeName(engineType) {
9067
9090
  return "library";
9068
9091
  }
9069
9092
  if (engineType === import_internals10.ClientEngineType.Client) {
9070
- if (!process.env.PRISMA_UNSTABLE_CLIENT_ENGINE_TYPE) {
9071
- throw new Error(
9072
- 'Unstable Feature: engineType="client" is in a proof of concept phase and not ready to be used publicly yet!'
9073
- );
9074
- }
9075
9093
  return "client";
9076
9094
  }
9077
9095
  (0, import_internals10.assertNever)(engineType, "Unknown engine type");
@@ -9096,7 +9114,18 @@ async function copyRuntimeFiles({ from, to, runtimeName, sourceMaps }) {
9096
9114
  if (sourceMaps) {
9097
9115
  files.push(...files.filter((file4) => file4.endsWith(".js")).map((file4) => `${file4}.map`));
9098
9116
  }
9099
- await Promise.all(files.map((file4) => import_promises.default.copyFile(import_path3.default.join(from, file4), import_path3.default.join(to, file4))));
9117
+ await Promise.all(
9118
+ files.map(async (file4) => {
9119
+ const sourcePath = import_path3.default.join(from, file4);
9120
+ const targetPath = import_path3.default.join(to, file4);
9121
+ if (file4.endsWith(".js")) {
9122
+ const content = await import_promises.default.readFile(sourcePath, "utf-8");
9123
+ await import_promises.default.writeFile(targetPath, addPreamble(content));
9124
+ } else {
9125
+ await import_promises.default.copyFile(sourcePath, targetPath);
9126
+ }
9127
+ })
9128
+ );
9100
9129
  }
9101
9130
  async function deleteOutputDir(outputDir) {
9102
9131
  try {
@@ -9125,7 +9154,7 @@ var import_internals12 = require("@prisma/internals");
9125
9154
  var import_ts_pattern = require("ts-pattern");
9126
9155
 
9127
9156
  // package.json
9128
- var version = "6.7.0-dev.4";
9157
+ var version = "6.7.0-dev.41";
9129
9158
 
9130
9159
  // src/resolvePrismaClient.ts
9131
9160
  var import_promises2 = __toESM(require("node:fs/promises"));
package/dist/index.mjs CHANGED
@@ -4408,7 +4408,7 @@ var package_default = {
4408
4408
  test: "dotenv -e ../../.db.env -- jest --silent",
4409
4409
  "test:e2e": "dotenv -e ../../.db.env -- tsx tests/e2e/_utils/run.ts",
4410
4410
  "test:functional": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts",
4411
- "test:functional:client": "PRISMA_UNSTABLE_CLIENT_ENGINE_TYPE=1 pnpm run test:functional --adapter js_pg --client-runtime client --preview-features driverAdapters --engine-type client --runInBand --json --outputFile tests/functional/results.json decimal",
4411
+ "test:functional:client": "pnpm run test:functional --adapter js_pg --client-runtime client --preview-features driverAdapters,queryCompiler --engine-type client --runInBand --json --outputFile tests/functional/results.json decimal",
4412
4412
  "test:memory": "dotenv -e ../../.db.env -- tsx helpers/memory-tests.ts",
4413
4413
  "test:functional:code": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts --no-types",
4414
4414
  "test:functional:types": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts --types-only",
@@ -4461,6 +4461,7 @@ var package_default = {
4461
4461
  "@opentelemetry/sdk-trace-base": "1.30.1",
4462
4462
  "@opentelemetry/semantic-conventions": "1.30.0",
4463
4463
  "@planetscale/database": "1.19.0",
4464
+ "@prisma/adapter-better-sqlite3": "workspace:*",
4464
4465
  "@prisma/adapter-d1": "workspace:*",
4465
4466
  "@prisma/adapter-libsql": "workspace:*",
4466
4467
  "@prisma/adapter-neon": "workspace:*",
@@ -4476,7 +4477,7 @@ var package_default = {
4476
4477
  "@prisma/dmmf": "workspace:*",
4477
4478
  "@prisma/driver-adapter-utils": "workspace:*",
4478
4479
  "@prisma/engines": "workspace:*",
4479
- "@prisma/engines-version": "6.7.0-2.f1c9ce159931e98b29ab3dd02ba38c01f49dc141",
4480
+ "@prisma/engines-version": "6.7.0-30.7f87299229fa36fe4a2adb8ffcfb188953f13c72",
4480
4481
  "@prisma/fetch-engine": "workspace:*",
4481
4482
  "@prisma/generator": "workspace:*",
4482
4483
  "@prisma/generator-helper": "workspace:*",
@@ -4486,8 +4487,8 @@ var package_default = {
4486
4487
  "@prisma/migrate": "workspace:*",
4487
4488
  "@prisma/mini-proxy": "0.9.5",
4488
4489
  "@prisma/pg-worker": "workspace:*",
4489
- "@prisma/query-compiler-wasm": "6.7.0-2.f1c9ce159931e98b29ab3dd02ba38c01f49dc141",
4490
- "@prisma/query-engine-wasm": "6.7.0-2.f1c9ce159931e98b29ab3dd02ba38c01f49dc141",
4490
+ "@prisma/query-compiler-wasm": "6.7.0-30.7f87299229fa36fe4a2adb8ffcfb188953f13c72",
4491
+ "@prisma/query-engine-wasm": "6.7.0-30.7f87299229fa36fe4a2adb8ffcfb188953f13c72",
4491
4492
  "@prisma/ts-builders": "workspace:*",
4492
4493
  "@snaplet/copycat": "6.0.0",
4493
4494
  "@swc-node/register": "1.10.9",
@@ -8528,6 +8529,24 @@ function buildTypedSql({
8528
8529
  return fileMap;
8529
8530
  }
8530
8531
 
8532
+ // src/utils/addPreamble.ts
8533
+ var generatedCodePreamble = `
8534
+ /* !!! This is code generated by Prisma. Do not edit directly. !!!
8535
+ /* eslint-disable */
8536
+ `;
8537
+ function addPreambleToJSFiles(fileMap) {
8538
+ for (const [key, value] of Object.entries(fileMap)) {
8539
+ if (typeof value === "string" && (key.endsWith(".js") || key.endsWith(".mjs"))) {
8540
+ fileMap[key] = addPreamble(value);
8541
+ } else if (typeof value === "object" && value !== null) {
8542
+ addPreambleToJSFiles(value);
8543
+ }
8544
+ }
8545
+ }
8546
+ function addPreamble(fileContent) {
8547
+ return generatedCodePreamble + fileContent;
8548
+ }
8549
+
8531
8550
  // src/generateClient.ts
8532
8551
  var debug = Debug("prisma:client:generateClient");
8533
8552
  var DenylistError = class extends Error {
@@ -8751,6 +8770,7 @@ export * from './edge.js'`;
8751
8770
  });
8752
8771
  }
8753
8772
  fileMap["package.json"] = JSON.stringify(pkgJson, null, 2);
8773
+ addPreambleToJSFiles(fileMap);
8754
8774
  return {
8755
8775
  fileMap,
8756
8776
  // a map of file names to their contents
@@ -8803,6 +8823,9 @@ async function generateClient(options) {
8803
8823
  typedSql
8804
8824
  } = options;
8805
8825
  const clientEngineType = getClientEngineType2(generator);
8826
+ if (clientEngineType === ClientEngineType3.Client && !generator.previewFeatures.includes("queryCompiler")) {
8827
+ throw new Error('`engineType = "client"` requires enabling the `queryCompiler` preview feature');
8828
+ }
8806
8829
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
8807
8830
  const { prismaClientDmmf, fileMap } = await buildClient({
8808
8831
  datamodel,
@@ -9065,11 +9088,6 @@ function getNodeRuntimeName(engineType) {
9065
9088
  return "library";
9066
9089
  }
9067
9090
  if (engineType === ClientEngineType3.Client) {
9068
- if (!process.env.PRISMA_UNSTABLE_CLIENT_ENGINE_TYPE) {
9069
- throw new Error(
9070
- 'Unstable Feature: engineType="client" is in a proof of concept phase and not ready to be used publicly yet!'
9071
- );
9072
- }
9073
9091
  return "client";
9074
9092
  }
9075
9093
  assertNever3(engineType, "Unknown engine type");
@@ -9094,7 +9112,18 @@ async function copyRuntimeFiles({ from, to, runtimeName, sourceMaps }) {
9094
9112
  if (sourceMaps) {
9095
9113
  files.push(...files.filter((file4) => file4.endsWith(".js")).map((file4) => `${file4}.map`));
9096
9114
  }
9097
- await Promise.all(files.map((file4) => fs.copyFile(path3.join(from, file4), path3.join(to, file4))));
9115
+ await Promise.all(
9116
+ files.map(async (file4) => {
9117
+ const sourcePath = path3.join(from, file4);
9118
+ const targetPath = path3.join(to, file4);
9119
+ if (file4.endsWith(".js")) {
9120
+ const content = await fs.readFile(sourcePath, "utf-8");
9121
+ await fs.writeFile(targetPath, addPreamble(content));
9122
+ } else {
9123
+ await fs.copyFile(sourcePath, targetPath);
9124
+ }
9125
+ })
9126
+ );
9098
9127
  }
9099
9128
  async function deleteOutputDir(outputDir) {
9100
9129
  try {
@@ -9123,7 +9152,7 @@ import { ClientEngineType as ClientEngineType4, getClientEngineType as getClient
9123
9152
  import { match } from "ts-pattern";
9124
9153
 
9125
9154
  // package.json
9126
- var version = "6.7.0-dev.4";
9155
+ var version = "6.7.0-dev.41";
9127
9156
 
9128
9157
  // src/resolvePrismaClient.ts
9129
9158
  var import_execa = __toESM(require_execa());
@@ -0,0 +1,6 @@
1
+ import { FileMap } from '../generateClient';
2
+ /**
3
+ * To ensure it is clear that this is generated code and shall not be lint checked.
4
+ */
5
+ export declare function addPreambleToJSFiles(fileMap: FileMap): void;
6
+ export declare function addPreamble(fileContent: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-generator-js",
3
- "version": "6.7.0-dev.4",
3
+ "version": "6.7.0-dev.41",
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.7.0-2.f1c9ce159931e98b29ab3dd02ba38c01f49dc141",
28
+ "@prisma/engines-version": "6.7.0-30.7f87299229fa36fe4a2adb8ffcfb188953f13c72",
29
29
  "ci-info": "4.2.0",
30
30
  "env-paths": "2.2.1",
31
31
  "indent-string": "4.0.0",
@@ -33,14 +33,14 @@
33
33
  "pkg-up": "3.1.0",
34
34
  "pluralize": "8.0.0",
35
35
  "ts-pattern": "5.6.2",
36
- "@prisma/client-common": "6.7.0-dev.4",
37
- "@prisma/dmmf": "6.7.0-dev.4",
38
- "@prisma/fetch-engine": "6.7.0-dev.4",
39
- "@prisma/generator": "6.7.0-dev.4",
40
- "@prisma/get-platform": "6.7.0-dev.4",
41
- "@prisma/debug": "6.7.0-dev.4",
42
- "@prisma/internals": "6.7.0-dev.4",
43
- "@prisma/ts-builders": "6.7.0-dev.4"
36
+ "@prisma/client-common": "6.7.0-dev.41",
37
+ "@prisma/debug": "6.7.0-dev.41",
38
+ "@prisma/dmmf": "6.7.0-dev.41",
39
+ "@prisma/fetch-engine": "6.7.0-dev.41",
40
+ "@prisma/generator": "6.7.0-dev.41",
41
+ "@prisma/get-platform": "6.7.0-dev.41",
42
+ "@prisma/internals": "6.7.0-dev.41",
43
+ "@prisma/ts-builders": "6.7.0-dev.41"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/pluralize": "0.0.33",