@zenstackhq/language 3.0.0-beta.10 → 3.0.0-beta.11

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
@@ -5425,9 +5425,9 @@ function getAllDeclarationsIncludingImports(documents, model) {
5425
5425
  }
5426
5426
  __name(getAllDeclarationsIncludingImports, "getAllDeclarationsIncludingImports");
5427
5427
  function getAuthDecl(decls) {
5428
- let authModel = decls.find((m) => hasAttribute(m, "@@auth"));
5428
+ let authModel = decls.find((d) => hasAttribute(d, "@@auth"));
5429
5429
  if (!authModel) {
5430
- authModel = decls.find((m) => m.name === "User");
5430
+ authModel = decls.find((d) => d.name === "User");
5431
5431
  }
5432
5432
  return authModel;
5433
5433
  }
@@ -5825,8 +5825,9 @@ var AttributeApplicationValidator = class {
5825
5825
  });
5826
5826
  }
5827
5827
  }
5828
- _checkUnique(attr, accept) {
5828
+ _checkConstraint(attr, accept) {
5829
5829
  const fields = attr.args[0]?.value;
5830
+ const attrName = attr.decl.ref?.name;
5830
5831
  if (!fields) {
5831
5832
  accept("error", `expects an array of field references`, {
5832
5833
  node: attr.args[0]
@@ -5835,7 +5836,7 @@ var AttributeApplicationValidator = class {
5835
5836
  }
5836
5837
  if (isArrayExpr(fields)) {
5837
5838
  if (fields.items.length === 0) {
5838
- accept("error", `\`@@unique\` expects at least one field reference`, {
5839
+ accept("error", `\`${attrName}\` expects at least one field reference`, {
5839
5840
  node: fields
5840
5841
  });
5841
5842
  return;
@@ -5854,7 +5855,7 @@ var AttributeApplicationValidator = class {
5854
5855
  return;
5855
5856
  }
5856
5857
  if (item.target.ref.$container !== attr.$container && isDelegateModel(item.target.ref.$container)) {
5857
- accept("error", `Cannot use fields inherited from a polymorphic base model in \`@@unique\``, {
5858
+ accept("error", `Cannot use fields inherited from a polymorphic base model in \`${attrName}\``, {
5858
5859
  node: item
5859
5860
  });
5860
5861
  }
@@ -5907,15 +5908,16 @@ _ts_decorate([
5907
5908
  _ts_metadata("design:returntype", void 0)
5908
5909
  ], AttributeApplicationValidator.prototype, "_checkValidate", null);
5909
5910
  _ts_decorate([
5910
- check("@@unique"),
5911
5911
  check("@@id"),
5912
+ check("@@index"),
5913
+ check("@@unique"),
5912
5914
  _ts_metadata("design:type", Function),
5913
5915
  _ts_metadata("design:paramtypes", [
5914
5916
  typeof AttributeApplication === "undefined" ? Object : AttributeApplication,
5915
5917
  typeof ValidationAcceptor === "undefined" ? Object : ValidationAcceptor
5916
5918
  ]),
5917
5919
  _ts_metadata("design:returntype", void 0)
5918
- ], AttributeApplicationValidator.prototype, "_checkUnique", null);
5920
+ ], AttributeApplicationValidator.prototype, "_checkConstraint", null);
5919
5921
  function assignableToAttributeParam(arg, param, attr) {
5920
5922
  const argResolvedType = arg.$resolvedType;
5921
5923
  if (!argResolvedType) {
@@ -7805,6 +7807,9 @@ function createZModelLanguageServices(context, logToConsole = false) {
7805
7807
  if (doc.parseResult.lexerErrors.length > 0 || doc.parseResult.parserErrors.length > 0) {
7806
7808
  continue;
7807
7809
  }
7810
+ if (doc.uri.scheme !== "file") {
7811
+ continue;
7812
+ }
7808
7813
  const schemaPath = fileURLToPath3(doc.uri.toString());
7809
7814
  const pluginSchemas = getPluginDocuments(doc.parseResult.value, schemaPath);
7810
7815
  for (const plugin of pluginSchemas) {