@zenstackhq/language 3.9.4-beta.1 → 3.9.4

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-DjeCl0z6.cjs");
4
+ const require_utils = require("./utils-C3bnOGl-.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");
@@ -4334,6 +4334,12 @@ var AttributeApplicationValidator = class {
4334
4334
  const provider = require_utils.getDataSourceProvider(zmodel);
4335
4335
  if (provider && provider !== "postgresql") accept("error", `\`@fullText\` is only supported for the \`postgresql\` provider`, { node: attr });
4336
4336
  }
4337
+ _checkUuid(attr, accept) {
4338
+ const versionArg = attr.args.find((arg) => arg.$resolvedParam?.name === "version");
4339
+ if (!versionArg) return;
4340
+ const version = require_utils.getNumberLiteral(versionArg.value);
4341
+ if (version !== void 0 && version !== 4 && version !== 7) accept("error", `\`@uuid\` version must be \`4\` or \`7\``, { node: versionArg });
4342
+ }
4337
4343
  _checkSchema(attr, accept) {
4338
4344
  const schemaName = require_utils.getStringLiteral(attr.args[0]?.value);
4339
4345
  (0, _zenstackhq_common_helpers.invariant)(schemaName, `@@schema expects a string literal`);
@@ -4402,6 +4408,12 @@ __decorate([
4402
4408
  __decorateMetadata("design:paramtypes", [Object, Object]),
4403
4409
  __decorateMetadata("design:returntype", void 0)
4404
4410
  ], AttributeApplicationValidator.prototype, "_checkFullText", null);
4411
+ __decorate([
4412
+ check("@uuid"),
4413
+ __decorateMetadata("design:type", Function),
4414
+ __decorateMetadata("design:paramtypes", [Object, Object]),
4415
+ __decorateMetadata("design:returntype", void 0)
4416
+ ], AttributeApplicationValidator.prototype, "_checkUuid", null);
4405
4417
  __decorate([
4406
4418
  check("@@schema"),
4407
4419
  __decorateMetadata("design:type", Function),
@@ -5120,7 +5132,7 @@ var FunctionDeclValidator = class {
5120
5132
  };
5121
5133
  //#endregion
5122
5134
  //#region src/validators/function-invocation-validator.ts
5123
- var _ref$1, _ref2$1, _ref3$1, _ref4$1, _ref5$1, _ref6$1, _ref7$1;
5135
+ var _ref$1, _ref2$1, _ref3$1, _ref4$1, _ref5$1, _ref6$1, _ref7$1, _ref8$1;
5124
5136
  const invocationCheckers = /* @__PURE__ */ new Map();
5125
5137
  function func(name) {
5126
5138
  return function(_target, _propertyKey, descriptor) {
@@ -5233,6 +5245,13 @@ var FunctionInvocationValidator = class {
5233
5245
  if (version !== void 0 && version !== 4 && version !== 7) accept("error", "first argument must be 4 or 7", { node: expr.args[0] });
5234
5246
  }
5235
5247
  }
5248
+ _checkIsUuid(expr, accept) {
5249
+ const versionArg = expr.args[1]?.value;
5250
+ if (versionArg) {
5251
+ const version = require_utils.getLiteral(versionArg);
5252
+ if (version !== void 0 && version !== 4 && version !== 7) accept("error", "second argument must be 4 or 7", { node: expr.args[1] });
5253
+ }
5254
+ }
5236
5255
  _checkCuid(expr, accept) {
5237
5256
  const versionArg = expr.args[0]?.value;
5238
5257
  if (versionArg) {
@@ -5329,39 +5348,45 @@ __decorate([
5329
5348
  __decorateMetadata("design:returntype", void 0)
5330
5349
  ], FunctionInvocationValidator.prototype, "_checkUuid", null);
5331
5350
  __decorate([
5332
- func("cuid"),
5351
+ func("isUuid"),
5333
5352
  __decorateMetadata("design:type", Function),
5334
5353
  __decorateMetadata("design:paramtypes", [typeof (_ref2$1 = typeof require_ast.InvocationExpr !== "undefined" && require_ast.InvocationExpr) === "function" ? _ref2$1 : Object, Object]),
5335
5354
  __decorateMetadata("design:returntype", void 0)
5355
+ ], FunctionInvocationValidator.prototype, "_checkIsUuid", null);
5356
+ __decorate([
5357
+ func("cuid"),
5358
+ __decorateMetadata("design:type", Function),
5359
+ __decorateMetadata("design:paramtypes", [typeof (_ref3$1 = typeof require_ast.InvocationExpr !== "undefined" && require_ast.InvocationExpr) === "function" ? _ref3$1 : Object, Object]),
5360
+ __decorateMetadata("design:returntype", void 0)
5336
5361
  ], FunctionInvocationValidator.prototype, "_checkCuid", null);
5337
5362
  __decorate([
5338
5363
  func("nanoid"),
5339
5364
  __decorateMetadata("design:type", Function),
5340
- __decorateMetadata("design:paramtypes", [typeof (_ref3$1 = typeof require_ast.InvocationExpr !== "undefined" && require_ast.InvocationExpr) === "function" ? _ref3$1 : Object, Object]),
5365
+ __decorateMetadata("design:paramtypes", [typeof (_ref4$1 = typeof require_ast.InvocationExpr !== "undefined" && require_ast.InvocationExpr) === "function" ? _ref4$1 : Object, Object]),
5341
5366
  __decorateMetadata("design:returntype", void 0)
5342
5367
  ], FunctionInvocationValidator.prototype, "_checkNanoid", null);
5343
5368
  __decorate([
5344
5369
  func("auth"),
5345
5370
  __decorateMetadata("design:type", Function),
5346
- __decorateMetadata("design:paramtypes", [typeof (_ref4$1 = typeof require_ast.InvocationExpr !== "undefined" && require_ast.InvocationExpr) === "function" ? _ref4$1 : Object, Object]),
5371
+ __decorateMetadata("design:paramtypes", [typeof (_ref5$1 = typeof require_ast.InvocationExpr !== "undefined" && require_ast.InvocationExpr) === "function" ? _ref5$1 : Object, Object]),
5347
5372
  __decorateMetadata("design:returntype", void 0)
5348
5373
  ], FunctionInvocationValidator.prototype, "_checkAuth", null);
5349
5374
  __decorate([
5350
5375
  func("length"),
5351
5376
  __decorateMetadata("design:type", Function),
5352
- __decorateMetadata("design:paramtypes", [typeof (_ref5$1 = typeof require_ast.InvocationExpr !== "undefined" && require_ast.InvocationExpr) === "function" ? _ref5$1 : Object, Object]),
5377
+ __decorateMetadata("design:paramtypes", [typeof (_ref6$1 = typeof require_ast.InvocationExpr !== "undefined" && require_ast.InvocationExpr) === "function" ? _ref6$1 : Object, Object]),
5353
5378
  __decorateMetadata("design:returntype", void 0)
5354
5379
  ], FunctionInvocationValidator.prototype, "_checkLength", null);
5355
5380
  __decorate([
5356
5381
  func("regex"),
5357
5382
  __decorateMetadata("design:type", Function),
5358
- __decorateMetadata("design:paramtypes", [typeof (_ref6$1 = typeof require_ast.InvocationExpr !== "undefined" && require_ast.InvocationExpr) === "function" ? _ref6$1 : Object, Object]),
5383
+ __decorateMetadata("design:paramtypes", [typeof (_ref7$1 = typeof require_ast.InvocationExpr !== "undefined" && require_ast.InvocationExpr) === "function" ? _ref7$1 : Object, Object]),
5359
5384
  __decorateMetadata("design:returntype", void 0)
5360
5385
  ], FunctionInvocationValidator.prototype, "_checkRegex", null);
5361
5386
  __decorate([
5362
5387
  func("check"),
5363
5388
  __decorateMetadata("design:type", Function),
5364
- __decorateMetadata("design:paramtypes", [typeof (_ref7$1 = typeof require_ast.InvocationExpr !== "undefined" && require_ast.InvocationExpr) === "function" ? _ref7$1 : Object, Object]),
5389
+ __decorateMetadata("design:paramtypes", [typeof (_ref8$1 = typeof require_ast.InvocationExpr !== "undefined" && require_ast.InvocationExpr) === "function" ? _ref8$1 : Object, Object]),
5365
5390
  __decorateMetadata("design:returntype", void 0)
5366
5391
  ], FunctionInvocationValidator.prototype, "_checkCheck", null);
5367
5392
  //#endregion