{"id":24886,"library":"acl-graphql","title":"acl-graphql","description":"A GraphQL ACL (Access Control List) transpiler that generates permission-based GraphQL schemas. Version 1.0.0 is the latest stable release. It transforms declarative ACL rules into GraphQL directives and resolvers, enabling fine-grained field-level access control without modifying existing schema definitions. Differentiates from other auth libraries by focusing on ACL-to-GraphQL transpilation rather than middleware-based enforcement.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","acl","graphql","access","list","control","factory"],"install":[{"cmd":"npm install acl-graphql","lang":"bash","label":"npm"},{"cmd":"yarn add acl-graphql","lang":"bash","label":"yarn"},{"cmd":"pnpm add acl-graphql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for GraphQL schema manipulation","package":"graphql","optional":false}],"imports":[{"note":"ESM-only package since v1.0.0","wrong":"const AclGraphql = require('acl-graphql')","symbol":"AclGraphql","correct":"import { AclGraphql } from 'acl-graphql'"},{"note":"Named export for defining ACL rules","symbol":"AclRule","correct":"import { AclRule } from 'acl-graphql'"},{"note":"Function name is camelCase, not PascalCase","wrong":"import { transpileACL } from 'acl-graphql'","symbol":"transpileAcl","correct":"import { transpileAcl } from 'acl-graphql'"},{"note":"Default export also available and preferred","wrong":"import { default as AclGraphql } from 'acl-graphql'","symbol":"default","correct":"import AclGraphql from 'acl-graphql'"}],"quickstart":{"code":"import { AclGraphql, AclRule } from 'acl-graphql';\nimport { buildSchema } from 'graphql';\n\nconst typeDefs = `\n  type Query {\n    user(id: ID!): User\n  }\n  type User {\n    id: ID!\n    name: String!\n    email: String!\n  }\n`;\n\nconst rules: AclRule[] = [\n  {\n    role: 'admin',\n    permissions: ['Query.user', 'User.id', 'User.name', 'User.email']\n  },\n  {\n    role: 'user',\n    permissions: ['Query.user', 'User.id', 'User.name']\n  }\n];\n\nconst acl = new AclGraphql({ typeDefs, rules });\nconst { schema, resolvers } = acl.transpile();\n\nconsole.log(schema); // GraphQLSchema with @acl directives\nconsole.log(resolvers); // Resolvers enforcing field-level access","lang":"typescript","description":"Creates an ACL-transpiled GraphQL schema from type definitions and rules, outputting schema with directives and authorization resolvers."},"warnings":[{"fix":"Update instantiation to use options object: new AclGraphql({ typeDefs, rules })","message":"As of v1.0.0, the constructor signature changed: new AclGraphql({ typeDefs, rules }) instead of positional arguments.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use flat dot notation for all field paths","message":"Rules must use dot notation for fields (e.g., 'User.email'). Nested fields are not supported.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Replace 'permissions' with 'fields' in rule definitions","message":"The 'permissions' field in rules is deprecated since v1.0.0. Use 'fields' instead.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use ES module import syntax: import { AclGraphql } from 'acl-graphql'","cause":"Using CommonJS require() with ESM-only package","error":"TypeError: AclGraphql is not a constructor"},{"fix":"Pass typeDefs in options object: new AclGraphql({ typeDefs, rules })","cause":"Omitting required 'typeDefs' option in constructor","error":"Error: No schema provided"},{"fix":"Verify field path exists in schema definition","cause":"Rule references a field that doesn't exist in the schema","error":"Error: Invalid rule - path 'User.email' not found in schema"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}