@zenstackhq/sdk 3.0.0-beta.7 → 3.0.0-beta.8

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
@@ -671,7 +671,7 @@ var PrismaSchemaGenerator = class {
671
671
  (0, import_ast2.isTypeDef)(field.type.reference?.ref) ? false : field.type.array
672
672
  );
673
673
  const type = new ModelFieldType(fieldType, isArray, field.type.optional);
674
- const attributes = field.attributes.filter((attr) => this.isPrismaAttribute(attr)).filter((attr) => !this.isDefaultWithPluginInvocation(attr)).filter((attr) => (
674
+ const attributes = field.attributes.filter((attr) => this.isPrismaAttribute(attr)).filter((attr) => !this.isDefaultWithAuthInvocation(attr)).filter((attr) => (
675
675
  // when building physical schema, exclude `@default` for id fields inherited from delegate base
676
676
  !(model_utils_exports.isIdField(field, contextModel) && this.isInheritedFromDelegate(field, contextModel) && attr.decl.$refText === "@default")
677
677
  )).map((attr) => this.makeFieldAttribute(attr));
@@ -681,7 +681,7 @@ var PrismaSchemaGenerator = class {
681
681
  const result = model.addField(field.name, type, attributes, docs, addToFront);
682
682
  return result;
683
683
  }
684
- isDefaultWithPluginInvocation(attr) {
684
+ isDefaultWithAuthInvocation(attr) {
685
685
  if (attr.decl.ref?.name !== "@default") {
686
686
  return false;
687
687
  }
@@ -689,11 +689,7 @@ var PrismaSchemaGenerator = class {
689
689
  if (!expr) {
690
690
  return false;
691
691
  }
692
- return import_langium.AstUtils.streamAst(expr).some((node) => (0, import_ast2.isInvocationExpr)(node) && this.isFromPlugin(node.function.ref));
693
- }
694
- isFromPlugin(node) {
695
- const model = import_langium.AstUtils.getContainerOfType(node, import_ast2.isModel);
696
- return !!model && !!model.$document && model.$document.uri.path.endsWith("plugin.zmodel");
692
+ return import_langium.AstUtils.streamAst(expr).some(import_utils2.isAuthInvocation);
697
693
  }
698
694
  isInheritedFromDelegate(field, contextModel) {
699
695
  return field.$container !== contextModel && model_utils_exports.isDelegateModel(field.$container);