@prisma/orm-toolchain 8.0.0-rc.20-dev.2 → 8.0.0-rc.20-dev.4

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
@@ -11,7 +11,7 @@ import { d as writeRef, r as readRef } from "./refs-DM3q3IZC-BC6H6P0X.mjs";
11
11
  import { a as contractHashAtMarker } from "./aggregate-T_HG6gq6.mjs";
12
12
  import { i as createScaffoldSpecifierResolver } from "./import-roots-BPn2s_fq.mjs";
13
13
  import { o as isLiveMarkerRef } from "./ref-resolution-Eo0QHp4f.mjs";
14
- import { $ as refuseMarkerOutsideGraph, A as executeRefDeleteCommand, B as loadContractRawSafely, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, G as mapContractAtError, H as loadContractSourceWithStack, I as isStatementVerb, J as migrationSpaceListEntriesFromAggregate, L as listRefsByContractHash, M as executeRefSetCommand, N as findPackageByDirPath, O as executeMigrationPlanCommand, P as formatSourceDiagnostic, R as liveMarkerUse, U as loadContractSpaceAggregateForCli, V as loadContractSource, W as looksLikePath, X as readMigrationRefs, Y as preflightRefAdvancement, Z as refuseContractSpaceIntegrity, _ as deriveStatusEdgeAnnotations, _t as statusForMigrationHash, a as advanceRefSafely, at as resolveContractRef$1, b as enumerateCheckSpaces, ct as resolveMigrationRef, d as buildRefAdvancementFields, dt as retryCommandFor, et as refuseMissingInvariantPath, f as checkSingleTarget, g as createControlClient, gt as sourceWarningDiagnostic, h as convertAndDelete, ht as snapshotVerifierFor, i as RECORDED_OR_EMPTY_CONTRACT_REF_FORMS, it as resolveAppTargetPath, j as executeRefListCommand, l as buildMigrationSpaceGraphEntries, m as contractValidationMeta, mt as runMigrationList, n as NO_REF_ADVANCEMENT, nt as refuseUnknownInvariants, ot as resolveContractRefToSnapshot, p as computeRefAdvancementName, pt as runMigrationCheck, q as matchConsents, r as RECORDED_CONTRACT_REF_FORMS, rt as requireDatabaseForLiveMarkerUse, s as appliedHashesFromLedger, t as ALL_CONTRACT_REF_FORMS, tt as refusePackageCorruptionOnAggregate, u as buildReadAggregate, vt as toDeclaredExtensionsFromRaw, x as executeContractEmit, yt as validateLoadedContract, z as loadAggregateIntegrityViolations } from "./ref-DEiY2Cbd-1ZImpUEN.mjs";
14
+ import { $ as refuseMarkerOutsideGraph, A as executeRefDeleteCommand, B as loadContractRawSafely, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, G as mapContractAtError, H as loadContractSourceWithStack, I as isStatementVerb, J as migrationSpaceListEntriesFromAggregate, L as listRefsByContractHash, M as executeRefSetCommand, N as findPackageByDirPath, O as executeMigrationPlanCommand, P as formatSourceDiagnostic, R as liveMarkerUse, U as loadContractSpaceAggregateForCli, V as loadContractSource, W as looksLikePath, X as readMigrationRefs, Y as preflightRefAdvancement, Z as refuseContractSpaceIntegrity, _ as deriveStatusEdgeAnnotations, _t as statusForMigrationHash, a as advanceRefSafely, at as resolveContractRef$1, b as enumerateCheckSpaces, bt as withWarningFindings, ct as resolveMigrationRef, d as buildRefAdvancementFields, dt as retryCommandFor, et as refuseMissingInvariantPath, f as checkSingleTarget, g as createControlClient, gt as sourceWarningDiagnostic, h as convertAndDelete, ht as snapshotVerifierFor, i as RECORDED_OR_EMPTY_CONTRACT_REF_FORMS, it as resolveAppTargetPath, j as executeRefListCommand, l as buildMigrationSpaceGraphEntries, m as contractValidationMeta, mt as runMigrationList, n as NO_REF_ADVANCEMENT, nt as refuseUnknownInvariants, ot as resolveContractRefToSnapshot, p as computeRefAdvancementName, pt as runMigrationCheck, q as matchConsents, r as RECORDED_CONTRACT_REF_FORMS, rt as requireDatabaseForLiveMarkerUse, s as appliedHashesFromLedger, t as ALL_CONTRACT_REF_FORMS, tt as refusePackageCorruptionOnAggregate, u as buildReadAggregate, vt as toDeclaredExtensionsFromRaw, x as executeContractEmit, yt as validateLoadedContract, z as loadAggregateIntegrityViolations } from "./ref-lBShHvAG-BwIX69xi.mjs";
15
15
  import { a as PRISMA7_QUICK_REFERENCE_STEP, i as PRISMA7_LOOP_STEP, n as InitOutputSchema, o as buildNextSteps, r as NEXT_STEPS_BEFORE_SCAFFOLD, t as DB_SIGN_STEP } from "./output-BcC8eB0h-C5bRd-aC.mjs";
