@zenstackhq/language 3.0.0-alpha.16 → 3.0.0-alpha.18
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 +14 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -21
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -6375,26 +6375,15 @@ var DataSourceValidator = class {
|
|
|
6375
6375
|
}
|
|
6376
6376
|
}
|
|
6377
6377
|
validateUrl(ds, accept) {
|
|
6378
|
-
const
|
|
6379
|
-
if (!
|
|
6380
|
-
|
|
6381
|
-
node: ds
|
|
6382
|
-
});
|
|
6378
|
+
const urlField = ds.fields.find((f) => f.name === "url");
|
|
6379
|
+
if (!urlField) {
|
|
6380
|
+
return;
|
|
6383
6381
|
}
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
"
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
if (!field) {
|
|
6390
|
-
continue;
|
|
6391
|
-
}
|
|
6392
|
-
const value = getStringLiteral(field.value);
|
|
6393
|
-
if (!value && !(isInvocationExpr(field.value) && field.value.function.ref?.name === "env")) {
|
|
6394
|
-
accept("error", `"${fieldName}" must be set to a string literal or an invocation of "env" function`, {
|
|
6395
|
-
node: field.value
|
|
6396
|
-
});
|
|
6397
|
-
}
|
|
6382
|
+
const value = getStringLiteral(urlField.value);
|
|
6383
|
+
if (!value && !(isInvocationExpr(urlField.value) && urlField.value.function.ref?.name === "env")) {
|
|
6384
|
+
accept("error", `"${urlField.name}" must be set to a string literal or an invocation of "env" function`, {
|
|
6385
|
+
node: urlField.value
|
|
6386
|
+
});
|
|
6398
6387
|
}
|
|
6399
6388
|
}
|
|
6400
6389
|
validateRelationMode(ds, accept) {
|
|
@@ -7803,8 +7792,12 @@ __name(linkContentToContainer, "linkContentToContainer");
|
|
|
7803
7792
|
function validationAfterImportMerge(model) {
|
|
7804
7793
|
const errors = [];
|
|
7805
7794
|
const dataSources = model.declarations.filter((d) => isDataSource(d));
|
|
7806
|
-
if (dataSources.length
|
|
7807
|
-
errors.push("Validation error:
|
|
7795
|
+
if (dataSources.length === 0) {
|
|
7796
|
+
errors.push("Validation error: schema must have a datasource declaration");
|
|
7797
|
+
} else {
|
|
7798
|
+
if (dataSources.length > 1) {
|
|
7799
|
+
errors.push("Validation error: multiple datasource declarations are not allowed");
|
|
7800
|
+
}
|
|
7808
7801
|
}
|
|
7809
7802
|
const decls = getDataModelAndTypeDefs(model, true);
|
|
7810
7803
|
const authDecls = decls.filter((d) => hasAttribute(d, "@@auth"));
|