@zenstackhq/language 3.0.0-beta.25 → 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.cjs +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/res/stdlib.zmodel +7 -0
package/dist/index.cjs
CHANGED
|
@@ -7046,6 +7046,13 @@ var FunctionInvocationValidator = class {
|
|
|
7046
7046
|
}
|
|
7047
7047
|
return true;
|
|
7048
7048
|
}
|
|
7049
|
+
_checkAuth(expr, accept) {
|
|
7050
|
+
if (!expr.$resolvedType) {
|
|
7051
|
+
accept("error", 'cannot resolve `auth()` - make sure you have a model or type with `@auth` attribute or named "User"', {
|
|
7052
|
+
node: expr
|
|
7053
|
+
});
|
|
7054
|
+
}
|
|
7055
|
+
}
|
|
7049
7056
|
_checkLength(expr, accept) {
|
|
7050
7057
|
const msg = "argument must be a string or list field";
|
|
7051
7058
|
const fieldArg = expr.args[0].value;
|
|
@@ -7155,6 +7162,15 @@ var FunctionInvocationValidator = class {
|
|
|
7155
7162
|
}
|
|
7156
7163
|
}
|
|
7157
7164
|
};
|
|
7165
|
+
_ts_decorate2([
|
|
7166
|
+
func("auth"),
|
|
7167
|
+
_ts_metadata2("design:type", Function),
|
|
7168
|
+
_ts_metadata2("design:paramtypes", [
|
|
7169
|
+
typeof InvocationExpr === "undefined" ? Object : InvocationExpr,
|
|
7170
|
+
typeof ValidationAcceptor === "undefined" ? Object : ValidationAcceptor
|
|
7171
|
+
]),
|
|
7172
|
+
_ts_metadata2("design:returntype", void 0)
|
|
7173
|
+
], FunctionInvocationValidator.prototype, "_checkAuth", null);
|
|
7158
7174
|
_ts_decorate2([
|
|
7159
7175
|
func("length"),
|
|
7160
7176
|
_ts_metadata2("design:type", Function),
|
|
@@ -8744,10 +8760,7 @@ var ZModelScopeProvider = class extends import_langium11.DefaultScopeProvider {
|
|
|
8744
8760
|
const referenceType = this.reflection.getReferenceType(context);
|
|
8745
8761
|
const globalScope = this.getGlobalScope(referenceType, context);
|
|
8746
8762
|
const node = context.container;
|
|
8747
|
-
const allowTypeDefScope = (
|
|
8748
|
-
// isAuthOrAuthMemberAccess(node.operand) ||
|
|
8749
|
-
!!import_langium11.AstUtils.getContainerOfType(node, isTypeDef)
|
|
8750
|
-
);
|
|
8763
|
+
const allowTypeDefScope = isAuthOrAuthMemberAccess(node.operand) || !!import_langium11.AstUtils.getContainerOfType(node, isTypeDef);
|
|
8751
8764
|
return (0, import_ts_pattern5.match)(node.operand).when(isReferenceExpr, (operand) => {
|
|
8752
8765
|
const ref = operand.target.ref;
|
|
8753
8766
|
if (isDataField(ref)) {
|
|
@@ -8776,7 +8789,7 @@ var ZModelScopeProvider = class extends import_langium11.DefaultScopeProvider {
|
|
|
8776
8789
|
const referenceType = this.reflection.getReferenceType(context);
|
|
8777
8790
|
const globalScope = this.getGlobalScope(referenceType, context);
|
|
8778
8791
|
const collection = collectionPredicate.left;
|
|
8779
|
-
const allowTypeDefScope =
|
|
8792
|
+
const allowTypeDefScope = isAuthOrAuthMemberAccess(collection);
|
|
8780
8793
|
return (0, import_ts_pattern5.match)(collection).when(isReferenceExpr, (expr) => {
|
|
8781
8794
|
const ref = expr.target.ref;
|
|
8782
8795
|
if (isDataField(ref)) {
|