@zenstackhq/language 3.9.1 → 3.9.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_ast = require("./ast-DSXl7TDv.cjs");
3
3
  const require_ast$1 = require("./ast.cjs");
4
- const require_utils = require("./utils-BvdQdCtT.cjs");
4
+ const require_utils = require("./utils-DjeCl0z6.cjs");
5
5
  let _zenstackhq_common_helpers = require("@zenstackhq/common-helpers");
6
6
  let langium = require("langium");
7
7
  let node_fs = require("node:fs");
@@ -4345,6 +4345,9 @@ var AttributeApplicationValidator = class {
4345
4345
  if (!found) accept("error", `Schema "${schemaName}" is not defined in the datasource`, { node: attr });
4346
4346
  }
4347
4347
  }
4348
+ _checkStrict(attr, accept) {
4349
+ if (!require_ast.isTypeDef(attr.$container)) accept("error", `attribute "@@strict" can only be used on type definitions`, { node: attr });
4350
+ }
4348
4351
  validatePolicyKinds(kind, candidates, attr, accept) {
4349
4352
  const items = kind.split(",").map((x) => x.trim());
4350
4353
  items.forEach((item) => {
@@ -4405,6 +4408,12 @@ __decorate([
4405
4408
  __decorateMetadata("design:paramtypes", [Object, Object]),
4406
4409
  __decorateMetadata("design:returntype", void 0)
4407
4410
  ], AttributeApplicationValidator.prototype, "_checkSchema", null);
4411
+ __decorate([
4412
+ check("@@strict"),
4413
+ __decorateMetadata("design:type", Function),
4414
+ __decorateMetadata("design:paramtypes", [Object, Object]),
4415
+ __decorateMetadata("design:returntype", void 0)
4416
+ ], AttributeApplicationValidator.prototype, "_checkStrict", null);
4408
4417
  function assignableToAttributeParam(arg, param, attr) {
4409
4418
  const genericError = {
4410
4419
  result: false,
@@ -4932,6 +4941,25 @@ var DataSourceValidator = class {
4932
4941
  }
4933
4942
  };
4934
4943
  //#endregion
4944
+ //#region src/validators/plugin-validator.ts
4945
+ /**
4946
+ * Validates plugin declarations.
4947
+ */
4948
+ var PluginValidator = class {
4949
+ validate(plugin, accept) {
4950
+ validateDuplicatedDeclarations(plugin, plugin.fields, accept);
4951
+ this.validateProvider(plugin, accept);
4952
+ }
4953
+ validateProvider(plugin, accept) {
4954
+ const provider = plugin.fields.find((f) => f.name === "provider");
4955
+ if (!provider) {
4956
+ accept("error", "plugin must include a \"provider\" field", { node: plugin });
4957
+ return;
4958
+ }
4959
+ if (!require_utils.getStringLiteral(provider.value)) accept("error", "\"provider\" must be set to a non-empty string literal", { node: provider.value });
4960
+ }
4961
+ };
4962
+ //#endregion
4935
4963
  //#region src/validators/enum-validator.ts
4936
4964
  /**
4937
4965
  * Validates enum declarations.
@@ -5420,6 +5448,7 @@ function registerValidationChecks(services) {
5420
5448
  const checks = {
5421
5449
  Model: validator.checkModel,
5422
5450
  DataSource: validator.checkDataSource,
5451
+ Plugin: validator.checkPlugin,
5423
5452
  GeneratorDecl: validator.checkGenerator,
5424
5453
  DataModel: validator.checkDataModel,
5425
5454
  TypeDef: validator.checkTypeDef,
@@ -5472,6 +5501,9 @@ var ZModelValidator = class {
5472
5501
  checkProcedure(node, accept) {
5473
5502
  new ProcedureValidator().validate(node, accept);
5474
5503
  }
5504
+ checkPlugin(node, accept) {
5505
+ new PluginValidator().validate(node, accept);
5506
+ }
5475
5507
  };
5476
5508
  //#endregion
5477
5509
  //#region src/zmodel-comment-provider.ts