{"_id":"@authomata/discord","name":"@authomata/discord","dist-tags":{"latest":"0.0.0"},"versions":{"0.0.0":{"name":"@authomata/discord","version":"0.0.0","description":"Discord integration for Authomata.","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/yuz-mc/Authomata.git","directory":"packages/discord"},"bugs":{"url":"https://github.com/yuz-mc/Authomata/issues"},"homepage":"https://github.com/yuz-mc/Authomata#readme","publishConfig":{"access":"public"},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc --noEmit -p tsconfig.typecheck.json"},"dependencies":{"@authomata/core":"workspace:*"},"gitHead":"24a52fb706d0bc737b54a6faccd23bd9a41a4163","_id":"@authomata/discord@0.0.0","_nodeVersion":"24.3.0","_npmVersion":"12.0.2","dist":{"integrity":"sha512-fclTOtjIEx7VcuVxjU2HXNMOcQEn2jLp6Wy0hrQpbOFmOppByBWhhWB3d7UfZNnBbc1z/ByvK6shLmxOli0F0g==","shasum":"e4e8388e01c9bb203ab141a3e1916a07950b7f5d","tarball":"https://registry.npmjs.org/@authomata/discord/-/discord-0.0.0.tgz","fileCount":10,"unpackedSize":15591,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFZnb0qH3xDhfG7w0SIfK90QBk4nMqUr4TqLSXMoMPVmAiANFI+jSzmu0JzezdwO6y4fFoqh4lpuotv2LJdW4UUsug=="}]},"_npmUser":{"name":"yuz_mc","email":"yuzumachan@vivaldi.net"},"directories":{},"maintainers":[{"name":"yuz_mc","email":"yuzumachan@vivaldi.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/discord_0.0.0_1788017432381_0.21612774174436722"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-29T15:30:32.222Z","0.0.0":"2026-08-29T15:30:32.517Z","modified":"2026-08-29T15:30:32.740Z"},"maintainers":[{"name":"yuz_mc","email":"yuzumachan@vivaldi.net"}],"description":"Discord integration for Authomata.","homepage":"https://github.com/yuz-mc/Authomata#readme","repository":{"type":"git","url":"git+https://github.com/yuz-mc/Authomata.git","directory":"packages/discord"},"bugs":{"url":"https://github.com/yuz-mc/Authomata/issues"},"license":"MIT","readme":"# @authomata/discord\n\nDiscord guild integration for Authomata. It reads guild membership and role\npositions through a small structural client interface, so it works with\ndiscord.js wrappers and Discord REST clients without taking a Discord runtime\ndependency.\n\n## Quick Start\n\n```ts\nimport { createDiscordAuthorizer } from \"@authomata/discord\";\n\nconst authorizer = createDiscordAuthorizer({\n  client, // implements getGuildMember() and getGuildRoles()\n  guildId: \"123456789012345678\",\n  roleDecisions: {\n    \"moderator-role-id\": { \"ticket.close\": \"allow\" },\n  },\n  defaultDecision: \"deny\",\n});\n\nconst allowed = await authorizer.isAllowed({\n  user: \"user-id\",\n  action: \"ticket.close\",\n  context: {},\n});\n```\n\nDiscord roles are groups. Higher Discord role positions are evaluated first;\nroles at the same position use the configured Authomata merge function.\n\n## Client Contract\n\n```ts\ninterface DiscordClient {\n  getGuildMember(guildId: string, userId: string):\n    Promise<{ roles: readonly string[] } | null>;\n  getGuildRoles(guildId: string):\n    Promise<readonly { id: string; position: number }[]>;\n}\n```\n\n`userDecisions` may provide user-specific overrides. Missing members and roles\nwith no decision fall through to lower-priority roles and then\n`defaultDecision` (deny by default).\n\nFor the complete guide, including precedence and operational guidance, see\n[Discord documentation](../../docs/discord.md). Read\n[Concepts](../../docs/concepts.md) for shared Authomata evaluation rules.\n","readmeFilename":"README.md","_rev":"1-3411b309bf97d545ec59b60a88048121"}