{"_id":"@adysre/rules-playground","name":"@adysre/rules-playground","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@adysre/rules-playground","version":"0.1.0","type":"module","description":"A runnable sandbox and the worked examples, each verified against the engine that runs it.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/abhisheksahu093/Adysre.git","directory":"packages/rules-playground"},"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","@types/react":"^19.0.0","@types/react-dom":"^19.0.0","eslint-plugin-react-hooks":"^7.1.1","react":"^19.0.0","react-dom":"^19.0.0","typescript":"^5.6.3","vitest":"^2.1.9","@adysre/config":"0.1.0"},"dependencies":{"@adysre/rules-core":"0.1.0","@adysre/rules-devtools":"0.1.0","@adysre/rules-theme":"0.1.0","adysre":"0.2.0","@adysre/rules-types":"0.1.0","@adysre/rules-ui":"0.1.0"},"peerDependencies":{"react":"^19.0.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":"vitest run","clean":"rm -rf dist .turbo tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo"},"_id":"@adysre/rules-playground@0.1.0","bugs":{"url":"https://github.com/abhisheksahu093/Adysre/issues"},"homepage":"https://github.com/abhisheksahu093/Adysre#readme","_integrity":"sha512-da+hS7BBPH1p9ZV+TEP3ZmhDR5Ote9ih6/wkPov4I3+XMlKIPiBVQVAiSvJ/rQDWFZvMn1XpDqDBwsaS0MGBwA==","_resolved":"/private/var/folders/xx/vrjl61fs7dlb3dhyq5_lgzkm0000gn/T/3a8855807d75c35b2f16a420be5fae45/adysre-rules-playground-0.1.0.tgz","_from":"file:adysre-rules-playground-0.1.0.tgz","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-da+hS7BBPH1p9ZV+TEP3ZmhDR5Ote9ih6/wkPov4I3+XMlKIPiBVQVAiSvJ/rQDWFZvMn1XpDqDBwsaS0MGBwA==","shasum":"54fa008a62222b0f0a7b6840bf2f43b2d561dcd9","tarball":"https://registry.npmjs.org/@adysre/rules-playground/-/rules-playground-0.1.0.tgz","fileCount":38,"unpackedSize":64093,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIA7J3ZOrfBxcObjG50OQPGbFvx91v37904IAmrVyIklxAiEAkjal75PxqR2sUXttyuKNtqzYUkbE37Uk+M4zPl0Ntig="}]},"_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-playground_0.1.0_1785148553997_0.6776331480941287"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-27T10:35:53.753Z","0.1.0":"2026-07-27T10:35:54.152Z","modified":"2026-07-27T10:35:54.466Z"},"maintainers":[{"name":"adysre","email":"abhisheksahu093@gmail.com"}],"description":"A runnable sandbox and the worked examples, each verified against the engine that runs it.","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-playground"},"bugs":{"url":"https://github.com/abhisheksahu093/Adysre/issues"},"license":"MIT","readme":"# @adysre/rules-playground\n\nThe whole ecosystem, running.\n\n```tsx\n<RulePlayground />\n```\n\nBuilder, debugger, live verdict and JSON over rules that exercise the parts of\nthe engine that interact. Everything a reader needs to answer \"what does this\nthing actually do\" without installing it.\n\n## The examples check themselves\n\nEvery sample declares the verdict the engine must produce:\n\n```ts\n{\n  id: 'new-customer',\n  label: 'A large order from a new customer',\n  subject: { order: { total: 2400 }, customer: { tier: 'new' } },\n  expect: 'matched',\n  expectActions: ['requireApproval'],\n}\n```\n\n`verifyExamples` runs them all, and the package's test fails if any example\nstops being true.\n\nThat is the whole design. An example is documentation, and documentation is the\none part of a system nothing else tests: a rule with a screenshot beside it\nlooks right on the day it is written, and the only thing checking it afterwards\nis a reader who assumes it works. If a comparison rule or an operator ever\nchanges meaning, the example that taught it fails in CI rather than teaching the\nwrong thing to everybody who reads it next.\n\nThe suite is framework-free, like the storage conformance suite, so it runs in a\nunit test, a docs build, or a deployment checking the examples it ships.\n\nBeyond the verdict, the tests also hold each example to being a **valid** rule,\nusing only plugins it registers, offering a field for every path it reads, and\nnaming every action it applies — the four ways an example is broken in a way a\nverdict alone would not catch.\n\n## What each one teaches\n\n| Example | Shows |\n| --- | --- |\n| Order approval | a nested `any` inside an `all`, a date function, and the `otherwise` branch people forget exists |\n| Access control | list membership, a boolean that is genuinely `false`, and why `all` stopping early matters |\n| Discount tier | a field compared to **another field**, a computed operand, and `between` being inclusive at both ends |\n| Hidden fault | a rule that answers correctly **by luck** |\n\nThe last one is the point of the debugger. Its first condition matches, so `any`\nshort-circuits and the second never runs — and the second cannot run at all,\nbecause it compares a number to a word. The rule reports `matched`, no\ndiagnostic is raised, and every report says it is fine. Change the customer's\ntier and it reports `errored`.\n\nThat example asserts `expectHidden: true`, so it cannot quietly become an\nordinary passing rule — which is exactly how a teaching example stops teaching\nwithout anybody noticing.\n\n## The clock is fixed\n\nNever `Date.now()`. Half of these rules read a date, and a moving clock makes a\ndeclared verdict a lie on a schedule and the server and browser renders\ndisagree. Each example carries the instant it is evaluated at, and a test\nasserts it.\n\n## Editing is the point\n\nThe badge above the builder compares the live run to what the example\ndocuments. It agrees until you change something — at which point saying\n\"now unmatched, documented as matched\" is more use than hiding the difference.\n\nChoosing a different example replaces the document, which is the one case\n`RuleBuilder` reloads on. Editing then behaves normally: the builder recognises\nits own document coming back and keeps the undo stack.\n\nNo `theme` prop is needed inside a host with a design system — the builder\ninherits its tokens. Pass one to scope a different palette to the sandbox.\n\nSee [`documents/RULES_ENGINE.md`](../../documents/RULES_ENGINE.md).\n","readmeFilename":"README.md","_rev":"1-0e25ff27d9b479a85b9f07887caa2e00"}