@prisma/orm-toolchain 8.0.0-rc.17-dev.33 → 8.0.0-rc.17-dev.34

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
@@ -6909,7 +6909,7 @@ const lspCommand = defineServerCommand({
6909
6909
  } },
6910
6910
  handler: async (args, io) => {
6911
6911
  const exitCode = await withoutClientProcessIdInArgv(async () => {
6912
- const { startServer } = await import("./exports-8DWd_zM2.mjs");
6912
+ const { startServer } = await import("./exports-D21BYJ-P.mjs");
6913
6913
  return startServer({
6914
6914
  stdin: io.stdin,
6915
6915
  stdout: io.stdout,
@@ -965,8 +965,8 @@ function attributeSpecResolver(context, source) {
965
965
  }
966
966
  case "field": {
967
967
  if (source.authoringContributions === void 0) return () => void 0;
968
- const model = source.binder.declaredSymbol(context.model.syntax);
969
- if (model?.kind !== "model" || source.controlMutationDefaults === void 0) return () => void 0;
968
+ const model = fieldSpecModel(source.binder.declaredSymbol(context.model.syntax));
969
+ if (model === void 0 || source.controlMutationDefaults === void 0) return () => void 0;
970
970
  const field = source.binder.declaredSymbol(context.field.syntax);
971
971
  if (field?.kind !== "field") return () => void 0;
972
972
  const specs = assembleAttributeSpecs(source.authoringContributions);
@@ -986,6 +986,10 @@ function attributeSpecResolver(context, source) {
986
986
  }
987
987
  }
988
988
  }
989
+ function fieldSpecModel(symbol) {
990
+ if (symbol?.kind === "model") return symbol;
991
+ return symbol?.kind === "mixin" && symbol.keyword === "model" ? symbol : void 0;
992
+ }
989
993
  function requiredArgumentsSnippet(signature) {
990
994
  return requiredArguments(signature).map((argument, index) => requiredArgumentSnippet(argument, index + 1)).join(", ");
991
995
  }
@@ -1599,9 +1603,9 @@ function pslSymbolOf(resolution) {
1599
1603
  case "compositeType":
1600
1604
  case "namedType":
1601
1605
  case "block":
1606
+ case "mixin":
1602
1607
  case "field":
1603
1608
  case "namespace": return resolution.symbol;
1604
- case "mixin":
1605
1609
  case "contributedType":
1606
1610
  case "contributedNamespace":
1607
1611
  case "crossSpace":
@@ -1961,6 +1965,7 @@ function resolveHoverResult(binder, token) {
1961
1965
  case "compositeType":
1962
1966
  case "namedType":
1963
1967
  case "block":
1968
+ case "mixin":
1964
1969
  case "field": return {
1965
1970
  kind: "entity",
1966
1971
  symbol: resolution.symbol
@@ -2075,12 +2080,13 @@ function argumentTypeLabel(arg) {
2075
2080
  return arg.values.map((value) => `'${value}'`).join(" | ");
2076
2081
  }
2077
2082
  function blockKeywordDocumentationAt(token, pslBlockDescriptors) {
2078
- const declaration = GenericBlockDeclarationAst.cast(token.parent);
2083
+ const declaration = GenericBlockDeclarationAst.cast(token.parent) ?? MixinDeclarationAst.cast(token.parent);
2079
2084
  if (declaration === void 0 || declaration.keyword()?.offset !== token.offset) return void 0;
2080
2085
  return findBlockDescriptor(pslBlockDescriptors, token.text)?.documentation;
2081
2086
  }
2082
2087
  function renderDeclarationLine(entity) {
2083
2088
  if (entity.kind === "block") return `${entity.keyword} ${entity.name}`;
2089
+ if (entity.kind === "mixin") return `${entity.keyword} mixin ${entity.name}`;
2084
2090
  if (entity.kind === "field" || entity.kind === "namedType") return collapseWhitespace(printSyntaxWithoutComments(entity.node.syntax));
2085
2091
  return `${entity.node.keyword()?.text ?? ""} ${entity.name}`;
2086
2092
  }
@@ -2390,7 +2396,7 @@ function modelTakesMap(model, source) {
2390
2396
  }
2391
2397
  function fieldTakesMap(field, source) {
2392
2398
  const owner = field.node.syntax.parent;
2393
- const model = owner === void 0 ? void 0 : ModelDeclarationAst.cast(owner);
2399
+ const model = owner === void 0 ? void 0 : fieldOwnerWithMap(owner);
2394
2400
  if (model === void 0) return false;
2395
2401
  if (hasAttribute(field.attributes, "map")) return false;
2396
2402
  const type = typeReferenceNode(field);
@@ -2402,6 +2408,12 @@ function fieldTakesMap(field, source) {
2402
2408
  model
2403
2409
  }, source)("map") !== void 0;
2404
2410
  }
2411
+ function fieldOwnerWithMap(owner) {
2412
+ const model = ModelDeclarationAst.cast(owner);
2413
+ if (model !== void 0) return model;
2414
+ const mixin = MixinDeclarationAst.cast(owner);
2415
+ return mixin?.keyword()?.text === "model" ? mixin : void 0;
2416
+ }
2405
2417
  function blockTakesMap(block, source) {
2406
2418
  if (hasAttribute(block.attributes, "map")) return false;
2407
2419
  return findBlockDescriptor(source.pslBlockDescriptors, block.keyword)?.nameIsStorageName === true;
@@ -2557,13 +2569,13 @@ function collectDeclaration(declaration, source, tokens) {
2557
2569
  if (declaration instanceof ModelDeclarationAst) {
2558
2570
  addToken(declaration.keyword(), "keyword", tokens);
2559
2571
  addIdentifier(declaration.name(), "class", tokens, semanticTokenModifierBits.declaration);
2560
- collectBlockMembers(declaration.members(), source, tokens);
2572
+ collectFieldBlockMembers(declaration.members(), source, tokens);
2561
2573
  return;
2562
2574
  }
2563
2575
  if (declaration instanceof CompositeTypeDeclarationAst) {
2564
2576
  addToken(declaration.keyword(), "keyword", tokens);
2565
2577
  addIdentifier(declaration.name(), "struct", tokens, semanticTokenModifierBits.declaration);
2566
- collectBlockMembers(declaration.members(), source, tokens);
2578
+ collectFieldBlockMembers(declaration.members(), source, tokens);
2567
2579
  return;
2568
2580
  }
2569
2581
  if (declaration instanceof NamespaceDeclarationAst) {
@@ -2581,38 +2593,45 @@ function collectDeclaration(declaration, source, tokens) {
2581
2593
  addToken(declaration.keyword(), "keyword", tokens);
2582
2594
  addToken(declaration.mixinKeyword(), "keyword", tokens);
2583
2595
  addIdentifier(declaration.name(), "type", tokens, semanticTokenModifierBits.declaration);
2596
+ if (FIELD_BLOCK_KEYWORDS.has(declaration.keyword()?.text ?? "")) collectFieldBlockMembers(declaration.members(), source, tokens);
2597
+ else collectEntryBlockMembers(declaration.members(), source, tokens);
2584
2598
  return;
2585
2599
  }
2586
2600
  addToken(declaration.keyword(), "keyword", tokens);
2587
2601
  addIdentifier(declaration.name(), "type", tokens, semanticTokenModifierBits.declaration);
2588
- collectGenericBlockMembers(declaration.members(), source, tokens);
2602
+ collectEntryBlockMembers(declaration.members(), source, tokens);
2603
+ }
2604
+ const FIELD_BLOCK_KEYWORDS = /* @__PURE__ */ new Set(["model", "type"]);
2605
+ function collectFieldBlockMembers(members, source, tokens) {
2606
+ for (const member of members) if (member instanceof MixinInclusionAst) collectInclusion(member, source, tokens);
2607
+ else if (member instanceof FieldDeclarationAst) collectField(member, source, tokens);
2608
+ else if (!(member instanceof KeyValuePairAst)) collectAttribute(member, source, tokens);
2609
+ }
2610
+ function collectEntryBlockMembers(members, source, tokens) {
2611
+ for (const member of members) if (member instanceof MixinInclusionAst) collectInclusion(member, source, tokens);
2612
+ else if (member instanceof KeyValuePairAst) {
2613
+ addIdentifier(member.key(), "property", tokens);
2614
+ collectExpression(member.value(), source, tokens);
2615
+ } else if (!(member instanceof FieldDeclarationAst)) collectAttribute(member, source, tokens);
2616
+ }
2617
+ function collectInclusion(inclusion, source, tokens) {
2618
+ const name = inclusion.name();
2619
+ if (name === void 0) return;
2620
+ const plus = inclusion.plus();
2621
+ const segments = identifierSegments(name);
2622
+ for (const [index, segment] of segments.entries()) {
2623
+ const isName = index === segments.length - 1;
2624
+ const qualifier = isName ? void 0 : source.binder.symbolForNode(segment.identifier.syntax);
2625
+ if (!isName && qualifier?.kind !== "namespace") continue;
2626
+ const range = rangeForIdentifier(segment.identifier, isName ? "type" : "namespace");
2627
+ tokens.push(index === 0 && plus !== void 0 && plus.offset < range.startOffset ? createPendingSemanticToken(plus.offset, range.endOffset, isName ? "type" : "namespace") : range);
2628
+ }
2589
2629
  }
2590
2630
  function collectNamedTypeDeclaration(declaration, source, tokens) {
2591
2631
  addIdentifier(declaration.name(), "type", tokens, semanticTokenModifierBits.declaration);
2592
2632
  collectTypeAnnotation(declaration.typeAnnotation(), source, tokens);
2593
2633
  collectAttributes(declaration.attributes(), source, tokens);
2594
2634
  }
2595
- function collectGenericBlockMembers(members, source, tokens) {
2596
- for (const member of members) {
2597
- if (member instanceof MixinInclusionAst) continue;
2598
- if ("key" in member) {
2599
- addIdentifier(member.key(), "property", tokens);
2600
- collectExpression(member.value(), source, tokens);
2601
- continue;
2602
- }
2603
- collectAttribute(member, source, tokens);
2604
- }
2605
- }
2606
- function collectBlockMembers(members, source, tokens) {
2607
- for (const member of members) {
2608
- if (member instanceof MixinInclusionAst) continue;
2609
- if (member instanceof FieldDeclarationAst) {
2610
- collectField(member, source, tokens);
2611
- continue;
2612
- }
2613
- collectAttribute(member, source, tokens);
2614
- }
2615
- }
2616
2635
  function collectField(field, source, tokens) {
2617
2636
  addIdentifier(field.name(), "property", tokens, semanticTokenModifierBits.declaration);
2618
2637
  collectTypeAnnotation(field.typeAnnotation(), source, tokens);
@@ -3799,4 +3818,4 @@ function startServer(streams) {
3799
3818
  //#endregion
3800
3819
  export { startServer };
3801
3820
 
3802
- //# sourceMappingURL=exports-8DWd_zM2.mjs.map
3821
+ //# sourceMappingURL=exports-D21BYJ-P.mjs.map