feat: add @trakoo/better-auth plugin, pii routing and EmitKit notify override - #45
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- sessionId: every event carries the request's session of the user it is about, resolved when the event happens; none when acting on someone else - api keys: report the acting user, never the org referenceId; add organizationId for organization-owned keys - team events are active only when organization teams are enabled - rename impersonation registry keys to userImpersonationStarted/Stopped - drop the redundant twoFactor sign-in property - one path→handler map for after hooks; shared organization hook reader - read the identify option once; pii routing and emitkit notify helpers - field readers move to fields.ts; docs and changeset updated
plugin.ts keeps the options, the send pipeline and the wiring. Each Better Auth plugin's events move to their own module (core.ts, plugins/*.ts), built from a small toolkit (emit, stateOf, actorOf, wrap) and returning its after-hook handlers by path and the callbacks it wraps at init.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
@trakoo/better-auth, a Better Auth plugin (better-auth^1.7.0) that sends a typed trakoo event for each auth lifecycle change: sign-ups, sign-ins, sessions, password and email changes, organizations, API keys, admin actions, two-factor, passkeys, anonymous users, SSO and Stripe subscriptions. It exports anauthEventsregistry to merge into your own, registers events only for the Better Auth plugins you install (team events only with teams enabled), reports database changes only after commit, identifies users, and never sends secrets or throws into Better Auth. Coretrakoogains apii: falseprovider routing option that keeps email and name from a provider, and a type fix so a registry can be spread intodefineEvents().@trakoo/emitkitnow reads a boolean__emitkit_notifyproperty that overridesnotifyfor a single event. Also included: tests (68 for the plugin),verify:packagesupport for the new root-entry package, a new Integrations docs page, updates to the EmitKit, routing and events docs and the agent skill, and changesets for all three packages.