@prisma/orm-toolchain 8.0.0-rc.23-dev.13 → 8.0.0-rc.23-dev.14

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-BIjV2dM9.mjs";
12
12
  import { i as createScaffoldSpecifierResolver } from "./import-roots-CWlCTZJ9.mjs";
13
13
  import { o as isLiveMarkerRef } from "./ref-resolution-Eo0QHp4f.mjs";
14
- import { $ as refuseContractSpaceIntegrity, A as executeRefDeleteCommand, B as loadAggregateIntegrityViolations, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, G as looksLikePath, H as loadContractSource, I as isStatementVerb, J as matchConsents, K as mapContractAtError, L as labelsText, M as executeRefSetCommand, N as findPackageByDirPath, O as executeMigrationPlanCommand, P as formatSourceDiagnostic, Q as readMigrationRefs, R as listRefsByContractHash, St as withWarningFindings, U as loadContractSourceWithStack, V as loadContractRawSafely, W as loadContractSpaceAggregateForCli, X as planEverySpace, Y as migrationSpaceListEntriesFromAggregate, Z as preflightRefAdvancement, _ as deriveStatusEdgeAnnotations, _t as snapshotVerifierFor, a as advanceRefSafely, at as requireDatabaseForLiveMarkerUse, b as enumerateCheckSpaces, bt as toDeclaredExtensionsFromRaw, ct as resolveContractRefToSnapshot, d as buildRefAdvancementFields, f as checkSingleTarget, g as createControlClient, gt as runMigrationList, h as convertAndDelete, ht as runMigrationCheck, i as RECORDED_OR_EMPTY_CONTRACT_REF_FORMS, it as renamedAndDeleted, j as executeRefListCommand, l as buildMigrationSpaceGraphEntries, m as contractValidationMeta, n as NO_REF_ADVANCEMENT, nt as refusePackageCorruptionOnAggregate, ot as resolveAppTargetPath, p as computeRefAdvancementName, pt as retryCommandFor, r as RECORDED_CONTRACT_REF_FORMS, rt as refuseUnknownInvariants, s as appliedHashesFromLedger, st as resolveContractRef$1, t as ALL_CONTRACT_REF_FORMS, tt as refuseMissingInvariantPath, u as buildReadAggregate, ut as resolveMigrationRef, vt as sourceWarningDiagnostic, x as executeContractEmit, xt as validateLoadedContract, yt as statusForMigrationHash, z as liveMarkerUse } from "./ref-hKV9pGrC-DVWnb8cQ.mjs";
14
+ import { $ as refuseContractSpaceIntegrity, A as executeRefDeleteCommand, B as loadAggregateIntegrityViolations, Ct as withWarningFindings, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, G as looksLikePath, H as loadContractSource, I as isStatementVerb, J as matchConsents, K as mapContractAtError, L as labelsText, M as executeRefSetCommand, N as findPackageByDirPath, O as executeMigrationPlanCommand, P as formatSourceDiagnostic, Q as readMigrationRefs, R as listRefsByContractHash, St as validateLoadedContract, U as loadContractSourceWithStack, V as loadContractRawSafely, W as loadContractSpaceAggregateForCli, X as planEverySpace, Y as migrationSpaceListEntriesFromAggregate, Z as preflightRefAdvancement, _ as deriveStatusEdgeAnnotations, _t as skippedOperationsText, a as advanceRefSafely, at as requireDatabaseForLiveMarkerUse, b as enumerateCheckSpaces, bt as statusForMigrationHash, ct as resolveContractRefToSnapshot, d as buildRefAdvancementFields, f as checkSingleTarget, g as createControlClient, gt as runMigrationList, h as convertAndDelete, ht as runMigrationCheck, i as RECORDED_OR_EMPTY_CONTRACT_REF_FORMS, it as renamedAndDeleted, j as executeRefListCommand, l as buildMigrationSpaceGraphEntries, m as contractValidationMeta, n as NO_REF_ADVANCEMENT, nt as refusePackageCorruptionOnAggregate, ot as resolveAppTargetPath, p as computeRefAdvancementName, pt as retryCommandFor, r as RECORDED_CONTRACT_REF_FORMS, rt as refuseUnknownInvariants, s as appliedHashesFromLedger, st as resolveContractRef$1, t as ALL_CONTRACT_REF_FORMS, tt as refuseMissingInvariantPath, u as buildReadAggregate, ut as resolveMigrationRef, vt as snapshotVerifierFor, x as executeContractEmit, xt as toDeclaredExtensionsFromRaw, yt as sourceWarningDiagnostic, z as liveMarkerUse } from "./ref-DH9J_oNY-CipATbYR.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 { a as resolveGating, i as readUserConfig, r as ensureInstallationId, s as runTelemetry, u as userConfigPath } from "./exports-DwuO4y2c.mjs";
17
17
  import { createRequire } from "node:module";
