{"_id":"@adysre/rules-core","name":"@adysre/rules-core","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@adysre/rules-core","version":"0.1.0","type":"module","description":"Framework-agnostic core of the ADYSRE Business Rules Engine: AST builders, traversal and validation. No runtime dependencies.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/abhisheksahu093/Adysre.git","directory":"packages/rules-core"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"main":"./dist/index.js","types":"./dist/index.d.ts","devDependencies":{"@types/node":"^20.16.10","tsx":"^4.19.1","typescript":"^5.6.3","@adysre/config":"0.1.0"},"dependencies":{"@adysre/rules-types":"0.1.0"},"keywords":["rules-engine","business-rules","rule-builder","json-logic","decision-engine","typescript"],"engines":{"node":">=20.0.0"},"sideEffects":false,"publishConfig":{"access":"public"},"scripts":{"build":"tsc -p tsconfig.build.json && node ../config/scripts/fix-declarations.mjs","lint":"eslint src","typecheck":"tsc --noEmit","test":"tsx --test 'src/**/*.test.ts'","clean":"rm -rf dist .turbo tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo"},"_id":"@adysre/rules-core@0.1.0","bugs":{"url":"https://github.com/abhisheksahu093/Adysre/issues"},"homepage":"https://github.com/abhisheksahu093/Adysre#readme","_integrity":"sha512-4Tb22GkkBu0J4dpUPITMSQJcbhe/CSVnkPCNbt4CrFefgNkY69CaiwZGKxbWRnChjBZQse3SyXLR38Brmhhsjg==","_resolved":"/private/var/folders/xx/vrjl61fs7dlb3dhyq5_lgzkm0000gn/T/c7013199d0c3a6ce70e190991b9cc63e/adysre-rules-core-0.1.0.tgz","_from":"file:adysre-rules-core-0.1.0.tgz","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-4Tb22GkkBu0J4dpUPITMSQJcbhe/CSVnkPCNbt4CrFefgNkY69CaiwZGKxbWRnChjBZQse3SyXLR38Brmhhsjg==","shasum":"6800296f0cace9d7f1d28a5402abf3f9ce09a9c1","tarball":"https://registry.npmjs.org/@adysre/rules-core/-/rules-core-0.1.0.tgz","fileCount":58,"unpackedSize":213170,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCGk7ifDB+enczKU+6VTZmb/CHmTb0l8OBtroG87y5MWgIgRiCsEEoc7War12I2ln6i23RhT9pb1vg08eEA6+yTcUU="}]},"_npmUser":{"name":"adysre","email":"abhisheksahu093@gmail.com"},"directories":{},"maintainers":[{"name":"adysre","email":"abhisheksahu093@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rules-core_0.1.0_1785148188391_0.19614181530724428"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-27T10:29:48.205Z","0.1.0":"2026-07-27T10:29:48.532Z","modified":"2026-07-27T10:29:48.798Z"},"maintainers":[{"name":"adysre","email":"abhisheksahu093@gmail.com"}],"description":"Framework-agnostic core of the ADYSRE Business Rules Engine: AST builders, traversal and validation. No runtime dependencies.","homepage":"https://github.com/abhisheksahu093/Adysre#readme","keywords":["rules-engine","business-rules","rule-builder","json-logic","decision-engine","typescript"],"repository":{"type":"git","url":"git+https://github.com/abhisheksahu093/Adysre.git","directory":"packages/rules-core"},"bugs":{"url":"https://github.com/abhisheksahu093/Adysre/issues"},"license":"MIT","readme":"# @adysre/rules-core\n\nThe AST and everything that can be done to it: building, walking, validating,\nserialising, and running.\n\n**Zero runtime dependencies**, deliberately. A rules engine is embedded, and one\nthat drags a dependency tree into every bundle that touches it is one teams work\naround. That is also why the validator is hand-written rather than delegated to\na schema library.\n\n```ts\nimport { rule, all, condition, field, literal, validateRule } from '@adysre/rules-core';\n\nconst document = rule({\n  name: 'Large orders need approval',\n  kind: 'validation',\n  when: all([\n    condition({ left: field('order.total'), operator: 'greaterThan', args: [literal(1000)] }),\n  ]),\n  then: [action({ type: 'reject', target: 'order.total' })],\n});\n\nvalidateRule(document); // { valid: true, diagnostics: [] }\n\nconst evaluator = createEvaluator(createRegistry(builtinPlugins));\nconst { verdict, actions, trace } = evaluator.evaluate(\n  document,\n  createContext({ order: { total: 2500 } }),\n); // 'matched', the reject action, and a record of how it got there\n```\n\n## What is here\n\n| Module | Purpose |\n| --- | --- |\n| `builders` | Construct an AST in code, with injectable ids and clock so a document is reproducible |\n| `walk` | Traverse, search, edit immutably, and report which fields, variables and plugins a rule needs |\n| `validate` | Structural validation, reporting the AST path of every problem |\n| `serialize` | Parse and stringify with a stable key order, plus a migration path between AST versions |\n| `registry` | Immutable plugin registry: duplicate ids throw at registration, lookups never throw |\n| `builtins` | 27 operators and 23 functions, offered rather than imposed |\n| `errors` | `RuleError`, how a plugin says \"I cannot answer that\" |\n| `resolve` | Operands to values: own-property field reads, bounded function nesting |\n| `execute` | The executor: verdicts, actions, diagnostics and a trace |\n\nThe renderers, the React state and the visual builder are separate packages\nprecisely so this one is safe to import anywhere a rule has to run: a server\nroute, a worker, a build step that lints them. Nothing here needs a DOM.\n\nSee [`documents/RULES_ENGINE.md`](../../documents/RULES_ENGINE.md).\n","readmeFilename":"README.md","_rev":"1-e02988900d31a7006d50b2c99228ea84"}