@prisma/client-generator-ts 6.6.0-dev.88 → 6.6.0-dev.90

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.
Files changed (3) hide show
  1. package/dist/index.js +46 -447
  2. package/dist/index.mjs +36 -437
  3. package/package.json +10 -9
package/dist/index.js CHANGED
@@ -494,11 +494,11 @@ var require_graceful_fs = __commonJS({
494
494
  }
495
495
  });
496
496
  }
497
- var debug3 = noop;
497
+ var debug2 = noop;
498
498
  if (util.debuglog)
499
- debug3 = util.debuglog("gfs4");
499
+ debug2 = util.debuglog("gfs4");
500
500
  else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
501
- debug3 = function() {
501
+ debug2 = function() {
502
502
  var m = util.format.apply(util, arguments);
503
503
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
504
504
  console.error(m);
@@ -533,7 +533,7 @@ var require_graceful_fs = __commonJS({
533
533
  }(fs2.closeSync);
534
534
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
535
535
  process.on("exit", function() {
536
- debug3(fs2[gracefulQueue]);
536
+ debug2(fs2[gracefulQueue]);
537
537
  require("assert").equal(fs2[gracefulQueue].length, 0);
538
538
  });
539
539
  }
@@ -786,7 +786,7 @@ var require_graceful_fs = __commonJS({
786
786
  return fs3;
787
787
  }
788
788
  function enqueue(elem) {
789
- debug3("ENQUEUE", elem[0].name, elem[1]);
789
+ debug2("ENQUEUE", elem[0].name, elem[1]);
790
790
  fs2[gracefulQueue].push(elem);
791
791
  retry();
792
792
  }
@@ -813,10 +813,10 @@ var require_graceful_fs = __commonJS({
813
813
  var startTime = elem[3];
814
814
  var lastTime = elem[4];
815
815
  if (startTime === void 0) {
816
- debug3("RETRY", fn.name, args);
816
+ debug2("RETRY", fn.name, args);
817
817
  fn.apply(null, args);
818
818
  } else if (Date.now() - startTime >= 6e4) {
819
- debug3("TIMEOUT", fn.name, args);
819
+ debug2("TIMEOUT", fn.name, args);
820
820
  var cb = args.pop();
821
821
  if (typeof cb === "function")
822
822
  cb.call(null, err);
@@ -825,7 +825,7 @@ var require_graceful_fs = __commonJS({
825
825
  var sinceStart = Math.max(lastTime - startTime, 1);
826
826
  var desiredDelay = Math.min(sinceStart * 1.2, 100);
827
827
  if (sinceAttempt >= desiredDelay) {
828
- debug3("RETRY", fn.name, args);
828
+ debug2("RETRY", fn.name, args);
829
829
  fn.apply(null, args.concat([startTime]));
830
830
  } else {
831
831
  fs2[gracefulQueue].push(elem);
@@ -2223,12 +2223,12 @@ function getMappings(mappings, datamodel) {
2223
2223
  }
2224
2224
 
2225
2225
  // src/generateClient.ts
2226
- var import_debug = __toESM(require("@prisma/debug"));
2226
+ var import_promises = __toESM(require("node:fs/promises"));
2227
+ var import_node_path = __toESM(require("node:path"));
2227
2228
  var import_fetch_engine = require("@prisma/fetch-engine");
2228
2229
  var import_internals10 = require("@prisma/internals");
2229
- var import_crypto2 = require("crypto");
2230
2230
  var import_env_paths = __toESM(require("env-paths"));
2231
- var import_promises = __toESM(require("fs/promises"));
2231
+ var import_fast_glob = require("fast-glob");
2232
2232
  var import_fs_extra = __toESM(require_lib());
2233
2233
 
2234
2234
  // ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs
@@ -2280,326 +2280,8 @@ var bgCyan = init(46, 49);
2280
2280
  var bgWhite = init(47, 49);
2281
2281
 
2282
2282
  // src/generateClient.ts
2283
- var import_path3 = __toESM(require("path"));
2284
2283
  var import_pkg_up = __toESM(require("pkg-up"));
2285
2284
 
2286
- // ../client/package.json
2287
- var package_default = {
2288
- name: "@prisma/client",
2289
- version: "0.0.0",
2290
- description: "Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.",
2291
- keywords: [
2292
- "ORM",
2293
- "Prisma",
2294
- "prisma2",
2295
- "Prisma Client",
2296
- "client",
2297
- "query",
2298
- "query-builder",
2299
- "database",
2300
- "db",
2301
- "JavaScript",
2302
- "JS",
2303
- "TypeScript",
2304
- "TS",
2305
- "SQL",
2306
- "SQLite",
2307
- "pg",
2308
- "Postgres",
2309
- "PostgreSQL",
2310
- "CockroachDB",
2311
- "MySQL",
2312
- "MariaDB",
2313
- "MSSQL",
2314
- "SQL Server",
2315
- "SQLServer",
2316
- "MongoDB",
2317
- "react-native"
2318
- ],
2319
- main: "default.js",
2320
- types: "default.d.ts",
2321
- browser: "index-browser.js",
2322
- exports: {
2323
- "./package.json": "./package.json",
2324
- ".": {
2325
- require: {
2326
- types: "./default.d.ts",
2327
- node: "./default.js",
2328
- "edge-light": "./default.js",
2329
- workerd: "./default.js",
2330
- worker: "./default.js",
2331
- browser: "./index-browser.js"
2332
- },
2333
- import: {
2334
- types: "./default.d.ts",
2335
- node: "./default.js",
2336
- "edge-light": "./default.js",
2337
- workerd: "./default.js",
2338
- worker: "./default.js",
2339
- browser: "./index-browser.js"
2340
- },
2341
- default: "./default.js"
2342
- },
2343
- "./edge": {
2344
- types: "./edge.d.ts",
2345
- require: "./edge.js",
2346
- import: "./edge.js",
2347
- default: "./edge.js"
2348
- },
2349
- "./react-native": {
2350
- types: "./react-native.d.ts",
2351
- require: "./react-native.js",
2352
- import: "./react-native.js",
2353
- default: "./react-native.js"
2354
- },
2355
- "./extension": {
2356
- types: "./extension.d.ts",
2357
- require: "./extension.js",
2358
- import: "./extension.js",
2359
- default: "./extension.js"
2360
- },
2361
- "./index-browser": {
2362
- types: "./index.d.ts",
2363
- require: "./index-browser.js",
2364
- import: "./index-browser.js",
2365
- default: "./index-browser.js"
2366
- },
2367
- "./index": {
2368
- types: "./index.d.ts",
2369
- require: "./index.js",
2370
- import: "./index.js",
2371
- default: "./index.js"
2372
- },
2373
- "./wasm": {
2374
- types: "./wasm.d.ts",
2375
- require: "./wasm.js",
2376
- import: "./wasm.mjs",
2377
- default: "./wasm.mjs"
2378
- },
2379
- "./runtime/client": {
2380
- types: "./runtime/client.d.ts",
2381
- require: "./runtime/client.js",
2382
- import: "./runtime/client.mjs",
2383
- default: "./runtime/client.mjs"
2384
- },
2385
- "./runtime/library": {
2386
- types: "./runtime/library.d.ts",
2387
- require: "./runtime/library.js",
2388
- import: "./runtime/library.mjs",
2389
- default: "./runtime/library.mjs"
2390
- },
2391
- "./runtime/binary": {
2392
- types: "./runtime/binary.d.ts",
2393
- require: "./runtime/binary.js",
2394
- import: "./runtime/binary.mjs",
2395
- default: "./runtime/binary.mjs"
2396
- },
2397
- "./runtime/wasm": {
2398
- types: "./runtime/wasm.d.ts",
2399
- require: "./runtime/wasm.js",
2400
- import: "./runtime/wasm.mjs",
2401
- default: "./runtime/wasm.mjs"
2402
- },
2403
- "./runtime/edge": {
2404
- types: "./runtime/edge.d.ts",
2405
- require: "./runtime/edge.js",
2406
- import: "./runtime/edge-esm.js",
2407
- default: "./runtime/edge-esm.js"
2408
- },
2409
- "./runtime/react-native": {
2410
- types: "./runtime/react-native.d.ts",
2411
- require: "./runtime/react-native.js",
2412
- import: "./runtime/react-native.js",
2413
- default: "./runtime/react-native.js"
2414
- },
2415
- "./generator-build": {
2416
- require: "./generator-build/index.js",
2417
- import: "./generator-build/index.js",
2418
- default: "./generator-build/index.js"
2419
- },
2420
- "./sql": {
2421
- require: {
2422
- types: "./sql.d.ts",
2423
- node: "./sql.js",
2424
- default: "./sql.js"
2425
- },
2426
- import: {
2427
- types: "./sql.d.ts",
2428
- node: "./sql.mjs",
2429
- default: "./sql.mjs"
2430
- },
2431
- default: "./sql.js"
2432
- },
2433
- "./*": "./*"
2434
- },
2435
- license: "Apache-2.0",
2436
- engines: {
2437
- node: ">=18.18"
2438
- },
2439
- homepage: "https://www.prisma.io",
2440
- repository: {
2441
- type: "git",
2442
- url: "https://github.com/prisma/prisma.git",
2443
- directory: "packages/client"
2444
- },
2445
- author: "Tim Suchanek <suchanek@prisma.io>",
2446
- bugs: "https://github.com/prisma/prisma/issues",
2447
- scripts: {
2448
- dev: "DEV=true tsx helpers/build.ts",
2449
- build: "tsx helpers/build.ts",
2450
- test: "dotenv -e ../../.db.env -- jest --silent",
2451
- "test:e2e": "dotenv -e ../../.db.env -- tsx tests/e2e/_utils/run.ts",
2452
- "test:functional": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts",
2453
- "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",
2454
- "test:memory": "dotenv -e ../../.db.env -- tsx helpers/memory-tests.ts",
2455
- "test:functional:code": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts --no-types",
2456
- "test:functional:types": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts --types-only",
2457
- "test:knownQueryCompilerFailures:check": "tsx helpers/functional-test/check-known-failures.ts",
2458
- "test:knownQueryCompilerFailures:record": "tsx helpers/functional-test/check-known-failures.ts --record",
2459
- "test-notypes": "dotenv -e ../../.db.env -- jest --testPathIgnorePatterns src/__tests__/types/types.test.ts",
2460
- generate: "node scripts/postinstall.js",
2461
- postinstall: "node scripts/postinstall.js",
2462
- prepublishOnly: "pnpm run build",
2463
- "new-test": "tsx ./helpers/new-test/new-test.ts"
2464
- },
2465
- files: [
2466
- "README.md",
2467
- "runtime",
2468
- "!runtime/*.map",
2469
- "scripts",
2470
- "generator-build",
2471
- "edge.js",
2472
- "edge.d.ts",
2473
- "wasm.js",
2474
- "wasm.d.ts",
2475
- "index.js",
2476
- "index.d.ts",
2477
- "react-native.js",
2478
- "react-native.d.ts",
2479
- "default.js",
2480
- "default.d.ts",
2481
- "index-browser.js",
2482
- "extension.js",
2483
- "extension.d.ts",
2484
- "sql.d.ts",
2485
- "sql.js",
2486
- "sql.mjs"
2487
- ],
2488
- devDependencies: {
2489
- "@cloudflare/workers-types": "4.20250214.0",
2490
- "@codspeed/benchmark.js-plugin": "4.0.0",
2491
- "@faker-js/faker": "9.6.0",
2492
- "@fast-check/jest": "2.0.3",
2493
- "@inquirer/prompts": "7.3.3",
2494
- "@jest/create-cache-key-function": "29.7.0",
2495
- "@jest/globals": "29.7.0",
2496
- "@jest/test-sequencer": "29.7.0",
2497
- "@libsql/client": "0.8.0",
2498
- "@neondatabase/serverless": "0.10.2",
2499
- "@opentelemetry/api": "1.9.0",
2500
- "@opentelemetry/context-async-hooks": "2.0.0",
2501
- "@opentelemetry/instrumentation": "0.57.2",
2502
- "@opentelemetry/resources": "1.30.1",
2503
- "@opentelemetry/sdk-trace-base": "1.30.1",
2504
- "@opentelemetry/semantic-conventions": "1.30.0",
2505
- "@planetscale/database": "1.19.0",
2506
- "@prisma/adapter-d1": "workspace:*",
2507
- "@prisma/adapter-libsql": "workspace:*",
2508
- "@prisma/adapter-neon": "workspace:*",
2509
- "@prisma/adapter-pg": "workspace:*",
2510
- "@prisma/adapter-pg-worker": "workspace:*",
2511
- "@prisma/adapter-planetscale": "workspace:*",
2512
- "@prisma/client-common": "workspace:*",
2513
- "@prisma/client-engine-runtime": "workspace:*",
2514
- "@prisma/client-generator-js": "workspace:*",
2515
- "@prisma/client-generator-ts": "workspace:*",
2516
- "@prisma/config": "workspace:*",
2517
- "@prisma/debug": "workspace:*",
2518
- "@prisma/dmmf": "workspace:*",
2519
- "@prisma/driver-adapter-utils": "workspace:*",
2520
- "@prisma/engines": "workspace:*",
2521
- "@prisma/engines-version": "6.6.0-45.fbda4d61f6cc9c7361b803e72f3a0ffeb87db447",
2522
- "@prisma/fetch-engine": "workspace:*",
2523
- "@prisma/generator": "workspace:*",
2524
- "@prisma/generator-helper": "workspace:*",
2525
- "@prisma/get-platform": "workspace:*",
2526
- "@prisma/instrumentation": "workspace:*",
2527
- "@prisma/internals": "workspace:*",
2528
- "@prisma/migrate": "workspace:*",
2529
- "@prisma/mini-proxy": "0.9.5",
2530
- "@prisma/pg-worker": "workspace:*",
2531
- "@prisma/query-compiler-wasm": "6.6.0-45.fbda4d61f6cc9c7361b803e72f3a0ffeb87db447",
2532
- "@prisma/query-engine-wasm": "6.6.0-45.fbda4d61f6cc9c7361b803e72f3a0ffeb87db447",
2533
- "@prisma/ts-builders": "workspace:*",
2534
- "@snaplet/copycat": "6.0.0",
2535
- "@swc-node/register": "1.10.9",
2536
- "@swc/core": "1.11.5",
2537
- "@swc/jest": "0.2.37",
2538
- "@timsuchanek/copy": "1.4.5",
2539
- "@types/debug": "4.1.12",
2540
- "@types/fs-extra": "11.0.4",
2541
- "@types/jest": "29.5.14",
2542
- "@types/js-levenshtein": "1.1.3",
2543
- "@types/mssql": "9.1.5",
2544
- "@types/node": "18.19.76",
2545
- "@types/pg": "8.11.11",
2546
- arg: "5.0.2",
2547
- benchmark: "2.1.4",
2548
- "decimal.js": "10.5.0",
2549
- esbuild: "0.25.1",
2550
- execa: "5.1.1",
2551
- "expect-type": "1.2.0",
2552
- "fs-extra": "11.3.0",
2553
- "get-stream": "6.0.1",
2554
- globby: "11.1.0",
2555
- "indent-string": "4.0.0",
2556
- jest: "29.7.0",
2557
- "jest-extended": "4.0.2",
2558
- "jest-junit": "16.0.0",
2559
- "jest-serializer-ansi-escapes": "4.0.0",
2560
- "jest-snapshot": "29.7.0",
2561
- "js-levenshtein": "1.1.6",
2562
- kleur: "4.1.5",
2563
- klona: "2.0.6",
2564
- mariadb: "3.4.0",
2565
- memfs: "4.17.0",
2566
- mssql: "11.0.1",
2567
- "new-github-issue-url": "0.2.1",
2568
- "node-fetch": "3.3.2",
2569
- "p-retry": "4.6.2",
2570
- pg: "8.14.1",
2571
- resolve: "1.22.10",
2572
- rimraf: "6.0.1",
2573
- "simple-statistics": "7.8.8",
2574
- "sort-keys": "5.1.0",
2575
- "source-map-support": "0.5.21",
2576
- "sql-template-tag": "5.2.1",
2577
- "stacktrace-parser": "0.1.11",
2578
- "strip-ansi": "6.0.1",
2579
- "strip-indent": "4.0.0",
2580
- "ts-node": "10.9.2",
2581
- "ts-pattern": "5.6.2",
2582
- tsd: "0.31.2",
2583
- typescript: "5.4.5",
2584
- undici: "7.4.0",
2585
- wrangler: "3.111.0",
2586
- zx: "8.4.1"
2587
- },
2588
- peerDependencies: {
2589
- prisma: "*",
2590
- typescript: ">=5.1.0"
2591
- },
2592
- peerDependenciesMeta: {
2593
- prisma: {
2594
- optional: true
2595
- },
2596
- typescript: {
2597
- optional: true
2598
- }
2599
- },
2600
- sideEffects: false
2601
- };
2602
-
2603
2285
  // src/getDMMF.ts
2604
2286
  var import_internals = require("@prisma/internals");
2605
2287
  function getPrismaClientDMMF(dmmf) {
@@ -6555,7 +6237,6 @@ function buildTypedSql({
6555
6237
  }
6556
6238
 
6557
6239
  // src/generateClient.ts
6558
- var debug = (0, import_debug.default)("prisma:client:generateClient");
6559
6240
  var DenylistError = class extends Error {
6560
6241
  constructor(message) {
6561
6242
  super(message);
@@ -6625,41 +6306,6 @@ function buildClient({
6625
6306
  runtimeNameTs: "react-native",
6626
6307
  edge: true
6627
6308
  });
6628
- const trampolineTsClient = new TSClient({
6629
- ...nodeClientOptions,
6630
- reusedTs: "index",
6631
- reusedJs: "#main-entry-point"
6632
- });
6633
- const exportsMapBase = {
6634
- node: "./index.js",
6635
- "edge-light": "./wasm.js",
6636
- workerd: "./wasm.js",
6637
- worker: "./wasm.js",
6638
- browser: "./index-browser.js",
6639
- default: "./index.js"
6640
- };
6641
- const exportsMapDefault = {
6642
- require: exportsMapBase,
6643
- import: exportsMapBase,
6644
- default: exportsMapBase.default
6645
- };
6646
- const pkgJson = {
6647
- name: getUniquePackageName(datamodel),
6648
- main: "index.js",
6649
- types: "index.d.ts",
6650
- browser: "index-browser.js",
6651
- // The order of exports is important:
6652
- // * `./client` before `...clientPkg.exports` allows it to have a higher priority than the `./*` export in `clientPkg.exports`
6653
- // * `.` after `...clientPkg.exports` makes it override the `.` export in `clientPkgs.exports`
6654
- exports: {
6655
- "./client": exportsMapDefault,
6656
- ...package_default.exports,
6657
- // TODO: remove on DA ga
6658
- ".": exportsMapDefault
6659
- },
6660
- version: clientVersion,
6661
- sideEffects: false
6662
- };
6663
6309
  const fileMap = {};
6664
6310
  fileMap["index.js"] = JS(nodeClient);
6665
6311
  fileMap["index.d.ts"] = TS(nodeClient);
@@ -6677,8 +6323,6 @@ function buildClient({
6677
6323
  const usesWasmRuntime = generator.previewFeatures.includes("driverAdapters");
6678
6324
  if (usesWasmRuntime) {
6679
6325
  const usesClientEngine = clientEngineType === import_internals10.ClientEngineType.Client;
6680
- fileMap["default.js"] = JS(trampolineTsClient);
6681
- fileMap["default.d.ts"] = TS(trampolineTsClient);
6682
6326
  if (usesClientEngine) {
6683
6327
  fileMap["wasm-worker-loader.mjs"] = `export default import('./query_compiler_bg.wasm')`;
6684
6328
  fileMap["wasm-edge-light-loader.mjs"] = `export default import('./query_compiler_bg.wasm?module')`;
@@ -6686,32 +6330,6 @@ function buildClient({
6686
6330
  fileMap["wasm-worker-loader.mjs"] = `export default import('./query_engine_bg.wasm')`;
6687
6331
  fileMap["wasm-edge-light-loader.mjs"] = `export default import('./query_engine_bg.wasm?module')`;
6688
6332
  }
6689
- pkgJson["browser"] = "default.js";
6690
- pkgJson["imports"] = {
6691
- // when `import('#wasm-engine-loader')` or `import('#wasm-compiler-loader')` is called, it will be resolved to the correct file
6692
- [usesClientEngine ? "#wasm-compiler-loader" : "#wasm-engine-loader"]: {
6693
- // Keys reference: https://runtime-keys.proposal.wintercg.org/#keys
6694
- /**
6695
- * Vercel Edge Functions / Next.js Middlewares
6696
- */
6697
- "edge-light": "./wasm-edge-light-loader.mjs",
6698
- /**
6699
- * Cloudflare Workers, Cloudflare Pages
6700
- */
6701
- workerd: "./wasm-worker-loader.mjs",
6702
- /**
6703
- * (Old) Cloudflare Workers
6704
- * @millsp It's a fallback, in case both other keys didn't work because we could be on a different edge platform. It's a hypothetical case rather than anything actually tested.
6705
- */
6706
- worker: "./wasm-worker-loader.mjs",
6707
- /**
6708
- * Fallback for every other JavaScript runtime
6709
- */
6710
- default: "./wasm-worker-loader.mjs"
6711
- },
6712
- // when `require('#main-entry-point')` is called, it will be resolved to the correct file
6713
- "#main-entry-point": exportsMapDefault
6714
- };
6715
6333
  const wasmClient = new TSClient({
6716
6334
  ...baseClientOptions,
6717
6335
  runtimeNameJs: "wasm",
@@ -6744,37 +6362,14 @@ export * from './edge.js'`;
6744
6362
  fileMap["deno/polyfill.js"] = "globalThis.process = { env: Deno.env.toObject() }; globalThis.global = globalThis";
6745
6363
  }
6746
6364
  if (typedSql && typedSql.length > 0) {
6747
- const edgeRuntimeName = usesWasmRuntime ? "wasm" : "edge";
6748
- const cjsEdgeIndex = `./sql/index.${edgeRuntimeName}.js`;
6749
- const esmEdgeIndex = `./sql/index.${edgeRuntimeName}.mjs`;
6750
- pkgJson.exports["./sql"] = {
6751
- require: {
6752
- types: "./sql/index.d.ts",
6753
- "edge-light": cjsEdgeIndex,
6754
- workerd: cjsEdgeIndex,
6755
- worker: cjsEdgeIndex,
6756
- node: "./sql/index.js",
6757
- default: "./sql/index.js"
6758
- },
6759
- import: {
6760
- types: "./sql/index.d.ts",
6761
- "edge-light": esmEdgeIndex,
6762
- workerd: esmEdgeIndex,
6763
- worker: esmEdgeIndex,
6764
- node: "./sql/index.mjs",
6765
- default: "./sql/index.mjs"
6766
- },
6767
- default: "./sql/index.js"
6768
- };
6769
6365
  fileMap["sql"] = buildTypedSql({
6770
6366
  dmmf,
6771
6367
  runtimeBase: getTypedSqlRuntimeBase(runtimeBase),
6772
6368
  mainRuntimeName: getNodeRuntimeName(clientEngineType),
6773
6369
  queries: typedSql,
6774
- edgeRuntimeName
6370
+ edgeRuntimeName: usesWasmRuntime ? "wasm" : "edge"
6775
6371
  });
6776
6372
  }
6777
- fileMap["package.json"] = JSON.stringify(pkgJson, null, 2);
6778
6373
  return {
6779
6374
  fileMap,
6780
6375
  // a map of file names to their contents
@@ -6839,12 +6434,10 @@ async function generateClient(options) {
6839
6434
  To learn more about how to rename models, check out https://pris.ly/d/naming-models`;
6840
6435
  throw new DenylistError(message);
6841
6436
  }
6842
- if (!copyEngine) {
6843
- await deleteOutputDir(outputDir);
6844
- }
6437
+ await deleteOutputDir(outputDir);
6845
6438
  await (0, import_fs_extra.ensureDir)(outputDir);
6846
6439
  if (generator.previewFeatures.includes("deno") && !!globalThis.Deno) {
6847
- await (0, import_fs_extra.ensureDir)(import_path3.default.join(outputDir, "deno"));
6440
+ await (0, import_fs_extra.ensureDir)(import_node_path.default.join(outputDir, "deno"));
6848
6441
  }
6849
6442
  await writeFileMap(outputDir, fileMap);
6850
6443
  const enginePath = clientEngineType === import_internals10.ClientEngineType.Library ? binaryPaths.libqueryEngine : binaryPaths.queryEngine;
@@ -6858,21 +6451,21 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
6858
6451
  await (0, import_fs_extra.ensureDir)("/tmp/prisma-engines");
6859
6452
  }
6860
6453
  for (const [binaryTarget, filePath] of Object.entries(enginePath)) {
6861
- const fileName = import_path3.default.basename(filePath);
6454
+ const fileName = import_node_path.default.basename(filePath);
6862
6455
  let target;
6863
6456
  if (process.env.NETLIFY && !["rhel-openssl-1.0.x", "rhel-openssl-3.0.x"].includes(binaryTarget)) {
6864
- target = import_path3.default.join("/tmp/prisma-engines", fileName);
6457
+ target = import_node_path.default.join("/tmp/prisma-engines", fileName);
6865
6458
  } else {
6866
- target = import_path3.default.join(outputDir, fileName);
6459
+ target = import_node_path.default.join(outputDir, fileName);
6867
6460
  }
6868
6461
  await (0, import_fetch_engine.overwriteFile)(filePath, target);
6869
6462
  }
6870
6463
  }
6871
- const schemaTargetPath = import_path3.default.join(outputDir, "schema.prisma");
6464
+ const schemaTargetPath = import_node_path.default.join(outputDir, "schema.prisma");
6872
6465
  await import_promises.default.writeFile(schemaTargetPath, datamodel, { encoding: "utf-8" });
6873
6466
  try {
6874
6467
  const prismaCache = (0, import_env_paths.default)("prisma").cache;
6875
- const signalsPath = import_path3.default.join(prismaCache, "last-generate");
6468
+ const signalsPath = import_node_path.default.join(prismaCache, "last-generate");
6876
6469
  await import_promises.default.mkdir(prismaCache, { recursive: true });
6877
6470
  await import_promises.default.writeFile(signalsPath, Date.now().toString());
6878
6471
  } catch {
@@ -6881,7 +6474,7 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
6881
6474
  function writeFileMap(outputDir, fileMap) {
6882
6475
  return Promise.all(
6883
6476
  Object.entries(fileMap).map(async ([fileName, content]) => {
6884
- const absolutePath = import_path3.default.join(outputDir, fileName);
6477
+ const absolutePath = import_node_path.default.join(outputDir, fileName);
6885
6478
  await import_promises.default.rm(absolutePath, { recursive: true, force: true });
6886
6479
  if (typeof content === "string") {
6887
6480
  await import_promises.default.writeFile(absolutePath, content);
@@ -6970,10 +6563,10 @@ function validateDmmfAgainstDenylists(prismaClientDmmf) {
6970
6563
  return errorArray.length > 0 ? errorArray : null;
6971
6564
  }
6972
6565
  async function getGenerationDirs({ runtimeBase, outputDir }) {
6973
- const normalizedOutputDir = import_path3.default.normalize(outputDir);
6566
+ const normalizedOutputDir = import_node_path.default.normalize(outputDir);
6974
6567
  const normalizedRuntimeBase = (0, import_internals10.pathToPosix)(runtimeBase);
6975
- const userPackageRoot = await (0, import_pkg_up.default)({ cwd: import_path3.default.dirname(normalizedOutputDir) });
6976
- const userProjectRoot = userPackageRoot ? import_path3.default.dirname(userPackageRoot) : process.cwd();
6568
+ const userPackageRoot = await (0, import_pkg_up.default)({ cwd: import_node_path.default.dirname(normalizedOutputDir) });
6569
+ const userProjectRoot = userPackageRoot ? import_node_path.default.dirname(userPackageRoot) : process.cwd();
6977
6570
  return {
6978
6571
  runtimeBase: normalizedRuntimeBase,
6979
6572
  outputDir: normalizedOutputDir,
@@ -6999,34 +6592,40 @@ function getNodeRuntimeName(engineType) {
6999
6592
  }
7000
6593
  async function deleteOutputDir(outputDir) {
7001
6594
  try {
7002
- debug(`attempting to delete ${outputDir} recursively`);
7003
- if (require(`${outputDir}/package.json`).name?.startsWith(GENERATED_PACKAGE_NAME_PREFIX)) {
7004
- await import_promises.default.rmdir(outputDir, { recursive: true }).catch(() => {
7005
- debug(`failed to delete ${outputDir} recursively`);
7006
- });
6595
+ const files = await import_promises.default.readdir(outputDir);
6596
+ if (files.length === 0) {
6597
+ return;
6598
+ }
6599
+ if (!files.includes("client.d.ts")) {
6600
+ throw new Error(
6601
+ `${outputDir} exists and is not empty but doesn't look like a generated Prisma Client. Please check your output path and remove the existing directory if you indeed want to generate the Prisma Client in that location.`
6602
+ );
6603
+ }
6604
+ await Promise.allSettled(
6605
+ (await (0, import_fast_glob.glob)(`${outputDir}/**/*.ts`, {
6606
+ globstar: true,
6607
+ onlyFiles: true,
6608
+ followSymbolicLinks: false
6609
+ })).map(import_promises.default.unlink)
6610
+ );
6611
+ } catch (error) {
6612
+ if (error.code !== "ENOENT") {
6613
+ throw error;
7007
6614
  }
7008
- } catch {
7009
- debug(`failed to delete ${outputDir} recursively, not found`);
7010
6615
  }
7011
6616
  }
7012
- function getUniquePackageName(datamodel) {
7013
- const hash = (0, import_crypto2.createHash)("sha256");
7014
- hash.write(datamodel);
7015
- return `${GENERATED_PACKAGE_NAME_PREFIX}${hash.digest().toString("hex")}`;
7016
- }
7017
- var GENERATED_PACKAGE_NAME_PREFIX = "prisma-client-";
7018
6617
 
7019
6618
  // src/generator.ts
7020
- var import_debug2 = __toESM(require("@prisma/debug"));
6619
+ var import_debug = __toESM(require("@prisma/debug"));
7021
6620
  var import_engines_version = require("@prisma/engines-version");
7022
6621
  var import_internals11 = require("@prisma/internals");
7023
6622
  var import_ts_pattern = require("ts-pattern");
7024
6623
 
7025
6624
  // package.json
7026
- var version = "6.6.0-dev.88";
6625
+ var version = "6.6.0-dev.90";
7027
6626
 
7028
6627
  // src/generator.ts
7029
- var debug2 = (0, import_debug2.default)("prisma:client:generator");
6628
+ var debug = (0, import_debug.default)("prisma:client:generator");
7030
6629
  var missingOutputErrorMessage = `An output path is required for the \`prisma-client-ts\` generator. Please provide an output path in your schema file:
7031
6630
 
7032
6631
  ${dim(`generator client {
@@ -7046,7 +6645,7 @@ var PrismaClientTsGenerator = class {
7046
6645
  name = "prisma-client-ts";
7047
6646
  getManifest(config) {
7048
6647
  const requiresEngines = (0, import_ts_pattern.match)((0, import_internals11.getClientEngineType)(config)).with(import_internals11.ClientEngineType.Library, () => ["libqueryEngine"]).with(import_internals11.ClientEngineType.Binary, () => ["queryEngine"]).with(import_internals11.ClientEngineType.Client, () => []).exhaustive();
7049
- debug2("requiresEngines", requiresEngines);
6648
+ debug("requiresEngines", requiresEngines);
7050
6649
  return Promise.resolve({
7051
6650
  defaultOutput: getOutputPath(config),
7052
6651
  prettyName: "Prisma Client",
package/dist/index.mjs CHANGED
@@ -494,11 +494,11 @@ var require_graceful_fs = __commonJS({
494
494
  }
495
495
  });
496
496
  }
497
- var debug3 = noop;
497
+ var debug2 = noop;
498
498
  if (util.debuglog)
499
- debug3 = util.debuglog("gfs4");
499
+ debug2 = util.debuglog("gfs4");
500
500
  else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
501
- debug3 = function() {
501
+ debug2 = function() {
502
502
  var m = util.format.apply(util, arguments);
503
503
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
504
504
  console.error(m);
@@ -533,7 +533,7 @@ var require_graceful_fs = __commonJS({
533
533
  }(fs2.closeSync);
534
534
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
535
535
  process.on("exit", function() {
536
- debug3(fs2[gracefulQueue]);
536
+ debug2(fs2[gracefulQueue]);
537
537
  __require("assert").equal(fs2[gracefulQueue].length, 0);
538
538
  });
539
539
  }
@@ -786,7 +786,7 @@ var require_graceful_fs = __commonJS({
786
786
  return fs3;
787
787
  }
788
788
  function enqueue(elem) {
789
- debug3("ENQUEUE", elem[0].name, elem[1]);
789
+ debug2("ENQUEUE", elem[0].name, elem[1]);
790
790
  fs2[gracefulQueue].push(elem);
791
791
  retry();
792
792
  }
@@ -813,10 +813,10 @@ var require_graceful_fs = __commonJS({
813
813
  var startTime = elem[3];
814
814
  var lastTime = elem[4];
815
815
  if (startTime === void 0) {
816
- debug3("RETRY", fn.name, args);
816
+ debug2("RETRY", fn.name, args);
817
817
  fn.apply(null, args);
818
818
  } else if (Date.now() - startTime >= 6e4) {
819
- debug3("TIMEOUT", fn.name, args);
819
+ debug2("TIMEOUT", fn.name, args);
820
820
  var cb = args.pop();
821
821
  if (typeof cb === "function")
822
822
  cb.call(null, err);
@@ -825,7 +825,7 @@ var require_graceful_fs = __commonJS({
825
825
  var sinceStart = Math.max(lastTime - startTime, 1);
826
826
  var desiredDelay = Math.min(sinceStart * 1.2, 100);
827
827
  if (sinceAttempt >= desiredDelay) {
828
- debug3("RETRY", fn.name, args);
828
+ debug2("RETRY", fn.name, args);
829
829
  fn.apply(null, args.concat([startTime]));
830
830
  } else {
831
831
  fs2[gracefulQueue].push(elem);
@@ -2213,7 +2213,8 @@ function getMappings(mappings, datamodel) {
2213
2213
 
2214
2214
  // src/generateClient.ts
2215
2215
  var import_fs_extra = __toESM(require_lib());
2216
- import Debug from "@prisma/debug";
2216
+ import fs from "node:fs/promises";
2217
+ import path3 from "node:path";
2217
2218
  import { overwriteFile } from "@prisma/fetch-engine";
2218
2219
  import {
2219
2220
  assertNever as assertNever3,
@@ -2222,9 +2223,8 @@ import {
2222
2223
  pathToPosix as pathToPosix4,
2223
2224
  setClassName
2224
2225
  } from "@prisma/internals";
2225
- import { createHash } from "crypto";
2226
2226
  import paths from "env-paths";
2227
- import fs from "fs/promises";
2227
+ import { glob } from "fast-glob";
2228
2228
 
2229
2229
  // ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs
2230
2230
  var FORCE_COLOR;
@@ -2275,326 +2275,8 @@ var bgCyan = init(46, 49);
2275
2275
  var bgWhite = init(47, 49);
2276
2276
 
2277
2277
  // src/generateClient.ts
2278
- import path3 from "path";
2279
2278
  import pkgUp from "pkg-up";
2280
2279
 
2281
- // ../client/package.json
2282
- var package_default = {
2283
- name: "@prisma/client",
2284
- version: "0.0.0",
2285
- description: "Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.",
2286
- keywords: [
2287
- "ORM",
2288
- "Prisma",
2289
- "prisma2",
2290
- "Prisma Client",
2291
- "client",
2292
- "query",
2293
- "query-builder",
2294
- "database",
2295
- "db",
2296
- "JavaScript",
2297
- "JS",
2298
- "TypeScript",
2299
- "TS",
2300
- "SQL",
2301
- "SQLite",
2302
- "pg",
2303
- "Postgres",
2304
- "PostgreSQL",
2305
- "CockroachDB",
2306
- "MySQL",
2307
- "MariaDB",
2308
- "MSSQL",
2309
- "SQL Server",
2310
- "SQLServer",
2311
- "MongoDB",
2312
- "react-native"
2313
- ],
2314
- main: "default.js",
2315
- types: "default.d.ts",
2316
- browser: "index-browser.js",
2317
- exports: {
2318
- "./package.json": "./package.json",
2319
- ".": {
2320
- require: {
2321
- types: "./default.d.ts",
2322
- node: "./default.js",
2323
- "edge-light": "./default.js",
2324
- workerd: "./default.js",
2325
- worker: "./default.js",
2326
- browser: "./index-browser.js"
2327
- },
2328
- import: {
2329
- types: "./default.d.ts",
2330
- node: "./default.js",
2331
- "edge-light": "./default.js",
2332
- workerd: "./default.js",
2333
- worker: "./default.js",
2334
- browser: "./index-browser.js"
2335
- },
2336
- default: "./default.js"
2337
- },
2338
- "./edge": {
2339
- types: "./edge.d.ts",
2340
- require: "./edge.js",
2341
- import: "./edge.js",
2342
- default: "./edge.js"
2343
- },
2344
- "./react-native": {
2345
- types: "./react-native.d.ts",
2346
- require: "./react-native.js",
2347
- import: "./react-native.js",
2348
- default: "./react-native.js"
2349
- },
2350
- "./extension": {
2351
- types: "./extension.d.ts",
2352
- require: "./extension.js",
2353
- import: "./extension.js",
2354
- default: "./extension.js"
2355
- },
2356
- "./index-browser": {
2357
- types: "./index.d.ts",
2358
- require: "./index-browser.js",
2359
- import: "./index-browser.js",
2360
- default: "./index-browser.js"
2361
- },
2362
- "./index": {
2363
- types: "./index.d.ts",
2364
- require: "./index.js",
2365
- import: "./index.js",
2366
- default: "./index.js"
2367
- },
2368
- "./wasm": {
2369
- types: "./wasm.d.ts",
2370
- require: "./wasm.js",
2371
- import: "./wasm.mjs",
2372
- default: "./wasm.mjs"
2373
- },
2374
- "./runtime/client": {
2375
- types: "./runtime/client.d.ts",
2376
- require: "./runtime/client.js",
2377
- import: "./runtime/client.mjs",
2378
- default: "./runtime/client.mjs"
2379
- },
2380
- "./runtime/library": {
2381
- types: "./runtime/library.d.ts",
2382
- require: "./runtime/library.js",
2383
- import: "./runtime/library.mjs",
2384
- default: "./runtime/library.mjs"
2385
- },
2386
- "./runtime/binary": {
2387
- types: "./runtime/binary.d.ts",
2388
- require: "./runtime/binary.js",
2389
- import: "./runtime/binary.mjs",
2390
- default: "./runtime/binary.mjs"
2391
- },
2392
- "./runtime/wasm": {
2393
- types: "./runtime/wasm.d.ts",
2394
- require: "./runtime/wasm.js",
2395
- import: "./runtime/wasm.mjs",
2396
- default: "./runtime/wasm.mjs"
2397
- },
2398
- "./runtime/edge": {
2399
- types: "./runtime/edge.d.ts",
2400
- require: "./runtime/edge.js",
2401
- import: "./runtime/edge-esm.js",
2402
- default: "./runtime/edge-esm.js"
2403
- },
2404
- "./runtime/react-native": {
2405
- types: "./runtime/react-native.d.ts",
2406
- require: "./runtime/react-native.js",
2407
- import: "./runtime/react-native.js",
2408
- default: "./runtime/react-native.js"
2409
- },
2410
- "./generator-build": {
2411
- require: "./generator-build/index.js",
2412
- import: "./generator-build/index.js",
2413
- default: "./generator-build/index.js"
2414
- },
2415
- "./sql": {
2416
- require: {
2417
- types: "./sql.d.ts",
2418
- node: "./sql.js",
2419
- default: "./sql.js"
2420
- },
2421
- import: {
2422
- types: "./sql.d.ts",
2423
- node: "./sql.mjs",
2424
- default: "./sql.mjs"
2425
- },
2426
- default: "./sql.js"
2427
- },
2428
- "./*": "./*"
2429
- },
2430
- license: "Apache-2.0",
2431
- engines: {
2432
- node: ">=18.18"
2433
- },
2434
- homepage: "https://www.prisma.io",
2435
- repository: {
2436
- type: "git",
2437
- url: "https://github.com/prisma/prisma.git",
2438
- directory: "packages/client"
2439
- },
2440
- author: "Tim Suchanek <suchanek@prisma.io>",
2441
- bugs: "https://github.com/prisma/prisma/issues",
2442
- scripts: {
2443
- dev: "DEV=true tsx helpers/build.ts",
2444
- build: "tsx helpers/build.ts",
2445
- test: "dotenv -e ../../.db.env -- jest --silent",
2446
- "test:e2e": "dotenv -e ../../.db.env -- tsx tests/e2e/_utils/run.ts",
2447
- "test:functional": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts",
2448
- "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",
2449
- "test:memory": "dotenv -e ../../.db.env -- tsx helpers/memory-tests.ts",
2450
- "test:functional:code": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts --no-types",
2451
- "test:functional:types": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts --types-only",
2452
- "test:knownQueryCompilerFailures:check": "tsx helpers/functional-test/check-known-failures.ts",
2453
- "test:knownQueryCompilerFailures:record": "tsx helpers/functional-test/check-known-failures.ts --record",
2454
- "test-notypes": "dotenv -e ../../.db.env -- jest --testPathIgnorePatterns src/__tests__/types/types.test.ts",
2455
- generate: "node scripts/postinstall.js",
2456
- postinstall: "node scripts/postinstall.js",
2457
- prepublishOnly: "pnpm run build",
2458
- "new-test": "tsx ./helpers/new-test/new-test.ts"
2459
- },
2460
- files: [
2461
- "README.md",
2462
- "runtime",
2463
- "!runtime/*.map",
2464
- "scripts",
2465
- "generator-build",
2466
- "edge.js",
2467
- "edge.d.ts",
2468
- "wasm.js",
2469
- "wasm.d.ts",
2470
- "index.js",
2471
- "index.d.ts",
2472
- "react-native.js",
2473
- "react-native.d.ts",
2474
- "default.js",
2475
- "default.d.ts",
2476
- "index-browser.js",
2477
- "extension.js",
2478
- "extension.d.ts",
2479
- "sql.d.ts",
2480
- "sql.js",
2481
- "sql.mjs"
2482
- ],
2483
- devDependencies: {
2484
- "@cloudflare/workers-types": "4.20250214.0",
2485
- "@codspeed/benchmark.js-plugin": "4.0.0",
2486
- "@faker-js/faker": "9.6.0",
2487
- "@fast-check/jest": "2.0.3",
2488
- "@inquirer/prompts": "7.3.3",
2489
- "@jest/create-cache-key-function": "29.7.0",
2490
- "@jest/globals": "29.7.0",
2491
- "@jest/test-sequencer": "29.7.0",
2492
- "@libsql/client": "0.8.0",
2493
- "@neondatabase/serverless": "0.10.2",
2494
- "@opentelemetry/api": "1.9.0",
2495
- "@opentelemetry/context-async-hooks": "2.0.0",
2496
- "@opentelemetry/instrumentation": "0.57.2",
2497
- "@opentelemetry/resources": "1.30.1",
2498
- "@opentelemetry/sdk-trace-base": "1.30.1",
2499
- "@opentelemetry/semantic-conventions": "1.30.0",
2500
- "@planetscale/database": "1.19.0",
2501
- "@prisma/adapter-d1": "workspace:*",
2502
- "@prisma/adapter-libsql": "workspace:*",
2503
- "@prisma/adapter-neon": "workspace:*",
2504
- "@prisma/adapter-pg": "workspace:*",
2505
- "@prisma/adapter-pg-worker": "workspace:*",
2506
- "@prisma/adapter-planetscale": "workspace:*",
2507
- "@prisma/client-common": "workspace:*",
2508
- "@prisma/client-engine-runtime": "workspace:*",
2509
- "@prisma/client-generator-js": "workspace:*",
2510
- "@prisma/client-generator-ts": "workspace:*",
2511
- "@prisma/config": "workspace:*",
2512
- "@prisma/debug": "workspace:*",
2513
- "@prisma/dmmf": "workspace:*",
2514
- "@prisma/driver-adapter-utils": "workspace:*",
2515
- "@prisma/engines": "workspace:*",
2516
- "@prisma/engines-version": "6.6.0-45.fbda4d61f6cc9c7361b803e72f3a0ffeb87db447",
2517
- "@prisma/fetch-engine": "workspace:*",
2518
- "@prisma/generator": "workspace:*",
2519
- "@prisma/generator-helper": "workspace:*",
2520
- "@prisma/get-platform": "workspace:*",
2521
- "@prisma/instrumentation": "workspace:*",
2522
- "@prisma/internals": "workspace:*",
2523
- "@prisma/migrate": "workspace:*",
2524
- "@prisma/mini-proxy": "0.9.5",
2525
- "@prisma/pg-worker": "workspace:*",
2526
- "@prisma/query-compiler-wasm": "6.6.0-45.fbda4d61f6cc9c7361b803e72f3a0ffeb87db447",
2527
- "@prisma/query-engine-wasm": "6.6.0-45.fbda4d61f6cc9c7361b803e72f3a0ffeb87db447",
2528
- "@prisma/ts-builders": "workspace:*",
2529
- "@snaplet/copycat": "6.0.0",
2530
- "@swc-node/register": "1.10.9",
2531
- "@swc/core": "1.11.5",
2532
- "@swc/jest": "0.2.37",
2533
- "@timsuchanek/copy": "1.4.5",
2534
- "@types/debug": "4.1.12",
2535
- "@types/fs-extra": "11.0.4",
2536
- "@types/jest": "29.5.14",
2537
- "@types/js-levenshtein": "1.1.3",
2538
- "@types/mssql": "9.1.5",
2539
- "@types/node": "18.19.76",
2540
- "@types/pg": "8.11.11",
2541
- arg: "5.0.2",
2542
- benchmark: "2.1.4",
2543
- "decimal.js": "10.5.0",
2544
- esbuild: "0.25.1",
2545
- execa: "5.1.1",
2546
- "expect-type": "1.2.0",
2547
- "fs-extra": "11.3.0",
2548
- "get-stream": "6.0.1",
2549
- globby: "11.1.0",
2550
- "indent-string": "4.0.0",
2551
- jest: "29.7.0",
2552
- "jest-extended": "4.0.2",
2553
- "jest-junit": "16.0.0",
2554
- "jest-serializer-ansi-escapes": "4.0.0",
2555
- "jest-snapshot": "29.7.0",
2556
- "js-levenshtein": "1.1.6",
2557
- kleur: "4.1.5",
2558
- klona: "2.0.6",
2559
- mariadb: "3.4.0",
2560
- memfs: "4.17.0",
2561
- mssql: "11.0.1",
2562
- "new-github-issue-url": "0.2.1",
2563
- "node-fetch": "3.3.2",
2564
- "p-retry": "4.6.2",
2565
- pg: "8.14.1",
2566
- resolve: "1.22.10",
2567
- rimraf: "6.0.1",
2568
- "simple-statistics": "7.8.8",
2569
- "sort-keys": "5.1.0",
2570
- "source-map-support": "0.5.21",
2571
- "sql-template-tag": "5.2.1",
2572
- "stacktrace-parser": "0.1.11",
2573
- "strip-ansi": "6.0.1",
2574
- "strip-indent": "4.0.0",
2575
- "ts-node": "10.9.2",
2576
- "ts-pattern": "5.6.2",
2577
- tsd: "0.31.2",
2578
- typescript: "5.4.5",
2579
- undici: "7.4.0",
2580
- wrangler: "3.111.0",
2581
- zx: "8.4.1"
2582
- },
2583
- peerDependencies: {
2584
- prisma: "*",
2585
- typescript: ">=5.1.0"
2586
- },
2587
- peerDependenciesMeta: {
2588
- prisma: {
2589
- optional: true
2590
- },
2591
- typescript: {
2592
- optional: true
2593
- }
2594
- },
2595
- sideEffects: false
2596
- };
2597
-
2598
2280
  // src/getDMMF.ts
2599
2281
  import { getDMMF as getRawDMMF } from "@prisma/internals";
2600
2282
  function getPrismaClientDMMF(dmmf) {
@@ -6553,7 +6235,6 @@ function buildTypedSql({
6553
6235
  }
6554
6236
 
6555
6237
  // src/generateClient.ts
6556
- var debug = Debug("prisma:client:generateClient");
6557
6238
  var DenylistError = class extends Error {
6558
6239
  constructor(message) {
6559
6240
  super(message);
@@ -6623,41 +6304,6 @@ function buildClient({
6623
6304
  runtimeNameTs: "react-native",
6624
6305
  edge: true
6625
6306
  });
6626
- const trampolineTsClient = new TSClient({
6627
- ...nodeClientOptions,
6628
- reusedTs: "index",
6629
- reusedJs: "#main-entry-point"
6630
- });
6631
- const exportsMapBase = {
6632
- node: "./index.js",
6633
- "edge-light": "./wasm.js",
6634
- workerd: "./wasm.js",
6635
- worker: "./wasm.js",
6636
- browser: "./index-browser.js",
6637
- default: "./index.js"
6638
- };
6639
- const exportsMapDefault = {
6640
- require: exportsMapBase,
6641
- import: exportsMapBase,
6642
- default: exportsMapBase.default
6643
- };
6644
- const pkgJson = {
6645
- name: getUniquePackageName(datamodel),
6646
- main: "index.js",
6647
- types: "index.d.ts",
6648
- browser: "index-browser.js",
6649
- // The order of exports is important:
6650
- // * `./client` before `...clientPkg.exports` allows it to have a higher priority than the `./*` export in `clientPkg.exports`
6651
- // * `.` after `...clientPkg.exports` makes it override the `.` export in `clientPkgs.exports`
6652
- exports: {
6653
- "./client": exportsMapDefault,
6654
- ...package_default.exports,
6655
- // TODO: remove on DA ga
6656
- ".": exportsMapDefault
6657
- },
6658
- version: clientVersion,
6659
- sideEffects: false
6660
- };
6661
6307
  const fileMap = {};
6662
6308
  fileMap["index.js"] = JS(nodeClient);
6663
6309
  fileMap["index.d.ts"] = TS(nodeClient);
@@ -6675,8 +6321,6 @@ function buildClient({
6675
6321
  const usesWasmRuntime = generator.previewFeatures.includes("driverAdapters");
6676
6322
  if (usesWasmRuntime) {
6677
6323
  const usesClientEngine = clientEngineType === ClientEngineType3.Client;
6678
- fileMap["default.js"] = JS(trampolineTsClient);
6679
- fileMap["default.d.ts"] = TS(trampolineTsClient);
6680
6324
  if (usesClientEngine) {
6681
6325
  fileMap["wasm-worker-loader.mjs"] = `export default import('./query_compiler_bg.wasm')`;
6682
6326
  fileMap["wasm-edge-light-loader.mjs"] = `export default import('./query_compiler_bg.wasm?module')`;
@@ -6684,32 +6328,6 @@ function buildClient({
6684
6328
  fileMap["wasm-worker-loader.mjs"] = `export default import('./query_engine_bg.wasm')`;
6685
6329
  fileMap["wasm-edge-light-loader.mjs"] = `export default import('./query_engine_bg.wasm?module')`;
6686
6330
  }
6687
- pkgJson["browser"] = "default.js";
6688
- pkgJson["imports"] = {
6689
- // when `import('#wasm-engine-loader')` or `import('#wasm-compiler-loader')` is called, it will be resolved to the correct file
6690
- [usesClientEngine ? "#wasm-compiler-loader" : "#wasm-engine-loader"]: {
6691
- // Keys reference: https://runtime-keys.proposal.wintercg.org/#keys
6692
- /**
6693
- * Vercel Edge Functions / Next.js Middlewares
6694
- */
6695
- "edge-light": "./wasm-edge-light-loader.mjs",
6696
- /**
6697
- * Cloudflare Workers, Cloudflare Pages
6698
- */
6699
- workerd: "./wasm-worker-loader.mjs",
6700
- /**
6701
- * (Old) Cloudflare Workers
6702
- * @millsp It's a fallback, in case both other keys didn't work because we could be on a different edge platform. It's a hypothetical case rather than anything actually tested.
6703
- */
6704
- worker: "./wasm-worker-loader.mjs",
6705
- /**
6706
- * Fallback for every other JavaScript runtime
6707
- */
6708
- default: "./wasm-worker-loader.mjs"
6709
- },
6710
- // when `require('#main-entry-point')` is called, it will be resolved to the correct file
6711
- "#main-entry-point": exportsMapDefault
6712
- };
6713
6331
  const wasmClient = new TSClient({
6714
6332
  ...baseClientOptions,
6715
6333
  runtimeNameJs: "wasm",
@@ -6742,37 +6360,14 @@ export * from './edge.js'`;
6742
6360
  fileMap["deno/polyfill.js"] = "globalThis.process = { env: Deno.env.toObject() }; globalThis.global = globalThis";
6743
6361
  }
6744
6362
  if (typedSql && typedSql.length > 0) {
6745
- const edgeRuntimeName = usesWasmRuntime ? "wasm" : "edge";
6746
- const cjsEdgeIndex = `./sql/index.${edgeRuntimeName}.js`;
6747
- const esmEdgeIndex = `./sql/index.${edgeRuntimeName}.mjs`;
6748
- pkgJson.exports["./sql"] = {
6749
- require: {
6750
- types: "./sql/index.d.ts",
6751
- "edge-light": cjsEdgeIndex,
6752
- workerd: cjsEdgeIndex,
6753
- worker: cjsEdgeIndex,
6754
- node: "./sql/index.js",
6755
- default: "./sql/index.js"
6756
- },
6757
- import: {
6758
- types: "./sql/index.d.ts",
6759
- "edge-light": esmEdgeIndex,
6760
- workerd: esmEdgeIndex,
6761
- worker: esmEdgeIndex,
6762
- node: "./sql/index.mjs",
6763
- default: "./sql/index.mjs"
6764
- },
6765
- default: "./sql/index.js"
6766
- };
6767
6363
  fileMap["sql"] = buildTypedSql({
6768
6364
  dmmf,
6769
6365
  runtimeBase: getTypedSqlRuntimeBase(runtimeBase),
6770
6366
  mainRuntimeName: getNodeRuntimeName(clientEngineType),
6771
6367
  queries: typedSql,
6772
- edgeRuntimeName
6368
+ edgeRuntimeName: usesWasmRuntime ? "wasm" : "edge"
6773
6369
  });
6774
6370
  }
6775
- fileMap["package.json"] = JSON.stringify(pkgJson, null, 2);
6776
6371
  return {
6777
6372
  fileMap,
6778
6373
  // a map of file names to their contents
@@ -6837,9 +6432,7 @@ async function generateClient(options) {
6837
6432
  To learn more about how to rename models, check out https://pris.ly/d/naming-models`;
6838
6433
  throw new DenylistError(message);
6839
6434
  }
6840
- if (!copyEngine) {
6841
- await deleteOutputDir(outputDir);
6842
- }
6435
+ await deleteOutputDir(outputDir);
6843
6436
  await (0, import_fs_extra.ensureDir)(outputDir);
6844
6437
  if (generator.previewFeatures.includes("deno") && !!globalThis.Deno) {
6845
6438
  await (0, import_fs_extra.ensureDir)(path3.join(outputDir, "deno"));
@@ -6997,34 +6590,40 @@ function getNodeRuntimeName(engineType) {
6997
6590
  }
6998
6591
  async function deleteOutputDir(outputDir) {
6999
6592
  try {
7000
- debug(`attempting to delete ${outputDir} recursively`);
7001
- if (__require(`${outputDir}/package.json`).name?.startsWith(GENERATED_PACKAGE_NAME_PREFIX)) {
7002
- await fs.rmdir(outputDir, { recursive: true }).catch(() => {
7003
- debug(`failed to delete ${outputDir} recursively`);
7004
- });
6593
+ const files = await fs.readdir(outputDir);
6594
+ if (files.length === 0) {
6595
+ return;
6596
+ }
6597
+ if (!files.includes("client.d.ts")) {
6598
+ throw new Error(
6599
+ `${outputDir} exists and is not empty but doesn't look like a generated Prisma Client. Please check your output path and remove the existing directory if you indeed want to generate the Prisma Client in that location.`
6600
+ );
6601
+ }
6602
+ await Promise.allSettled(
6603
+ (await glob(`${outputDir}/**/*.ts`, {
6604
+ globstar: true,
6605
+ onlyFiles: true,
6606
+ followSymbolicLinks: false
6607
+ })).map(fs.unlink)
6608
+ );
6609
+ } catch (error) {
6610
+ if (error.code !== "ENOENT") {
6611
+ throw error;
7005
6612
  }
7006
- } catch {
7007
- debug(`failed to delete ${outputDir} recursively, not found`);
7008
6613
  }
7009
6614
  }
7010
- function getUniquePackageName(datamodel) {
7011
- const hash = createHash("sha256");
7012
- hash.write(datamodel);
7013
- return `${GENERATED_PACKAGE_NAME_PREFIX}${hash.digest().toString("hex")}`;
7014
- }
7015
- var GENERATED_PACKAGE_NAME_PREFIX = "prisma-client-";
7016
6615
 
7017
6616
  // src/generator.ts
7018
- import Debug2 from "@prisma/debug";
6617
+ import Debug from "@prisma/debug";
7019
6618
  import { enginesVersion } from "@prisma/engines-version";
7020
6619
  import { ClientEngineType as ClientEngineType4, getClientEngineType as getClientEngineType3, parseEnvValue } from "@prisma/internals";
7021
6620
  import { match } from "ts-pattern";
7022
6621
 
7023
6622
  // package.json
7024
- var version = "6.6.0-dev.88";
6623
+ var version = "6.6.0-dev.90";
7025
6624
 
7026
6625
  // src/generator.ts
7027
- var debug2 = Debug2("prisma:client:generator");
6626
+ var debug = Debug("prisma:client:generator");
7028
6627
  var missingOutputErrorMessage = `An output path is required for the \`prisma-client-ts\` generator. Please provide an output path in your schema file:
7029
6628
 
7030
6629
  ${dim(`generator client {
@@ -7044,7 +6643,7 @@ var PrismaClientTsGenerator = class {
7044
6643
  name = "prisma-client-ts";
7045
6644
  getManifest(config) {
7046
6645
  const requiresEngines = match(getClientEngineType3(config)).with(ClientEngineType4.Library, () => ["libqueryEngine"]).with(ClientEngineType4.Binary, () => ["queryEngine"]).with(ClientEngineType4.Client, () => []).exhaustive();
7047
- debug2("requiresEngines", requiresEngines);
6646
+ debug("requiresEngines", requiresEngines);
7048
6647
  return Promise.resolve({
7049
6648
  defaultOutput: getOutputPath(config),
7050
6649
  prettyName: "Prisma Client",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/client-generator-ts",
3
- "version": "6.6.0-dev.88",
3
+ "version": "6.6.0-dev.90",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -28,19 +28,20 @@
28
28
  "@prisma/engines-version": "6.6.0-45.fbda4d61f6cc9c7361b803e72f3a0ffeb87db447",
29
29
  "ci-info": "4.2.0",
30
30
  "env-paths": "2.2.1",
31
+ "fast-glob": "3.3.3",
31
32
  "indent-string": "4.0.0",
32
33
  "klona": "2.0.6",
33
34
  "pkg-up": "3.1.0",
34
35
  "pluralize": "8.0.0",
35
36
  "ts-pattern": "5.6.2",
36
- "@prisma/debug": "6.6.0-dev.88",
37
- "@prisma/dmmf": "6.6.0-dev.88",
38
- "@prisma/generator": "6.6.0-dev.88",
39
- "@prisma/get-platform": "6.6.0-dev.88",
40
- "@prisma/fetch-engine": "6.6.0-dev.88",
41
- "@prisma/client-common": "6.6.0-dev.88",
42
- "@prisma/internals": "6.6.0-dev.88",
43
- "@prisma/ts-builders": "6.6.0-dev.88"
37
+ "@prisma/client-common": "6.6.0-dev.90",
38
+ "@prisma/dmmf": "6.6.0-dev.90",
39
+ "@prisma/fetch-engine": "6.6.0-dev.90",
40
+ "@prisma/debug": "6.6.0-dev.90",
41
+ "@prisma/generator": "6.6.0-dev.90",
42
+ "@prisma/get-platform": "6.6.0-dev.90",
43
+ "@prisma/internals": "6.6.0-dev.90",
44
+ "@prisma/ts-builders": "6.6.0-dev.90"
44
45
  },
45
46
  "devDependencies": {
46
47
  "@types/pluralize": "0.0.33",