@@ -43,8 +43,8 @@ import stringWidth from "string-width";
43
43
  import { bold, createColors, cyan, cyanBright, dim, green, yellow } from "colorette";
44
44
  import { isCI } from "ci-info";
45
45
  import { build } from "esbuild";
46
- //#region ../../../1-framework/3-tooling/cli/dist/cli-CFId1dwB.mjs
47
- var version = "8.0.0-rc.23-dev.13";
46
+ //#region ../../../1-framework/3-tooling/cli/dist/cli-BvlI6kIO.mjs
47
+ var version = "8.0.0-rc.23-dev.14";
48
48
  const ESCAPES = {
49
49
  "\\": "\\\\",
50
50
  " ": "\\t",
@@ -833,6 +833,11 @@ function renderPreviewStatement(text, language) {
833
833
  function previewBlockHeader(preview) {
834
834
  return preview.statements.length > 0 && preview.statements.every((s) => s.language === "sql") ? "DDL preview" : "Operation preview";
835
835
  }
836
+ /** A planner warning as the CLI prints it: its summary, then its why. */
837
+ function plannerWarningText(warning) {
838
+ if (warning.why === void 0) return warning.summary;
839
+ return `${/[.!?]$/.test(warning.summary) ? warning.summary : `${warning.summary}.`} ${warning.why}`;
840
+ }
836
841
  const SLOT_TEXT = {
837
842
  convert: "conversion slot written in migration.ts",
838
843
  backfill: "backfill slots written in migration.ts"
@@ -918,6 +923,14 @@ function operationBlocks$2(result) {
918
923
  roots: result.plan.operations.map(operationNode)
919
924
  }, ...destructiveWarningBlocks(hasDestructive)];
920
925
  }
926
+ /** What the planner flagged without refusing to plan it, each its summary followed by its why. */
927
+ function plannerWarningBlocks(result) {
928
+ return (result.plannerWarnings ?? []).map((warning) => ({
929
+ kind: "summary",
930
+ status: "warn",
931
+ text: plannerWarningText(warning)
932
+ }));
933
+ }
921
934
  /** The statements a database would run, printed verbatim rather than laid out. */
922
935
  function previewBlocks$2(preview) {
923
936
  if (preview === void 0) return [];
@@ -938,26 +951,13 @@ function previewBlocks$2(preview) {
938
951
  lines: statements
939
952
  }];
940
953
  }
941
- /** What the planner flagged without refusing to plan it. */
942
- function plannerWarningBlocks(result) {
943
- const warnings = result.warnings ?? [];
944
- if (warnings.length === 0) return [];
945
- return [{
946
- kind: "summary",
947
- status: "warn",
948
- text: "Planner warnings"
949
- }, {
950
- kind: "list",
951
- items: warnings.map((warning) => warning.summary)
952
- }];
953
- }
954
954
  /** The new required fields whose existing rows get a temporary value, and how to choose the value. */
