@prisma/orm-toolchain 8.0.0-rc.14-dev.16 → 8.0.0-rc.14-dev.17

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.
@@ -1,3 +1,3 @@
1
1
  import { v as errorFromCaught } from "./caught-errors-DulynoX6-BSeStARm.mjs";
2
- import { $ as resolveFromForPlan, A as hasMigrationPath, B as migrationSpaceListEntriesFromAggregate, C as executeMigrationPlanCommand, D as executeRefSetCommand, E as executeRefListCommand, G as refuseDeclaredExtensionTargetMismatch, H as preflightRefAdvancement, I as loadContractSpaceAggregateForCli, J as refusePackageCorruptionOnAggregate, K as refuseMarkerOutsideGraph, M as loadAggregateIntegrityViolations, N as loadContractRawSafely, P as loadContractSource, Q as resolveContractRefToSnapshot, R as mapContractAtError, S as executeMigrationNewCommand, T as executeRefDeleteCommand, U as readMigrationRefs, V as originHashForStatus, W as refuseContractSpaceIntegrity, Y as refuseUnknownInvariants, Z as resolveContractRef$1, _ as executeContractEmit, a as appliedHashesFromLedger, b as executeDbVerify, c as buildReadAggregate, d as computeRefAdvancementName, et as resolveMigrationRef, f as createControlClient, g as enumerateCheckSpaces, h as enrichContract, i as appContractStandInFromIdentity, it as runMigrationList, j as listRefsByContractHash, l as buildRefAdvancementFields, m as disposeEmitQueue, n as NO_REF_ADVANCEMENT, nt as runContractSpaceSeedPhase, o as buildContractSpaceAggregate, p as deriveStatusEdgeAnnotations, q as refuseMissingInvariantPath, r as advanceRefSafely, rt as runMigrationCheck, s as buildMigrationSpaceGraphEntries, st as statusForMigrationHash, tt as resolveToForPlan, u as checkSingleTarget, v as executeDbInit, w as executeRefAdvancement, x as executeMigrateShowPlan, y as executeDbUpdate, z as mapIntegrityViolations } from "./ref-BLBgE_oK-CYZXibbI.mjs";
2
+ import { $ as resolveFromForPlan, A as hasMigrationPath, B as migrationSpaceListEntriesFromAggregate, C as executeMigrationPlanCommand, D as executeRefSetCommand, E as executeRefListCommand, G as refuseDeclaredExtensionTargetMismatch, H as preflightRefAdvancement, I as loadContractSpaceAggregateForCli, J as refusePackageCorruptionOnAggregate, K as refuseMarkerOutsideGraph, M as loadAggregateIntegrityViolations, N as loadContractRawSafely, P as loadContractSource, Q as resolveContractRefToSnapshot, R as mapContractAtError, S as executeMigrationNewCommand, T as executeRefDeleteCommand, U as readMigrationRefs, V as originHashForStatus, W as refuseContractSpaceIntegrity, Y as refuseUnknownInvariants, Z as resolveContractRef$1, _ as executeContractEmit, a as appliedHashesFromLedger, b as executeDbVerify, c as buildReadAggregate, d as computeRefAdvancementName, et as resolveMigrationRef, f as createControlClient, g as enumerateCheckSpaces, h as enrichContract, i as appContractStandInFromIdentity, it as runMigrationList, j as listRefsByContractHash, l as buildRefAdvancementFields, m as disposeEmitQueue, n as NO_REF_ADVANCEMENT, nt as runContractSpaceSeedPhase, o as buildContractSpaceAggregate, p as deriveStatusEdgeAnnotations, q as refuseMissingInvariantPath, r as advanceRefSafely, rt as runMigrationCheck, s as buildMigrationSpaceGraphEntries, st as statusForMigrationHash, tt as resolveToForPlan, u as checkSingleTarget, v as executeDbInit, w as executeRefAdvancement, x as executeMigrateShowPlan, y as executeDbUpdate, z as mapIntegrityViolations } from "./ref-CfA-jmzP-qW6n6gqk.mjs";
3
3
  export { NO_REF_ADVANCEMENT, advanceRefSafely, appContractStandInFromIdentity, appliedHashesFromLedger, buildContractSpaceAggregate, buildMigrationSpaceGraphEntries, buildReadAggregate, buildRefAdvancementFields, checkSingleTarget, computeRefAdvancementName, createControlClient, deriveStatusEdgeAnnotations, disposeEmitQueue, enrichContract, enumerateCheckSpaces, errorFromCaught, executeContractEmit, executeDbInit, executeDbUpdate, executeDbVerify, executeMigrateShowPlan, executeMigrationNewCommand, executeMigrationPlanCommand, executeRefAdvancement, executeRefDeleteCommand, executeRefListCommand, executeRefSetCommand, hasMigrationPath, listRefsByContractHash, loadAggregateIntegrityViolations, loadContractRawSafely, loadContractSource, loadContractSpaceAggregateForCli, mapContractAtError, mapIntegrityViolations, migrationSpaceListEntriesFromAggregate, originHashForStatus, preflightRefAdvancement, readMigrationRefs, refuseContractSpaceIntegrity, refuseDeclaredExtensionTargetMismatch, refuseMarkerOutsideGraph, refuseMissingInvariantPath, refusePackageCorruptionOnAggregate, refuseUnknownInvariants, resolveContractRef$1 as resolveContractRef, resolveContractRefToSnapshot, resolveFromForPlan, resolveMigrationRef, resolveToForPlan, runContractSpaceSeedPhase, runMigrationCheck, runMigrationList, statusForMigrationHash };
