@prisma/client-generator-js 6.7.0-integration-push-qwtnrmswnvqm.1 → 6.8.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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",
@@ -4482,7 +4482,7 @@ var package_default = {
4482
4482
  "@prisma/dmmf": "workspace:*",
4483
4483
  "@prisma/driver-adapter-utils": "workspace:*",
4484
4484
  "@prisma/engines": "workspace:*",
4485
- "@prisma/engines-version": "6.7.0-22.4c3ddfb7dad39802dcdfa9953a1bdf747a5494fa",
4485
+ "@prisma/engines-version": "6.8.0-4.11dc2141e668fa4059294850762e1d75fb54cf47",
4486
4486
  "@prisma/fetch-engine": "workspace:*",
4487
4487
  "@prisma/generator": "workspace:*",
4488
4488
  "@prisma/generator-helper": "workspace:*",
@@ -4492,8 +4492,8 @@ var package_default = {
4492
4492
  "@prisma/migrate": "workspace:*",
4493
4493
  "@prisma/mini-proxy": "0.9.5",
4494
4494
  "@prisma/pg-worker": "workspace:*",
4495
- "@prisma/query-compiler-wasm": "6.7.0-22.4c3ddfb7dad39802dcdfa9953a1bdf747a5494fa",
4496
- "@prisma/query-engine-wasm": "6.7.0-22.4c3ddfb7dad39802dcdfa9953a1bdf747a5494fa",
4495
+ "@prisma/query-compiler-wasm": "6.8.0-4.11dc2141e668fa4059294850762e1d75fb54cf47",
4496
+ "@prisma/query-engine-wasm": "6.8.0-4.11dc2141e668fa4059294850762e1d75fb54cf47",
4497
4497
  "@prisma/ts-builders": "workspace:*",
4498
4498
  "@snaplet/copycat": "6.0.0",
4499
4499
  "@swc-node/register": "1.10.9",
@@ -8531,6 +8531,24 @@ function buildTypedSql({
8531
8531
  return fileMap;
8532
8532
  }
8533
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
+
8534
8552
  // src/generateClient.ts
8535
8553
  var debug = (0, import_debug.Debug)("prisma:client:generateClient");
8536
8554
  var DenylistError = class extends Error {
@@ -8754,6 +8772,7 @@ export * from './edge.js'`;
8754
8772
  });
8755
8773
  }
8756
8774
  fileMap["package.json"] = JSON.stringify(pkgJson, null, 2);
8775
+ addPreambleToJSFiles(fileMap);
8757
8776
  return {
8758
8777
  fileMap,
8759
8778
  // a map of file names to their contents
@@ -8806,6 +8825,9 @@ async function generateClient(options) {
8806
8825
  typedSql
8807
8826
  } = options;
8808
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
+ }
8809
8831
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
8810
8832
  const { prismaClientDmmf, fileMap } = await buildClient({
8811
8833
  datamodel,
@@ -9068,11 +9090,6 @@ function getNodeRuntimeName(engineType) {
9068
9090
  return "library";
9069
9091
  }
9070
9092
  if (engineType === import_internals10.ClientEngineType.Client) {
9071
- if (!process.env.PRISMA_UNSTABLE_CLIENT_ENGINE_TYPE) {
9072
- throw new Error(
9073
- 'Unstable Feature: engineType="client" is in a proof of concept phase and not ready to be used publicly yet!'
9074
- );
9075
- }
9076
9093
  return "client";
9077
9094
  }
9078
9095
  (0, import_internals10.assertNever)(engineType, "Unknown engine type");
@@ -9097,7 +9114,18 @@ async function copyRuntimeFiles({ from, to, runtimeName, sourceMaps }) {
9097
9114
  if (sourceMaps) {
9098
9115
  files.push(...files.filter((file4) => file4.endsWith(".js")).map((file4) => `${file4}.map`));
9099
9116
  }
9100
- 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
+ );
9101
9129
  }
9102
9130
  async function deleteOutputDir(outputDir) {
9103
9131
  try {
@@ -9126,7 +9154,7 @@ var import_internals12 = require("@prisma/internals");
9126
9154
  var import_ts_pattern = require("ts-pattern");
9127
9155
 
9128
9156
  // package.json
9129
- var version = "6.7.0-integration-push-qwtnrmswnvqm.1";
9157
+ var version = "6.8.0-dev.1";
9130
9158
 
9131
9159
  // src/resolvePrismaClient.ts
9132
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",
@@ -4477,7 +4477,7 @@ var package_default = {
4477
4477
  "@prisma/dmmf": "workspace:*",
4478
4478
  "@prisma/driver-adapter-utils": "workspace:*",
4479
4479
  "@prisma/engines": "workspace:*",
4480
- "@prisma/engines-version": "6.7.0-22.4c3ddfb7dad39802dcdfa9953a1bdf747a5494fa",
4480
+ "@prisma/engines-version": "6.8.0-4.11dc2141e668fa4059294850762e1d75fb54cf47",
4481
4481
  "@prisma/fetch-engine": "workspace:*",
4482
4482
  "@prisma/generator": "workspace:*",
4483
4483
  "@prisma/generator-helper": "workspace:*",
@@ -4487,8 +4487,8 @@ var package_default = {
4487
4487
  "@prisma/migrate": "workspace:*",
4488
4488
  "@prisma/mini-proxy": "0.9.5",
4489
4489
  "@prisma/pg-worker": "workspace:*",
4490
- "@prisma/query-compiler-wasm": "6.7.0-22.4c3ddfb7dad39802dcdfa9953a1bdf747a5494fa",
4491
- "@prisma/query-engine-wasm": "6.7.0-22.4c3ddfb7dad39802dcdfa9953a1bdf747a5494fa",
4490
+ "@prisma/query-compiler-wasm": "6.8.0-4.11dc2141e668fa4059294850762e1d75fb54cf47",
4491
+ "@prisma/query-engine-wasm": "6.8.0-4.11dc2141e668fa4059294850762e1d75fb54cf47",
4492
4492
  "@prisma/ts-builders": "workspace:*",
4493
4493
  "@snaplet/copycat": "6.0.0",
4494
4494
  "@swc-node/register": "1.10.9",
@@ -8529,6 +8529,24 @@ function buildTypedSql({
8529
8529
  return fileMap;
8530
8530
  }
8531
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
+
8532
8550
  // src/generateClient.ts
8533
8551
  var debug = Debug("prisma:client:generateClient");
8534
8552
  var DenylistError = class extends Error {
@@ -8752,6 +8770,7 @@ export * from './edge.js'`;
8752
8770
  });
8753
8771
  }
8754
8772
  fileMap["package.json"] = JSON.stringify(pkgJson, null, 2);
8773
+ addPreambleToJSFiles(fileMap);
8755
8774
  return {
8756
8775
  fileMap,
8757
8776
  // a map of file names to their contents
@@ -8804,6 +8823,9 @@ async function generateClient(options) {
8804
8823
  typedSql
8805
8824
  } = options;
8806
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
+ }
8807
8829
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
8808
8830
  const { prismaClientDmmf, fileMap } = await buildClient({
8809
8831
  datamodel,
@@ -9066,11 +9088,6 @@ function getNodeRuntimeName(engineType) {
9066
9088
  return "library";
9067
9089
  }
9068
9090
  if (engineType === ClientEngineType3.Client) {
9069
- if (!process.env.PRISMA_UNSTABLE_CLIENT_ENGINE_TYPE) {
9070
- throw new Error(
9071
- 'Unstable Feature: engineType="client" is in a proof of concept phase and not ready to be used publicly yet!'
9072
- );
9073
- }
9074
9091
  return "client";
9075
9092
  }
9076
9093
  assertNever3(engineType, "Unknown engine type");
@@ -9095,7 +9112,18 @@ async function copyRuntimeFiles({ from, to, runtimeName, sourceMaps }) {
9095
9112
  if (sourceMaps) {
9096
9113
  files.push(...files.filter((file4) => file4.endsWith(".js")).map((file4) => `${file4}.map`));
9097
9114
  }
9098
- 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
+ );
9099
9127
  }
9100
9128
  async function deleteOutputDir(outputDir) {
9101
9129
  try {
@@ -9124,7 +9152,7 @@ import { ClientEngineType as ClientEngineType4, getClientEngineType as getClient
9124
9152
  import { match } from "ts-pattern";
9125
9153
 
9126
9154
  // package.json
9127
- var version = "6.7.0-integration-push-qwtnrmswnvqm.1";
9155
+ var version = "6.8.0-dev.1";
9128
9156
 
9129
9157
  // src/resolvePrismaClient.ts
9130
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-integration-push-qwtnrmswnvqm.1",
3
+ "version": "6.8.0-dev.1",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,7 +25,7 @@
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
27
  "@antfu/ni": "0.21.12",
28
- "@prisma/engines-version": "6.7.0-22.4c3ddfb7dad39802dcdfa9953a1bdf747a5494fa",
28
+ "@prisma/engines-version": "6.8.0-4.11dc2141e668fa4059294850762e1d75fb54cf47",
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-integration-push-qwtnrmswnvqm.1",
37
- "@prisma/debug": "6.7.0-integration-push-qwtnrmswnvqm.1",
38
- "@prisma/fetch-engine": "6.7.0-integration-push-qwtnrmswnvqm.1",
39
- "@prisma/get-platform": "6.7.0-integration-push-qwtnrmswnvqm.1",
40
- "@prisma/dmmf": "6.7.0-integration-push-qwtnrmswnvqm.1",
41
- "@prisma/internals": "6.7.0-integration-push-qwtnrmswnvqm.1",
42
- "@prisma/generator": "6.7.0-integration-push-qwtnrmswnvqm.1",
43
- "@prisma/ts-builders": "6.7.0-integration-push-qwtnrmswnvqm.1"
36
+ "@prisma/debug": "6.8.0-dev.1",
37
+ "@prisma/fetch-engine": "6.8.0-dev.1",
38
+ "@prisma/dmmf": "6.8.0-dev.1",
39
+ "@prisma/generator": "6.8.0-dev.1",
40
+ "@prisma/client-common": "6.8.0-dev.1",
41
+ "@prisma/get-platform": "6.8.0-dev.1",
42
+ "@prisma/internals": "6.8.0-dev.1",
43
+ "@prisma/ts-builders": "6.8.0-dev.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/pluralize": "0.0.33",