955
955
  function temporaryValueBlocks$1(result, invocation, databaseStorageHash) {
956
956
  const get = result.mode === "plan" ? "would get" : "got";
957
957
  return (result.temporaryValues ?? []).map(({ field, value }) => ({
958
958
  kind: "summary",
959
959
  status: "warn",
960
- text: `Existing rows ${get} ${value} in field "${field}". To choose the value, plan a migration with ${printedPlanCommand(invocation, databaseStorageHash, [statementFlag({
960
+ text: `Field "${field}" ${get} the temporary value ${value} where existing data has none. To choose the value, plan a migration with ${printedPlanCommand(invocation, databaseStorageHash, [statementFlag({
961
961
  verb: "backfill",
962
962
  text: field
963
963
  })])} instead.`
@@ -970,11 +970,12 @@ function planSummaryText(result) {
970
970
  }
971
971
  function applySummaryText(result) {
972
972
  const executed = result.execution?.operationsExecuted ?? 0;
973
+ const planned = result.plan.operations.length;
973
974
  const spaces = result.perSpace?.length ?? 0;
974
975
  const across = spaces > 0 ? ` across ${spaces} contract space${spaces === 1 ? "" : "s"}` : "";
975
976
  if (result.changedStorageEntities !== void 0) return result.summary;
976
977
  if (executed === 0) return `Database already matches contract${across}`;
977
- return `Applied ${executed} operation(s)${across}`;
978
+ return executed < planned ? `Applied ${executed} of ${planned} operation(s)${across}; ${skippedOperationsText(planned - executed)}` : `Applied ${executed} operation(s)${across}`;
978
979
  }
979
980
  /** For each namespace the plan removes, the answers that answer all of its questions. */
980
981
  function namespaceAnswerLines(result) {
@@ -1128,9 +1129,8 @@ function migrationResultNextActions(result, invocation, applyCommand) {
1128
1129
  return result.mode === "plan" ? [runCommandAction("Apply the planned operations", applyCommand)] : [runCommandAction(result.perSpace !== void 0 && result.perSpace.length === 1 ? "Confirm the space is up to date" : "Confirm every space is up to date", cliCommand(invocation, "migration status"))];
1129
1130
  }
1130
1131
  /**
1131
- * Collects the planner's warnings a run hands to `onPlannerWarnings`. A failed run reports them as
1132
- * `warn` messages, which reach the human and the `--json` output; a successful one lists them in
1133
- * its result.
1132
+ * Collects the planner's warnings a run hands to `onPlannerWarnings`. A successful run shows them
1133
+ * in its result; a failed one reports them as `warn` messages, which come before its error.
1134
1134
  */
1135
1135
  function plannerWarningsCollector(report) {
1136
1136
  let collected = [];
@@ -1143,7 +1143,7 @@ function plannerWarningsCollector(report) {
1143
1143
  for (const warning of collected) report({
1144
1144
  kind: "message",
1145
1145
  severity: "warn",
1146
- text: warning.summary
1146
+ text: plannerWarningText(warning)
1147
1147
  });
1148
1148
  }
1149
1149
  };
@@ -1255,7 +1255,7 @@ function initDocument(inputs) {
1255
1255
  ...ifDefined("perSpace", value.perSpace),
1256
1256
  advancedRef: inputs.advancedRef,
1257
1257
  plannedAdvanceRef: inputs.plannedAdvanceRef,
1258
- ...inputs.plannerWarnings.length > 0 ? { warnings: inputs.plannerWarnings } : {},
1258
+ ...inputs.plannerWarnings.length > 0 ? { plannerWarnings: inputs.plannerWarnings } : {},
1259
1259
  summary: value.summary,
1260
1260
  timings: { total: Date.now() - inputs.startedAt }
1261
1261
  };
@@ -2430,7 +2430,7 @@ function updateDocument(inputs) {
2430
2430
  removedNamespaces: removedNamespacesJson(value, inputs.statements),
2431
2431
  addedNamespaces: value.namespaces?.added ?? []
2432
2432
  } : {},
2433
- ...inputs.plannerWarnings.length > 0 ? { warnings: inputs.plannerWarnings } : {},
2433
+ ...inputs.plannerWarnings.length > 0 ? { plannerWarnings: inputs.plannerWarnings } : {},
2434
2434
  advancedRef: inputs.advancedRef,
2435
2435
  plannedAdvanceRef: inputs.plannedAdvanceRef,
2436
2436
  summary: value.summary,
@@ -10725,14 +10725,14 @@ function temporaryValueBlocks(result) {
10725
10725
  return result.temporaryValues.map(({ field, value }) => ({
10726
10726
  kind: "summary",
10727
10727
  status: "warn",
10728
- text: `Existing rows get ${value} in field "${field}". To choose the value, plan again with ${statementFlag({
10728
+ text: `Field "${field}" gets the temporary value ${value} where existing data has none. To choose the value, plan again with ${statementFlag({
10729
10729
  verb: "backfill",
10730
10730
  text: field
10731
10731
  })}.`
10732
10732
  }));
10733
10733
  }
10734
10734
  function warningBlocks(result) {
10735
- return (result.warnings ?? []).map((text) => ({
10735
+ return [...result.warnings ?? [], ...(result.plannerWarnings ?? []).map(plannerWarningText)].map((text) => ({
10736
10736
  kind: "summary",
10737
10737
  status: "warn",
10738
10738
  text