@@ -1,4 +1,5 @@
1
1
  import { h as requireConfigSections, i as expandContractInputs, l as loadConfig, o as findNearestConfigPathForFile } from "./exports-Ca10vlXU.mjs";
2
+ import { ifDefined } from "@prisma/orm-framework/utils/defined";
2
3
  import { CliStructuredError } from "@prisma/orm-framework/errors/control";
3
4
  import { createControlStack } from "@prisma/orm-framework/components/control";
4
5
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
@@ -343,7 +344,8 @@ function lspControlStackFromStack(stack) {
343
344
  scalarTypes: [...stack.scalarTypes],
344
345
  pslBlockDescriptors: stack.authoringContributions.pslBlockDescriptors,
345
346
  authoringContributions: stack.authoringContributions,
346
- ...stack.controlMutationDefaults === void 0 ? {} : { controlMutationDefaults: stack.controlMutationDefaults }
347
+ ...stack.controlMutationDefaults === void 0 ? {} : { controlMutationDefaults: stack.controlMutationDefaults },
348
+ ...ifDefined("pslDiagnostics", stack.family?.pslDiagnostics)
347
349
  };
348
350
  }
349
351
  function resolveInterpretation(config, stack, inputs) {
@@ -355,6 +357,7 @@ function resolveInterpretation(config, stack, inputs) {
355
357
  composedExtensions: stack.extensions.map((p) => p.id),
356
358
  composedExtensionContracts: stack.extensionContracts,
357
359
  authoringContributions: stack.authoringContributions,
360
+ ...ifDefined("pslDiagnostics", stack.family?.pslDiagnostics),
358
361
  codecLookup: stack.codecLookup,
359
362
  dataTypeLookup: stack.dataTypeLookup,
360
363
  controlMutationDefaults: stack.controlMutationDefaults,
@@ -898,9 +901,12 @@ function attributeSpecResolver(context, source) {
898
901
  dataTypeEntries: source.authoringContributions.dataTypes ?? {}
899
902
  }
900
903
  };
904
+ const node = typeReferenceNode(field);
905
+ const typeResolution = node === void 0 ? void 0 : source.binder.symbolForNode(node);
901
906
  return (name) => specs.field[name]?.({
902
907
  ...specContext,
903
- field
908
+ field,
909
+ typeResolution
904
910
  });
905
911
  }
906
912
  }
@@ -910,7 +916,7 @@ function requiredArgumentsSnippet(signature) {
910
916
  }
