@zenstackhq/language 3.0.0-beta.24 → 3.0.0-beta.26

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
@@ -7010,6 +7010,13 @@ var FunctionInvocationValidator = class {
7010
7010
  }
7011
7011
  return true;
7012
7012
  }
7013
+ _checkAuth(expr, accept) {
7014
+ if (!expr.$resolvedType) {
7015
+ accept("error", 'cannot resolve `auth()` - make sure you have a model or type with `@auth` attribute or named "User"', {
7016
+ node: expr
7017
+ });
7018
+ }
7019
+ }
7013
7020
  _checkLength(expr, accept) {
7014
7021
  const msg = "argument must be a string or list field";
7015
7022
  const fieldArg = expr.args[0].value;
@@ -7119,6 +7126,15 @@ var FunctionInvocationValidator = class {
7119
7126
  }
7120
7127
  }
7121
7128
  };
7129
+ _ts_decorate2([
7130
+ func("auth"),
7131
+ _ts_metadata2("design:type", Function),
7132
+ _ts_metadata2("design:paramtypes", [
7133
+ typeof InvocationExpr === "undefined" ? Object : InvocationExpr,
7134
+ typeof ValidationAcceptor === "undefined" ? Object : ValidationAcceptor
7135
+ ]),
7136
+ _ts_metadata2("design:returntype", void 0)
7137
+ ], FunctionInvocationValidator.prototype, "_checkAuth", null);
7122
7138
  _ts_decorate2([
7123
7139
  func("length"),
7124
7140
  _ts_metadata2("design:type", Function),
@@ -8708,10 +8724,7 @@ var ZModelScopeProvider = class extends DefaultScopeProvider {
8708
8724
  const referenceType = this.reflection.getReferenceType(context);
8709
8725
  const globalScope = this.getGlobalScope(referenceType, context);
8710
8726
  const node = context.container;
8711
- const allowTypeDefScope = (
8712
- // isAuthOrAuthMemberAccess(node.operand) ||
8713
- !!AstUtils7.getContainerOfType(node, isTypeDef)
8714
- );
8727
+ const allowTypeDefScope = isAuthOrAuthMemberAccess(node.operand) || !!AstUtils7.getContainerOfType(node, isTypeDef);
8715
8728
  return match5(node.operand).when(isReferenceExpr, (operand) => {
8716
8729
  const ref = operand.target.ref;
8717
8730
  if (isDataField(ref)) {
@@ -8740,7 +8753,7 @@ var ZModelScopeProvider = class extends DefaultScopeProvider {
8740
8753
  const referenceType = this.reflection.getReferenceType(context);
8741
8754
  const globalScope = this.getGlobalScope(referenceType, context);
8742
8755
  const collection = collectionPredicate.left;
8743
- const allowTypeDefScope = false;
8756
+ const allowTypeDefScope = isAuthOrAuthMemberAccess(collection);
8744
8757
  return match5(collection).when(isReferenceExpr, (expr) => {
8745
8758
  const ref = expr.target.ref;
8746
8759
  if (isDataField(ref)) {