16
16
  import { createRequire } from "node:module";
17
17
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -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-DjVZj4AV.mjs
43
+ //#region ../../../1-framework/3-tooling/cli/dist/load-config-CCwIZ4uh.mjs
44
44
  const ESCAPES = {
45
45
  "\\": "\\\\",
46
46
  " ": "\\t",
@@ -539,22 +539,19 @@ const defaultContractPrintDependencies = { printPsl };
539
539
  async function executeContractPrint(options, dependencies = defaultContractPrintDependencies) {
540
540
  const { config, contractConfig, description, cwd, signal } = options;
541
541
  const stack = createControlStack(config);
542
- const sourceWarnings = [];
543
542
  const loaded = await loadContractSourceWithStack({
544
543
  stack,
545
544
  source: contractConfig.source,
546
545
  cwd,
547
- ...ifDefined("signal", signal),
548
- reportWarning: (diagnostic) => {
549
- sourceWarnings.push(diagnostic);
550
- }
546
+ ...ifDefined("signal", signal)
551
547
  });
552
- if (!loaded.ok) throw loaded.failure.error;
548
+ if (!loaded.ok) throw withWarningFindings(loaded.failure.error, loaded.failure.warnings, cwd);
549
+ const { warnings: sourceWarnings } = loaded.value;
553
550
  const familyInstance = config.family.create(stack);
554
551
  const contract = validateLoadedContract({
555
552
  config,
556
553
  familyInstance,
557
- contract: loaded.value
554
+ contract: loaded.value.contract
558
555
  });
559
556
  if (!hasPslContractBuild(familyInstance)) throw errorRuntime("CONTRACT.PRINT_UNSUPPORTED", "contract print is not supported for this family", {
560
557
  why: "The configured family cannot print a contract as PSL, so nothing was written.",
@@ -1342,104 +1339,21 @@ function createDbInitCommand(createClient) {
1342
1339
  }
1343
1340
  const dbInitCommand = createDbInitCommand(createControlClient);
1344
1341
  const SUMMARY = "Schema read successfully";
1345
- /**
1346
- * A leading keyword and the name it introduces: `<keyword> <name>`, or
1347
- * `<keyword>: <name>`. The keyword recedes and the name is the identifier.
1348
- */
1349
- function keywordThenName(label) {
1350
- const colon = label.match(/^(.+?):\s*(\S.*)$/);
1351
- if (colon?.[1] !== void 0 && colon[2] !== void 0) return [
1352
- {
1353
- text: colon[1],
1354
- tone: "muted"
1355
- },
1356
- { text: ": " },
1357
- {
1358
- text: colon[2],
1359
- tone: "identifier"
1360
- }
1361
- ];
1362
- const spaced = label.match(/^(\S.*\S|\S+)\s+(\S+)$/);
1363
- if (spaced?.[1] !== void 0 && spaced[2] !== void 0) return [
1364
- {
1365
- text: spaced[1],
1366
- tone: "muted"
1367
- },
1368
- { text: " " },
1369
- {
1370
- text: spaced[2],
1371
- tone: "identifier"
1372
- }
1373
- ];
1374
- }
1375
- /** `<name>: <detail> (<qualifier>)` — the name leads and the qualifier recedes. */
1376
- function namedDetail(label) {
1377
- const parts = label.match(/^([^:]+):\s*(.+)$/);
1378
- if (parts?.[1] === void 0 || parts[2] === void 0) return;
1379
- const [, name, rest] = parts;
1380
- const qualified = rest.match(/^([^\s(]+)\s*(\([^)]+\))$/);
1381
- if (qualified?.[1] !== void 0 && qualified[2] !== void 0) return [
1382
- {
1383
- text: name,
1384
- tone: "identifier"
1385
- },
1386
- { text: `: ${qualified[1]} ` },
1387
- {
1388
- text: qualified[2],
1389
- tone: "muted"
1390
- }
1391
- ];
1392
- return [{
1393
- text: name,
1394
- tone: "identifier"
1395
- }, { text: `: ${rest}` }];
1396
- }
1397
- /** `<name> <rest>` — the name leads and the prose behind it recedes. */
1398
- function nameThenProse(label) {
1399
- const parts = label.match(/^(\S+)\s+(\S.*)$/);
1400
- if (parts?.[1] === void 0 || parts[2] === void 0) return;
1401
- return [
1402
- {
1403
- text: parts[1],
1404
- tone: "identifier"
1405
- },
1406
- { text: " " },
1407
- {
1408
- text: parts[2],
1409
- tone: "muted"
1410
- }
1411
- ];
1342
+ const PART_TONES = {
1343
+ title: "emphasis",
1344
+ keyword: "muted",
1345
+ name: "identifier",
1346
+ detail: "muted"
1347
+ };
1348
+ function partSpan(part) {
1349
+ return part.role === void 0 ? { text: part.text } : {
1350
+ text: part.text,
1351
+ tone: PART_TONES[part.role]
1352
+ };
1412
1353
  }
1413
- /**
1414
- * What a schema node's label means, said in tones.
1415
- *
1416
- * The families phrase these labels themselves, so the shapes recognised here
1417
- * are positional (`<keyword> <name>`, `<name>: <detail>`) rather than a list of
1418
- * words: a family that renames a keyword keeps its colouring, and no family's
1419
- * vocabulary is written down in the framework layer.
1420
- */
1354
+ /** A node's label in tones, taken from the parts its family marked. */
1421
1355
  function labelSpans(node) {
1422
- switch (node.kind) {
1423
- case "root": return [{
1424
- text: node.label,
1425
- tone: "emphasis"
1426
- }];
1427
- case "collection": return [{
1428
- text: node.label,
1429
- tone: "muted"
1430
- }];
1431
- case "entity":
1432
- case "index": return keywordThenName(node.label) ?? [{
1433
- text: node.label,
1434
- tone: "identifier"
1435
- }];
1436
- case "field": return namedDetail(node.label) ?? [{ text: node.label }];
1437
- case "dependency": return nameThenProse(node.label) ?? [{
1438
- text: node.label,
1439
- tone: "identifier"
1440
- }];
1441
- default: return [{ text: node.label }];
1442
- }
1356
+ return node.labelParts.map(partSpan);
1443
1357
  }
1444
1358
  function treeNode(node) {
1445
1359
  return {
@@ -4956,22 +4870,21 @@ function prisma6SideBySideSetup(inputs) {
4956
4870
  };
4957
4871
  }
4958
4872
  /**
4959
- * Recognised pnpm error signatures that justify a fallback to npm.
4960
- *
4961
- * These patterns indicate the published artifact itself is at fault
4962
- * (a leaked `workspace:*` or `catalog:` specifier), not the user's
4963
- * environment — pnpm is faithfully reporting "I cannot resolve this
4964
- * registry version", and npm is willing to install it because npm
4965
- * doesn't care about the protocol prefix when there's a fallback range.
4966
- *
4967
- * The predicate lives on its own so both shells' `init` share one list:
4968
- * the commander command matches it against captured child stderr, the
4969
- * engine command against the stderr the package-manager capability
4970
- * returns on a failed install.
4873
+ * pnpm error codes that mean the published artifact itself is at fault (a leaked `workspace:`
4874
+ * or `catalog:` specifier), not the user's environment. npm installs such an artifact, so init
4875
+ * falls back to it. Pinned against pnpm 10.27: a leaked `workspace:` specifier reports
4876
+ * `ERR_PNPM_WORKSPACE_PKG_NOT_FOUND`, a leaked `catalog:` one
4877
+ * `ERR_PNPM_SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER`. `ERR_PNPM_NO_MATCHING_VERSION` is left out: pnpm
4878
+ * reports it for a version the registry does not have, which npm cannot install either.
4879
+ */
4880
+ const FALLBACK_PNPM_ERROR_CODES = /* @__PURE__ */ new Set(["ERR_PNPM_WORKSPACE_PKG_NOT_FOUND", "ERR_PNPM_SPEC_NOT_SUPPORTED_BY_ANY_RESOLVER"]);
4881
+ const PNPM_ERROR_CODE = /\bERR_PNPM_[A-Z0-9_]+\b/g;
4882
+ /**
4883
+ * Whether pnpm's output names an error code that justifies the npm fallback. `init` reads it
4884
+ * from the output the package-manager capability returns on a failed install.
4971
4885
  */
4972
- function isRecognisedPnpmResolutionError(stderr) {
4973
- if (!stderr) return false;
4974
- return stderr.includes("ERR_PNPM_WORKSPACE_PKG_NOT_FOUND") || stderr.includes("ERR_PNPM_NO_MATCHING_VERSION") || /No matching version found for .* in the catalog/i.test(stderr) || /workspace:[^\s]+ is not a valid (version|spec)/i.test(stderr) || /catalog:[^\s]* is not a valid (version|spec)/i.test(stderr);
4886
+ function isRecognisedPnpmResolutionError(output) {
4887
+ return Array.from(output.matchAll(PNPM_ERROR_CODE), ([code]) => code).some((code) => FALLBACK_PNPM_ERROR_CODES.has(code));
4975
4888
  }
4976
4889
  function metaString(failure, key) {
4977
4890
  const value = failure.meta?.[key];
@@ -4980,7 +4893,9 @@ function metaString(failure, key) {
4980
4893
  /**
4981
4894
  * pnpm reported a specifier the published artifact leaked, which npm installs
4982
4895
  * happily. The engine redacts credentials out of the stderr it returns but
4983
- * leaves error codes alone, which is what this reads.
4896
+ * leaves error codes alone, which is what this reads. pnpm 10 prints its
4897
+ * `ERR_PNPM_*` codes on stdout, though, and the engine returns only stderr, so
4898
+ * this does not fire until the engine returns stdout as well.
4984
4899
  */
4985
4900
  function pnpmLeakedASpecifier(failure) {
4986
4901
  return metaString(failure, "manager") === "pnpm" && isRecognisedPnpmResolutionError(metaString(failure, "stderrTail"));
@@ -7122,7 +7037,7 @@ const lspCommand = defineServerCommand({
7122
7037
  } },
7123
7038
  handler: async (args, io) => {
7124
7039
  const exitCode = await withoutClientProcessIdInArgv(async () => {
7125
- const { startServer } = await import("./exports-CKgwcXbp.mjs");
7040
+ const { startServer } = await import("./exports-Dc7BjdfY.mjs");
7126
7041
  return startServer({
7127
7042
  stdin: io.stdin,
7128
7043
  stdout: io.stdout,