@zenstackhq/language 3.9.2 → 3.9.4-beta.1

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-DSpz4Ig6.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");
@@ -4941,6 +4941,25 @@ var DataSourceValidator = class {
4941
4941
  }
4942
4942
  };
4943
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
4944
4963
  //#region src/validators/enum-validator.ts
4945
4964
  /**
4946
4965
  * Validates enum declarations.
@@ -5429,6 +5448,7 @@ function registerValidationChecks(services) {
5429
5448
  const checks = {
5430
5449
  Model: validator.checkModel,
5431
5450
  DataSource: validator.checkDataSource,
5451
+ Plugin: validator.checkPlugin,
5432
5452
  GeneratorDecl: validator.checkGenerator,
5433
5453
  DataModel: validator.checkDataModel,
5434
5454
  TypeDef: validator.checkTypeDef,
@@ -5481,6 +5501,9 @@ var ZModelValidator = class {
5481
5501
  checkProcedure(node, accept) {
5482
5502
  new ProcedureValidator().validate(node, accept);
5483
5503
  }
5504
+ checkPlugin(node, accept) {
5505
+ new PluginValidator().validate(node, accept);
5506
+ }
5484
5507
  };
5485
5508
  //#endregion
5486
5509
  //#region src/zmodel-comment-provider.ts