@zenstackhq/language 3.0.0-beta.10 → 3.0.0-beta.12
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 +12 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +2 -2
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/utils.js.map +1 -1
- package/package.json +5 -5
- package/res/stdlib.zmodel +13 -13
package/dist/index.cjs
CHANGED
|
@@ -5459,9 +5459,9 @@ function getAllDeclarationsIncludingImports(documents, model) {
|
|
|
5459
5459
|
}
|
|
5460
5460
|
__name(getAllDeclarationsIncludingImports, "getAllDeclarationsIncludingImports");
|
|
5461
5461
|
function getAuthDecl(decls) {
|
|
5462
|
-
let authModel = decls.find((
|
|
5462
|
+
let authModel = decls.find((d) => hasAttribute(d, "@@auth"));
|
|
5463
5463
|
if (!authModel) {
|
|
5464
|
-
authModel = decls.find((
|
|
5464
|
+
authModel = decls.find((d) => d.name === "User");
|
|
5465
5465
|
}
|
|
5466
5466
|
return authModel;
|
|
5467
5467
|
}
|
|
@@ -5859,8 +5859,9 @@ var AttributeApplicationValidator = class {
|
|
|
5859
5859
|
});
|
|
5860
5860
|
}
|
|
5861
5861
|
}
|
|
5862
|
-
|
|
5862
|
+
_checkConstraint(attr, accept) {
|
|
5863
5863
|
const fields = attr.args[0]?.value;
|
|
5864
|
+
const attrName = attr.decl.ref?.name;
|
|
5864
5865
|
if (!fields) {
|
|
5865
5866
|
accept("error", `expects an array of field references`, {
|
|
5866
5867
|
node: attr.args[0]
|
|
@@ -5869,7 +5870,7 @@ var AttributeApplicationValidator = class {
|
|
|
5869
5870
|
}
|
|
5870
5871
|
if (isArrayExpr(fields)) {
|
|
5871
5872
|
if (fields.items.length === 0) {
|
|
5872
|
-
accept("error",
|
|
5873
|
+
accept("error", `\`${attrName}\` expects at least one field reference`, {
|
|
5873
5874
|
node: fields
|
|
5874
5875
|
});
|
|
5875
5876
|
return;
|
|
@@ -5888,7 +5889,7 @@ var AttributeApplicationValidator = class {
|
|
|
5888
5889
|
return;
|
|
5889
5890
|
}
|
|
5890
5891
|
if (item.target.ref.$container !== attr.$container && isDelegateModel(item.target.ref.$container)) {
|
|
5891
|
-
accept("error", `Cannot use fields inherited from a polymorphic base model in
|
|
5892
|
+
accept("error", `Cannot use fields inherited from a polymorphic base model in \`${attrName}\``, {
|
|
5892
5893
|
node: item
|
|
5893
5894
|
});
|
|
5894
5895
|
}
|
|
@@ -5941,15 +5942,16 @@ _ts_decorate([
|
|
|
5941
5942
|
_ts_metadata("design:returntype", void 0)
|
|
5942
5943
|
], AttributeApplicationValidator.prototype, "_checkValidate", null);
|
|
5943
5944
|
_ts_decorate([
|
|
5944
|
-
check("@@unique"),
|
|
5945
5945
|
check("@@id"),
|
|
5946
|
+
check("@@index"),
|
|
5947
|
+
check("@@unique"),
|
|
5946
5948
|
_ts_metadata("design:type", Function),
|
|
5947
5949
|
_ts_metadata("design:paramtypes", [
|
|
5948
5950
|
typeof AttributeApplication === "undefined" ? Object : AttributeApplication,
|
|
5949
5951
|
typeof ValidationAcceptor === "undefined" ? Object : ValidationAcceptor
|
|
5950
5952
|
]),
|
|
5951
5953
|
_ts_metadata("design:returntype", void 0)
|
|
5952
|
-
], AttributeApplicationValidator.prototype, "
|
|
5954
|
+
], AttributeApplicationValidator.prototype, "_checkConstraint", null);
|
|
5953
5955
|
function assignableToAttributeParam(arg, param, attr) {
|
|
5954
5956
|
const argResolvedType = arg.$resolvedType;
|
|
5955
5957
|
if (!argResolvedType) {
|
|
@@ -7840,6 +7842,9 @@ function createZModelLanguageServices(context, logToConsole = false) {
|
|
|
7840
7842
|
if (doc.parseResult.lexerErrors.length > 0 || doc.parseResult.parserErrors.length > 0) {
|
|
7841
7843
|
continue;
|
|
7842
7844
|
}
|
|
7845
|
+
if (doc.uri.scheme !== "file") {
|
|
7846
|
+
continue;
|
|
7847
|
+
}
|
|
7843
7848
|
const schemaPath = (0, import_node_url3.fileURLToPath)(doc.uri.toString());
|
|
7844
7849
|
const pluginSchemas = getPluginDocuments(doc.parseResult.value, schemaPath);
|
|
7845
7850
|
for (const plugin of pluginSchemas) {
|