Repository navigation
Conversation
|
@mvanhorn is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
81d88ae to
bd75dd5
Compare
Guilds, channels, messages, members, roles, OAuth and an inspector UI, wired into the service registry. Rebuilt on current main: core replaced the real `hono` dependency with its own implementation in `core/src/http.ts`, so `Hono`, `Context` and `Next` now come from `@emulators/core` like the other emulators, and the package no longer depends on `hono`.
aa9dec4 to
68b93f0
Compare
|
Rebased onto main -- 68b93f0. Still relevant: no Discord emulator on Same story as the Auth0 branch: 72 commits behind, and 35 tests in |
pnpm-lock.yaml is regenerated from main.
sync-versions --check fails on any @emulators package off the release version.
The package bundles core, so it needs the same LICENSE and THIRD_PARTY_NOTICES.md the other emulators publish. CI checks every tarball.
The configuration test requires a section for every registry service. This one matches the starter that emulate init writes.
Resolve the registry and example config conflicts with the new ai service by keeping both entries. Move @emulators/discord onto main's toolchain like the other emulators: oxlint, tsc-ts type-check, TypeScript 7, emitted declarations through scripts/emit-types.mjs, and version 0.13.1.
|
Merged main back in - 1c82a8c. The only conflicts were the new Main also moved every emulator to oxlint, Locally: build, format check, sync-versions, both type-checks, lint and the full test suite pass, including the 35 Discord tests. |
Summary
Adds a Discord service emulator with stateful guilds, channels, members, roles, and messages, plus full OAuth 2.0 (authorization code flow) and a Message / Guild Inspector. Snowflake IDs match Discord's documented 64-bit format. Both
Authorization: Bot <token>andAuthorization: Bearer <token>are supported.Closes the OAuth + REST surface — interactions / signature verification, guild webhooks, and Gateway WebSocket are intentionally separate follow-ups.
Why this matters
Discord has become the community plane for most modern SaaS — community bots, role automation, slash-command integrations, magic-link sign-ins through Discord OAuth. The official
discord.jsSDK has ~700K weekly npm downloads and@discordjs/restis in every modern bot stack. CI tests against Discord today either hit production (rate limits, real users, real channels) or stub at the HTTP level. No general-purpose emulator covers Discord — WireMock is too low-level and MSW is browser-only.emulate's
Storegives us stateful guilds + channels + messages; the shared OAuth helpers give us a real authorization_code + Bearer/Bot token flow.Inspector
Browse seeded guilds, channels, messages, members, and roles. Tabbed navigation, terminal-green aesthetic from
core/src/ui.ts.OAuth Consent
Standard
/oauth2/authorizeflow with a user picker.Discord API Coverage
GET /api/v10/users/@meGET /api/v10/guilds/POSTGET /api/v10/guilds/:idPATCH /api/v10/guilds/:id/DELETEGET /api/v10/guilds/:id/channels/POSTGET /api/v10/channels/:id/PATCH/DELETEGET /api/v10/channels/:id/messages/POSTGET /api/v10/channels/:id/messages/:id/PATCH/DELETEGET /api/v10/guilds/:id/membersPUT /api/v10/guilds/:id/members/:userIdPATCH /api/v10/guilds/:id/members/:userId/DELETEGET /api/v10/guilds/:id/roles/POSTPATCH /api/v10/guilds/:id/roles/:roleId/DELETEGET /oauth2/authorizePOST /api/oauth2/tokenBot tokens
Configure applications in seed config; bot tokens auto-register with the emulator's tokenMap so
Authorization: Bot <token>works immediately:Default port
4012(appended at the end ofSERVICE_NAME_LISTafterclerk— no other service's port shifts).What's not yet covered
WebhookDispatcher(separate PR)Tests
35 Vitest tests covering guild / channel / message / member / role CRUD, OAuth code flow, snowflake bit layout, both auth header shapes (
BotandBearer), inspector rendering, and seed-config token registration.