Skip to content

Commit 7046aef

Browse files
feat(eligibility-rules): implement deterministic community eligibility rules engine
Implements issue #384. Adds the @guildpass/eligibility-rules package at packages/eligibility-rules with: - EligibilityRule discriminated union (equals, exists, in, gte, lte, all, any, not) - parseEligibilityRule: validates untrusted input against the rule grammar with configurable depth and node-count limits - evaluateEligibilityRule: evaluates a rule tree against a caller- supplied facts object, returning a structured eligibility decision - Dot-separated fact path resolution that safely handles missing segments and null mid-path values - explain mode that collects stable machine-readable denial reasons - Configurable and exported DEFAULT_ELIGIBILITY_RULE_LIMITS - No database, HTTP or external runtime dependencies - 90 unit tests covering all predicates, nesting, missing fields, type mismatches, boundary cases, depth/node limits and explain mode pnpm typecheck, pnpm build and pnpm test all pass across the monorepo. Closes #384
1 parent cfd31fd commit 7046aef

5 files changed

Lines changed: 1500 additions & 3 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "@guildpass/eligibility-rules",
3+
"version": "2.0.0",
4+
"private": true,
5+
"type": "module",
6+
"main": "./dist/index.js",
7+
"types": "./dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"types": "./dist/index.d.ts",
11+
"import": "./dist/index.js"
12+
}
13+
},
14+
"scripts": {
15+
"build": "tsc -p tsconfig.json",
16+
"typecheck": "tsc -p tsconfig.json --noEmit",
17+
"test": "node --test dist/**/*.test.js"
18+
}
19+
}

0 commit comments

Comments
 (0)