911
917
  function typeConstructorSnippet(name, descriptor) {
912
918
  const args = descriptor.args ?? [];
913
- const reference = descriptor.entityRefArg;
919
+ const reference = descriptor.kind === "typeConstructor" ? descriptor.entityRefArg : void 0;
914
920
  const count = Math.max(args.length, (reference?.index ?? -1) + 1);
915
921
  const values = [];
916
922
  for (let index = 0; index < count; index++) {
@@ -999,7 +1005,7 @@ function scopeCompletionItems(entries, binder, range, capabilities, selector) {
999
1005
  break;
1000
1006
  case "contributedType": {
1001
1007
  const descriptor = resolution.symbol.descriptor;
1002
- const callable = descriptor.args !== void 0 || descriptor.entityRefArg !== void 0;
1008
+ const callable = descriptor.kind === "fieldPreset" || descriptor.args !== void 0 || descriptor.entityRefArg !== void 0;
1003
1009
  item.kind = callable ? CompletionItemKind.Function : CompletionItemKind.Class;
1004
1010
  if (callable) {
1005
1011
  item.textEdit = {
@@ -1008,6 +1014,10 @@ function scopeCompletionItems(entries, binder, range, capabilities, selector) {
1008
1014
  };
1009
1015
  if (capabilities.clientSupportsSnippets) item.insertTextFormat = InsertTextFormat.Snippet;
1010
1016
  }
1017
+ if (descriptor.kind === "fieldPreset") {
1018
+ item.detail = "Field preset";
1019
+ break;
1020
+ }
1011
1021
  item.detail = descriptor.deprecated === void 0 ? descriptor.documentation || "Configured scalar type" : `Deprecated: use ${descriptor.deprecated.replacement}.`;
1012
1022
  if (descriptor.deprecated !== void 0) item.tags = [CompletionItemTag.Deprecated];
1013
1023
  break;
@@ -1457,6 +1467,24 @@ function addFoldingRange(declaration, sources, ranges) {
1457
1467
  kind: FoldingRangeKind.Region
1458
1468
  });
1459
1469
  }
1470
+ function binderContextFromStack(stack) {
1471
+ return {
1472
+ authoringContributions: stack.authoringContributions ?? {
1473
+ field: {},
1474
+ type: {},
1475
+ entityTypes: {},
1476
+ pslBlockDescriptors: stack.pslBlockDescriptors,
1477
+ modelAttributes: {},
1478
+ attributeSpecs: {
1479
+ model: {},
1480
+ field: {}
1481
+ },
1482
+ dataTypes: {}
1483
+ },
1484
+ controlMutationDefaults: { defaultFunctionRegistry: stack.controlMutationDefaults?.defaultFunctionRegistry ?? /* @__PURE__ */ new Map() },
1485
+ ...stack.pslDiagnostics === void 0 ? {} : { pslDiagnostics: stack.pslDiagnostics }
1486
+ };
1487
+ }
1460
1488
  function schemaInputIdentities(inputs) {
1461
1489
  return new Set(Array.from(inputs.uris(), canonicalFileIdentity));
1462
1490
  }
@@ -1488,9 +1516,11 @@ var ProjectArtifacts = class {
1488
1516
  const snapshot = this.#readDocument(uri);
1489
1517
  if (snapshot === void 0) return [];
1490
1518
  const symbolDiagnostics = (projectSymbolDiagnostics ?? this.symbolDiagnostics()).filter((diagnostic) => diagnostic.filename === snapshot.uri);
1519
+ const binderDiagnostics = this.#binderDiagnostics().filter((diagnostic) => diagnostic.filename === snapshot.uri);
1491
1520
  return [
1492
1521
  ...mapParseDiagnostics(snapshot.parse().diagnostics),
1493
1522
  ...mapParseDiagnostics(symbolDiagnostics),
1523
+ ...mapParseDiagnostics(binderDiagnostics),
1494
1524
  ...this.#interpretDiagnostics(snapshot.uri)
1495
1525
  ];
1496
1526
  };
@@ -1498,21 +1528,12 @@ var ProjectArtifacts = class {
1498
1528
  symbolDiagnostics = () => this.#readSymbolTableResult().diagnostics;
1499
1529
  binder = () => this.#readBinderResult().binder;
1500
1530
  #readBinderResult() {
1501
- const symbolTable = this.#readSymbolTable();
1502
- const stack = this.#options.controlStack;
1503
- this.#binderResult ??= createBinder({
1504
- sources: this.sources,
1531
+ if (this.#binderResult !== void 0) return this.#binderResult;
1532
+ const symbolTable = (this.#symbolTableResult ?? this.#readSymbolTableResult()).symbolTable;
1533
+ this.#binderResult = createBinder({
1505
1534
  symbolTable,
1506
- typeConstructors: stack.authoringContributions?.type ?? {},
1507
- attributeSpecs: stack.authoringContributions === void 0 ? {
1508
- model: {},
1509
- field: {}
1510
- } : assembleAttributeSpecs(stack.authoringContributions),
1511
- pslBlockDescriptors: stack.pslBlockDescriptors,
1512
- controlMutationDefaults: {
1513
- defaultFunctionRegistry: stack.controlMutationDefaults?.defaultFunctionRegistry ?? /* @__PURE__ */ new Map(),
1514
- dataTypeEntries: stack.authoringContributions?.dataTypes ?? {}
1515
- }
1535
+ sources: this.sources,
1536
+ context: this.#interpretation?.context ?? binderContextFromStack(this.#options.controlStack)
1516
1537
  });
1517
1538
  return this.#binderResult;
1518
1539
  }
@@ -1535,15 +1556,7 @@ var ProjectArtifacts = class {
1535
1556
  this.#interpretMemo = void 0;
1536
1557
  }
1537
1558
  #projectInterpretDiagnostics() {
1538
- if (this.#interpretation === void 0) {
1539
- const bySourceId = /* @__PURE__ */ new Map();
1540
- for (const diagnostic of this.#readBinderResult().diagnostics) {
1541
- const group = bySourceId.get(diagnostic.filename) ?? [];
1542
- group.push(...mapParseDiagnostics([diagnostic]));
1543
- bySourceId.set(diagnostic.filename, group);
1544
- }
1545
- return bySourceId;
1546
- }
1559
+ if (this.#interpretation === void 0) return /* @__PURE__ */ new Map();
1547
1560
  this.#interpretMemo ??= this.#computeInterpretDistribution(this.#interpretation);
1548
1561
  return this.#interpretMemo;
1549
1562
  }
@@ -1551,10 +1564,12 @@ var ProjectArtifacts = class {
1551
1564
  const currentSymbolTable = (this.#symbolTableResult ?? this.#readSymbolTableResult()).symbolTable;
1552
1565
  const allDocuments = Array.from(this.#documents.values(), (snapshot) => snapshot.parse().document);
1553
1566
  const warnings = [];
1567
+ const binderResult = this.#readBinderResult();
1554
1568
  const result = activeInterpretation.source.interpret({
1555
1569
  documents: allDocuments,
1556
1570
  sources: this.sources,
1557
- symbolTable: currentSymbolTable
1571
+ symbolTable: currentSymbolTable,
1572
+ binder: binderResult.binder
1558
1573
  }, {
1559
1574
  ...activeInterpretation.context,
1560
1575
  reportWarning: (diagnostic) => {
@@ -1645,6 +1660,9 @@ var ProjectArtifacts = class {
1645
1660
  #readSymbolTable() {
1646
1661
  return this.#readSymbolTableResult().symbolTable;
1647
1662
  }
1663
+ #binderDiagnostics() {
1664
+ return this.#readBinderResult().diagnostics;
1665
+ }
1648
1666
  };
1649
1667
  const semanticTokenTypes = [
1650
1668
  SemanticTokenTypes.keyword,
@@ -3030,4 +3048,4 @@ function startServer(streams) {
3030
3048
  //#endregion
3031
3049
  export { startServer };
3032
3050
 
3033
- //# sourceMappingURL=exports-F_cSTVqK.mjs.map
3051
+ //# sourceMappingURL=exports-EXh7hBAx.mjs.map