{"_id":"@eleven-am/golem-policy","name":"@eleven-am/golem-policy","dist-tags":{"latest":"0.6.0"},"versions":{"0.6.0":{"name":"@eleven-am/golem-policy","version":"0.6.0","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc -p tsconfig.json","test":"npm run test:typecheck && node --experimental-vm-modules ../../node_modules/jest/bin/jest.js","test:typecheck":"tsc --noEmit -p test/tsconfig.json","test:generate":"prisma generate --schema test/prisma/schema.prisma && prisma generate --schema test/prisma-postgres/schema.prisma && prisma generate --schema test/prisma-arrays/schema.prisma","test:postgres":"node --experimental-vm-modules ../../node_modules/jest/bin/jest.js test/sql-divergence.postgres.test.ts"},"dependencies":{"@casl/ability":"^7.0.1"},"devDependencies":{"@casl/prisma":"^2.0.2","@prisma/adapter-better-sqlite3":"^7.0.0","@prisma/adapter-pg":"^7.0.0","@prisma/client":"^7.0.0","@types/jest":"^29.5.14","@types/node":"^22.10.0","fast-check":"^3.23.2","jest":"^29.7.0","pg":"^8.13.0","prisma":"^7.0.0","ts-jest":"^29.2.5","typescript":"^5.7.0"},"license":"GPL-3.0","author":{"name":"Roy OSSAI"},"engines":{"node":">=20.19"},"publishConfig":{"access":"public"},"description":"Golem policy engine: the operator table and evaluator behind CASL condition matching, shared by the in-memory and SQL backends","keywords":["golem","casl","authorization","policy","prisma"],"repository":{"type":"git","url":"git+https://github.com/eleven-am/golem.git","directory":"packages/policy"},"gitHead":"bbf1deb0cf406fb8de441b4c90a27e0c4660d067","_id":"@eleven-am/golem-policy@0.6.0","bugs":{"url":"https://github.com/eleven-am/golem/issues"},"homepage":"https://github.com/eleven-am/golem#readme","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-ekFLdYvsQ3R/9vCIkQaBLz9+7ET0c7kGb+hOC5H3/oex5wTXAqAF5FK4SmUEmW7U9g2oQ4TKifrHgRrt/aqiiw==","shasum":"f8941d84c826f7a87ad098e664b0c6f3de7ab750","tarball":"https://registry.npmjs.org/@eleven-am/golem-policy/-/golem-policy-0.6.0.tgz","fileCount":25,"unpackedSize":181032,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDp7NqKWqjhr2UpXjVKse43sKIBkviDWA7qEj+FTRsADAiEAp0q7jiUatwxneBz2wlqGeMvBeYG5cr3V5aCMNG4ZbTs="}]},"_npmUser":{"name":"eleven-am","email":"maixperiyon@gmail.com"},"directories":{},"maintainers":[{"name":"eleven-am","email":"maixperiyon@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/golem-policy_0.6.0_1785761632684_0.6847394374758209"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-03T12:53:52.523Z","0.6.0":"2026-08-03T12:53:52.820Z","modified":"2026-08-03T12:53:53.032Z"},"maintainers":[{"name":"eleven-am","email":"maixperiyon@gmail.com"}],"description":"Golem policy engine: the operator table and evaluator behind CASL condition matching, shared by the in-memory and SQL backends","homepage":"https://github.com/eleven-am/golem#readme","keywords":["golem","casl","authorization","policy","prisma"],"repository":{"type":"git","url":"git+https://github.com/eleven-am/golem.git","directory":"packages/policy"},"author":{"name":"Roy OSSAI"},"bugs":{"url":"https://github.com/eleven-am/golem/issues"},"license":"GPL-3.0","readme":"# @eleven-am/golem-policy\n\nGolem's own evaluator for CASL rule conditions, replacing the `@casl/prisma` interpreter.\n\nOne operator table defines every supported operator once: its JavaScript predicate, its parameterised SQL rendering, its null semantics, and its operand constraints. Both backends are generated from the same entry, so the in-memory check and the database filter cannot drift apart. Only the JavaScript side is wired up today; the SQL renderings are declarative and dialect-neutral until a SQL backend consumes them.\n\nConditions are two-valued: an object matches a condition or it does not, and there is no third \"unknown\" outcome. Null and absent values are ordinary values that fail to equal things, so `AND`, `OR` and `NOT` are classical boolean algebra over the leaves. Numeric comparison is exact across `number`, `bigint` and `Decimal`, including magnitudes past `Number.MAX_SAFE_INTEGER`.\n\nUnsupported operators are rejected, never approximated. `validateConditions` reports every offending operator with its path so an application can refuse a policy at boot instead of silently under- or over-granting at request time.\n\n```ts\nimport { compileConditions, validateConditions } from '@eleven-am/golem-policy';\n\nconst result = validateConditions({ title: { contains: 'x' } });\nif (!result.supported) {\n  throw new Error(result.issues[0].message);\n}\n\nconst compiled = compileConditions({ post: { is: { authorId: 'u1' } } });\ncompiled.test({ post: { authorId: 'u1' } });\n```\n\nSee the [full guide](https://github.com/eleven-am/golem#readme).\n","readmeFilename":"README.md","_rev":"1-46c282ab3d83186be1540e6dc68a2cab"}