@zenstackhq/language 3.0.0-beta.29 → 3.0.0-beta.30

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/index.js CHANGED
@@ -5572,13 +5572,23 @@ function getAllAttributes(decl, seen = /* @__PURE__ */ new Set()) {
5572
5572
  }
5573
5573
  if (isDataModel(decl) && decl.baseModel) {
5574
5574
  if (decl.baseModel.ref) {
5575
- attributes.push(...getAllAttributes(decl.baseModel.ref, seen));
5575
+ const attrs = getAllAttributes(decl.baseModel.ref, seen).filter((attr) => !isNonInheritableAttribute(attr));
5576
+ attributes.push(...attrs);
5576
5577
  }
5577
5578
  }
5578
5579
  attributes.push(...decl.attributes);
5579
5580
  return attributes;
5580
5581
  }
5581
5582
  __name(getAllAttributes, "getAllAttributes");
5583
+ function isNonInheritableAttribute(attr) {
5584
+ const attrName = attr.decl.ref?.name ?? attr.decl.$refText;
5585
+ return [
5586
+ "@@map",
5587
+ "@@unique",
5588
+ "@@index"
5589
+ ].includes(attrName);
5590
+ }
5591
+ __name(isNonInheritableAttribute, "isNonInheritableAttribute");
5582
5592
  function getDocument(node) {
5583
5593
  const rootNode = findRootNode(node);
5584
5594
  const result = rootNode.$document;
@@ -6376,7 +6386,7 @@ var DataModelValidator = class {
6376
6386
  if (!thisRelation.valid) {
6377
6387
  return;
6378
6388
  }
6379
- if (this.isFieldInheritedFromDelegateModel(field)) {
6389
+ if (this.isFieldInheritedFromDelegateModel(field, contextModel)) {
6380
6390
  return;
6381
6391
  }
6382
6392
  if (this.isSelfRelation(field)) {
@@ -6499,8 +6509,8 @@ var DataModelValidator = class {
6499
6509
  }
6500
6510
  }
6501
6511
  // checks if the given field is inherited directly or indirectly from a delegate model
6502
- isFieldInheritedFromDelegateModel(field) {
6503
- return isDelegateModel(field.$container);
6512
+ isFieldInheritedFromDelegateModel(field, contextModel) {
6513
+ return field.$container !== contextModel && isDelegateModel(field.$container);
6504
6514
  }
6505
6515
  validateInherits(model, accept) {
6506
6516
  if (!model.baseModel) {