{"_id":"@airtrafficcontrol/validation","name":"@airtrafficcontrol/validation","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@airtrafficcontrol/validation","version":"0.0.1","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","dependencies":{"@airtrafficcontrol/types":"0.0.1","@airtrafficcontrol/errors":"0.0.1"},"scripts":{"build":"tsc --build"},"_id":"@airtrafficcontrol/validation@0.0.1","description":"Pure validation functions for certification checks, seat assignment rules, and permission enforcement. These functions implement the guard logic that ensures pilots are eligible for their seats and authorized for their actions.","_integrity":"sha512-lvlNOaGAXZVoT2Dj6PLVCfZHDP/EinNlrsLKJldF3OL9EiuF7SHGnzymdr6CWFG/2Q/u5D7rKKKpfzyJrB6aVA==","_resolved":"/private/var/folders/n5/tzqmrds50218kyrpz8166v3w0000gn/T/cd1009af7732c59cb7c140b00595a3d1/airtrafficcontrol-validation-0.0.1.tgz","_from":"file:airtrafficcontrol-validation-0.0.1.tgz","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-lvlNOaGAXZVoT2Dj6PLVCfZHDP/EinNlrsLKJldF3OL9EiuF7SHGnzymdr6CWFG/2Q/u5D7rKKKpfzyJrB6aVA==","shasum":"62784dcb12edd183b14bc1c8a319ef9d74e63950","tarball":"https://registry.npmjs.org/@airtrafficcontrol/validation/-/validation-0.0.1.tgz","fileCount":30,"unpackedSize":34754,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCTLMMdpdZO/eQmXoRahTgDYVgJACl+gSBGQmENnYY2ZgIgG4GjdFSoHAYL7aSvwU1IWEuIMhw9pS6ybeBO8wtv4w0="}]},"_npmUser":{"name":"mfoulks200","email":"mfoulks1@gmail.com"},"directories":{},"maintainers":[{"name":"mfoulks200","email":"mfoulks1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/validation_0.0.1_1776908437101_0.7850464900230925"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-23T01:40:37.042Z","0.0.1":"2026-04-23T01:40:37.303Z","modified":"2026-04-23T01:40:37.497Z"},"maintainers":[{"name":"mfoulks200","email":"mfoulks1@gmail.com"}],"description":"Pure validation functions for certification checks, seat assignment rules, and permission enforcement. These functions implement the guard logic that ensures pilots are eligible for their seats and authorized for their actions.","readme":"# @airtrafficcontrol/validation\n\nPure validation functions for certification checks, seat assignment rules, and permission enforcement. These functions implement the guard logic that ensures pilots are eligible for their seats and authorized for their actions.\n\n## Installation\n\n```bash\npnpm add @airtrafficcontrol/validation\n```\n\nThis is an internal workspace package (`workspace:*`).\n\n## API Reference\n\n### Certification\n\n#### `isPilotCertified(pilot: Pilot, category: string): boolean`\n\nChecks whether a pilot holds a certification for the given craft category. Matching is case-sensitive.\n\nSee `RULE-PILOT-2`.\n\n```typescript\nimport { isPilotCertified } from \"@airtrafficcontrol/validation\";\n\nconst pilot = { identifier: \"agent-1\", certifications: [\"feature\", \"bugfix\"] };\nisPilotCertified(pilot, \"feature\"); // true\nisPilotCertified(pilot, \"refactor\"); // false\n```\n\n### Seat Assignment\n\n#### `isValidSeatAssignment(pilot: Pilot, seat: SeatType, craftCategory: string): boolean`\n\nChecks whether a pilot can validly occupy the given seat. Returns `true` if the seat is Jumpseat (no certification required) or if the pilot is certified for the craft's category.\n\nSee `RULE-SEAT-2`, `RULE-SEAT-3`.\n\n#### `validateSeatAssignment(pilot: Pilot, seat: SeatType, craftCategory: string): void`\n\nThrows `SeatAssignmentError` if the pilot lacks the required certification for a non-jumpseat position.\n\nSee `RULE-SEAT-2`, `RULE-SEAT-3`.\n\n#### `validateCraftCrew(captain: Pilot, firstOfficers: readonly Pilot[], craftCategory: string): void`\n\nValidates the full crew composition: the captain and all first officers must be certified for the craft's category. The single-captain constraint (`RULE-SEAT-1`) is enforced structurally by the function signature.\n\nThrows `SeatAssignmentError` if any crew member is not certified.\n\nSee `RULE-CRAFT-5`, `RULE-SEAT-1`, `RULE-SEAT-2`.\n\n### Permissions\n\n#### `canHoldControls(seat: SeatType): boolean`\n\nChecks whether a pilot in the given seat is allowed to hold controls. Only Captain and FirstOfficer may hold controls.\n\nSee `RULE-CTRL-2`.\n\n```typescript\nimport { canHoldControls } from \"@airtrafficcontrol/validation\";\nimport { SeatType } from \"@airtrafficcontrol/types\";\n\ncanHoldControls(SeatType.Captain);     // true\ncanHoldControls(SeatType.FirstOfficer); // true\ncanHoldControls(SeatType.Jumpseat);    // false\n```\n\n#### `canPerformAction(seat: SeatType, action: PilotAction): boolean`\n\nLooks up whether a pilot in the given seat is permitted to perform the specified action, according to the `PERMISSIONS` matrix.\n\nSee `RULE-SEAT-1` through `RULE-SEAT-4`, `RULE-CTRL-2`, `RULE-BBOX-3`, `RULE-EMER-1`.\n\n```typescript\nimport { canPerformAction } from \"@airtrafficcontrol/validation\";\nimport { SeatType } from \"@airtrafficcontrol/types\";\n\ncanPerformAction(SeatType.Captain, \"declareEmergency\");      // true\ncanPerformAction(SeatType.FirstOfficer, \"declareEmergency\"); // false\ncanPerformAction(SeatType.Jumpseat, \"writeBlackBox\");        // true\n```\n\n## Dependencies\n\n| Package | Purpose |\n|---|---|\n| `@airtrafficcontrol/types` | `Pilot`, `SeatType`, `PilotAction`, `PERMISSIONS` |\n| `@airtrafficcontrol/errors` | `SeatAssignmentError` |\n\n## Related Packages\n\n- [`@airtrafficcontrol/types`](../types/) — Domain types and permissions matrix\n- [`@airtrafficcontrol/errors`](../errors/) — Error class thrown on invalid assignments\n- [`@airtrafficcontrol/core`](../core/) — Uses `validateCraftCrew` during craft creation\n","readmeFilename":"README.md","_rev":"1-c0c5a999dbb45544fcce937f823ed41b"}