@prisma/orm-toolchain 8.0.0-rc.18-dev.19 → 8.0.0-rc.18-dev.21

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/cli.mjs CHANGED
@@ -40,7 +40,7 @@ import { applyEdits, modify, parse, printParseErrorCode } from "jsonc-parser";
40
40
  import stringWidth from "string-width";
41
41
  import { bold, createColors, cyan, cyanBright, dim, green, yellow } from "colorette";
42
42
  import { build } from "esbuild";
43
- //#region ../../../1-framework/3-tooling/cli/dist/load-config-CZKX80aY.mjs
43
+ //#region ../../../1-framework/3-tooling/cli/dist/load-config-BvLuytQm.mjs
44
44
  /**
45
45
  * `isStructuredError` is the repo's own check, and it is the one that matters here: it holds the
46
46
  * regular expression for a dotted `NAMESPACE.SUBCODE`, so only a code the protocol accepts
@@ -4515,23 +4515,18 @@ export default definePrismaConfig({
4515
4515
  }
4516
4516
  function dbFile(target, resolveImportSpecifier = keepInternalSpecifiers) {
4517
4517
  const runtime = targetEntrypoint(target, "runtime", resolveImportSpecifier);
4518
- if (target === "postgres") return `import 'dotenv/config';
4519
- import postgres from '${runtime}';
4520
- import type { Contract } from './contract.d';
4521
- import contractJson from './contract.json' with { type: 'json' };
4522
-
4523
- export const db = postgres<Contract>({
4524
- contractJson,
4525
- url: process.env['DATABASE_URL']!,
4526
- });
4527
- `;
4518
+ const staticEntry = targetEntrypoint(target, "static", resolveImportSpecifier);
4519
+ const factory = target === "postgres" ? "postgres" : "mongo";
4528
4520
  return `import 'dotenv/config';
4529
- import mongo from '${runtime}';
4521
+ import ${factory} from '${runtime}';
4522
+ import { contractFromJson } from '${staticEntry}';
4530
4523
  import type { Contract } from './contract.d';
4531
4524
  import contractJson from './contract.json' with { type: 'json' };
4532
4525
 
4533
- export const db = mongo<Contract>({
4534
- contractJson,
4526
+ export const contract = contractFromJson<Contract>(contractJson);
4527
+
4528
+ export const db = ${factory}({
4529
+ contract,
4535
4530
  url: process.env['DATABASE_URL']!,
4536
4531
  });
4537
4532
  `;